define outputContextSpec for all bundles

This commit is contained in:
Val Erastov 2022-08-13 16:42:34 -07:00
parent a7217d8d3a
commit 54a30ccf10
25 changed files with 123 additions and 14 deletions

View file

@ -4,6 +4,7 @@ import {state, StateStream, Stream} from 'lstream';
import {LOG_FLAGS} from '../logFlags';
import {ApplicationContext} from "cad/context";
import {IconType} from "react-icons";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(context: ApplicationContext) {
@ -155,8 +156,11 @@ export interface ActionService {
hint$: StateStream<Hint>;
}
export interface ActionSystemBundle {
export interface ActionSystemBundleContext {
actionService: ActionService;
}
export const outputContextSpec: ContextSpec<ActionSystemBundleContext> = {
actionService: 'required'
}

View file

@ -9,6 +9,7 @@ import {AssemblyView} from "./ui/AssemblyView";
import {IoMdConstruct} from "react-icons/io";
import {AssemblyConstraintDefinition} from "./assemblyConstraint";
import {AssemblyConstraintsSchemas} from "./assemblySchemas";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -104,3 +105,6 @@ export interface AssemblyBundleContext {
assemblyService: AssemblyService;
}
export const outputContextSpec: ContextSpec<AssemblyBundleContext> = {
assemblyService: 'required'
}

View file

@ -1,14 +1,14 @@
import {Plugin} from "plugable/pluginSystem";
import {Bundle} from "bundler/bundleSystem";
import {AttributesService} from "cad/attributes/attributesService";
import {contributeComponent} from "cad/dom/components/ContributedComponents";
import {DisplayOptionsDialogManager} from "cad/attributes/ui/DisplayOptionsDialog";
import {ActionSystemBundle} from "cad/actions/actionSystemBundle";
import {ActionSystemBundleContext} from "cad/actions/actionSystemBundle";
import {RequiresAnyModelSelection} from "cad/actions/actionHelpers";
import {IoColorPalette} from "react-icons/io5";
import {FaTable} from "react-icons/fa";
import {ApplicationContext} from "cad/context";
type AttributesPluginInputContext = ActionSystemBundle;
type AttributesPluginInputContext = ActionSystemBundleContext;
export interface AttributesPluginContext {
attributesService: AttributesService;
@ -16,7 +16,7 @@ export interface AttributesPluginContext {
type AttributesPluginWorkingContext = AttributesPluginInputContext&AttributesPluginContext;
export const AttributesBundle: Plugin<AttributesPluginInputContext, AttributesPluginContext, AttributesPluginWorkingContext> = {
export const AttributesBundle: Bundle<AttributesPluginInputContext, AttributesPluginContext, AttributesPluginWorkingContext> = {
inputContextSpec: {
actionService: 'required',

View file

@ -7,6 +7,7 @@ import {MEdge} from "../model/medge";
import {MSketchObject} from "../model/msketchObject";
import {MDatum, MDatumAxis} from "../model/mdatum";
import {MLoop} from "../model/mloop";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -112,3 +113,7 @@ export interface CadRegistryBundleContext {
cadRegistry: CadRegistry;
}
export const outputContextSpec: ContextSpec<CadRegistryBundleContext> = {
cadRegistry: 'required'
}

View file

@ -8,6 +8,7 @@ import {CoreContext} from "cad/context";
import {MFace} from "../model/mface";
import {OperationParams} from "cad/craft/schema/schema";
import {clearImplicitModels} from "cad/craft/e0/occCommandInterface";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: CoreContext) {
@ -295,3 +296,7 @@ export interface CraftBundleContext {
craftService: CraftService;
}
export const outputContextSpec: ContextSpec<CraftBundleContext> = {
craftService: 'required'
}

View file

@ -1,6 +1,7 @@
import {GenericWASMEngine_V1} from "engine/impl/wasm/GenericWASMEngine_V1";
import {CraftEngine} from "./craftEngine";
import {createOCCService, OCCService} from "cad/craft/e0/occService";
import {ContextSpec} from "bundler/bundleSystem";
export interface OCCBundleContext {
@ -54,6 +55,12 @@ function loadWasm(ctx) {
document.head.appendChild(mainScript);
}
export const outputContextSpec: ContextSpec<OCCBundleContext> = {
craftEngine: 'required',
occService: 'required'
}

View file

@ -14,6 +14,7 @@ import {resolveIcon} from "cad/craft/ui/iconResolver";
import {loadDeclarativeForm} from "cad/mdf/declarativeFormLoader";
import {operationIconToActionIcon} from "cad/craft/operationHelper";
import {GenerateWorkbenchOperationDocumentationLink} from "doc/documentationHelper";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -238,4 +239,8 @@ export interface OperationBundleContext {
operationService: OperationService;
}
export const outputContextSpec: ContextSpec<OperationBundleContext> = {
operationService: 'required'
}

View file

@ -17,6 +17,7 @@ import {OperationParamValue} from "cad/craft/schema/schema";
import {ApplicationContext} from "cad/context";
import {Operation} from "cad/craft/operationBundle";
import produce from "immer"
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -186,6 +187,11 @@ export interface WizardPluginContext {
wizardService: WizardService
}
export const outputContextSpec: ContextSpec<WizardPluginContext> = {
wizardService: 'required'
}
function applyOverrides(params, initialOverrides) {
Object.assign(params, initialOverrides);
}

View file

@ -3,7 +3,7 @@ import {OperationRequest} from "cad/craft/craftBundle";
import {ParamsPath, WizardService} from "cad/craft/wizard/wizardTypes";
import {OperationParamPrimitive} from "cad/craft/schema/schema";
import {EntityReference} from "cad/craft/operationBundle";
import {Plugin} from "plugable/pluginSystem";
import {Bundle} from "bundler/bundleSystem";
import {MarkerPluginContext} from "cad/scene/selectionMarker/markerPlugin";
import {WizardPluginContext} from "cad/craft/wizard/wizardBundle";
import {PickControlPluginContext} from "cad/scene/controls/pickControlPlugin";
@ -17,7 +17,7 @@ export interface WizardSelectionPluginContext {
export type WizardSelectionWorkingContext = WizardSelectionPluginInputContext & WizardSelectionPluginContext;
export const WizardSelectionPlugin: Plugin<WizardSelectionPluginInputContext, WizardSelectionPluginContext, WizardSelectionWorkingContext> = {
export const WizardSelectionPlugin: Bundle<WizardSelectionPluginInputContext, WizardSelectionPluginContext, WizardSelectionWorkingContext> = {
inputContextSpec: {
markerService: 'required',

View file

@ -1,5 +1,6 @@
import {state, StateStream} from "lstream";
import {ApplicationContext} from "cad/context";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -82,3 +83,6 @@ export interface AppTabsBundleContext {
appTabsService: AppTabsService;
}
export const outputContextSpec: ContextSpec<AppTabsBundleContext> = {
appTabsService: 'required'
}

View file

@ -1,5 +1,5 @@
import {contributeComponent} from './components/ContributedComponents';
import {Plugin} from "plugable/pluginSystem";
import {Bundle} from "bundler/bundleSystem";
import {AppTabsService} from "cad/dom/appTabsBundle";
export interface DomService {
@ -23,7 +23,7 @@ export interface DomPluginContext {
type DomPluginWorkingContext = DomPluginInputContext&DomPluginContext;
export const DomBundle: Plugin<DomPluginInputContext, DomPluginContext, DomPluginWorkingContext> = {
export const DomBundle: Bundle<DomPluginInputContext, DomPluginContext, DomPluginWorkingContext> = {
inputContextSpec: {
appTabsService: 'required',

View file

@ -1,4 +1,5 @@
import {state, StateStream} from 'lstream';
import {ContextSpec} from "bundler/bundleSystem";
export function defineStreams({streams}) {
@ -74,3 +75,8 @@ export interface UIBundleContext {
}
};
}
export const outputContextSpec: ContextSpec<UIBundleContext> = {
uiService: undefined
}

View file

@ -1,6 +1,7 @@
import {merge, state, StateStream, Stream} from 'lstream';
import {indexArray} from 'gems/iterables';
import {CoreContext} from "cad/context";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: CoreContext) {
@ -120,3 +121,8 @@ export interface ExpressionBundleContext {
expressionService: ExpressionService;
}
export const outputContextSpec: ContextSpec<ExpressionBundleContext> = {
expressionService: 'required'
}

View file

@ -2,6 +2,7 @@ import {state, StateStream} from "lstream";
import {ApplicationContext} from "cad/context";
import {MShell} from "../model/mshell";
import {LocationDialog} from "./LocationDialog";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -40,3 +41,7 @@ export interface LocationBundleContext {
locationService: LocationService;
}
export const outputContextSpec: ContextSpec<LocationBundleContext> = {
locationService: 'required'
}

View file

@ -16,6 +16,7 @@ import {activate as activateExpressionsPlugin} from '../expressions/expressionsB
import {activate as activateCadRegistryPlugin} from '../craft/cadRegistryBundle';
import {activate as activateStoragePlugin} from '../storage/storageBundle';
import {activate as activateSketchStoragePlugin} from '../sketch/sketchStorageBundle';
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -184,4 +185,7 @@ export interface RemotePartsBundleContext {
remotePartsService: RemotePartsService;
}
export const outputContextSpec: ContextSpec<RemotePartsBundleContext> = {
remotePartsService: 'required'
}

View file

@ -5,6 +5,7 @@ import {ApplicationContext} from "cad/context";
import {ProjectModel} from "./projectManager/projectManagerBundle";
import {DebugMode$} from "debugger/Debugger";
import {fillUpMissingFields} from "cad/craft/schema/initializeBySchema";
import {ContextSpec} from "bundler/bundleSystem";
export const STORAGE_GLOBAL_PREFIX = 'TCAD';
export const PROJECTS_PREFIX = `${STORAGE_GLOBAL_PREFIX}.projects.`;
@ -191,4 +192,8 @@ export interface ProjectBundleContext {
}
export const outputContextSpec: ContextSpec<ProjectBundleContext> = {
projectService: 'required'
}

View file

@ -5,6 +5,7 @@ import {SketchFormat_V3} from "sketcher/io";
import {ApplicationContext} from "cad/context";
import {OperationRequest} from "../craft/craftBundle";
import {AssemblyConstraintDefinition} from "cad/assembly/assemblyConstraint";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
@ -251,3 +252,7 @@ export interface ProjectManagerBundleContext {
projectManager: IProjectManager;
}
export const outputContextSpec: ContextSpec<ProjectManagerBundleContext> = {
projectManager: 'required'
}

View file

@ -3,6 +3,7 @@ import {combine, state, StateStream, Stream} from 'lstream';
import {addToListInMap, EMPTY_ARRAY} from 'gems/iterables';
import {DATUM, EDGE, FACE, LOOP, SHELL, SKETCH_OBJECT} from '../model/entities';
import {MObject} from "cad/model/mobject";
import {ContextSpec} from "bundler/bundleSystem";
export const SELECTABLE_ENTITIES = [FACE, EDGE, SKETCH_OBJECT, DATUM, SHELL];
@ -70,3 +71,7 @@ export interface EntityContextBundleContext {
selectedEntities: StateStream<MObject[]>
};
}
export const outputContextSpec: ContextSpec<EntityContextBundleContext> = {
entityContextService: 'required'
}

View file

@ -1,4 +1,4 @@
import {Plugin} from "plugable/pluginSystem";
import {Bundle} from "bundler/bundleSystem";
import {combine, merge, Stream, stream} from "lstream";
import Viewer from "cad/scene/viewer";
import {ScanStream} from "lstream/scan";
@ -53,7 +53,7 @@ export interface HighlightPluginContext {
type HighlightPluginWorkingContext = HighlightPluginInputContext&HighlightPluginContext;
export const HighlightBundle: Plugin<HighlightPluginInputContext, HighlightPluginContext, HighlightPluginWorkingContext> = {
export const HighlightBundle: Bundle<HighlightPluginInputContext, HighlightPluginContext, HighlightPluginWorkingContext> = {
inputContextSpec: {
viewer: 'required',

View file

@ -2,6 +2,7 @@ import Viewer from './viewer';
import CadScene from './cadScene';
import {externalState, stream} from 'lstream';
import {ApplicationContext} from "cad/context";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: ApplicationContext) {
const {services} = ctx;
@ -56,3 +57,8 @@ export interface SceneBundleContext {
cadScene: CadScene;
viewer: Viewer;
}
export const outputContextSpec: ContextSpec<SceneBundleContext> = {
cadScene: 'required',
viewer: 'required'
}

View file

@ -1,5 +1,6 @@
import {CoreContext} from "cad/context";
import {ReadSketch} from "./sketchReader";
import {ContextSpec} from "bundler/bundleSystem";
export function activate(ctx: CoreContext) {
@ -73,4 +74,8 @@ export interface SketchStorageBundleContext {
sketchStorageService: SketchStorageService;
}
export const outputContextSpec: ContextSpec<SketchStorageBundleContext> = {
sketchStorageService: 'required'
}

View file

@ -7,6 +7,7 @@ import {Viewer} from "sketcher/viewer2d";
import {IO} from "sketcher/io";
import {Generator} from "sketcher/id-generator";
import {MFace} from "cad/model/mface";
import {ContextSpec} from "bundler/bundleSystem";
export function defineStreams(ctx) {
ctx.streams.sketcher = {
@ -204,3 +205,7 @@ export interface SketcherBundleContext {
sketcherService: SketcherService;
}
export const outputContextSpec: ContextSpec<SketcherBundleContext> = {
sketcherService: 'required'
}

View file

@ -1,5 +1,6 @@
import {stream} from 'lstream';
import {CoreContext} from "cad/context";
import {ContextSpec} from "bundler/bundleSystem";
const updates$ = stream();
@ -87,3 +88,6 @@ export interface StorageBundleContext {
storageService: StorageService;
}
export const outputContextSpec: ContextSpec<StorageBundleContext> = {
storageService: 'required'
}

View file

@ -1,6 +1,7 @@
import {ApplicationContext} from "cad/context";
import {WorkbenchService} from "cad/workbench/workbenchService";
import {CurrentWorkbenchIcon} from "cad/workbench/CurrentWorkbenchIcon";
import {Bundle} from "bundler/bundleSystem";
export interface WorkbenchBundleContext {
@ -8,7 +9,19 @@ export interface WorkbenchBundleContext {
workbenchService: WorkbenchService;
}
export const WorkbenchBundle = {
export const WorkbenchBundle: Bundle<ApplicationContext, WorkbenchBundleContext> = {
deactivate(ctx: ApplicationContext & WorkbenchBundleContext) {
},
inputContextSpec: {
},
outputContextSpec: {
workbenchService: 'required'
},
activate(ctx: ApplicationContext) {

View file

@ -4,7 +4,7 @@ import createDatumOperation from "cad/craft/datum/create/createDatumOperation";
import moveDatumOperation from "cad/craft/datum/move/moveDatumOperation";
import rotateDatumOperation from "cad/craft/datum/rotate/rotateDatumOperation";
import datumOperation from "cad/craft/primitives/plane/planeOperation";
import {Plugin} from "plugable/pluginSystem";
import {Bundle} from "bundler/bundleSystem";
import {WorkbenchService} from "cad/workbench/workbenchService";
import {OperationService} from "cad/craft/operationBundle";
@ -13,7 +13,7 @@ export interface WorkbenchesLoaderInputContext {
operationService: OperationService
}
export const WorkbenchesLoaderPlugin: Plugin<WorkbenchesLoaderInputContext, {}> = {
export const WorkbenchesLoaderPlugin: Bundle<WorkbenchesLoaderInputContext, {}> = {
inputContextSpec: {
workbenchService: 'required',