mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
simplify bundle system
This commit is contained in:
parent
1363ceb761
commit
02054d62c2
50 changed files with 325 additions and 436 deletions
|
|
@ -1,109 +1,95 @@
|
||||||
type BagOfPlugins = Set<Bundle<any, any>>;
|
|
||||||
|
|
||||||
export class BundleSystem {
|
export class BundleSystem {
|
||||||
|
|
||||||
plugins: BagOfPlugins = new Set();
|
|
||||||
waitingQueue: BagOfPlugins = new Set();
|
|
||||||
globalContext: any;
|
globalContext: any;
|
||||||
|
activatedBundles = new Set<string>();
|
||||||
|
waitingQueue = new Set<Bundle<any>>();
|
||||||
|
perfectLoad = true;
|
||||||
|
|
||||||
constructor(globalContext: any) {
|
constructor(globalContext) {
|
||||||
this.globalContext = globalContext;
|
this.globalContext = globalContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
load(plugin: Bundle<any, any>) {
|
activate(bundle: Bundle<any>) {
|
||||||
this.waitingQueue.add(plugin);
|
|
||||||
|
if (!bundle.BundleName) {
|
||||||
|
console.error("BundleName is not provided for the bundle");
|
||||||
|
bundle.BundleName = "@Unknown_" + (UNKNOWNS_COUNTER++);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.activatedBundles.has(bundle.BundleName)) {
|
||||||
|
throw `Bundle ${bundle.BundleName} has already activated. Possible name collision`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.readinessCheck(bundle)) {
|
||||||
|
this.perfectLoad = false;
|
||||||
|
this.waitingQueue.add(bundle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.doActivate(bundle);
|
||||||
|
|
||||||
this.processWaitingQueue();
|
this.processWaitingQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private doActivate(bundle) {
|
||||||
|
bundle.activate(this.globalContext);
|
||||||
|
this.activatedBundles.add(bundle.BundleName);
|
||||||
|
}
|
||||||
|
|
||||||
processWaitingQueue() {
|
processWaitingQueue() {
|
||||||
let needPass = true;
|
for (let bundle of this.waitingQueue) {
|
||||||
while (needPass) {
|
if (this.readinessCheck(bundle)) {
|
||||||
needPass = false;
|
this.waitingQueue.delete(bundle);
|
||||||
this.waitingQueue.forEach(plugin => {
|
this.doActivate(bundle);
|
||||||
const ready = readiness(plugin, this.globalContext);
|
|
||||||
if (ready) {
|
|
||||||
try {
|
|
||||||
plugin.activate(this.globalContext);
|
|
||||||
checkActivation(plugin, this.globalContext);
|
|
||||||
needPass = true;
|
|
||||||
this.plugins.add(plugin);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
this.waitingQueue.delete(plugin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unload(plugin: Bundle<any, any>) {
|
|
||||||
this.waitingQueue.delete(plugin);
|
|
||||||
this.plugins.delete(plugin);
|
|
||||||
try {
|
|
||||||
if (plugin.deactivate) {
|
|
||||||
plugin.deactivate(this.globalContext);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
}
|
||||||
console.error(error);
|
}
|
||||||
|
|
||||||
|
readinessCheck(bundle) {
|
||||||
|
|
||||||
|
if (!bundle.activationDependencies) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let needPass = true;
|
for (let dep of bundle.activationDependencies) {
|
||||||
while (needPass) {
|
if (!this.activatedBundles.has(dep)) {
|
||||||
needPass = false;
|
return false;
|
||||||
this.plugins.forEach(plugin => {
|
}
|
||||||
if (!plugin.deactivate) {
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
const isReady = readiness(plugin, this.globalContext);
|
|
||||||
if (!isReady) {
|
checkDanglingBundles() {
|
||||||
try {
|
this.waitingQueue.forEach(dangling => {
|
||||||
plugin.deactivate(this.globalContext);
|
const unsatisfied = new Set(dangling.activationDependencies);
|
||||||
this.plugins.delete(plugin);
|
this.activatedBundles.forEach(activated => unsatisfied.delete(activated));
|
||||||
this.waitingQueue.add(plugin);
|
console.error('Bundle', dangling.BundleName, 'was never activated because of unsatisfied dependencies: ', Array.from(unsatisfied).join(', '));
|
||||||
needPass = true;
|
})
|
||||||
} catch (error) {
|
}
|
||||||
console.error(error);
|
|
||||||
}
|
checkPerfectLoad() {
|
||||||
}
|
if (!this.perfectLoad) {
|
||||||
})
|
console.warn("Bundle activation wasn't perfect. Consider reordering bundles to following:");
|
||||||
|
console.info(Array.from(this.activatedBundles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readiness(plugin: Bundle<any, any>, globalContext: any) {
|
export type Spec = 'required';
|
||||||
const specKeys = Object.keys(plugin.inputContextSpec);
|
|
||||||
for (let key of specKeys) {
|
|
||||||
if (!globalContext[key] && plugin.inputContextSpec[key] === 'required') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkActivation(plugin: Bundle<any, any>, globalContext: any) {
|
|
||||||
const specKeys = Object.keys(plugin.outputContextSpec);
|
|
||||||
for (let key of specKeys) {
|
|
||||||
if (!globalContext[key] && plugin.outputContextSpec[key] === 'required') {
|
|
||||||
console.error("declared service was never activated: " + key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Spec = 'required' | 'optional';
|
|
||||||
|
|
||||||
export type ContextSpec<T> = {
|
export type ContextSpec<T> = {
|
||||||
[Property in keyof T]: Spec;
|
[Property in keyof T]: Spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface Bundle<InputContext, OutputContext, WorkingContext = InputContext&OutputContext> {
|
export interface Bundle<WorkingContext> {
|
||||||
|
|
||||||
inputContextSpec: ContextSpec<InputContext>;
|
activationDependencies?: string[];
|
||||||
|
|
||||||
outputContextSpec: ContextSpec<OutputContext>;
|
runtimeDependencies?: string[];
|
||||||
|
|
||||||
activate(ctx: InputContext&OutputContext);
|
activate(ctx: WorkingContext);
|
||||||
|
|
||||||
deactivate?(ctx: InputContext&OutputContext);
|
|
||||||
|
|
||||||
|
BundleName: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let UNKNOWNS_COUNTER = 0;
|
||||||
6
modules/bundler/bundlerContext.ts
Normal file
6
modules/bundler/bundlerContext.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function createBundlerContext() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ import {
|
||||||
ALL_EXCLUDING_SOLID_KINDS,
|
ALL_EXCLUDING_SOLID_KINDS,
|
||||||
PICK_KIND,
|
PICK_KIND,
|
||||||
traversePickResults
|
traversePickResults
|
||||||
} from '../../../web/app/cad/scene/controls/pickControlPlugin';
|
} from 'cad/scene/controls/pickControlBundle';
|
||||||
import {Vector3} from "three";
|
import {Vector3} from "three";
|
||||||
|
|
||||||
function waitFor(checkFn) {
|
function waitFor(checkFn) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import {state, StateStream, Stream} from 'lstream';
|
||||||
import {LOG_FLAGS} from '../logFlags';
|
import {LOG_FLAGS} from '../logFlags';
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {IconType} from "react-icons";
|
import {IconType} from "react-icons";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(context: ApplicationContext) {
|
export function activate(context: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -160,7 +159,6 @@ export interface ActionSystemBundleContext {
|
||||||
actionService: ActionService;
|
actionService: ActionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<ActionSystemBundleContext> = {
|
export const BundleName = "@ActionSystem";
|
||||||
actionService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import {AssemblyView} from "./ui/AssemblyView";
|
||||||
import {IoMdConstruct} from "react-icons/io";
|
import {IoMdConstruct} from "react-icons/io";
|
||||||
import {AssemblyConstraintDefinition} from "./assemblyConstraint";
|
import {AssemblyConstraintDefinition} from "./assemblyConstraint";
|
||||||
import {AssemblyConstraintsSchemas} from "./assemblySchemas";
|
import {AssemblyConstraintsSchemas} from "./assemblySchemas";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
@ -105,6 +104,4 @@ export interface AssemblyBundleContext {
|
||||||
assemblyService: AssemblyService;
|
assemblyService: AssemblyService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<AssemblyBundleContext> = {
|
export const BundleName = "@Assembly";
|
||||||
assemblyService: 'required'
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,22 @@ import {Bundle} from "bundler/bundleSystem";
|
||||||
import {AttributesService} from "cad/attributes/attributesService";
|
import {AttributesService} from "cad/attributes/attributesService";
|
||||||
import {contributeComponent} from "cad/dom/components/ContributedComponents";
|
import {contributeComponent} from "cad/dom/components/ContributedComponents";
|
||||||
import {DisplayOptionsDialogManager} from "cad/attributes/ui/DisplayOptionsDialog";
|
import {DisplayOptionsDialogManager} from "cad/attributes/ui/DisplayOptionsDialog";
|
||||||
import {ActionSystemBundleContext} from "cad/actions/actionSystemBundle";
|
|
||||||
import {RequiresAnyModelSelection} from "cad/actions/actionHelpers";
|
import {RequiresAnyModelSelection} from "cad/actions/actionHelpers";
|
||||||
import {IoColorPalette} from "react-icons/io5";
|
import {IoColorPalette} from "react-icons/io5";
|
||||||
import {FaTable} from "react-icons/fa";
|
import {FaTable} from "react-icons/fa";
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
type AttributesPluginInputContext = ActionSystemBundleContext;
|
export interface AttributesBundleContext {
|
||||||
|
|
||||||
export interface AttributesPluginContext {
|
|
||||||
attributesService: AttributesService;
|
attributesService: AttributesService;
|
||||||
}
|
}
|
||||||
|
|
||||||
type AttributesPluginWorkingContext = AttributesPluginInputContext&AttributesPluginContext;
|
export const AttributesBundle: Bundle<ApplicationContext> = {
|
||||||
|
|
||||||
export const AttributesBundle: Bundle<AttributesPluginInputContext, AttributesPluginContext, AttributesPluginWorkingContext> = {
|
activationDependencies: [
|
||||||
|
'@ActionSystem'
|
||||||
|
],
|
||||||
|
|
||||||
inputContextSpec: {
|
activate(ctx: ApplicationContext) {
|
||||||
actionService: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
|
||||||
attributesService: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
activate(ctx: AttributesPluginWorkingContext) {
|
|
||||||
ctx.attributesService = new AttributesService();
|
ctx.attributesService = new AttributesService();
|
||||||
contributeComponent(DisplayOptionsDialogManager);
|
contributeComponent(DisplayOptionsDialogManager);
|
||||||
|
|
||||||
|
|
@ -55,6 +46,7 @@ export const AttributesBundle: Bundle<AttributesPluginInputContext, AttributesPl
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
BundleName: "@Attributes",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
22
web/app/cad/context/LegacyStructureBundle.ts
Normal file
22
web/app/cad/context/LegacyStructureBundle.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import {Bundle} from "bundler/bundleSystem";
|
||||||
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
|
|
||||||
|
export interface LegacyStructureBundleContext {
|
||||||
|
services: any,
|
||||||
|
streams: any
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const LegacyStructureBundle: Bundle<ApplicationContext> = {
|
||||||
|
|
||||||
|
activate(ctx: ApplicationContext) {
|
||||||
|
ctx.services = {};
|
||||||
|
ctx.streams = {};
|
||||||
|
},
|
||||||
|
|
||||||
|
BundleName: "@Legacy",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,52 +1,48 @@
|
||||||
import {ProjectBundleContext} from "cad/projectBundle";
|
import {ProjectBundleContext} from "cad/projectBundle";
|
||||||
import {ActionSystemBundleContext} from "cad/actions/actionSystemBundle";
|
import {ActionSystemBundleContext} from "cad/actions/actionSystemBundle";
|
||||||
import {AssemblyBundleContext} from "cad/assembly/assemblyBundle";
|
import {AssemblyBundleContext} from "cad/assembly/assemblyBundle";
|
||||||
import {AttributesPluginContext} from "cad/attributes/attributesBundle";
|
import {AttributesBundleContext} from "cad/attributes/attributesBundle";
|
||||||
import {CadRegistryBundleContext} from "cad/craft/cadRegistryBundle";
|
import {CadRegistryBundleContext} from "cad/craft/cadRegistryBundle";
|
||||||
import {CraftBundleContext} from "cad/craft/craftBundle";
|
import {CraftBundleContext} from "cad/craft/craftBundle";
|
||||||
import {OperationBundleContext} from "cad/craft/operationBundle";
|
import {OperationBundleContext} from "cad/craft/operationBundle";
|
||||||
import {OCCBundleContext} from "cad/craft/e0/occtBundle";
|
import {OCCBundleContext} from "cad/craft/e0/occtBundle";
|
||||||
import {WizardPluginContext} from "cad/craft/wizard/wizardBundle";
|
import {WizardBundleContext} from "cad/craft/wizard/wizardBundle";
|
||||||
import {AppTabsBundleContext} from "cad/dom/appTabsBundle";
|
import {AppTabsBundleContext} from "cad/dom/appTabsBundle";
|
||||||
import {DomPluginContext} from "cad/dom/domBundle";
|
import {DomBundleContext} from "cad/dom/domBundle";
|
||||||
import {UIBundleContext} from "cad/dom/uiBundle";
|
import {UIBundleContext} from "cad/dom/uiBundle";
|
||||||
import {ExpressionBundleContext} from "cad/expressions/expressionsBundle";
|
import {ExpressionBundleContext} from "cad/expressions/expressionsBundle";
|
||||||
import {LocationBundleContext} from "cad/location/LocationBundle";
|
import {LocationBundleContext} from "cad/location/LocationBundle";
|
||||||
import {RemotePartsBundleContext} from "cad/partImport/remotePartsBundle";
|
import {RemotePartsBundleContext} from "cad/partImport/remotePartsBundle";
|
||||||
import {ProjectManagerBundleContext} from "cad/projectManager/projectManagerBundle";
|
import {ProjectManagerBundleContext} from "cad/projectManager/projectManagerBundle";
|
||||||
import {EntityContextBundleContext} from "cad/scene/entityContextBundle";
|
import {EntityContextBundleContext} from "cad/scene/entityContextBundle";
|
||||||
import {HighlightPluginContext} from "cad/scene/highlightBundle";
|
import {HighlightBundleContext} from "cad/scene/highlightBundle";
|
||||||
import {SceneBundleContext} from "cad/scene/sceneBundle";
|
import {SceneBundleContext} from "cad/scene/sceneBundle";
|
||||||
import {SketcherBundleContext} from "cad/sketch/sketcherBundle";
|
import {SketcherBundleContext} from "cad/sketch/sketcherBundle";
|
||||||
import {SketchStorageBundleContext} from "cad/sketch/sketchStorageBundle";
|
import {SketchStorageBundleContext} from "cad/sketch/sketchStorageBundle";
|
||||||
import {StorageBundleContext} from "cad/storage/storageBundle";
|
import {StorageBundleContext} from "cad/storage/storageBundle";
|
||||||
import {WorkbenchBundleContext} from "cad/workbench/workbenchBundle";
|
import {WorkbenchBundleContext} from "cad/workbench/workbenchBundle";
|
||||||
|
import {LegacyStructureBundleContext} from "cad/context/LegacyStructureBundle";
|
||||||
export interface LegacyContext {
|
|
||||||
services: any,
|
|
||||||
streams: any,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ApplicationContext extends
|
export interface ApplicationContext extends
|
||||||
LegacyContext,
|
LegacyStructureBundleContext,
|
||||||
ProjectBundleContext,
|
ProjectBundleContext,
|
||||||
ActionSystemBundleContext,
|
ActionSystemBundleContext,
|
||||||
AssemblyBundleContext,
|
AssemblyBundleContext,
|
||||||
AttributesPluginContext,
|
AttributesBundleContext,
|
||||||
CadRegistryBundleContext,
|
CadRegistryBundleContext,
|
||||||
CraftBundleContext,
|
CraftBundleContext,
|
||||||
OperationBundleContext,
|
OperationBundleContext,
|
||||||
OCCBundleContext,
|
OCCBundleContext,
|
||||||
WizardPluginContext,
|
WizardBundleContext,
|
||||||
AppTabsBundleContext,
|
AppTabsBundleContext,
|
||||||
DomPluginContext,
|
DomBundleContext,
|
||||||
UIBundleContext,
|
UIBundleContext,
|
||||||
ExpressionBundleContext,
|
ExpressionBundleContext,
|
||||||
LocationBundleContext,
|
LocationBundleContext,
|
||||||
RemotePartsBundleContext,
|
RemotePartsBundleContext,
|
||||||
ProjectManagerBundleContext,
|
ProjectManagerBundleContext,
|
||||||
EntityContextBundleContext,
|
EntityContextBundleContext,
|
||||||
HighlightPluginContext,
|
HighlightBundleContext,
|
||||||
SceneBundleContext,
|
SceneBundleContext,
|
||||||
SketcherBundleContext,
|
SketcherBundleContext,
|
||||||
SketchStorageBundleContext,
|
SketchStorageBundleContext,
|
||||||
|
|
@ -56,10 +52,5 @@ export interface ApplicationContext extends
|
||||||
|
|
||||||
export type CoreContext = ApplicationContext;
|
export type CoreContext = ApplicationContext;
|
||||||
|
|
||||||
export default {
|
export default {} as ApplicationContext;
|
||||||
|
|
||||||
services: {},
|
|
||||||
streams: {}
|
|
||||||
|
|
||||||
} as ApplicationContext;
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,4 @@ export interface CadRegistryBundleContext {
|
||||||
cadRegistry: CadRegistry;
|
cadRegistry: CadRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<CadRegistryBundleContext> = {
|
export const BundleName = "@CadRegistry";
|
||||||
cadRegistry: 'required'
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,4 @@ export interface CraftBundleContext {
|
||||||
craftService: CraftService;
|
craftService: CraftService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<CraftBundleContext> = {
|
export const BundleName = "@Craft";
|
||||||
craftService: 'required'
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
import defaultCraftEngine from './defaultCraftEngine';
|
|
||||||
|
|
||||||
|
|
||||||
export function activate(ctx) {
|
|
||||||
ctx.services.craftEngine = defaultCraftEngine
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import {state} from 'lstream';
|
import {state} from 'lstream';
|
||||||
import {EMPTY_OBJECT} from 'gems/objects';
|
import {EMPTY_OBJECT} from 'gems/objects';
|
||||||
|
|
||||||
|
export const BundleName = "@CraftUI";
|
||||||
|
|
||||||
export function activate({streams}) {
|
export function activate({streams}) {
|
||||||
streams.ui.craft = {
|
streams.ui.craft = {
|
||||||
modificationSelection: state(EMPTY_OBJECT)
|
modificationSelection: state(EMPTY_OBJECT)
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import {GenericWASMEngine_V1} from "engine/impl/wasm/GenericWASMEngine_V1";
|
import {GenericWASMEngine_V1} from "engine/impl/wasm/GenericWASMEngine_V1";
|
||||||
import {CraftEngine} from "./craftEngine";
|
import {CraftEngine} from "./craftEngine";
|
||||||
import {createOCCService, OCCService} from "cad/craft/e0/occService";
|
import {createOCCService, OCCService} from "cad/craft/e0/occService";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export interface OCCBundleContext {
|
export interface OCCBundleContext {
|
||||||
|
|
||||||
|
|
@ -55,10 +54,7 @@ function loadWasm(ctx) {
|
||||||
document.head.appendChild(mainScript);
|
document.head.appendChild(mainScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<OCCBundleContext> = {
|
export const BundleName = "@OCCT";
|
||||||
craftEngine: 'required',
|
|
||||||
occService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import {STORAGE_GLOBAL_PREFIX} from '../projectBundle';
|
import {STORAGE_GLOBAL_PREFIX} from '../projectBundle';
|
||||||
|
|
||||||
|
export const BundleName = "@Extensions";
|
||||||
|
|
||||||
const EXTENSIONS_STORAGE_PREFIX = `${STORAGE_GLOBAL_PREFIX}.Extensions`;
|
const EXTENSIONS_STORAGE_PREFIX = `${STORAGE_GLOBAL_PREFIX}.Extensions`;
|
||||||
|
|
||||||
let extensions = [];
|
let extensions = [];
|
||||||
|
|
@ -10,11 +10,9 @@ import {Types} from "cad/craft/schema/types";
|
||||||
import {EntityTypeSchema} from "cad/craft/schema/types/entityType";
|
import {EntityTypeSchema} from "cad/craft/schema/types/entityType";
|
||||||
import {FlattenPath, ParamsPath} from "cad/craft/wizard/wizardTypes";
|
import {FlattenPath, ParamsPath} from "cad/craft/wizard/wizardTypes";
|
||||||
import {IconDeclaration} from "cad/icons/IconDeclaration";
|
import {IconDeclaration} from "cad/icons/IconDeclaration";
|
||||||
import {resolveIcon} from "cad/craft/ui/iconResolver";
|
|
||||||
import {loadDeclarativeForm} from "cad/mdf/declarativeFormLoader";
|
import {loadDeclarativeForm} from "cad/mdf/declarativeFormLoader";
|
||||||
import {operationIconToActionIcon} from "cad/craft/operationHelper";
|
import {operationIconToActionIcon} from "cad/craft/operationHelper";
|
||||||
import {GenerateWorkbenchOperationDocumentationLink} from "doc/documentationHelper";
|
import {GenerateWorkbenchOperationDocumentationLink} from "doc/documentationHelper";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -239,8 +237,6 @@ export interface OperationBundleContext {
|
||||||
operationService: OperationService;
|
operationService: OperationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<OperationBundleContext> = {
|
export const BundleName = "@Operation";
|
||||||
operationService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,15 +183,12 @@ export function activate(ctx: ApplicationContext) {
|
||||||
ctx.wizardService = services.wizard = wizardService;
|
ctx.wizardService = services.wizard = wizardService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WizardPluginContext {
|
export interface WizardBundleContext {
|
||||||
wizardService: WizardService
|
wizardService: WizardService
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<WizardPluginContext> = {
|
|
||||||
wizardService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function applyOverrides(params, initialOverrides) {
|
function applyOverrides(params, initialOverrides) {
|
||||||
Object.assign(params, initialOverrides);
|
Object.assign(params, initialOverrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const BundleName = "@Wizard";
|
||||||
|
|
@ -1,34 +1,29 @@
|
||||||
import {FACE, SHELL} from 'cad/model/entities';
|
import {FACE} from 'cad/model/entities';
|
||||||
import {OperationRequest} from "cad/craft/craftBundle";
|
import {OperationRequest} from "cad/craft/craftBundle";
|
||||||
import {ParamsPath, WizardService} from "cad/craft/wizard/wizardTypes";
|
import {ParamsPath, WizardService} from "cad/craft/wizard/wizardTypes";
|
||||||
import {OperationParamPrimitive} from "cad/craft/schema/schema";
|
import {OperationParamPrimitive} from "cad/craft/schema/schema";
|
||||||
import {EntityReference} from "cad/craft/operationBundle";
|
import {EntityReference} from "cad/craft/operationBundle";
|
||||||
import {Bundle} from "bundler/bundleSystem";
|
import {Bundle} from "bundler/bundleSystem";
|
||||||
import {MarkerPluginContext} from "cad/scene/selectionMarker/markerPlugin";
|
import {MarkerBundleContext} from "cad/scene/selectionMarker/markerBundle";
|
||||||
import {WizardPluginContext} from "cad/craft/wizard/wizardBundle";
|
import {WizardBundleContext} from "cad/craft/wizard/wizardBundle";
|
||||||
import {PickControlPluginContext} from "cad/scene/controls/pickControlPlugin";
|
import {PickControlBundleContext} from "cad/scene/controls/pickControlBundle";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import {MObject} from "cad/model/mobject";
|
import {MObject} from "cad/model/mobject";
|
||||||
|
|
||||||
export type WizardSelectionPluginInputContext = MarkerPluginContext & WizardPluginContext & PickControlPluginContext;
|
type WizardSelectionBundleActivationContext = MarkerBundleContext & WizardBundleContext & PickControlBundleContext;
|
||||||
|
|
||||||
export interface WizardSelectionPluginContext {
|
export interface WizardSelectionBundleContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WizardSelectionWorkingContext = WizardSelectionPluginInputContext & WizardSelectionPluginContext;
|
export type WizardSelectionBundleWorkingContext = WizardSelectionBundleActivationContext & WizardSelectionBundleContext;
|
||||||
|
|
||||||
export const WizardSelectionPlugin: Bundle<WizardSelectionPluginInputContext, WizardSelectionPluginContext, WizardSelectionWorkingContext> = {
|
export const WizardSelectionBundle: Bundle<WizardSelectionBundleWorkingContext> = {
|
||||||
|
|
||||||
inputContextSpec: {
|
activationDependencies: [
|
||||||
markerService: 'required',
|
'@Marker', '@Wizard', '@PickControl'
|
||||||
pickControlService: 'required',
|
],
|
||||||
wizardService: 'required'
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
activate(ctx: WizardSelectionBundleWorkingContext) {
|
||||||
},
|
|
||||||
|
|
||||||
activate(ctx: WizardSelectionWorkingContext) {
|
|
||||||
const wizardService = ctx.wizardService;
|
const wizardService = ctx.wizardService;
|
||||||
let wizardPickHandler = null;
|
let wizardPickHandler = null;
|
||||||
|
|
||||||
|
|
@ -70,6 +65,8 @@ export const WizardSelectionPlugin: Bundle<WizardSelectionPluginInputContext, Wi
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
BundleName: "@WizardSelection",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPickHandlerFromSchema(wizardService: WizardService) {
|
function createPickHandlerFromSchema(wizardService: WizardService) {
|
||||||
|
|
@ -10,6 +10,8 @@ import curveTess from 'geom/impl/curve/curve-tess';
|
||||||
import {LOG_FLAGS} from './logFlags';
|
import {LOG_FLAGS} from './logFlags';
|
||||||
import {state} from "lstream";
|
import {state} from "lstream";
|
||||||
|
|
||||||
|
export const BundleName = "@Debug";
|
||||||
|
|
||||||
const BREP_DEBUG_WINDOW_VISIBLE$ = state(false);
|
const BREP_DEBUG_WINDOW_VISIBLE$ = state(false);
|
||||||
|
|
||||||
export function activate(ctx) {
|
export function activate(ctx) {
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
export function activate() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import {state, StateStream} from "lstream";
|
import {state, StateStream} from "lstream";
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -83,6 +82,4 @@ export interface AppTabsBundleContext {
|
||||||
appTabsService: AppTabsService;
|
appTabsService: AppTabsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<AppTabsBundleContext> = {
|
export const BundleName = "@AppTabs";
|
||||||
appTabsService: 'required'
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ import ControlBar, {ControlBarButton} from './ControlBar';
|
||||||
import connect from 'ui/connect';
|
import connect from 'ui/connect';
|
||||||
import Fa from 'ui/components/Fa';
|
import Fa from 'ui/components/Fa';
|
||||||
import {toIdAndOverrides} from '../../actions/actionRef';
|
import {toIdAndOverrides} from '../../actions/actionRef';
|
||||||
import {isMenuAction} from '../menu/menuPlugin';
|
import {isMenuAction} from '../menu/menuBundle';
|
||||||
import {menuAboveElementHint} from '../menu/menuUtils';
|
import {menuAboveElementHint} from '../menu/menuUtils';
|
||||||
import {useStream} from "ui/effects";
|
import {useStream} from "ui/effects";
|
||||||
import {ActionButtonBehavior} from "../../actions/ActionButtonBehavior";
|
import {ActionButtonBehavior} from "../../actions/ActionButtonBehavior";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {contributeComponent} from './components/ContributedComponents';
|
import {contributeComponent} from './components/ContributedComponents';
|
||||||
import {Bundle} from "bundler/bundleSystem";
|
import {Bundle} from "bundler/bundleSystem";
|
||||||
import {AppTabsService} from "cad/dom/appTabsBundle";
|
import {AppTabsService} from "cad/dom/appTabsBundle";
|
||||||
|
import {LegacyStructureBundle, LegacyStructureBundleContext} from "cad/context/LegacyStructureBundle";
|
||||||
|
|
||||||
export interface DomService {
|
export interface DomService {
|
||||||
|
|
||||||
|
|
@ -12,29 +13,25 @@ export interface DomService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DomPluginInputContext {
|
interface DomBundleActivationContext extends LegacyStructureBundleContext {
|
||||||
appTabsService: AppTabsService;
|
appTabsService: AppTabsService;
|
||||||
services: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DomPluginContext {
|
export interface DomBundleContext {
|
||||||
domService: DomService;
|
domService: DomService;
|
||||||
}
|
}
|
||||||
|
|
||||||
type DomPluginWorkingContext = DomPluginInputContext&DomPluginContext;
|
type DomBundleWorkingContext = DomBundleActivationContext&DomBundleContext;
|
||||||
|
|
||||||
export const DomBundle: Bundle<DomPluginInputContext, DomPluginContext, DomPluginWorkingContext> = {
|
|
||||||
|
|
||||||
inputContextSpec: {
|
export const DomBundle: Bundle<DomBundleWorkingContext> = {
|
||||||
appTabsService: 'required',
|
|
||||||
services: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
activationDependencies: [
|
||||||
domService: 'required',
|
'@AppTabs',
|
||||||
},
|
LegacyStructureBundle.BundleName
|
||||||
|
],
|
||||||
|
|
||||||
activate(ctx: DomPluginInputContext&DomPluginContext) {
|
activate(ctx: DomBundleWorkingContext) {
|
||||||
ctx.domService = {
|
ctx.domService = {
|
||||||
viewerContainer: document.getElementById('viewer-container'),
|
viewerContainer: document.getElementById('viewer-container'),
|
||||||
contributeComponent,
|
contributeComponent,
|
||||||
|
|
@ -56,6 +53,8 @@ export const DomBundle: Bundle<DomPluginInputContext, DomPluginContext, DomPlugi
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
BundleName: "@Dom",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import {state} from 'lstream';
|
import {state} from 'lstream';
|
||||||
|
|
||||||
|
export const BundleName = "@Menu";
|
||||||
|
|
||||||
export function activate(ctx) {
|
export function activate(ctx) {
|
||||||
|
|
||||||
const {services, streams} = ctx;
|
const {services, streams} = ctx;
|
||||||
|
|
@ -76,7 +76,4 @@ export interface UIBundleContext {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<UIBundleContext> = {
|
export const BundleName = "@UI";
|
||||||
uiService: undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import {STLExporter} from './stl/stlExporter';
|
import {STLExporter} from './stl/stlExporter';
|
||||||
import exportTextData from 'gems/exportTextData';
|
import exportTextData from 'gems/exportTextData';
|
||||||
|
|
||||||
|
export const BundleName = "@Export";
|
||||||
|
|
||||||
export function activate(ctx) {
|
export function activate(ctx) {
|
||||||
|
|
||||||
function toStlAsciiString() {
|
function toStlAsciiString() {
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import exposure from './exposure';
|
import exposure from './exposure';
|
||||||
import {MBrepShell} from '../model/mshell';
|
import {MBrepShell} from '../model/mshell';
|
||||||
|
|
||||||
|
export const BundleName = "@Exposure";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* exposure stands for the Test Program Interface
|
* exposure stands for the Test Program Interface
|
||||||
*/
|
*/
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 {CoreContext} from "cad/context";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
|
export const BundleName = "@Expressions";
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: CoreContext) {
|
||||||
let _evaluateExpression: (string) => any = () => {};
|
let _evaluateExpression: (string) => any = () => {};
|
||||||
|
|
@ -120,9 +120,3 @@ export interface ExpressionBundleContext {
|
||||||
|
|
||||||
expressionService: ExpressionService;
|
expressionService: ExpressionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<ExpressionBundleContext> = {
|
|
||||||
expressionService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,3 +37,5 @@ export function activate(ctx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const BundleName = "@Lifecycle";
|
||||||
|
|
@ -1,141 +1,117 @@
|
||||||
import * as LifecyclePlugin from './lifecyclePlugin';
|
import * as LifecycleBundle from './lifecycleBundle';
|
||||||
import * as AppTabsPlugin from '../dom/appTabsBundle';
|
import * as AppTabsBundle from '../dom/appTabsBundle';
|
||||||
import {DomBundle} from '../dom/domBundle';
|
import {DomBundle} from '../dom/domBundle';
|
||||||
import * as PickControlPlugin from '../scene/controls/pickControlPlugin';
|
import * as PickControlBundle from '../scene/controls/pickControlBundle';
|
||||||
import * as MouseEventSystemPlugin from '../scene/controls/mouseEventSystemPlugin';
|
import * as MouseEventSystemBundle from '../scene/controls/mouseEventSystemBundle';
|
||||||
import * as ScenePlugin from '../scene/sceneBundle';
|
import * as SceneBundle from '../scene/sceneBundle';
|
||||||
import * as MarkerPlugin from '../scene/selectionMarker/markerPlugin';
|
import * as MarkerBundle from '../scene/selectionMarker/markerBundle';
|
||||||
import * as ActionSystemPlugin from '../actions/actionSystemBundle';
|
import * as ActionSystemBundle from '../actions/actionSystemBundle';
|
||||||
import * as UiPlugin from '../dom/uiBundle';
|
import * as UIBundle from '../dom/uiBundle';
|
||||||
import * as MenuPlugin from '../dom/menu/menuPlugin';
|
import * as MenuBundle from '../dom/menu/menuBundle';
|
||||||
import * as KeyboardPlugin from '../keyboard/keyboardPlugin';
|
import * as KeyboardBundle from '../keyboard/keyboardBundle';
|
||||||
import * as WizardPlugin from '../craft/wizard/wizardBundle';
|
import * as WizardBundle from '../craft/wizard/wizardBundle';
|
||||||
import {WizardSelectionPlugin} from '../craft/wizard/wizardSelectionPlugin';
|
import {WizardSelectionBundle} from '../craft/wizard/wizardSelectionBundle';
|
||||||
import * as PreviewPlugin from '../preview/previewPlugin';
|
import * as PreviewBundle from '../preview/previewBundle';
|
||||||
import * as OperationPlugin from '../craft/operationBundle';
|
import * as OperationBundle from '../craft/operationBundle';
|
||||||
import * as ExtensionsPlugin from '../craft/extensionsPlugin';
|
import * as ExtensionsBundle from '../craft/extensionsBundle';
|
||||||
import * as CadRegistryPlugin from '../craft/cadRegistryBundle';
|
import * as CadRegistryBundle from '../craft/cadRegistryBundle';
|
||||||
import * as CraftPlugin from '../craft/craftBundle';
|
import * as CraftBundle from '../craft/craftBundle';
|
||||||
import * as RemotePartsPlugin from '../partImport/remotePartsBundle';
|
import * as RemotePartsBundle from '../partImport/remotePartsBundle';
|
||||||
import * as CraftUiPlugin from '../craft/craftUiPlugin';
|
import * as CraftUIBundle from '../craft/craftUIBundle';
|
||||||
import * as StoragePlugin from '../storage/storageBundle';
|
import * as StorageBundle from '../storage/storageBundle';
|
||||||
import * as ProjectPlugin from '../projectBundle';
|
import * as ProjectBundle from '../projectBundle';
|
||||||
import * as ProjectManagerPlugin from '../projectManager/projectManagerBundle';
|
import * as ProjectManagerBundle from '../projectManager/projectManagerBundle';
|
||||||
import * as SketcherPlugin from '../sketch/sketcherBundle';
|
import * as SketcherBundle from '../sketch/sketcherBundle';
|
||||||
import * as SketcherStoragePlugin from '../sketch/sketchStorageBundle';
|
import * as SketcherStorageBundle from '../sketch/sketchStorageBundle';
|
||||||
import * as ExportPlugin from '../exportPlugin';
|
import * as ExportBundle from '../exportBundle';
|
||||||
import * as ExposurePlugin from '../exposure/exposurePlugin';
|
import * as ExposureBundle from '../exposure/exposureBundle';
|
||||||
import {ViewSyncPlugin} from '../scene/viewSyncPlugin';
|
import {ViewSyncBundle} from '../scene/viewSyncBundle';
|
||||||
import * as EntityContextPlugin from '../scene/entityContextBundle';
|
import * as EntityContextPlugin from '../scene/entityContextBundle';
|
||||||
import * as OCCTPlugin from '../craft/e0/occtBundle';
|
import * as OCCTBundle from '../craft/e0/occtBundle';
|
||||||
|
|
||||||
import context from 'cad/context';
|
|
||||||
|
|
||||||
import startReact from "../dom/startReact";
|
import startReact from "../dom/startReact";
|
||||||
import * as UIConfigPlugin from "../workbench/uiConfigPlugin";
|
import * as UIConfigBundle from "../workbench/uiConfigBundle";
|
||||||
import * as DebugPlugin from "../debugPlugin";
|
import * as DebugBundle from "../debugBundle";
|
||||||
import * as ExpressionsPlugin from "../expressions/expressionsBundle";
|
import * as ExpressionsBundle from "../expressions/expressionsBundle";
|
||||||
import {WorkbenchBundle} from "../workbench/workbenchBundle";
|
import {WorkbenchBundle} from "../workbench/workbenchBundle";
|
||||||
import * as LocationPlugin from "../location/LocationBundle";
|
import * as LocationBundle from "../location/LocationBundle";
|
||||||
import * as AssemblyPlugin from "../assembly/assemblyBundle";
|
import * as AssemblyBundle from "../assembly/assemblyBundle";
|
||||||
import {WorkbenchesLoaderPlugin} from "cad/workbench/workbenchesLoaderPlugin";
|
import {WorkbenchesLoaderBundle} from "cad/workbench/workbenchesLoaderBundle";
|
||||||
import {BundleSystem} from "bundler/bundleSystem";
|
|
||||||
import {AttributesBundle} from "cad/attributes/attributesBundle";
|
import {AttributesBundle} from "cad/attributes/attributesBundle";
|
||||||
import {HighlightBundle} from "cad/scene/highlightBundle";
|
import {HighlightBundle} from "cad/scene/highlightBundle";
|
||||||
|
import {LegacyStructureBundle} from "cad/context/LegacyStructureBundle";
|
||||||
|
import context from "cad/context";
|
||||||
|
import {BundleSystem} from "bundler/bundleSystem";
|
||||||
|
|
||||||
export default function startApplication(callback) {
|
export default function startApplication(callback) {
|
||||||
|
|
||||||
let preUIPlugins = [
|
let preUIBundles = [
|
||||||
LifecyclePlugin,
|
LifecycleBundle,
|
||||||
ProjectPlugin,
|
ProjectBundle,
|
||||||
StoragePlugin,
|
StorageBundle,
|
||||||
AppTabsPlugin,
|
AppTabsBundle,
|
||||||
ActionSystemPlugin,
|
ActionSystemBundle,
|
||||||
UiPlugin,
|
UIBundle,
|
||||||
MenuPlugin,
|
MenuBundle,
|
||||||
KeyboardPlugin,
|
KeyboardBundle,
|
||||||
ExpressionsPlugin,
|
ExpressionsBundle,
|
||||||
OperationPlugin,
|
OperationBundle,
|
||||||
CraftPlugin,
|
CraftBundle,
|
||||||
ExtensionsPlugin,
|
ExtensionsBundle,
|
||||||
SketcherStoragePlugin,
|
SketcherStorageBundle,
|
||||||
WizardPlugin,
|
WizardBundle,
|
||||||
PreviewPlugin,
|
PreviewBundle,
|
||||||
CraftUiPlugin,
|
CraftUIBundle,
|
||||||
CadRegistryPlugin,
|
CadRegistryBundle,
|
||||||
ExportPlugin,
|
ExportBundle,
|
||||||
ExposurePlugin,
|
ExposureBundle,
|
||||||
OCCTPlugin,
|
OCCTBundle,
|
||||||
ProjectManagerPlugin
|
ProjectManagerBundle
|
||||||
];
|
];
|
||||||
|
|
||||||
let plugins = [
|
let bundles = [
|
||||||
DomBundle,
|
DomBundle,
|
||||||
ScenePlugin,
|
SceneBundle,
|
||||||
MouseEventSystemPlugin,
|
MouseEventSystemBundle,
|
||||||
MarkerPlugin,
|
MarkerBundle,
|
||||||
PickControlPlugin,
|
PickControlBundle,
|
||||||
EntityContextPlugin,
|
EntityContextPlugin,
|
||||||
WorkbenchesLoaderPlugin,
|
WorkbenchesLoaderBundle,
|
||||||
WorkbenchBundle,
|
WorkbenchBundle,
|
||||||
SketcherPlugin,
|
SketcherBundle,
|
||||||
UIConfigPlugin,
|
UIConfigBundle,
|
||||||
DebugPlugin,
|
DebugBundle,
|
||||||
LocationPlugin,
|
LocationBundle,
|
||||||
AssemblyPlugin,
|
AssemblyBundle,
|
||||||
RemotePartsPlugin,
|
RemotePartsBundle,
|
||||||
ViewSyncPlugin,
|
ViewSyncBundle,
|
||||||
WizardSelectionPlugin,
|
WizardSelectionBundle,
|
||||||
AttributesBundle,
|
AttributesBundle,
|
||||||
HighlightBundle
|
HighlightBundle
|
||||||
];
|
];
|
||||||
|
|
||||||
let allPlugins = [...preUIPlugins, ...plugins];
|
const allBundle = [...preUIBundles, ...bundles];
|
||||||
const pluginSystem = new BundleSystem(context);
|
const bundleSystem = new BundleSystem(context);
|
||||||
context.pluginSystem = pluginSystem;
|
|
||||||
|
|
||||||
defineStreams(allPlugins, context);
|
bundleSystem.activate(LegacyStructureBundle);
|
||||||
|
allBundle.forEach(bundle => {
|
||||||
activatePlugins(preUIPlugins, pluginSystem);
|
if (bundle.defineStreams) {
|
||||||
|
bundle.defineStreams(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
preUIBundles.forEach(bundle => {
|
||||||
|
bundleSystem.activate(bundle);
|
||||||
|
});
|
||||||
|
|
||||||
startReact(context, () => {
|
startReact(context, () => {
|
||||||
activatePlugins(plugins, pluginSystem);
|
bundles.forEach(bundle => {
|
||||||
|
bundleSystem.activate(bundle);
|
||||||
|
});
|
||||||
context.services.lifecycle.declareAppReady();
|
context.services.lifecycle.declareAppReady();
|
||||||
context.services.viewer.render();
|
context.viewer.render();
|
||||||
callback(context);
|
callback(context);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
bundleSystem.checkDanglingBundles();
|
||||||
export function defineStreams(plugins, context) {
|
bundleSystem.checkPerfectLoad();
|
||||||
for (let plugin of plugins) {
|
|
||||||
if (plugin.defineStreams) {
|
|
||||||
plugin.defineStreams(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function adapter(oldStylePlugin) {
|
|
||||||
|
|
||||||
if (oldStylePlugin.inputContextSpec) {
|
|
||||||
return oldStylePlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
|
|
||||||
inputContextSpec: {},
|
|
||||||
|
|
||||||
outputContextSpec: {},
|
|
||||||
|
|
||||||
activate: oldStylePlugin.activate,
|
|
||||||
|
|
||||||
deactivate: ctx => {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export function activatePlugins(plugins, pluginSystem) {
|
|
||||||
for (let plugin of plugins) {
|
|
||||||
pluginSystem.load(adapter(plugin));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import Mousetrap from 'mousetrap';
|
import Mousetrap from 'mousetrap';
|
||||||
import DefaultKeymap from './keymaps/default';
|
import DefaultKeymap from './keymaps/default';
|
||||||
import {isMenuAction} from '../dom/menu/menuPlugin';
|
import {isMenuAction} from '../dom/menu/menuBundle';
|
||||||
import {state} from 'lstream';
|
import {state} from 'lstream';
|
||||||
|
|
||||||
|
export const BundleName = "@Keyboard";
|
||||||
|
|
||||||
export function activate(ctx) {
|
export function activate(ctx) {
|
||||||
|
|
||||||
const {services, streams} = ctx;
|
const {services, streams} = ctx;
|
||||||
|
|
@ -2,7 +2,6 @@ import {state, StateStream} from "lstream";
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {MShell} from "../model/mshell";
|
import {MShell} from "../model/mshell";
|
||||||
import {LocationDialog} from "./LocationDialog";
|
import {LocationDialog} from "./LocationDialog";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -41,7 +40,4 @@ export interface LocationBundleContext {
|
||||||
locationService: LocationService;
|
locationService: LocationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<LocationBundleContext> = {
|
export const BundleName = "@Location";
|
||||||
locationService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,22 +1,18 @@
|
||||||
import {ApplicationContext, CoreContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {Repository} from "../repository/repository";
|
import {Repository} from "../repository/repository";
|
||||||
import {IconType} from "react-icons";
|
import {IconType} from "react-icons";
|
||||||
import {Emitter, stream} from "lstream";
|
import {Emitter, stream} from "lstream";
|
||||||
import {ShowDialogRequest} from "ui/showDialogRequest";
|
import {ShowDialogRequest} from "ui/showDialogRequest";
|
||||||
import {CatalogPartChooser} from "./ui/CatalogPartChooser";
|
|
||||||
import {ImportPartOperation} from "./importPartOperation/importPartOperation";
|
|
||||||
import {MObject, MObjectIdGenerator} from "../model/mobject";
|
import {MObject, MObjectIdGenerator} from "../model/mobject";
|
||||||
import {WEB_CAD_ORG_PARTS_REPO, WEB_CAD_ORG_COMMONS_CATALOG} from "./remotePartsConfig";
|
|
||||||
import {indexById} from "gems/iterables";
|
import {indexById} from "gems/iterables";
|
||||||
import {ModelBundle} from "../projectManager/projectManagerBundle";
|
import {ModelBundle} from "../projectManager/projectManagerBundle";
|
||||||
import {PartRepository} from "./partRepository";
|
import {PartRepository} from "./partRepository";
|
||||||
import {initProjectService} from "../projectBundle";
|
import {initProjectService} from "../projectBundle";
|
||||||
import {activate as activateCraftPlugin} from '../craft/craftBundle';
|
import {activate as activateCraftBundle} from '../craft/craftBundle';
|
||||||
import {activate as activateExpressionsPlugin} from '../expressions/expressionsBundle';
|
import {activate as activateExpressionsBundle} from '../expressions/expressionsBundle';
|
||||||
import {activate as activateCadRegistryPlugin} from '../craft/cadRegistryBundle';
|
import {activate as activateCadRegistryBundle} from '../craft/cadRegistryBundle';
|
||||||
import {activate as activateStoragePlugin} from '../storage/storageBundle';
|
import {activate as activateStorageBundle} from '../storage/storageBundle';
|
||||||
import {activate as activateSketchStoragePlugin} from '../sketch/sketchStorageBundle';
|
import {activate as activateSketchStorageBundle} from '../sketch/sketchStorageBundle';
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -75,12 +71,12 @@ export function activate(ctx: ApplicationContext) {
|
||||||
};
|
};
|
||||||
|
|
||||||
initProjectService(evalContext, partRef, {});
|
initProjectService(evalContext, partRef, {});
|
||||||
activateStoragePlugin(evalContext);
|
activateStorageBundle(evalContext);
|
||||||
activateSketchStoragePlugin(evalContext);
|
activateSketchStorageBundle(evalContext);
|
||||||
activateExpressionsPlugin(evalContext);
|
activateExpressionsBundle(evalContext);
|
||||||
activateCraftPlugin(evalContext);
|
activateCraftBundle(evalContext);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
activateCadRegistryPlugin(evalContext);
|
activateCadRegistryBundle(evalContext);
|
||||||
// initProject(evalContext, partRef, {});
|
// initProject(evalContext, partRef, {});
|
||||||
|
|
||||||
evalContext.expressionService.load(projectModel.expressions);
|
evalContext.expressionService.load(projectModel.expressions);
|
||||||
|
|
@ -185,7 +181,5 @@ export interface RemotePartsBundleContext {
|
||||||
remotePartsService: RemotePartsService;
|
remotePartsService: RemotePartsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<RemotePartsBundleContext> = {
|
export const BundleName = "@RemoteParts";
|
||||||
remotePartsService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import * as DomPlugin from './dom/domBundle';
|
|
||||||
import * as PickControlPlugin from './scene/controls/pickControlPlugin';
|
|
||||||
import * as ScenePlugin from './scene/sceneBundle';
|
|
||||||
import * as SelectionMarkerPlugin from './scene/selectionMarker/markerPlugin';
|
|
||||||
|
|
||||||
export default [
|
|
||||||
DomPlugin,
|
|
||||||
ScenePlugin,
|
|
||||||
PickControlPlugin,
|
|
||||||
SelectionMarkerPlugin
|
|
||||||
]
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import {createPreviewer} from './scenePreviewer';
|
import {createPreviewer} from './scenePreviewer';
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
|
|
||||||
|
export const BundleName = "@Preview";
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
let previewer = null;
|
let previewer = null;
|
||||||
ctx.wizardService.materializedWorkingRequest$.attach(materializedWorkingRequest => {
|
ctx.wizardService.materializedWorkingRequest$.attach(materializedWorkingRequest => {
|
||||||
|
|
@ -5,7 +5,6 @@ import {ApplicationContext} from "cad/context";
|
||||||
import {ProjectModel} from "./projectManager/projectManagerBundle";
|
import {ProjectModel} from "./projectManager/projectManagerBundle";
|
||||||
import {DebugMode$} from "debugger/Debugger";
|
import {DebugMode$} from "debugger/Debugger";
|
||||||
import {fillUpMissingFields} from "cad/craft/schema/initializeBySchema";
|
import {fillUpMissingFields} from "cad/craft/schema/initializeBySchema";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export const STORAGE_GLOBAL_PREFIX = 'TCAD';
|
export const STORAGE_GLOBAL_PREFIX = 'TCAD';
|
||||||
export const PROJECTS_PREFIX = `${STORAGE_GLOBAL_PREFIX}.projects.`;
|
export const PROJECTS_PREFIX = `${STORAGE_GLOBAL_PREFIX}.projects.`;
|
||||||
|
|
@ -192,8 +191,5 @@ export interface ProjectBundleContext {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<ProjectBundleContext> = {
|
export const BundleName = "@Project";
|
||||||
projectService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import {SketchFormat_V3} from "sketcher/io";
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {OperationRequest} from "../craft/craftBundle";
|
import {OperationRequest} from "../craft/craftBundle";
|
||||||
import {AssemblyConstraintDefinition} from "cad/assembly/assemblyConstraint";
|
import {AssemblyConstraintDefinition} from "cad/assembly/assemblyConstraint";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -253,6 +252,4 @@ export interface ProjectManagerBundleContext {
|
||||||
projectManager: IProjectManager;
|
projectManager: IProjectManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<ProjectManagerBundleContext> = {
|
export const BundleName = "@ProjectManager";
|
||||||
projectManager: 'required'
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import {GitHubRepoRepository} from "./GitHubRepoRepository";
|
|
||||||
|
|
||||||
new GitHubRepoRepository('xibyte/jsketcher', 'master');
|
|
||||||
|
|
@ -2,6 +2,8 @@ import {printRaycastDebugInfo, RayCastDebugInfo} from "./rayCastDebug";
|
||||||
import {LOG_FLAGS} from "cad/logFlags";
|
import {LOG_FLAGS} from "cad/logFlags";
|
||||||
import {stream} from "lstream";
|
import {stream} from "lstream";
|
||||||
|
|
||||||
|
export const BundleName = "@MouseEventSystem";
|
||||||
|
|
||||||
const MouseStates = {
|
const MouseStates = {
|
||||||
IDLE: 'IDLE',
|
IDLE: 'IDLE',
|
||||||
DOWN: 'DOWN'
|
DOWN: 'DOWN'
|
||||||
|
|
@ -29,7 +29,7 @@ export interface PickControlService {
|
||||||
simulatePickFromRay()
|
simulatePickFromRay()
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PickControlPluginContext {
|
export interface PickControlBundleContext {
|
||||||
pickControlService: PickControlService;
|
pickControlService: PickControlService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,4 +339,6 @@ function printPickInfo(model, rayCastData?) {
|
||||||
console.log('POINT: ' + pt.x + ', ' + pt.y + ',' + pt.z);
|
console.log('POINT: ' + pt.x + ', ' + pt.y + ',' + pt.z);
|
||||||
printRaycastDebugInfo('selection', rayCastData);
|
printRaycastDebugInfo('selection', rayCastData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const BundleName = "@PickControl";
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import {combine, state, StateStream, Stream} from 'lstream';
|
import {combine, state, StateStream} from 'lstream';
|
||||||
|
|
||||||
import {addToListInMap, EMPTY_ARRAY} from 'gems/iterables';
|
import {addToListInMap, EMPTY_ARRAY} from 'gems/iterables';
|
||||||
import {DATUM, EDGE, FACE, LOOP, SHELL, SKETCH_OBJECT} from '../model/entities';
|
import {DATUM, EDGE, FACE, LOOP, SHELL, SKETCH_OBJECT} from '../model/entities';
|
||||||
import {MObject} from "cad/model/mobject";
|
import {MObject} from "cad/model/mobject";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export const SELECTABLE_ENTITIES = [FACE, EDGE, SKETCH_OBJECT, DATUM, SHELL];
|
export const SELECTABLE_ENTITIES = [FACE, EDGE, SKETCH_OBJECT, DATUM, SHELL];
|
||||||
|
|
||||||
|
|
@ -72,6 +71,4 @@ export interface EntityContextBundleContext {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<EntityContextBundleContext> = {
|
export const BundleName = "@EntityContext";
|
||||||
entityContextService: 'required'
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import {Bundle} from "bundler/bundleSystem";
|
import {Bundle} from "bundler/bundleSystem";
|
||||||
import {combine, merge, Stream, stream} from "lstream";
|
import {combine, merge, Stream, stream} from "lstream";
|
||||||
import Viewer from "cad/scene/viewer";
|
import Viewer from "cad/scene/viewer";
|
||||||
import {ScanStream} from "lstream/scan";
|
|
||||||
|
|
||||||
export class HighlightService {
|
export class HighlightService {
|
||||||
|
|
||||||
|
|
@ -43,30 +42,23 @@ export class HighlightService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HighlightPluginInputContext {
|
interface HighlightBundleInputContext {
|
||||||
viewer: Viewer;
|
viewer: Viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HighlightPluginContext {
|
export interface HighlightBundleContext {
|
||||||
highlightService: HighlightService;
|
highlightService: HighlightService;
|
||||||
}
|
}
|
||||||
|
|
||||||
type HighlightPluginWorkingContext = HighlightPluginInputContext&HighlightPluginContext;
|
type HighlightBundleWorkingContext = HighlightBundleInputContext&HighlightBundleContext;
|
||||||
|
|
||||||
export const HighlightBundle: Bundle<HighlightPluginInputContext, HighlightPluginContext, HighlightPluginWorkingContext> = {
|
export const HighlightBundle: Bundle<HighlightBundleWorkingContext> = {
|
||||||
|
|
||||||
inputContextSpec: {
|
activate(ctx: HighlightBundleWorkingContext) {
|
||||||
viewer: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
|
||||||
highlightService: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
activate(ctx: HighlightPluginWorkingContext) {
|
|
||||||
ctx.highlightService = new HighlightService(ctx.viewer);
|
ctx.highlightService = new HighlightService(ctx.viewer);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
BundleName: "@Highlight",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import Viewer from './viewer';
|
import Viewer from './viewer';
|
||||||
import CadScene from './cadScene';
|
import CadScene from './cadScene';
|
||||||
import {externalState, stream} from 'lstream';
|
|
||||||
import {ApplicationContext} from "cad/context";
|
import {ApplicationContext} from "cad/context";
|
||||||
import {ContextSpec} from "bundler/bundleSystem";
|
|
||||||
|
|
||||||
export function activate(ctx: ApplicationContext) {
|
export function activate(ctx: ApplicationContext) {
|
||||||
const {services} = ctx;
|
const {services} = ctx;
|
||||||
|
|
@ -58,7 +56,4 @@ export interface SceneBundleContext {
|
||||||
viewer: Viewer;
|
viewer: Viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<SceneBundleContext> = {
|
export const BundleName = "@Scene";
|
||||||
cadScene: 'required',
|
|
||||||
viewer: 'required'
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,8 @@ import {OrderedMap} from 'gems/linkedMap';
|
||||||
import {eventStream, Stream} from 'lstream';
|
import {eventStream, Stream} from 'lstream';
|
||||||
import {MObject} from "cad/model/mobject";
|
import {MObject} from "cad/model/mobject";
|
||||||
|
|
||||||
|
export const BundleName = "@Marker";
|
||||||
|
|
||||||
export interface MarkerService {
|
export interface MarkerService {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
|
@ -24,7 +26,7 @@ export interface MarkerService {
|
||||||
$markedEntities: Stream<MObject>
|
$markedEntities: Stream<MObject>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarkerPluginContext {
|
export interface MarkerBundleContext {
|
||||||
markerService: MarkerService;
|
markerService: MarkerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7,16 +7,17 @@ import {MShell} from '../model/mshell';
|
||||||
import {MDatum} from '../model/mdatum';
|
import {MDatum} from '../model/mdatum';
|
||||||
import DatumView from './views/datumView';
|
import DatumView from './views/datumView';
|
||||||
import {View} from './views/view';
|
import {View} from './views/view';
|
||||||
|
import {HighlightBundle} from "cad/scene/highlightBundle";
|
||||||
|
import {AttributesBundle} from "cad/attributes/attributesBundle";
|
||||||
|
|
||||||
export const ViewSyncPlugin = {
|
export const ViewSyncBundle = {
|
||||||
|
|
||||||
inputContextSpec: {
|
BundleName: "@ViewSync",
|
||||||
highlightService: 'required',
|
|
||||||
attributesService: 'required',
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
activationDependencies: [
|
||||||
},
|
HighlightBundle.BundleName,
|
||||||
|
AttributesBundle.BundleName
|
||||||
|
],
|
||||||
|
|
||||||
activate(ctx) {
|
activate(ctx) {
|
||||||
let {streams} = ctx;
|
let {streams} = ctx;
|
||||||
|
|
@ -74,8 +74,5 @@ export interface SketchStorageBundleContext {
|
||||||
sketchStorageService: SketchStorageService;
|
sketchStorageService: SketchStorageService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<SketchStorageBundleContext> = {
|
export const BundleName = "@SketchStorage";
|
||||||
sketchStorageService: 'required'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,4 @@ export interface SketcherBundleContext {
|
||||||
sketcherService: SketcherService;
|
sketcherService: SketcherService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<SketcherBundleContext> = {
|
export const BundleName = "@Sketcher";
|
||||||
sketcherService: 'required'
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,4 @@ export interface StorageBundleContext {
|
||||||
storageService: StorageService;
|
storageService: StorageService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const outputContextSpec: ContextSpec<StorageBundleContext> = {
|
export const BundleName = "@Storage";
|
||||||
storageService: 'required'
|
|
||||||
}
|
|
||||||
|
|
@ -10,6 +10,8 @@ import {SelectionView} from "../dom/components/SelectionView";
|
||||||
import {GrSelect} from "react-icons/gr";
|
import {GrSelect} from "react-icons/gr";
|
||||||
import {Explorer} from "cad/dom/components/Explorer";
|
import {Explorer} from "cad/dom/components/Explorer";
|
||||||
|
|
||||||
|
export const BundleName = "@UIConfig";
|
||||||
|
|
||||||
export function activate(ctx) {
|
export function activate(ctx) {
|
||||||
const {services, streams} = ctx;
|
const {services, streams} = ctx;
|
||||||
streams.ui.controlBars.left.value = ['menu.file', 'menu.craft', 'menu.boolean', 'menu.primitives', 'menu.views', 'menu.viewModes', 'Donate', 'GitHub'];
|
streams.ui.controlBars.left.value = ['menu.file', 'menu.craft', 'menu.boolean', 'menu.primitives', 'menu.views', 'menu.viewModes', 'Donate', 'GitHub'];
|
||||||
|
|
@ -3,25 +3,12 @@ import {WorkbenchService} from "cad/workbench/workbenchService";
|
||||||
import {CurrentWorkbenchIcon} from "cad/workbench/CurrentWorkbenchIcon";
|
import {CurrentWorkbenchIcon} from "cad/workbench/CurrentWorkbenchIcon";
|
||||||
import {Bundle} from "bundler/bundleSystem";
|
import {Bundle} from "bundler/bundleSystem";
|
||||||
|
|
||||||
|
|
||||||
export interface WorkbenchBundleContext {
|
export interface WorkbenchBundleContext {
|
||||||
|
|
||||||
workbenchService: WorkbenchService;
|
workbenchService: WorkbenchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WorkbenchBundle: Bundle<ApplicationContext, WorkbenchBundleContext> = {
|
export const WorkbenchBundle: Bundle<ApplicationContext> = {
|
||||||
|
|
||||||
deactivate(ctx: ApplicationContext & WorkbenchBundleContext) {
|
|
||||||
},
|
|
||||||
|
|
||||||
inputContextSpec: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {
|
|
||||||
workbenchService: 'required'
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
activate(ctx: ApplicationContext) {
|
activate(ctx: ApplicationContext) {
|
||||||
|
|
||||||
|
|
@ -40,6 +27,8 @@ export const WorkbenchBundle: Bundle<ApplicationContext, WorkbenchBundleContext>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
BundleName: "@Workbench",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,29 +8,29 @@ import {Bundle} from "bundler/bundleSystem";
|
||||||
import {WorkbenchService} from "cad/workbench/workbenchService";
|
import {WorkbenchService} from "cad/workbench/workbenchService";
|
||||||
import {OperationService} from "cad/craft/operationBundle";
|
import {OperationService} from "cad/craft/operationBundle";
|
||||||
|
|
||||||
export interface WorkbenchesLoaderInputContext {
|
interface WorkbenchesLoaderActivationContext {
|
||||||
workbenchService: WorkbenchService,
|
workbenchService: WorkbenchService,
|
||||||
operationService: OperationService
|
operationService: OperationService
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WorkbenchesLoaderPlugin: Bundle<WorkbenchesLoaderInputContext, {}> = {
|
type WorkbenchesLoaderWorkingContext = WorkbenchesLoaderActivationContext;
|
||||||
|
|
||||||
inputContextSpec: {
|
export const WorkbenchesLoaderBundle: Bundle<WorkbenchesLoaderWorkingContext> = {
|
||||||
workbenchService: 'required',
|
|
||||||
operationService: 'required'
|
|
||||||
},
|
|
||||||
|
|
||||||
outputContextSpec: {},
|
activationDependencies: [
|
||||||
|
'@Workbench', '@Operation'
|
||||||
|
],
|
||||||
|
|
||||||
activate(ctx) {
|
activate(ctx: WorkbenchesLoaderWorkingContext) {
|
||||||
registerCoreOperations(ctx);
|
registerCoreOperations(ctx);
|
||||||
WorkbenchRegistry.forEach(wConfig => ctx.workbenchService.registerWorkbench(wConfig));
|
WorkbenchRegistry.forEach(wConfig => ctx.workbenchService.registerWorkbench(wConfig));
|
||||||
ctx.workbenchService.switchToDefaultWorkbench();
|
ctx.workbenchService.switchToDefaultWorkbench();
|
||||||
}
|
},
|
||||||
|
|
||||||
|
BundleName: "@WorkbenchesLoader",
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerCoreOperations(ctx: WorkbenchesLoaderInputContext) {
|
function registerCoreOperations(ctx: WorkbenchesLoaderActivationContext) {
|
||||||
|
|
||||||
ctx.operationService.registerOperations([
|
ctx.operationService.registerOperations([
|
||||||
planeOperation,
|
planeOperation,
|
||||||
Loading…
Reference in a new issue