@visactor/vrender-core 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,8 +19,8 @@ export declare function createContributionProvider<T>(serviceIdentifier: Service
19
19
  export declare function bindContributionProvider(bind: any, id: ServiceIdentifier): void;
20
20
  export declare function bindContributionProviderNoSingletonScope(bind: any, id: ServiceIdentifier): void;
21
21
  export declare class ContributionStore {
22
- static store: Map<ServiceIdentifier<any>, ContributionProviderCache<any>>;
23
- static getStore(id: ServiceIdentifier<any>): ContributionProviderCache<any>;
22
+ static store: Map<ServiceIdentifier<any>, Set<ContributionProviderCache<any>>>;
23
+ static getStore(id: ServiceIdentifier<any>): ContributionProviderCache<any> | undefined;
24
24
  static setStore(id: ServiceIdentifier<any>, cache: ContributionProviderCache<any>): void;
25
25
  static refreshAllContributions(): void;
26
26
  }
@@ -35,14 +35,18 @@ exports.bindContributionProviderNoSingletonScope = bindContributionProviderNoSin
35
35
 
36
36
  class ContributionStore {
37
37
  static getStore(id) {
38
- return this.store.get(id);
38
+ var _a;
39
+ return null === (_a = this.store.get(id)) || void 0 === _a ? void 0 : _a.values().next().value;
39
40
  }
40
41
  static setStore(id, cache) {
41
- this.store.set(id, cache);
42
+ let caches = this.store.get(id);
43
+ caches || (caches = new Set, this.store.set(id, caches)), caches.add(cache);
42
44
  }
43
45
  static refreshAllContributions() {
44
- this.store.forEach((cache => {
45
- cache.refresh();
46
+ this.store.forEach((caches => {
47
+ caches.forEach((cache => {
48
+ cache.refresh();
49
+ }));
46
50
  }));
47
51
  }
48
52
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/contribution-provider.ts"],"names":[],"mappings":";;;AAGa,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEnE,MAAM,yBAAyB;IAK7B,YACE,iBAAuC,EACvC,SAA+F;QAE/F,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;Q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CAAC;AACzB,CAAC;AALD,4DAKC;AAED,SAAgB,wCAAwC,CAAC,IAAS,EAAE,EAAqB;IACvF,IAAI,CAAC,4BAAoB,CAAC;SACvB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAuC,EAAE,EAAE,CAAC,0BAA0B,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;SACjH,eAAe,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAJD,4FAIC;AAED,MAAa,iBAAiB;IAG5B,MAAM,CAAC,QAAQ,CAAC,EAA0B;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,EAA0B,EAAE,KAAqC;QAC/E,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,uBAAuB;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;;AAfH,8CAgBC;AAfQ,uBAAK,GAAgE,IAAI,GAAG,EAAE,CAAC","file":"contribution-provider.js","sourcesContent":["import type { IBindingResolver, ServiceIdentifier } from './explicit-binding';\nimport type { IContributionProvider } from '../interface';\n\nexport const ContributionProvider = Symbol('ContributionProvider');\n\nclass ContributionProviderCache<T> implements IContributionProvider<T> {\n protected caches?: T[];\n protected serviceIdentifier: ServiceIdentifier<T>;\n protected container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean };\n\n constructor(\n serviceIdentifier: ServiceIdentifier<T>,\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean }\n ) {\n this.serviceIdentifier = serviceIdentifier;\n this.container = container;\n ContributionStore.setStore(this.serviceIdentifier, this);\n }\n\n getContributions(): T[] {\n if (!this.caches) {\n this.caches = [];\n this.container &&\n this.container.isBound(this.serviceIdentifier) &&\n this.caches.push(...this.container.getAll(this.serviceIdentifier));\n }\n return this.caches;\n }\n\n refresh() {\n if (!this.caches) {\n return;\n }\n this.caches.length = 0;\n this.container &&\n this.container.isBound(this.serviceIdentifier) &&\n this.caches.push(...this.container.getAll(this.serviceIdentifier));\n }\n}\n\ntype IContributionProviderFactoryContext = {\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier) => boolean };\n};\n\nexport function createContributionProvider<T>(\n serviceIdentifier: ServiceIdentifier<T>,\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean }\n): IContributionProvider<T> {\n return new ContributionProviderCache(serviceIdentifier, container);\n}\n\nexport function bindContributionProvider(bind: any, id: ServiceIdentifier): void {\n bind(ContributionProvider)\n .toDynamicValue(({ container }: IContributionProviderFactoryContext) => createContributionProvider(id, container))\n .inSingletonScope()\n .whenTargetNamed(id);\n}\n\nexport function bindContributionProviderNoSingletonScope(bind: any, id: ServiceIdentifier): void {\n bind(ContributionProvider)\n .toDynamicValue(({ container }: IContributionProviderFactoryContext) => createContributionProvider(id, container))\n .whenTargetNamed(id);\n}\n\nexport class ContributionStore {\n static store: Map<ServiceIdentifier<any>, ContributionProviderCache<any>> = new Map();\n\n static getStore(id: ServiceIdentifier<any>): ContributionProviderCache<any> {\n return this.store.get(id);\n }\n\n static setStore(id: ServiceIdentifier<any>, cache: ContributionProviderCache<any>): void {\n this.store.set(id, cache);\n }\n\n static refreshAllContributions(): void {\n this.store.forEach(cache => {\n cache.refresh();\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/common/contribution-provider.ts"],"names":[],"mappings":";;;AAGa,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEnE,MAAM,yBAAyB;IAK7B,YACE,iBAAuC,EACvC,SAA+F;QAE/F,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,S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ALD,4DAKC;AAED,SAAgB,wCAAwC,CAAC,IAAS,EAAE,EAAqB;IACvF,IAAI,CAAC,4BAAoB,CAAC;SACvB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAuC,EAAE,EAAE,CAAC,0BAA0B,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;SACjH,eAAe,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAJD,4FAIC;AAED,MAAa,iBAAiB;IAG5B,MAAM,CAAC,QAAQ,CAAC,EAA0B;;QACxC,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,0CAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,EAA0B,EAAE,KAAqC;QAC/E,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;YACnD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SAC5B;QACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,uBAAuB;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC1B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACrB,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;;AAtBH,8CAuBC;AAtBQ,uBAAK,GAAqE,IAAI,GAAG,EAAE,CAAC","file":"contribution-provider.js","sourcesContent":["import type { IBindingResolver, ServiceIdentifier } from './explicit-binding';\nimport type { IContributionProvider } from '../interface';\n\nexport const ContributionProvider = Symbol('ContributionProvider');\n\nclass ContributionProviderCache<T> implements IContributionProvider<T> {\n protected caches?: T[];\n protected serviceIdentifier: ServiceIdentifier<T>;\n protected container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean };\n\n constructor(\n serviceIdentifier: ServiceIdentifier<T>,\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean }\n ) {\n this.serviceIdentifier = serviceIdentifier;\n this.container = container;\n ContributionStore.setStore(this.serviceIdentifier, this);\n }\n\n getContributions(): T[] {\n if (!this.caches) {\n this.caches = [];\n this.container &&\n this.container.isBound(this.serviceIdentifier) &&\n this.caches.push(...this.container.getAll(this.serviceIdentifier));\n }\n return this.caches;\n }\n\n refresh() {\n if (!this.caches) {\n return;\n }\n this.caches.length = 0;\n this.container &&\n this.container.isBound(this.serviceIdentifier) &&\n this.caches.push(...this.container.getAll(this.serviceIdentifier));\n }\n}\n\ntype IContributionProviderFactoryContext = {\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier) => boolean };\n};\n\nexport function createContributionProvider<T>(\n serviceIdentifier: ServiceIdentifier<T>,\n container: IBindingResolver & { isBound: (serviceIdentifier: ServiceIdentifier<T>) => boolean }\n): IContributionProvider<T> {\n return new ContributionProviderCache(serviceIdentifier, container);\n}\n\nexport function bindContributionProvider(bind: any, id: ServiceIdentifier): void {\n bind(ContributionProvider)\n .toDynamicValue(({ container }: IContributionProviderFactoryContext) => createContributionProvider(id, container))\n .inSingletonScope()\n .whenTargetNamed(id);\n}\n\nexport function bindContributionProviderNoSingletonScope(bind: any, id: ServiceIdentifier): void {\n bind(ContributionProvider)\n .toDynamicValue(({ container }: IContributionProviderFactoryContext) => createContributionProvider(id, container))\n .whenTargetNamed(id);\n}\n\nexport class ContributionStore {\n static store: Map<ServiceIdentifier<any>, Set<ContributionProviderCache<any>>> = new Map();\n\n static getStore(id: ServiceIdentifier<any>): ContributionProviderCache<any> | undefined {\n return this.store.get(id)?.values().next().value;\n }\n\n static setStore(id: ServiceIdentifier<any>, cache: ContributionProviderCache<any>): void {\n let caches = this.store.get(id);\n if (!caches) {\n caches = new Set<ContributionProviderCache<any>>();\n this.store.set(id, caches);\n }\n caches.add(cache);\n }\n\n static refreshAllContributions(): void {\n this.store.forEach(caches => {\n caches.forEach(cache => {\n cache.refresh();\n });\n });\n }\n}\n"]}
@@ -2,6 +2,18 @@ import type { IGlobal, IGraphicPicker } from '../interface';
2
2
  import type { IApp } from './types';
