mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
get rid of CoreContext in favor of granular bundle contexts
This commit is contained in:
parent
49ec6090aa
commit
4bb2abadab
22 changed files with 51 additions and 55 deletions
|
|
@ -50,7 +50,5 @@ export interface ApplicationContext extends
|
||||||
WorkbenchBundleContext
|
WorkbenchBundleContext
|
||||||
{}
|
{}
|
||||||
|
|
||||||
export type CoreContext = ApplicationContext;
|
|
||||||
|
|
||||||
export default {} as ApplicationContext;
|
export default {} as ApplicationContext;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import materializeParams from './schema/materializeParams';
|
||||||
import CadError from '../../utils/errors';
|
import CadError from '../../utils/errors';
|
||||||
import {MObject, MObjectIdGenerator} from '../model/mobject';
|
import {MObject, MObjectIdGenerator} from '../model/mobject';
|
||||||
import {intercept} from "lstream/intercept";
|
import {intercept} from "lstream/intercept";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {OperationParams} from "cad/craft/schema/schema";
|
import {OperationParams} from "cad/craft/schema/schema";
|
||||||
import {clearImplicitModels} from "cad/craft/e0/occCommandInterface";
|
import {clearImplicitModels} from "cad/craft/e0/occCommandInterface";
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
||||||
const modifications$ = state({
|
const modifications$ = state({
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {SketchGeom} from "cad/sketch/sketchReader";
|
import {SketchGeom} from "cad/sketch/sketchReader";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import CSys from "math/csys";
|
import CSys from "math/csys";
|
||||||
import {OperationResult} from "cad/craft/craftBundle";
|
import {OperationResult} from "cad/craft/craftBundle";
|
||||||
import {BooleanDefinition, BooleanKind} from "cad/craft/schema/common/BooleanDefinition";
|
import {BooleanDefinition, BooleanKind} from "cad/craft/schema/common/BooleanDefinition";
|
||||||
|
|
@ -27,7 +27,7 @@ export interface FaceRef extends WireRef {
|
||||||
topoShape: Shell,
|
topoShape: Shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOCCUtils(ctx: CoreContext): OCCUtils {
|
export function createOCCUtils(ctx: ApplicationContext): OCCUtils {
|
||||||
|
|
||||||
function sketchToFaces(sketch: SketchGeom, csys: CSys): FaceRef[] {
|
function sketchToFaces(sketch: SketchGeom, csys: CSys): FaceRef[] {
|
||||||
const occ = ctx.occService;
|
const occ = ctx.occService;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {MObject} from "cad/model/mobject";
|
||||||
import {Interrogate} from "cad/craft/e0/interact";
|
import {Interrogate} from "cad/craft/e0/interact";
|
||||||
import {readShellEntityFromJson} from "cad/scene/wrappers/entityIO";
|
import {readShellEntityFromJson} from "cad/scene/wrappers/entityIO";
|
||||||
import {createOCCSketchLoader, OCCSketchLoader} from "cad/craft/e0/occSketchLoader";
|
import {createOCCSketchLoader, OCCSketchLoader} from "cad/craft/e0/occSketchLoader";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ProductionAnalyzer} from "cad/craft/production/productionAnalyzer";
|
import {ProductionAnalyzer} from "cad/craft/production/productionAnalyzer";
|
||||||
import {readBrep} from "brep/io/brepIO";
|
import {readBrep} from "brep/io/brepIO";
|
||||||
import {Shell} from "brep/topo/shell";
|
import {Shell} from "brep/topo/shell";
|
||||||
|
|
@ -22,7 +22,7 @@ export interface OCCIO {
|
||||||
sketchLoader: OCCSketchLoader
|
sketchLoader: OCCSketchLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOCCIO(ctx: CoreContext): OCCIO {
|
export function createOCCIO(ctx: ApplicationContext): OCCIO {
|
||||||
|
|
||||||
function getShell(shapeName: string, productionAnalyzer?: ProductionAnalyzer): MShell {
|
function getShell(shapeName: string, productionAnalyzer?: ProductionAnalyzer): MShell {
|
||||||
const shapeJson = Interrogate(shapeName);
|
const shapeJson = Interrogate(shapeName);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {OCCCommandInterface, OCI} from "cad/craft/e0/occCommandInterface";
|
import {OCCCommandInterface, OCI} from "cad/craft/e0/occCommandInterface";
|
||||||
import {createOCCIO, OCCIO} from "cad/craft/e0/occIO";
|
import {createOCCIO, OCCIO} from "cad/craft/e0/occIO";
|
||||||
import {createOCCUtils, OCCUtils} from "cad/craft/e0/OCCUtils";
|
import {createOCCUtils, OCCUtils} from "cad/craft/e0/OCCUtils";
|
||||||
|
|
@ -15,7 +15,7 @@ export interface OCCService {
|
||||||
engineInterface: any
|
engineInterface: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOCCService(ctx: CoreContext): OCCService {
|
export function createOCCService(ctx: ApplicationContext): OCCService {
|
||||||
|
|
||||||
const oci = OCI;
|
const oci = OCI;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import {state} from 'lstream';
|
import {state} from 'lstream';
|
||||||
import {IconType} from "react-icons";
|
import {IconType} from "react-icons";
|
||||||
import {ActionAppearance} from "../actions/actionSystemBundle";
|
import {ActionAppearance} from "../actions/actionSystemBundle";
|
||||||
import {ApplicationContext, CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {OperationResult} from "./craftBundle";
|
import {OperationResult} from "./craftBundle";
|
||||||
import {OperationSchema, SchemaField, schemaIterator, unwrapMetadata} from "cad/craft/schema/schema";
|
import {OperationSchema, SchemaField, schemaIterator, unwrapMetadata} from "cad/craft/schema/schema";
|
||||||
import {FormDefinition} from "cad/mdf/ui/uiDefinition";
|
import {FormDefinition} from "cad/mdf/ui/uiDefinition";
|
||||||
|
|
@ -137,7 +137,7 @@ export interface OperationDescriptor<R> {
|
||||||
info: string;
|
info: string;
|
||||||
icon: OpIcon;
|
icon: OpIcon;
|
||||||
actionParams?: any;
|
actionParams?: any;
|
||||||
run: (params: {}, ctx: CoreContext, rawParams: R) => OperationResult | Promise<OperationResult>;
|
run: (params: {}, ctx: ApplicationContext, rawParams: R) => OperationResult | Promise<OperationResult>;
|
||||||
paramsInfo: (params: R) => string,
|
paramsInfo: (params: R) => string,
|
||||||
previewGeomProvider?: (params: R) => OperationGeometryProvider,
|
previewGeomProvider?: (params: R) => OperationGeometryProvider,
|
||||||
previewer?: any,
|
previewer?: any,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import {Types} from "cad/craft/schema/types";
|
import {Types} from "cad/craft/schema/types";
|
||||||
import {isValueNotProvided, OperationSchema, SchemaField} from "cad/craft/schema/schema";
|
import {isValueNotProvided, OperationSchema, SchemaField} from "cad/craft/schema/schema";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
export default function initializeBySchema(schema: OperationSchema, context: CoreContext) {
|
export default function initializeBySchema(schema: OperationSchema, context: ApplicationContext) {
|
||||||
let fields = Object.keys(schema);
|
let fields = Object.keys(schema);
|
||||||
let obj = {};
|
let obj = {};
|
||||||
for (let field of fields) {
|
for (let field of fields) {
|
||||||
|
|
@ -43,7 +43,7 @@ export default function initializeBySchema(schema: OperationSchema, context: Cor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function fillUpMissingFields(params: any, schema: OperationSchema, context: CoreContext) {
|
export function fillUpMissingFields(params: any, schema: OperationSchema, context: ApplicationContext) {
|
||||||
let fields = Object.keys(schema);
|
let fields = Object.keys(schema);
|
||||||
for (let field of fields) {
|
for (let field of fields) {
|
||||||
const md = schema[field] as SchemaField;
|
const md = schema[field] as SchemaField;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {TypeRegistry} from "cad/craft/schema/types";
|
import {TypeRegistry} from "cad/craft/schema/types";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {
|
import {
|
||||||
isValueNotProvided,
|
isValueNotProvided,
|
||||||
OperationParams,
|
OperationParams,
|
||||||
|
|
@ -19,7 +19,7 @@ function createErrorReporter(path: string[], errors: OperationParamsError[]): Op
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function materializeParams(ctx: CoreContext,
|
export default function materializeParams(ctx: ApplicationContext,
|
||||||
params: OperationParams,
|
params: OperationParams,
|
||||||
schema: OperationSchema,
|
schema: OperationSchema,
|
||||||
result: any,
|
result: any,
|
||||||
|
|
@ -28,7 +28,7 @@ export default function materializeParams(ctx: CoreContext,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function materializeParamsImpl(ctx: CoreContext,
|
function materializeParamsImpl(ctx: ApplicationContext,
|
||||||
params: OperationParams,
|
params: OperationParams,
|
||||||
schema: OperationSchema,
|
schema: OperationSchema,
|
||||||
result: any,
|
result: any,
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import {ArrayTypeSchema} from "cad/craft/schema/types/arrayType";
|
||||||
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
||||||
import {StringTypeSchema} from "cad/craft/schema/types/stringType";
|
import {StringTypeSchema} from "cad/craft/schema/types/stringType";
|
||||||
import {BooleanTypeSchema} from "cad/craft/schema/types/booleanType";
|
import {BooleanTypeSchema} from "cad/craft/schema/types/booleanType";
|
||||||
import {Materializer, Types} from "cad/craft/schema/types";
|
import {Types} from "cad/craft/schema/types";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ParamsPath} from "cad/craft/wizard/wizardTypes";
|
import {ParamsPath} from "cad/craft/wizard/wizardTypes";
|
||||||
|
|
||||||
export type Coercable = any;
|
export type Coercable = any;
|
||||||
|
|
@ -55,7 +55,7 @@ export type OperationParamsErrorReporter = ((msg: string) => void) & {
|
||||||
dot: (pathPart: string|number) => OperationParamsErrorReporter
|
dot: (pathPart: string|number) => OperationParamsErrorReporter
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ValueResolver<IN, OUT> = (ctx: CoreContext,
|
export type ValueResolver<IN, OUT> = (ctx: ApplicationContext,
|
||||||
value: IN,
|
value: IN,
|
||||||
md: SchemaField,
|
md: SchemaField,
|
||||||
reportError: OperationParamsErrorReporter) => OUT;
|
reportError: OperationParamsErrorReporter) => OUT;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Materializer, Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
import {Materializer, Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter, SchemaField} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter, SchemaField} from "cad/craft/schema/schema";
|
||||||
|
|
||||||
export interface ArrayTypeSchema extends BaseSchemaField {
|
export interface ArrayTypeSchema extends BaseSchemaField {
|
||||||
|
|
@ -19,7 +19,7 @@ export interface ArrayTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
export const ArrayType: Type<any[], any[], ArrayTypeSchema> = {
|
export const ArrayType: Type<any[], any[], ArrayTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: any[],
|
value: any[],
|
||||||
md: ArrayTypeSchema,
|
md: ArrayTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Materializer, Type, Types} from "cad/craft/schema/types/index";
|
import {Materializer, Type, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
||||||
|
|
||||||
export interface BooleanTypeSchema extends BaseSchemaField {
|
export interface BooleanTypeSchema extends BaseSchemaField {
|
||||||
|
|
@ -10,7 +10,7 @@ export interface BooleanTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
export const BooleanType: Type<any, boolean, BooleanTypeSchema> = {
|
export const BooleanType: Type<any, boolean, BooleanTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: any,
|
value: any,
|
||||||
md: BooleanTypeSchema,
|
md: BooleanTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
import {Type, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
||||||
import {EntityKind} from "cad/model/entities";
|
import {EntityKind} from "cad/model/entities";
|
||||||
import {MObject} from "cad/model/mobject";
|
import {MObject} from "cad/model/mobject";
|
||||||
|
|
@ -20,7 +20,7 @@ export type EntityCapture = (entity: MObject) => boolean;
|
||||||
|
|
||||||
export const EntityType: Type<string, MObject, EntityTypeSchema> = {
|
export const EntityType: Type<string, MObject, EntityTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: string,
|
value: string,
|
||||||
md: EntityTypeSchema,
|
md: EntityTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter): MObject {
|
reportError: OperationParamsErrorReporter): MObject {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {OperationParams, OperationParamsErrorReporter, OperationSchema, SchemaField} from "cad/craft/schema/schema";
|
import {OperationParams, OperationParamsErrorReporter, OperationSchema, SchemaField} from "cad/craft/schema/schema";
|
||||||
import {ArrayType} from "cad/craft/schema/types/arrayType";
|
import {ArrayType} from "cad/craft/schema/types/arrayType";
|
||||||
import {EntityType} from "cad/craft/schema/types/entityType";
|
import {EntityType} from "cad/craft/schema/types/entityType";
|
||||||
|
|
@ -7,7 +7,7 @@ import {ObjectType} from "cad/craft/schema/types/objectType";
|
||||||
import {StringType} from "cad/craft/schema/types/stringType";
|
import {StringType} from "cad/craft/schema/types/stringType";
|
||||||
import {BooleanType} from "cad/craft/schema/types/booleanType";
|
import {BooleanType} from "cad/craft/schema/types/booleanType";
|
||||||
|
|
||||||
export type Materializer = (ctx: CoreContext,
|
export type Materializer = (ctx: ApplicationContext,
|
||||||
params: OperationParams,
|
params: OperationParams,
|
||||||
schema: OperationSchema,
|
schema: OperationSchema,
|
||||||
result: any,
|
result: any,
|
||||||
|
|
@ -15,7 +15,7 @@ export type Materializer = (ctx: CoreContext,
|
||||||
|
|
||||||
export interface Type<IN, OUT, METADATA extends SchemaField> {
|
export interface Type<IN, OUT, METADATA extends SchemaField> {
|
||||||
|
|
||||||
resolve(ctx: CoreContext, value: IN, md: METADATA,
|
resolve(ctx: ApplicationContext, value: IN, md: METADATA,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
materializer: Materializer): OUT;
|
materializer: Materializer): OUT;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import {Materializer, Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
import {Materializer, Type, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter, SchemaField} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
||||||
import {EntityType} from "cad/craft/schema/types/entityType";
|
|
||||||
|
|
||||||
export interface NumberTypeSchema extends BaseSchemaField {
|
export interface NumberTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
|
|
@ -15,7 +14,7 @@ export interface NumberTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
export const NumberType: Type<any, number, NumberTypeSchema> = {
|
export const NumberType: Type<any, number, NumberTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: any,
|
value: any,
|
||||||
md: NumberTypeSchema,
|
md: NumberTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Materializer, Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
import {Materializer, Type, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter, OperationSchema} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter, OperationSchema} from "cad/craft/schema/schema";
|
||||||
|
|
||||||
export interface ObjectTypeSchema extends BaseSchemaField {
|
export interface ObjectTypeSchema extends BaseSchemaField {
|
||||||
|
|
@ -14,7 +14,7 @@ export interface ObjectTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
export const ObjectType: Type<any, any, ObjectTypeSchema> = {
|
export const ObjectType: Type<any, any, ObjectTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: any,
|
value: any,
|
||||||
md: ObjectTypeSchema,
|
md: ObjectTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Materializer, Type, TypeRegistry, Types} from "cad/craft/schema/types/index";
|
import {Materializer, Type, Types} from "cad/craft/schema/types/index";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
import {BaseSchemaField, OperationParamsErrorReporter} from "cad/craft/schema/schema";
|
||||||
|
|
||||||
export interface StringTypeSchema extends BaseSchemaField {
|
export interface StringTypeSchema extends BaseSchemaField {
|
||||||
|
|
@ -12,7 +12,7 @@ export interface StringTypeSchema extends BaseSchemaField {
|
||||||
|
|
||||||
export const StringType: Type<any, string, StringTypeSchema> = {
|
export const StringType: Type<any, string, StringTypeSchema> = {
|
||||||
|
|
||||||
resolve(ctx: CoreContext,
|
resolve(ctx: ApplicationContext,
|
||||||
value: any,
|
value: any,
|
||||||
md: StringTypeSchema,
|
md: StringTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter,
|
reportError: OperationParamsErrorReporter,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import {merge, state, StateStream, Stream} from 'lstream';
|
import {merge, state, StateStream, Stream} from 'lstream';
|
||||||
import {indexArray} from 'gems/iterables';
|
import {indexArray} from 'gems/iterables';
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
export const BundleName = "@Expressions";
|
export const BundleName = "@Expressions";
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
let _evaluateExpression: (string) => any = () => {};
|
let _evaluateExpression: (string) => any = () => {};
|
||||||
|
|
||||||
const script$ = state('');
|
const script$ = state('');
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {EntityKind} from "cad/model/entities";
|
||||||
import {SectionWidgetProps} from "cad/mdf/ui/SectionWidget";
|
import {SectionWidgetProps} from "cad/mdf/ui/SectionWidget";
|
||||||
import {MObject} from "cad/model/mobject";
|
import {MObject} from "cad/model/mobject";
|
||||||
import Axis from "math/axis";
|
import Axis from "math/axis";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
||||||
|
|
||||||
export interface AxisInput {
|
export interface AxisInput {
|
||||||
|
|
@ -13,7 +13,7 @@ export interface AxisInput {
|
||||||
flip: boolean
|
flip: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AxisResolver: ValueResolver<AxisInput, Axis> = (ctx: CoreContext,
|
export const AxisResolver: ValueResolver<AxisInput, Axis> = (ctx: ApplicationContext,
|
||||||
value: AxisInput,
|
value: AxisInput,
|
||||||
md: ObjectTypeSchema,
|
md: ObjectTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter): Axis => {
|
reportError: OperationParamsErrorReporter): Axis => {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {OperationParamsErrorReporter, ValueResolver} from "cad/craft/schema/schema";
|
import {OperationParamsErrorReporter, ValueResolver} from "cad/craft/schema/schema";
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
import {ObjectTypeSchema} from "cad/craft/schema/types/objectType";
|
||||||
import {AxisBasedWidgetDefinition, AxisBasedWidgetProps, AxisInput, AxisResolver} from "cad/mdf/ui/AxisWidget";
|
import {AxisBasedWidgetDefinition, AxisBasedWidgetProps, AxisInput, AxisResolver} from "cad/mdf/ui/AxisWidget";
|
||||||
import {UnitVector} from "math/vector";
|
import {UnitVector} from "math/vector";
|
||||||
|
|
||||||
export const DirectionResolver: ValueResolver<AxisInput, UnitVector> = (ctx: CoreContext,
|
export const DirectionResolver: ValueResolver<AxisInput, UnitVector> = (ctx: ApplicationContext,
|
||||||
value: AxisInput,
|
value: AxisInput,
|
||||||
md: ObjectTypeSchema,
|
md: ObjectTypeSchema,
|
||||||
reportError: OperationParamsErrorReporter): UnitVector => {
|
reportError: OperationParamsErrorReporter): UnitVector => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ReadSketch} from "./sketchReader";
|
import {ReadSketch} from "./sketchReader";
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
function getAllSketches() {
|
function getAllSketches() {
|
||||||
let nm = ctx.projectService.sketchStorageNamespace;
|
let nm = ctx.projectService.sketchStorageNamespace;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {stream} from 'lstream';
|
import {stream} from 'lstream';
|
||||||
import {CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
const updates$ = stream();
|
const updates$ = stream();
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ export function defineStreams(ctx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
const {services, streams} = ctx;
|
const {services, streams} = ctx;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,16 @@ import {OperationDescriptor} from "cad/craft/operationBundle";
|
||||||
import {ActionDefinition} from "cad/actions/actionSystemBundle";
|
import {ActionDefinition} from "cad/actions/actionSystemBundle";
|
||||||
import {state} from "lstream";
|
import {state} from "lstream";
|
||||||
import {Index} from "gems/indexType";
|
import {Index} from "gems/indexType";
|
||||||
import {ApplicationContext, CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ActionRef} from "cad/dom/uiBundle";
|
import {ActionRef} from "cad/dom/uiBundle";
|
||||||
import {IconDeclaration} from "cad/icons/IconDeclaration";
|
import {IconDeclaration} from "cad/icons/IconDeclaration";
|
||||||
import {CurrentWorkbenchIcon} from "cad/workbench/CurrentWorkbenchIcon";
|
|
||||||
|
|
||||||
export class WorkbenchService {
|
export class WorkbenchService {
|
||||||
|
|
||||||
workbenches$ = state<Index<WorkbenchConfig>>({});
|
workbenches$ = state<Index<WorkbenchConfig>>({});
|
||||||
|
|
||||||
currentWorkbench$ = state<WorkbenchConfig>(null);
|
currentWorkbench$ = state<WorkbenchConfig>(null);
|
||||||
ctx: CoreContext;
|
ctx: ApplicationContext;
|
||||||
|
|
||||||
constructor(ctx: ApplicationContext) {
|
constructor(ctx: ApplicationContext) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue