diff --git a/web/app/cad/actions/actionSystemBundle.ts b/web/app/cad/actions/actionSystemBundle.ts index bb69cb47..addfe6a3 100644 --- a/web/app/cad/actions/actionSystemBundle.ts +++ b/web/app/cad/actions/actionSystemBundle.ts @@ -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; } -export interface ActionSystemBundle { +export interface ActionSystemBundleContext { actionService: ActionService; } +export const outputContextSpec: ContextSpec = { + actionService: 'required' +} diff --git a/web/app/cad/assembly/assemblyBundle.ts b/web/app/cad/assembly/assemblyBundle.ts index 7b98fabe..5f4841f2 100644 --- a/web/app/cad/assembly/assemblyBundle.ts +++ b/web/app/cad/assembly/assemblyBundle.ts @@ -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 = { + assemblyService: 'required' +} diff --git a/web/app/cad/attributes/attributesBundle.ts b/web/app/cad/attributes/attributesBundle.ts index 719b25ac..3900dca9 100644 --- a/web/app/cad/attributes/attributesBundle.ts +++ b/web/app/cad/attributes/attributesBundle.ts @@ -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 = { +export const AttributesBundle: Bundle = { inputContextSpec: { actionService: 'required', diff --git a/web/app/cad/craft/cadRegistryBundle.ts b/web/app/cad/craft/cadRegistryBundle.ts index 338fb830..9f9e0740 100644 --- a/web/app/cad/craft/cadRegistryBundle.ts +++ b/web/app/cad/craft/cadRegistryBundle.ts @@ -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 = { + cadRegistry: 'required' +} diff --git a/web/app/cad/craft/craftBundle.ts b/web/app/cad/craft/craftBundle.ts index 250ef127..63453c8d 100644 --- a/web/app/cad/craft/craftBundle.ts +++ b/web/app/cad/craft/craftBundle.ts @@ -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 = { + craftService: 'required' +} diff --git a/web/app/cad/craft/e0/occtBundle.ts b/web/app/cad/craft/e0/occtBundle.ts index 762a9656..5632d618 100644 --- a/web/app/cad/craft/e0/occtBundle.ts +++ b/web/app/cad/craft/e0/occtBundle.ts @@ -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 = { + craftEngine: 'required', + occService: 'required' +} + + diff --git a/web/app/cad/craft/operationBundle.ts b/web/app/cad/craft/operationBundle.ts index 34b29efe..3cb17905 100644 --- a/web/app/cad/craft/operationBundle.ts +++ b/web/app/cad/craft/operationBundle.ts @@ -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 = { + operationService: 'required' +} + diff --git a/web/app/cad/craft/wizard/wizardBundle.ts b/web/app/cad/craft/wizard/wizardBundle.ts index c94153b5..777115c2 100644 --- a/web/app/cad/craft/wizard/wizardBundle.ts +++ b/web/app/cad/craft/wizard/wizardBundle.ts @@ -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 = { + wizardService: 'required' +} + + function applyOverrides(params, initialOverrides) { Object.assign(params, initialOverrides); } diff --git a/web/app/cad/craft/wizard/wizardSelectionPlugin.ts b/web/app/cad/craft/wizard/wizardSelectionPlugin.ts index 0605ae3c..9bcba628 100644 --- a/web/app/cad/craft/wizard/wizardSelectionPlugin.ts +++ b/web/app/cad/craft/wizard/wizardSelectionPlugin.ts @@ -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 = { +export const WizardSelectionPlugin: Bundle = { inputContextSpec: { markerService: 'required', diff --git a/web/app/cad/dom/appTabsBundle.ts b/web/app/cad/dom/appTabsBundle.ts index 6f5361d5..d1e19950 100644 --- a/web/app/cad/dom/appTabsBundle.ts +++ b/web/app/cad/dom/appTabsBundle.ts @@ -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 = { + appTabsService: 'required' +} diff --git a/web/app/cad/dom/domBundle.ts b/web/app/cad/dom/domBundle.ts index 95d101b0..dbbaad82 100644 --- a/web/app/cad/dom/domBundle.ts +++ b/web/app/cad/dom/domBundle.ts @@ -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 = { +export const DomBundle: Bundle = { inputContextSpec: { appTabsService: 'required', diff --git a/web/app/cad/dom/uiBundle.ts b/web/app/cad/dom/uiBundle.ts index f9b900de..2e5f7fb3 100644 --- a/web/app/cad/dom/uiBundle.ts +++ b/web/app/cad/dom/uiBundle.ts @@ -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 = { + uiService: undefined +} + diff --git a/web/app/cad/expressions/expressionsBundle.ts b/web/app/cad/expressions/expressionsBundle.ts index 150d6c34..d745277b 100644 --- a/web/app/cad/expressions/expressionsBundle.ts +++ b/web/app/cad/expressions/expressionsBundle.ts @@ -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 = { + expressionService: 'required' +} + + diff --git a/web/app/cad/location/LocationBundle.ts b/web/app/cad/location/LocationBundle.ts index 03aae1b9..693c5c2f 100644 --- a/web/app/cad/location/LocationBundle.ts +++ b/web/app/cad/location/LocationBundle.ts @@ -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 = { + locationService: 'required' +} + diff --git a/web/app/cad/partImport/remotePartsBundle.ts b/web/app/cad/partImport/remotePartsBundle.ts index 2bb6a9c4..2a5b0482 100644 --- a/web/app/cad/partImport/remotePartsBundle.ts +++ b/web/app/cad/partImport/remotePartsBundle.ts @@ -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 = { + remotePartsService: 'required' +} diff --git a/web/app/cad/projectBundle.ts b/web/app/cad/projectBundle.ts index e0c5bc16..c66eee75 100644 --- a/web/app/cad/projectBundle.ts +++ b/web/app/cad/projectBundle.ts @@ -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 = { + projectService: 'required' +} + diff --git a/web/app/cad/projectManager/projectManagerBundle.ts b/web/app/cad/projectManager/projectManagerBundle.ts index a553a165..b67f51d3 100644 --- a/web/app/cad/projectManager/projectManagerBundle.ts +++ b/web/app/cad/projectManager/projectManagerBundle.ts @@ -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 = { + projectManager: 'required' +} diff --git a/web/app/cad/scene/entityContextBundle.ts b/web/app/cad/scene/entityContextBundle.ts index 9d42e9e2..eb7efa48 100644 --- a/web/app/cad/scene/entityContextBundle.ts +++ b/web/app/cad/scene/entityContextBundle.ts @@ -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 }; } + +export const outputContextSpec: ContextSpec = { + entityContextService: 'required' +} diff --git a/web/app/cad/scene/highlightBundle.ts b/web/app/cad/scene/highlightBundle.ts index bb47eba0..3c3fbeb8 100644 --- a/web/app/cad/scene/highlightBundle.ts +++ b/web/app/cad/scene/highlightBundle.ts @@ -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 = { +export const HighlightBundle: Bundle = { inputContextSpec: { viewer: 'required', diff --git a/web/app/cad/scene/sceneBundle.ts b/web/app/cad/scene/sceneBundle.ts index 0aa40c89..25cf851d 100644 --- a/web/app/cad/scene/sceneBundle.ts +++ b/web/app/cad/scene/sceneBundle.ts @@ -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 = { + cadScene: 'required', + viewer: 'required' +} diff --git a/web/app/cad/sketch/sketchStorageBundle.ts b/web/app/cad/sketch/sketchStorageBundle.ts index 31ed84ec..46aa0735 100644 --- a/web/app/cad/sketch/sketchStorageBundle.ts +++ b/web/app/cad/sketch/sketchStorageBundle.ts @@ -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 = { + sketchStorageService: 'required' +} + diff --git a/web/app/cad/sketch/sketcherBundle.ts b/web/app/cad/sketch/sketcherBundle.ts index d70ca117..36677cbf 100644 --- a/web/app/cad/sketch/sketcherBundle.ts +++ b/web/app/cad/sketch/sketcherBundle.ts @@ -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 = { + sketcherService: 'required' +} diff --git a/web/app/cad/storage/storageBundle.ts b/web/app/cad/storage/storageBundle.ts index 8da162a1..ed45c858 100644 --- a/web/app/cad/storage/storageBundle.ts +++ b/web/app/cad/storage/storageBundle.ts @@ -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 = { + storageService: 'required' +} diff --git a/web/app/cad/workbench/workbenchBundle.ts b/web/app/cad/workbench/workbenchBundle.ts index f54b1ad2..9106603a 100644 --- a/web/app/cad/workbench/workbenchBundle.ts +++ b/web/app/cad/workbench/workbenchBundle.ts @@ -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 = { + + deactivate(ctx: ApplicationContext & WorkbenchBundleContext) { + }, + + inputContextSpec: { + + }, + + outputContextSpec: { + workbenchService: 'required' + }, + activate(ctx: ApplicationContext) { diff --git a/web/app/cad/workbench/workbenchesLoaderPlugin.ts b/web/app/cad/workbench/workbenchesLoaderPlugin.ts index 1df03219..17876a82 100644 --- a/web/app/cad/workbench/workbenchesLoaderPlugin.ts +++ b/web/app/cad/workbench/workbenchesLoaderPlugin.ts @@ -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 = { +export const WorkbenchesLoaderPlugin: Bundle = { inputContextSpec: { workbenchService: 'required',