3
3
  import type { ServiceIdentifier } from '../common/explicit-binding';
4
4
  import { type ILegacyBindingContext } from '../legacy/binding-context';
5
+ export type TRuntimeContributionModuleRegistry = (bind: ILegacyBindingContext['bind'], unbind: (serviceIdentifier: ServiceIdentifier) => void, isBound: ILegacyBindingContext['isBound'], rebind: ILegacyBindingContext['rebind']) => void;
6
+ export type TRuntimeContributionModule = ((context: ILegacyBindingContext) => void) | {
7
+ registry: TRuntimeContributionModuleRegistry;
8
+ };
9
+ export type TRuntimeContributionInstallTarget = 'graphic-renderer' | 'draw-contribution' | {
10
+ picker: ServiceIdentifier<IGraphicPicker>;
11
+ };
12
+ export interface IRuntimeContributionModuleInstallOptions {
13
+ app?: IApp;
14
+ legacy?: boolean;
15
+ targets?: TRuntimeContributionInstallTarget[];
16
+ }
5
17
  export declare function getRuntimeInstallerBindingContext(): ILegacyBindingContext;
6
18
  export declare function refreshRuntimeInstallerContributions(): void;
7
19
  export declare function getRuntimeInstallerGlobal(): IGlobal;
@@ -9,3 +21,4 @@ export declare function configureRuntimeApplicationForApp(app: IApp): void;
9
21
  export declare function installRuntimeGraphicRenderersToApp(app: IApp): void;
10
22
  export declare function installRuntimeDrawContributionsToApp(app: IApp): void;
11
23
  export declare function installRuntimePickersToApp<T extends IGraphicPicker>(app: IApp, serviceIdentifier: ServiceIdentifier<T>): void;
24
+ export declare function installRuntimeContributionModule(module: TRuntimeContributionModule, { app, legacy, targets }?: IRuntimeContributionModuleInstallOptions): void;
@@ -8,14 +8,14 @@ var __importDefault = this && this.__importDefault || function(mod) {
8
8
 
9
9
  Object.defineProperty(exports, "__esModule", {
10
10
  value: !0
11
- }), exports.installRuntimePickersToApp = exports.installRuntimeDrawContributionsToApp = exports.installRuntimeGraphicRenderersToApp = exports.configureRuntimeApplicationForApp = exports.getRuntimeInstallerGlobal = exports.refreshRuntimeInstallerContributions = exports.getRuntimeInstallerBindingContext = void 0;
11
+ }), exports.installRuntimeContributionModule = exports.installRuntimePickersToApp = exports.installRuntimeDrawContributionsToApp = exports.installRuntimeGraphicRenderersToApp = exports.configureRuntimeApplicationForApp = exports.getRuntimeInstallerGlobal = exports.refreshRuntimeInstallerContributions = exports.getRuntimeInstallerBindingContext = void 0;
12
12
 
13
- const application_1 = require("../application"), constants_1 = require("../canvas/constants"), contribution_provider_1 = require("../common/contribution-provider"), constants_2 = require("../constants"), modules_1 = __importDefault(require("../core/contributions/modules")), global_1 = require("../core/global"), window_1 = require("../core/window"), core_modules_1 = __importDefault(require("../core/core-modules")), graphic_module_1 = __importDefault(require("../graphic/graphic-service/graphic-module")), binding_context_1 = require("../legacy/binding-context"), pick_modules_1 = __importDefault(require("../picker/pick-modules")), constants_3 = require("../render/contributions/render/contributions/constants"), draw_interceptor_1 = require("../render/contributions/render/draw-interceptor"), incremental_area_render_1 = require("../render/contributions/render/incremental-area-render"), incremental_draw_contribution_1 = require("../render/contributions/render/incremental-draw-contribution"), incremental_line_render_1 = require("../render/contributions/render/incremental-line-render"), render_modules_1 = __importDefault(require("../render/render-modules")), symbol_1 = require("../render/contributions/render/symbol"), modules_2 = __importDefault(require("../render/contributions/modules")), constants_4 = require("../plugins/constants"), plugin_service_1 = require("../plugins/plugin-service"), runtimeInstallerContext = (0,
13
+ const application_1 = require("../application"), constants_1 = require("../canvas/constants"), contribution_provider_1 = require("../common/contribution-provider"), constants_2 = require("../constants"), modules_1 = __importDefault(require("../core/contributions/modules")), global_1 = require("../core/global"), window_1 = require("../core/window"), core_modules_1 = __importDefault(require("../core/core-modules")), graphic_module_1 = __importDefault(require("../graphic/graphic-service/graphic-module")), binding_context_1 = require("../legacy/binding-context"), bootstrap_1 = require("../legacy/bootstrap"), pick_modules_1 = __importDefault(require("../picker/pick-modules")), constants_3 = require("../render/contributions/render/contributions/constants"), draw_interceptor_1 = require("../render/contributions/render/draw-interceptor"), incremental_area_render_1 = require("../render/contributions/render/incremental-area-render"), incremental_draw_contribution_1 = require("../render/contributions/render/incremental-draw-contribution"), incremental_line_render_1 = require("../render/contributions/render/incremental-line-render"), render_modules_1 = __importDefault(require("../render/render-modules")), symbol_1 = require("../render/contributions/render/symbol"), modules_2 = __importDefault(require("../render/contributions/modules")), constants_4 = require("../plugins/constants"), plugin_service_1 = require("../plugins/plugin-service"), runtimeInstallerContext = (0,
14
14
  binding_context_1.createLegacyBindingContext)();
15
15
 
16
16
  let runtimeGlobal, runtimeInstallerPreloaded = !1;
17
17
 
18
- const RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer", RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker", runtimeEntryKeys = new WeakMap, runtimeDrawContributions = new WeakMap;
18
+ const RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer", RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker", runtimeEntryKeys = new WeakMap, runtimeDrawContributions = new WeakMap, loadedRuntimeContributionModules = new WeakMap, DEFAULT_RUNTIME_CONTRIBUTION_TARGETS = [ "graphic-renderer" ], noopUnbindRuntimeContributionService = () => {};
19
19
 
20
20
  function ensureRuntimeInstallerPreloaded() {
21
21
  runtimeInstallerPreloaded || (runtimeInstallerPreloaded = !0, (0, core_modules_1.default)({
@@ -93,13 +93,13 @@ function installRuntimeGraphicRenderersToApp(app) {
93
93
  var _a;
94
94
  const bindingContext = getRuntimeInstallerBindingContext();
95
95
  refreshRuntimeInstallerContributions();
96
- const renderers = bindingContext.getAll(symbol_1.GraphicRender), registeredKeys = getTrackedEntryKeys(app.registry.renderer, "vrender:runtime-renderer");
97
- clearTrackedEntryKeys(app.registry.renderer, "vrender:runtime-renderer", null === (_a = app.registry.renderer.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.renderer)),
96
+ const renderers = bindingContext.getAll(symbol_1.GraphicRender), registeredKeys = getTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE);
97
+ clearTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE, null === (_a = app.registry.renderer.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.renderer)),
98
98
  registerRuntimeEntries(((key, renderer) => {
99
99
  var _a;
100
100
  null === (_a = null == renderer ? void 0 : renderer.reInit) || void 0 === _a || _a.call(renderer),
101
101
  app.registry.renderer.register(key, renderer), registeredKeys.add(key);
102
- }), renderers, "vrender:runtime-renderer");
102
+ }), renderers, RUNTIME_RENDERER_NAMESPACE);
103
103
  }
104
104
 
105
105
  function installRuntimeDrawContributionsToApp(app) {
@@ -122,16 +122,59 @@ function installRuntimePickersToApp(app, serviceIdentifier) {
122
122
  var _a;
123
123
  const bindingContext = getRuntimeInstallerBindingContext();
124
124
  refreshRuntimeInstallerContributions();
125
- const pickers = bindingContext.getAll(serviceIdentifier), registeredKeys = getTrackedEntryKeys(app.registry.picker, "vrender:runtime-picker");
126
- clearTrackedEntryKeys(app.registry.picker, "vrender:runtime-picker", null === (_a = app.registry.picker.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.picker)),
125
+ const pickers = bindingContext.getAll(serviceIdentifier), registeredKeys = getTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE);
126
+ clearTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE, null === (_a = app.registry.picker.unregister) || void 0 === _a ? void 0 : _a.bind(app.registry.picker)),
127
127
  registerRuntimeEntries(((key, picker) => {
128
128
  app.registry.picker.register(key, picker), registeredKeys.add(key);
129
- }), pickers, "vrender:runtime-picker");
129
+ }), pickers, RUNTIME_PICKER_NAMESPACE);
130
+ }
131
+
132
+ function getRuntimeContributionModuleIdentity(module) {
133
+ return module;
134
+ }
135
+
136
+ function hasLoadedRuntimeContributionModule(context, module) {
137
+ var _a, _b;
138
+ return null !== (_b = null === (_a = loadedRuntimeContributionModules.get(context)) || void 0 === _a ? void 0 : _a.has(getRuntimeContributionModuleIdentity(module))) && void 0 !== _b && _b;
139
+ }
140
+
141
+ function markRuntimeContributionModuleLoaded(context, module) {
142
+ let modules = loadedRuntimeContributionModules.get(context);
143
+ modules || (modules = new WeakSet, loadedRuntimeContributionModules.set(context, modules)),
144
+ modules.add(getRuntimeContributionModuleIdentity(module));
145
+ }
146
+
147
+ function loadRuntimeContributionModuleToContext(context, module) {
148
+ hasLoadedRuntimeContributionModule(context, module) || ("function" == typeof module ? module(context) : module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind),
149
+ markRuntimeContributionModuleLoaded(context, module));
150
+ }
151
+
152
+ function isRuntimePickerTarget(target) {
153
+ return "object" == typeof target && null !== target && "picker" in target;
154
+ }
155
+
156
+ function installRuntimeContributionTargetsToApp(app, targets) {
157
+ const resolvedTargets = null != targets ? targets : DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;
158
+ let installGraphicRenderers = !1, installDrawContributions = !1;
159
+ const pickerTargets = new Set;
160
+ resolvedTargets.forEach((target => {
161
+ "graphic-renderer" === target ? installGraphicRenderers = !0 : "draw-contribution" === target ? installDrawContributions = !0 : isRuntimePickerTarget(target) && pickerTargets.add(target.picker);
162
+ })), installDrawContributions && installRuntimeDrawContributionsToApp(app), installGraphicRenderers && installRuntimeGraphicRenderersToApp(app),
163
+ pickerTargets.forEach((serviceIdentifier => {
164
+ installRuntimePickersToApp(app, serviceIdentifier);
165
+ }));
166
+ }
167
+
168
+ function installRuntimeContributionModule(module, {app: app, legacy: legacy = !0, targets: targets} = {}) {
169
+ loadRuntimeContributionModuleToContext(getRuntimeInstallerBindingContext(), module),
170
+ legacy && ((0, bootstrap_1.preLoadAllModule)(), loadRuntimeContributionModuleToContext((0,
171
+ bootstrap_1.getLegacyBindingContext)(), module)), refreshRuntimeInstallerContributions(),
172
+ app && installRuntimeContributionTargetsToApp(app, targets);
130
173
  }
131
174
 
132
175
  exports.getRuntimeInstallerBindingContext = getRuntimeInstallerBindingContext, exports.refreshRuntimeInstallerContributions = refreshRuntimeInstallerContributions,
133
176
  exports.getRuntimeInstallerGlobal = getRuntimeInstallerGlobal, exports.configureRuntimeApplicationForApp = configureRuntimeApplicationForApp,
134
177
  exports.installRuntimeGraphicRenderersToApp = installRuntimeGraphicRenderersToApp,
135
178
  exports.installRuntimeDrawContributionsToApp = installRuntimeDrawContributionsToApp,
136
- exports.installRuntimePickersToApp = installRuntimePickersToApp;
179
+ exports.installRuntimePickersToApp = installRuntimePickersToApp, exports.installRuntimeContributionModule = installRuntimeContributionModule;
137
180
  //# sourceMappingURL=runtime-installer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":";;;;;;AAUA,gDAA6C;AAC7C,mDAAsE;AACtE,2EAAgG;AAEhG,4CAA+C;AAC/C,4EAAqE;AACrE,2CAA+C;AAC/C,2CAA0E;AAC1E,wEAA8C;AAC9C,+FAAsE;AACtE,+DAAmG;AACnG,0EAAgD;AAChD,sFAAgG;AAChG,sFAAsF;AACtF,oGAA4G;AAC5G,gHAAkH;AAClH,oGAA4G;AAC5G,8EAAoD;AACpD,kEAAsE;AACtE,8EAAsE;AACtE,oDAAyD;AACzD,8DAAiE;AAEjE,MAAM,uBAAuB,GAAG,IAAA,4CAA0B,GAAE,CAAC;AAC7D,IAAI,yBAAyB,GAAG,KAAK,CAAC;AACtC,IAAI,aAAkC,CAAC;AACvC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAC9D,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAoC,CAAC;AACzE,MAAM,wBAAwB,GAAG,IAAI,OAAO,EAAiD,CAAC;AAE9F,SAAS,+BAA+B;IACtC,IAAI,yBAAyB,EAAE;QAC7B,OAAO;KAC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AAG,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,0CAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC1D,CAAC;IAEF,sBAAsB,CACpB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACd,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,EACD,OAAgB,EAChB,wBAAwB,CACzB,CAAC;AACJ,CAAC;AAvBD,gEAuBC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\nimport pickModule from '../picker/pick-modules';\nimport { AreaRenderContribution } from '../render/contributions/render/contributions/constants';\nimport { DrawItemInterceptor } from '../render/contributions/render/draw-interceptor';\nimport { DefaultIncrementalCanvasAreaRender } from '../render/contributions/render/incremental-area-render';\nimport { DefaultIncrementalDrawContribution } from '../render/contributions/render/incremental-draw-contribution';\nimport { DefaultIncrementalCanvasLineRender } from '../render/contributions/render/incremental-line-render';\nimport renderModule from '../render/render-modules';\nimport { GraphicRender } from '../render/contributions/render/symbol';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { AutoEnablePlugins } from '../plugins/constants';\nimport { DefaultPluginService } from '../plugins/plugin-service';\n\nconst runtimeInstallerContext = createLegacyBindingContext();\nlet runtimeInstallerPreloaded = false;\nlet runtimeGlobal: IGlobal | undefined;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = new WeakMap<object, Map<string, Set<string>>>();\nconst runtimeDrawContributions = new WeakMap<object, Set<IDrawItemInterceptorContribution>>();\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerPreloaded) {\n return;\n }\n\n runtimeInstallerPreloaded = true;\n coreModule({ bind: runtimeInstallerContext.bind });\n graphicModule({ bind: runtimeInstallerContext.bind });\n renderModule({ bind: runtimeInstallerContext.bind });\n pickModule({ bind: runtimeInstallerContext.bind, isBound: runtimeInstallerContext.isBound });\n loadBuiltinContributions(runtimeInstallerContext);\n loadRenderContributions(runtimeInstallerContext);\n}\n\nfunction resolveRuntimeNamed<T>(serviceIdentifier: ServiceIdentifier<T>, name: string): T {\n const bindingContext = getRuntimeInstallerBindingContext();\n const instance = bindingContext.getNamed(serviceIdentifier, name);\n\n if (instance == null) {\n throw new Error(`${String(serviceIdentifier)} is not configured for ${name}`);\n }\n\n return instance;\n}\n\nfunction registerRuntimeEntries<T extends { type?: string }>(\n register: (key: string, value: T) => void,\n entries: T[],\n prefix: string\n): void {\n entries.forEach((entry, index) => {\n const name = entry?.type ?? entry?.constructor?.name ?? `${prefix}-entry`;\n register(`${prefix}:${String(name)}:${index}`, entry);\n });\n}\n\nfunction getTrackedEntryKeys(registry: object, namespace: string): Set<string> {\n let namespaces = runtimeEntryKeys.get(registry);\n if (!namespaces) {\n namespaces = new Map();\n runtimeEntryKeys.set(registry, namespaces);\n }\n\n let keys = namespaces.get(namespace);\n if (!keys) {\n keys = new Set();\n namespaces.set(namespace, keys);\n }\n\n return keys;\n}\n\nfunction clearTrackedEntryKeys(registry: object, namespace: string, unregister?: (key: string) => void): void {\n const keys = getTrackedEntryKeys(registry, namespace);\n if (unregister) {\n keys.forEach(key => unregister(key));\n }\n keys.clear();\n}\n\nfunction createAppRegistryContributionProvider<T>(app: IApp, key: ServiceIdentifier<T>): IContributionProvider<T> {\n return {\n getContributions: () => app.context.registry.contribution.get(key as any) as T[]\n };\n}\n\nexport function getRuntimeInstallerBindingContext(): ILegacyBindingContext {\n ensureRuntimeInstallerPreloaded();\n return runtimeInstallerContext;\n}\n\nexport function refreshRuntimeInstallerContributions(): void {\n ContributionStore.refreshAllContributions();\n}\n\nexport function getRuntimeInstallerGlobal(): IGlobal {\n ensureRuntimeInstallerPreloaded();\n runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeGlobal;\n}\n\nexport function configureRuntimeApplicationForApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n const global = getRuntimeInstallerGlobal();\n\n application.global = global;\n application.canvasFactory = env => bindingContext.getNamed(CanvasFactory, env);\n application.context2dFactory = env => bindingContext.getNamed(Context2dFactory, env);\n application.windowHandlerFactory = env => resolveRuntimeNamed(WindowHandlerContribution, env);\n application.windowFactory = () =>\n new DefaultWindow(global, env => resolveRuntimeNamed(WindowHandlerContribution, env));\n application.pluginServiceFactory = () =>\n new DefaultPluginService(createContributionProvider<IPlugin>(AutoEnablePlugins, bindingContext), {\n pluginRegistry: app.context.registry.plugin as any\n });\n application.incrementalDrawContributionFactory = () =>\n new DefaultIncrementalDrawContribution(\n [],\n new DefaultIncrementalCanvasLineRender(),\n new DefaultIncrementalCanvasAreaRender(\n createContributionProvider<IAreaRenderContribution>(AreaRenderContribution, bindingContext)\n ),\n createAppRegistryContributionProvider<IDrawItemInterceptorContribution>(app, DrawItemInterceptor)\n );\n}\n\nexport function installRuntimeGraphicRenderersToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const renderers = bindingContext.getAll(GraphicRender);\n const registeredKeys = getTrackedEntryKeys(app.registry.renderer as object, RUNTIME_RENDERER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.renderer as object,\n RUNTIME_RENDERER_NAMESPACE,\n app.registry.renderer.unregister?.bind(app.registry.renderer)\n );\n\n registerRuntimeEntries(\n (key, renderer) => {\n renderer?.reInit?.();\n app.registry.renderer.register(key, renderer);\n registeredKeys.add(key);\n },\n renderers as any[],\n RUNTIME_RENDERER_NAMESPACE\n );\n}\n\nexport function installRuntimeDrawContributionsToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const contributions = bindingContext.getAll(DrawItemInterceptor) as IDrawItemInterceptorContribution[];\n const tracked =\n runtimeDrawContributions.get(app.context.registry.contribution as object) ??\n new Set<IDrawItemInterceptorContribution>();\n tracked.forEach(contribution => {\n app.context.registry.contribution.unregister?.(DrawItemInterceptor, contribution);\n });\n tracked.clear();\n runtimeDrawContributions.set(app.context.registry.contribution as object, tracked);\n const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));\n\n contributions.forEach(contribution => {\n if (!registered.has(contribution)) {\n app.context.registry.contribution.register(DrawItemInterceptor, contribution);\n registered.add(contribution);\n }\n tracked.add(contribution);\n });\n}\n\nexport function installRuntimePickersToApp<T extends IGraphicPicker>(\n app: IApp,\n serviceIdentifier: ServiceIdentifier<T>\n): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const pickers = bindingContext.getAll(serviceIdentifier);\n const registeredKeys = getTrackedEntryKeys(app.registry.picker as object, RUNTIME_PICKER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.picker as object,\n RUNTIME_PICKER_NAMESPACE,\n app.registry.picker.unregister?.bind(app.registry.picker)\n );\n\n registerRuntimeEntries(\n (key, picker) => {\n app.registry.picker.register(key, picker);\n registeredKeys.add(key);\n },\n pickers as any[],\n RUNTIME_PICKER_NAMESPACE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GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC;AAjBD,4EAiBC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\nimport { getLegacyBindingContext, preLoadAllModule } from '../legacy/bootstrap';\nimport pickModule from '../picker/pick-modules';\nimport { AreaRenderContribution } from '../render/contributions/render/contributions/constants';\nimport { DrawItemInterceptor } from '../render/contributions/render/draw-interceptor';\nimport { DefaultIncrementalCanvasAreaRender } from '../render/contributions/render/incremental-area-render';\nimport { DefaultIncrementalDrawContribution } from '../render/contributions/render/incremental-draw-contribution';\nimport { DefaultIncrementalCanvasLineRender } from '../render/contributions/render/incremental-line-render';\nimport renderModule from '../render/render-modules';\nimport { GraphicRender } from '../render/contributions/render/symbol';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { AutoEnablePlugins } from '../plugins/constants';\nimport { DefaultPluginService } from '../plugins/plugin-service';\n\nexport type TRuntimeContributionModuleRegistry = (\n bind: ILegacyBindingContext['bind'],\n unbind: (serviceIdentifier: ServiceIdentifier) => void,\n isBound: ILegacyBindingContext['isBound'],\n rebind: ILegacyBindingContext['rebind']\n) => void;\n\nexport type TRuntimeContributionModule =\n | ((context: ILegacyBindingContext) => void)\n | {\n registry: TRuntimeContributionModuleRegistry;\n };\n\nexport type TRuntimeContributionInstallTarget =\n | 'graphic-renderer'\n | 'draw-contribution'\n | {\n picker: ServiceIdentifier<IGraphicPicker>;\n };\n\nexport interface IRuntimeContributionModuleInstallOptions {\n app?: IApp;\n legacy?: boolean;\n targets?: TRuntimeContributionInstallTarget[];\n}\n\nconst runtimeInstallerContext = createLegacyBindingContext();\nlet runtimeInstallerPreloaded = false;\nlet runtimeGlobal: IGlobal | undefined;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = new WeakMap<object, Map<string, Set<string>>>();\nconst runtimeDrawContributions = new WeakMap<object, Set<IDrawItemInterceptorContribution>>();\nconst loadedRuntimeContributionModules = new WeakMap<object, WeakSet<object>>();\nconst DEFAULT_RUNTIME_CONTRIBUTION_TARGETS: TRuntimeContributionInstallTarget[] = ['graphic-renderer'];\nconst noopUnbindRuntimeContributionService = (): void => undefined;\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerPreloaded) {\n return;\n }\n\n runtimeInstallerPreloaded = true;\n coreModule({ bind: runtimeInstallerContext.bind });\n graphicModule({ bind: runtimeInstallerContext.bind });\n renderModule({ bind: runtimeInstallerContext.bind });\n pickModule({ bind: runtimeInstallerContext.bind, isBound: runtimeInstallerContext.isBound });\n loadBuiltinContributions(runtimeInstallerContext);\n loadRenderContributions(runtimeInstallerContext);\n}\n\nfunction resolveRuntimeNamed<T>(serviceIdentifier: ServiceIdentifier<T>, name: string): T {\n const bindingContext = getRuntimeInstallerBindingContext();\n const instance = bindingContext.getNamed(serviceIdentifier, name);\n\n if (instance == null) {\n throw new Error(`${String(serviceIdentifier)} is not configured for ${name}`);\n }\n\n return instance;\n}\n\nfunction registerRuntimeEntries<T extends { type?: string }>(\n register: (key: string, value: T) => void,\n entries: T[],\n prefix: string\n): void {\n entries.forEach((entry, index) => {\n const name = entry?.type ?? entry?.constructor?.name ?? `${prefix}-entry`;\n register(`${prefix}:${String(name)}:${index}`, entry);\n });\n}\n\nfunction getTrackedEntryKeys(registry: object, namespace: string): Set<string> {\n let namespaces = runtimeEntryKeys.get(registry);\n if (!namespaces) {\n namespaces = new Map();\n runtimeEntryKeys.set(registry, namespaces);\n }\n\n let keys = namespaces.get(namespace);\n if (!keys) {\n keys = new Set();\n namespaces.set(namespace, keys);\n }\n\n return keys;\n}\n\nfunction clearTrackedEntryKeys(registry: object, namespace: string, unregister?: (key: string) => void): void {\n const keys = getTrackedEntryKeys(registry, namespace);\n if (unregister) {\n keys.forEach(key => unregister(key));\n }\n keys.clear();\n}\n\nfunction createAppRegistryContributionProvider<T>(app: IApp, key: ServiceIdentifier<T>): IContributionProvider<T> {\n return {\n getContributions: () => app.context.registry.contribution.get(key as any) as T[]\n };\n}\n\nexport function getRuntimeInstallerBindingContext(): ILegacyBindingContext {\n ensureRuntimeInstallerPreloaded();\n return runtimeInstallerContext;\n}\n\nexport function refreshRuntimeInstallerContributions(): void {\n ContributionStore.refreshAllContributions();\n}\n\nexport function getRuntimeInstallerGlobal(): IGlobal {\n ensureRuntimeInstallerPreloaded();\n runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeGlobal;\n}\n\nexport function configureRuntimeApplicationForApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n const global = getRuntimeInstallerGlobal();\n\n application.global = global;\n application.canvasFactory = env => bindingContext.getNamed(CanvasFactory, env);\n application.context2dFactory = env => bindingContext.getNamed(Context2dFactory, env);\n application.windowHandlerFactory = env => resolveRuntimeNamed(WindowHandlerContribution, env);\n application.windowFactory = () =>\n new DefaultWindow(global, env => resolveRuntimeNamed(WindowHandlerContribution, env));\n application.pluginServiceFactory = () =>\n new DefaultPluginService(createContributionProvider<IPlugin>(AutoEnablePlugins, bindingContext), {\n pluginRegistry: app.context.registry.plugin as any\n });\n application.incrementalDrawContributionFactory = () =>\n new DefaultIncrementalDrawContribution(\n [],\n new DefaultIncrementalCanvasLineRender(),\n new DefaultIncrementalCanvasAreaRender(\n createContributionProvider<IAreaRenderContribution>(AreaRenderContribution, bindingContext)\n ),\n createAppRegistryContributionProvider<IDrawItemInterceptorContribution>(app, DrawItemInterceptor)\n );\n}\n\nexport function installRuntimeGraphicRenderersToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const renderers = bindingContext.getAll(GraphicRender);\n const registeredKeys = getTrackedEntryKeys(app.registry.renderer as object, RUNTIME_RENDERER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.renderer as object,\n RUNTIME_RENDERER_NAMESPACE,\n app.registry.renderer.unregister?.bind(app.registry.renderer)\n );\n\n registerRuntimeEntries(\n (key, renderer) => {\n renderer?.reInit?.();\n app.registry.renderer.register(key, renderer);\n registeredKeys.add(key);\n },\n renderers as any[],\n RUNTIME_RENDERER_NAMESPACE\n );\n}\n\nexport function installRuntimeDrawContributionsToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const contributions = bindingContext.getAll(DrawItemInterceptor) as IDrawItemInterceptorContribution[];\n const tracked =\n runtimeDrawContributions.get(app.context.registry.contribution as object) ??\n new Set<IDrawItemInterceptorContribution>();\n tracked.forEach(contribution => {\n app.context.registry.contribution.unregister?.(DrawItemInterceptor, contribution);\n });\n tracked.clear();\n runtimeDrawContributions.set(app.context.registry.contribution as object, tracked);\n const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));\n\n contributions.forEach(contribution => {\n if (!registered.has(contribution)) {\n app.context.registry.contribution.register(DrawItemInterceptor, contribution);\n registered.add(contribution);\n }\n tracked.add(contribution);\n });\n}\n\nexport function installRuntimePickersToApp<T extends IGraphicPicker>(\n app: IApp,\n serviceIdentifier: ServiceIdentifier<T>\n): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const pickers = bindingContext.getAll(serviceIdentifier);\n const registeredKeys = getTrackedEntryKeys(app.registry.picker as object, RUNTIME_PICKER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.picker as object,\n RUNTIME_PICKER_NAMESPACE,\n app.registry.picker.unregister?.bind(app.registry.picker)\n );\n\n registerRuntimeEntries(\n (key, picker) => {\n app.registry.picker.register(key, picker);\n registeredKeys.add(key);\n },\n pickers as any[],\n RUNTIME_PICKER_NAMESPACE\n );\n}\n\nfunction getRuntimeContributionModuleIdentity(module: TRuntimeContributionModule): object {\n return module as object;\n}\n\nfunction hasLoadedRuntimeContributionModule(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): boolean {\n return loadedRuntimeContributionModules.get(context)?.has(getRuntimeContributionModuleIdentity(module)) ?? false;\n}\n\nfunction markRuntimeContributionModuleLoaded(context: ILegacyBindingContext, module: TRuntimeContributionModule): void {\n let modules = loadedRuntimeContributionModules.get(context);\n if (!modules) {\n modules = new WeakSet<object>();\n loadedRuntimeContributionModules.set(context, modules);\n }\n modules.add(getRuntimeContributionModuleIdentity(module));\n}\n\nfunction loadRuntimeContributionModuleToContext(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): void {\n if (hasLoadedRuntimeContributionModule(context, module)) {\n return;\n }\n\n if (typeof module === 'function') {\n module(context);\n } else {\n module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind);\n }\n\n markRuntimeContributionModuleLoaded(context, module);\n}\n\nfunction isRuntimePickerTarget(\n target: TRuntimeContributionInstallTarget\n): target is { picker: ServiceIdentifier<IGraphicPicker> } {\n return typeof target === 'object' && target !== null && 'picker' in target;\n}\n\nfunction installRuntimeContributionTargetsToApp(\n app: IApp,\n targets: TRuntimeContributionInstallTarget[] | undefined\n): void {\n const resolvedTargets = targets ?? DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;\n let installGraphicRenderers = false;\n let installDrawContributions = false;\n const pickerTargets = new Set<ServiceIdentifier<IGraphicPicker>>();\n\n resolvedTargets.forEach(target => {\n if (target === 'graphic-renderer') {\n installGraphicRenderers = true;\n } else if (target === 'draw-contribution') {\n installDrawContributions = true;\n } else if (isRuntimePickerTarget(target)) {\n pickerTargets.add(target.picker);\n }\n });\n\n if (installDrawContributions) {\n installRuntimeDrawContributionsToApp(app);\n }\n if (installGraphicRenderers) {\n installRuntimeGraphicRenderersToApp(app);\n }\n pickerTargets.forEach(serviceIdentifier => {\n installRuntimePickersToApp(app, serviceIdentifier);\n });\n}\n\nexport function installRuntimeContributionModule(\n module: TRuntimeContributionModule,\n { app, legacy = true, targets }: IRuntimeContributionModuleInstallOptions = {}\n): void {\n const runtimeContext = getRuntimeInstallerBindingContext();\n loadRuntimeContributionModuleToContext(runtimeContext, module);\n\n if (legacy) {\n preLoadAllModule();\n loadRuntimeContributionModuleToContext(getLegacyBindingContext(), module);\n }\n\n refreshRuntimeInstallerContributions();\n\n if (app) {\n installRuntimeContributionTargetsToApp(app, targets);\n }\n}\n"]}
@@ -26,6 +26,7 @@ type ResolvedGraphicStateTransition<T> = {
26
26
  effectiveStates: string[];
27
27
  resolvedStateAttrs: Partial<T>;
28
28
  };
29
+ type ExcludedAttributeKeys = Record<string, true>;
29
30
  export declare const NOWORK_ANIMATE_ATTR: {
30
31
  strokeSeg: number;
31
32
  boundsPadding: number;
@@ -155,9 +156,9 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
155
156
  protected recomputeCurrentStatePatch(): void;
156
157
  protected buildStaticAttributeSnapshot(): Partial<T>;
157
158
  protected buildRemovedStateAnimationAttrs(targetStateAttrs: Partial<T>, previousResolvedStatePatch?: Partial<T>): Partial<T>;
158
- protected syncObjectToSnapshot(target: Record<string, any>, snapshot: Record<string, any>): AttributeDelta;
159
- protected _syncAttribute(): AttributeDelta;
160
- protected _syncFinalAttributeFromStaticTruth(): void;
159
+ protected syncObjectToSnapshot(target: Record<string, any>, snapshot: Record<string, any>, excludedKeys?: ExcludedAttributeKeys): AttributeDelta;
160
+ protected _syncAttribute(excludedKeys?: ExcludedAttributeKeys): AttributeDelta;
161
+ protected _syncFinalAttributeFromStaticTruth(excludedKeys?: ExcludedAttributeKeys): void;
161
162
  protected mergeAttributeDeltaCategory(category: UpdateCategory, key: string, prev: unknown, next: unknown): number;
162
163
  protected submitUpdateByCategory(category: UpdateCategory, forceUpdateTag?: boolean): void;
163
164
  protected submitUpdateByDelta(delta: AttributeDelta, forceUpdateTag?: boolean): void;
@@ -170,9 +171,10 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
170
171
  protected commitBaseAttributesByTouchedKeys(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
171
172
  protected commitBaseAttributeBySingleKey(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
172
173
  protected applyBaseAttributes(params: Partial<T>): void;
174
+ protected _commitAnimationStaticAttributes(params: Partial<T>, context?: ISetAttributeContext): void;
173
175
  applyAnimationTransientAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
174
176
  protected applyTransientAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
175
- protected _restoreAttributeFromStaticTruth(context?: ISetAttributeContext): void;
177
+ protected _restoreAttributeFromStaticTruth(context?: ISetAttributeContext, excludedKeys?: ExcludedAttributeKeys): void;
176
178
  protected collectStatePatchDeltaKeys(previousPatch?: Partial<T>, nextPatch?: Partial<T>): string[];
177
179
  protected getStaticTruthValueForStateKey(key: string, nextPatch?: Partial<T>): {
178
180
  hasValue: boolean;
@@ -250,9 +250,10 @@ class Graphic extends node_tree_1.Node {
250
250
  } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
251
251
  })), extraAttrs;
252
252
  }
253
- syncObjectToSnapshot(target, snapshot) {
253
+ syncObjectToSnapshot(target, snapshot, excludedKeys) {
254
254
  const delta = new Map;
255
255
  return new Set([ ...Object.keys(target), ...Object.keys(snapshot) ]).forEach((key => {
256
+ if (!0 === (null == excludedKeys ? void 0 : excludedKeys[key])) return;
256
257
  const hasNext = Object.prototype.hasOwnProperty.call(snapshot, key), previousValue = target[key];
257
258
  if (!hasNext) return void (Object.prototype.hasOwnProperty.call(target, key) && (delta.set(key, {
258
259
  prev: previousValue,
@@ -265,17 +266,17 @@ class Graphic extends node_tree_1.Node {
265
266
  }), target[key] = cloneAttributeValue(nextValue));
266
267
  })), delta;
267
268
  }
268
- _syncAttribute() {
269
+ _syncAttribute(excludedKeys) {
269
270
  this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
270
- const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot);
271
- return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1,
271
+ const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot, excludedKeys);
272
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !!excludedKeys,
272
273
  delta;
273
274
  }
274
- _syncFinalAttributeFromStaticTruth() {
275
+ _syncFinalAttributeFromStaticTruth(excludedKeys) {
275
276
  const target = this.finalAttribute;
276
277
  if (!target) return;
277
278
  const snapshot = this.buildStaticAttributeSnapshot();
278
- this.syncObjectToSnapshot(target, snapshot);
279
+ this.syncObjectToSnapshot(target, snapshot, excludedKeys);
279
280
  }
280
281
  mergeAttributeDeltaCategory(category, key, prev, next) {
281
282
  var _a;
@@ -346,6 +347,22 @@ class Graphic extends node_tree_1.Node {
346
347
  this.getBaseAttributesStorage()[key] = params[key];
347
348
  }
348
349
  }
350
+ _commitAnimationStaticAttributes(params, context) {
351
+ if (!params) return;
352
+ const source = params, baseAttributes = this.getBaseAttributesStorage(), target = this.attribute, delta = new Map;
353
+ let hasKeys = !1;
354
+ for (const key in source) {
355
+ if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
356
+ hasKeys = !0;
357
+ const previousValue = target[key], nextValue = source[key];
358
+ baseAttributes[key] = nextValue, target[key] = nextValue, areAttributeValuesEqual(previousValue, nextValue) || delta.set(key, {
359
+ prev: previousValue,
360
+ next: nextValue
361
+ });
362
+ }
363
+ hasKeys && (this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !0,
364
+ this.submitUpdateByDelta(delta), this.onAttributeUpdate(context));
365
+ }
349
366
  applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
350
367
  const source = params;
351
368
  let target, needsShapeAndBounds = forceUpdateTag;
@@ -367,9 +384,9 @@ class Graphic extends node_tree_1.Node {
367
384
  delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(),
368
385
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
369
386
  }
370
- _restoreAttributeFromStaticTruth(context) {
371
- this._syncFinalAttributeFromStaticTruth();
372
- const delta = this._syncAttribute();
387
+ _restoreAttributeFromStaticTruth(context, excludedKeys) {
388
+ this._syncFinalAttributeFromStaticTruth(excludedKeys);
389
+ const delta = this._syncAttribute(excludedKeys);
373
390
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
374
391
  }
375
392
  collectStatePatchDeltaKeys(previousPatch, nextPatch) {