@visactor/vrender-core 1.1.3-alpha.5 → 1.1.4-alpha.0

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.
Files changed (126) hide show
  1. package/cjs/allocator/bounds-allocate.js +1 -2
  2. package/cjs/allocator/canvas-allocate.js +2 -1
  3. package/cjs/application-state.d.ts +27 -0
  4. package/cjs/application-state.js +22 -0
  5. package/cjs/application-state.js.map +1 -0
  6. package/cjs/application.d.ts +2 -22
  7. package/cjs/application.js +24 -3
  8. package/cjs/application.js.map +1 -1
  9. package/cjs/common/bounds-context.js +1 -2
  10. package/cjs/common/contribution-provider.d.ts +2 -1
  11. package/cjs/common/contribution-provider.js +19 -2
  12. package/cjs/common/contribution-provider.js.map +1 -1
  13. package/cjs/common/contribution-store-state.d.ts +6 -0
  14. package/cjs/common/contribution-store-state.js +20 -0
  15. package/cjs/common/contribution-store-state.js.map +1 -0
  16. package/cjs/common/event-listener-manager.js +2 -1
  17. package/cjs/common/performance-raf.js +1 -2
  18. package/cjs/common/polygon.js +2 -2
  19. package/cjs/common/rect-utils.js +1 -1
  20. package/cjs/common/render-area.js +1 -1
  21. package/cjs/common/render-command-list.js +1 -1
  22. package/cjs/common/render-curve.js +1 -1
  23. package/cjs/common/render-utils.js +1 -1
  24. package/cjs/common/seg-context.js +1 -1
  25. package/cjs/core/camera.js +1 -1
  26. package/cjs/core/constants.js +1 -1
  27. package/cjs/core/core-modules.js +1 -1
  28. package/cjs/core/global.js +1 -1
  29. package/cjs/core/graphic-utils.js +2 -1
  30. package/cjs/core/index.js +1 -1
  31. package/cjs/core/layer-service.js +1 -1
  32. package/cjs/core/layer.js +1 -1
  33. package/cjs/core/light.js +1 -1
  34. package/cjs/core/stage.js +1 -1
  35. package/cjs/core/window.js +1 -1
  36. package/cjs/entries/runtime-installer-state.d.ts +12 -0
  37. package/cjs/entries/runtime-installer-state.js +27 -0
  38. package/cjs/entries/runtime-installer-state.js.map +1 -0
  39. package/cjs/entries/runtime-installer.d.ts +3 -1
  40. package/cjs/entries/runtime-installer.js +23 -13
  41. package/cjs/entries/runtime-installer.js.map +1 -1
  42. package/cjs/factory-state.d.ts +5 -0
  43. package/cjs/factory-state.js +19 -0
  44. package/cjs/factory-state.js.map +1 -0
  45. package/cjs/factory.d.ts +2 -0
  46. package/cjs/factory.js +18 -2
  47. package/cjs/factory.js.map +1 -1
  48. package/cjs/graphic/graphic-creator.d.ts +2 -29
  49. package/cjs/graphic/graphic-creator.js +24 -38
  50. package/cjs/graphic/graphic-creator.js.map +1 -1
  51. package/cjs/graphic/graphic-registry.d.ts +36 -0
  52. package/cjs/graphic/graphic-registry.js +65 -0
  53. package/cjs/graphic/graphic-registry.js.map +1 -0
  54. package/cjs/graphic/index.d.ts +2 -0
  55. package/cjs/graphic/index.js +29 -16
  56. package/cjs/graphic/index.js.map +1 -1
  57. package/cjs/legacy/bootstrap-state.d.ts +7 -0
  58. package/cjs/legacy/bootstrap-state.js +24 -0
  59. package/cjs/legacy/bootstrap-state.js.map +1 -0
  60. package/cjs/legacy/bootstrap.d.ts +3 -4
  61. package/cjs/legacy/bootstrap.js +20 -7
  62. package/cjs/legacy/bootstrap.js.map +1 -1
  63. package/dist/index.es.js +110 -22
  64. package/es/allocator/bounds-allocate.js +1 -2
  65. package/es/allocator/canvas-allocate.js +2 -1
  66. package/es/application-state.d.ts +27 -0
  67. package/es/application-state.js +17 -0
  68. package/es/application-state.js.map +1 -0
  69. package/es/application.d.ts +2 -22
  70. package/es/application.js +2 -3
  71. package/es/application.js.map +1 -1
  72. package/es/common/bounds-context.js +1 -2
  73. package/es/common/contribution-provider.d.ts +2 -1
  74. package/es/common/contribution-provider.js +5 -1
  75. package/es/common/contribution-provider.js.map +1 -1
  76. package/es/common/contribution-store-state.d.ts +6 -0
  77. package/es/common/contribution-store-state.js +14 -0
  78. package/es/common/contribution-store-state.js.map +1 -0
  79. package/es/common/event-listener-manager.js +2 -1
  80. package/es/common/performance-raf.js +1 -2
  81. package/es/common/polygon.js +1 -1
  82. package/es/common/rect-utils.js +1 -1
  83. package/es/common/render-area.js +1 -1
  84. package/es/common/render-command-list.js +1 -1
  85. package/es/common/render-curve.js +1 -1
  86. package/es/common/render-utils.js +1 -1
  87. package/es/common/seg-context.js +1 -1
  88. package/es/core/camera.js +1 -1
  89. package/es/core/constants.js +1 -1
  90. package/es/core/core-modules.js +1 -1
  91. package/es/core/global.js +1 -1
  92. package/es/core/graphic-utils.js +2 -1
  93. package/es/core/index.js +1 -1
  94. package/es/core/layer-service.js +1 -1
  95. package/es/core/layer.js +1 -1
  96. package/es/core/light.js +1 -1
  97. package/es/core/stage.js +1 -1
  98. package/es/core/window.js +1 -1
  99. package/es/entries/runtime-installer-state.d.ts +12 -0
  100. package/es/entries/runtime-installer-state.js +20 -0
  101. package/es/entries/runtime-installer-state.js.map +1 -0
  102. package/es/entries/runtime-installer.d.ts +3 -1
  103. package/es/entries/runtime-installer.js +8 -9
  104. package/es/entries/runtime-installer.js.map +1 -1
  105. package/es/factory-state.d.ts +5 -0
  106. package/es/factory-state.js +14 -0
  107. package/es/factory-state.js.map +1 -0
  108. package/es/factory.d.ts +2 -0
  109. package/es/factory.js +5 -1
  110. package/es/factory.js.map +1 -1
  111. package/es/graphic/graphic-creator.d.ts +2 -29
  112. package/es/graphic/graphic-creator.js +1 -41
  113. package/es/graphic/graphic-creator.js.map +1 -1
  114. package/es/graphic/graphic-registry.d.ts +36 -0
  115. package/es/graphic/graphic-registry.js +57 -0
  116. package/es/graphic/graphic-registry.js.map +1 -0
  117. package/es/graphic/index.d.ts +2 -0
  118. package/es/graphic/index.js +2 -0
  119. package/es/graphic/index.js.map +1 -1
  120. package/es/legacy/bootstrap-state.d.ts +7 -0
  121. package/es/legacy/bootstrap-state.js +17 -0
  122. package/es/legacy/bootstrap-state.js.map +1 -0
  123. package/es/legacy/bootstrap.d.ts +3 -4
  124. package/es/legacy/bootstrap.js +5 -5
  125. package/es/legacy/bootstrap.js.map +1 -1
  126. package/package.json +9 -1
@@ -91,4 +91,4 @@ export class ReflectSegContext extends SegContext {
91
91
  return super.clear();
92
92
  }
93
93
  }
94
- //# sourceMappingURL=seg-context.js.map
94
+ //# sourceMappingURL=seg-context.js.map
package/es/core/camera.js CHANGED
@@ -66,4 +66,4 @@ export class OrthoCamera {
66
66
  export const registerOrthoCamera = () => {
67
67
  Factory.registerPlugin("OrthoCamera", OrthoCamera);
68
68
  };
69
- //# sourceMappingURL=camera.js.map
69
+ //# sourceMappingURL=camera.js.map
@@ -9,4 +9,4 @@ export const StaticLayerHandlerContribution = Symbol.for("StaticLayerHandlerCont
9
9
  export const DynamicLayerHandlerContribution = Symbol.for("DynamicLayerHandlerContribution");
10
10
 
11
11
  export const VirtualLayerHandlerContribution = Symbol.for("VirtualLayerHandlerContribution");
12
- //# sourceMappingURL=constants.js.map
12
+ //# sourceMappingURL=constants.js.map
@@ -21,4 +21,4 @@ export function bindCoreModules({bind: bind}) {
21
21
  }
22
22
 
23
23
  export default bindCoreModules;
24
- //# sourceMappingURL=core-modules.js.map
24
+ //# sourceMappingURL=core-modules.js.map
package/es/core/global.js CHANGED
@@ -222,4 +222,4 @@ export class DefaultGlobal extends EventListenerManager {
222
222
  return this._env || this.setEnv("browser"), this.envContribution.copyToClipBoard(text);
223
223
  }
224
224
  }
225
- //# sourceMappingURL=global.js.map
225
+ //# sourceMappingURL=global.js.map
@@ -161,4 +161,5 @@ export class DefaultTransformUtil {
161
161
  simplifyMatrix(target) {
162
162
  return this;
163
163
  }
164
- }
164
+ }
165
+ //# sourceMappingURL=graphic-utils.js.map
package/es/core/index.js CHANGED
@@ -15,4 +15,4 @@ export * from "./layer-service";
15
15
  export * from "./constants";
16
16
 
17
17
  export * from "../interface/core";
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -76,4 +76,4 @@ export class DefaultLayerService {
76
76
  }
77
77
 
78
78
  DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0;
79
- //# sourceMappingURL=layer-service.js.map
79
+ //# sourceMappingURL=layer-service.js.map
package/es/core/layer.js CHANGED
@@ -112,4 +112,4 @@ export class Layer extends Group {
112
112
  }, params)), this.afterDrawCbs.forEach((c => c(this)));
113
113
  }
114
114
  }
115
- //# sourceMappingURL=layer.js.map
115
+ //# sourceMappingURL=layer.js.map
package/es/core/light.js CHANGED
@@ -23,4 +23,4 @@ export class DirectionalLight {
23
23
  export const registerDirectionalLight = () => {
24
24
  Factory.registerPlugin("DirectionalLight", DirectionalLight);
25
25
  };
26
- //# sourceMappingURL=light.js.map
26
+ //# sourceMappingURL=light.js.map
package/es/core/stage.js CHANGED
@@ -595,4 +595,4 @@ export class Stage extends Group {
595
595
  this.renderService.reInit(), this.pickerService.reInit();
596
596
  }
597
597
  }
598
- //# sourceMappingURL=stage.js.map
598
+ //# sourceMappingURL=stage.js.map
package/es/core/window.js CHANGED
@@ -150,4 +150,4 @@ export class DefaultWindow extends EventListenerManager {
150
150
  return this._handler.getTopLeft(baseWindow);
151
151
  }
152
152
  }
153
- //# sourceMappingURL=window.js.map
153
+ //# sourceMappingURL=window.js.map
@@ -0,0 +1,12 @@
1
+ import type { IGlobal, IDrawItemInterceptorContribution } from '../interface';
2
+ import { type ILegacyBindingContext } from '../legacy/binding-context';
3
+ export declare const RUNTIME_INSTALLER_STATE_SYMBOL: unique symbol;
4
+ export interface IRuntimeInstallerState {
5
+ runtimeInstallerContext: ILegacyBindingContext;
6
+ preloaded: boolean;
7
+ runtimeGlobal?: IGlobal;
8
+ runtimeEntryKeys: WeakMap<object, Map<string, Set<string>>>;
9
+ runtimeDrawContributions: WeakMap<object, Set<IDrawItemInterceptorContribution>>;
10
+ loadedRuntimeContributionModules: WeakMap<object, WeakSet<object>>;
11
+ }
12
+ export declare function getRuntimeInstallerState(): IRuntimeInstallerState;
@@ -0,0 +1,20 @@
1
+ import { createLegacyBindingContext } from "../legacy/binding-context";
2
+
3
+ export const RUNTIME_INSTALLER_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/runtime-installer-state");
4
+
5
+ function createRuntimeInstallerState() {
6
+ return {
7
+ runtimeInstallerContext: createLegacyBindingContext(),
8
+ preloaded: !1,
9
+ runtimeEntryKeys: new WeakMap,
10
+ runtimeDrawContributions: new WeakMap,
11
+ loadedRuntimeContributionModules: new WeakMap
12
+ };
13
+ }
14
+
15
+ export function getRuntimeInstallerState() {
16
+ const scope = globalThis;
17
+ return scope[RUNTIME_INSTALLER_STATE_SYMBOL] || (scope[RUNTIME_INSTALLER_STATE_SYMBOL] = createRuntimeInstallerState()),
18
+ scope[RUNTIME_INSTALLER_STATE_SYMBOL];
19
+ }
20
+ //# sourceMappingURL=runtime-installer-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/entries/runtime-installer-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAA8B,MAAM,2BAA2B,CAAC;AAEnG,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;AAW3G,SAAS,2BAA2B;IAClC,OAAO;QACL,uBAAuB,EAAE,0BAA0B,EAAE;QACrD,SAAS,EAAE,KAAK;QAChB,gBAAgB,EAAE,IAAI,OAAO,EAAoC;QACjE,wBAAwB,EAAE,IAAI,OAAO,EAAiD;QACtF,gCAAgC,EAAE,IAAI,OAAO,EAA2B;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,MAAM,KAAK,GAAG,UAA+F,CAAC;IAE9G,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QAC1C,KAAK,CAAC,8BAA8B,CAAC,GAAG,2BAA2B,EAAE,CAAC;KACvE;IAED,OAAO,KAAK,CAAC,8BAA8B,CAA2B,CAAC;AACzE,CAAC","file":"runtime-installer-state.js","sourcesContent":["import type { IGlobal, IDrawItemInterceptorContribution } from '../interface';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\n\nexport const RUNTIME_INSTALLER_STATE_SYMBOL = Symbol.for('@visactor/vrender-core/runtime-installer-state');\n\nexport interface IRuntimeInstallerState {\n runtimeInstallerContext: ILegacyBindingContext;\n preloaded: boolean;\n runtimeGlobal?: IGlobal;\n runtimeEntryKeys: WeakMap<object, Map<string, Set<string>>>;\n runtimeDrawContributions: WeakMap<object, Set<IDrawItemInterceptorContribution>>;\n loadedRuntimeContributionModules: WeakMap<object, WeakSet<object>>;\n}\n\nfunction createRuntimeInstallerState(): IRuntimeInstallerState {\n return {\n runtimeInstallerContext: createLegacyBindingContext(),\n preloaded: false,\n runtimeEntryKeys: new WeakMap<object, Map<string, Set<string>>>(),\n runtimeDrawContributions: new WeakMap<object, Set<IDrawItemInterceptorContribution>>(),\n loadedRuntimeContributionModules: new WeakMap<object, WeakSet<object>>()\n };\n}\n\nexport function getRuntimeInstallerState(): IRuntimeInstallerState {\n const scope = globalThis as typeof globalThis & { [RUNTIME_INSTALLER_STATE_SYMBOL]?: IRuntimeInstallerState };\n\n if (!scope[RUNTIME_INSTALLER_STATE_SYMBOL]) {\n scope[RUNTIME_INSTALLER_STATE_SYMBOL] = createRuntimeInstallerState();\n }\n\n return scope[RUNTIME_INSTALLER_STATE_SYMBOL] as IRuntimeInstallerState;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { IGlobal, IGraphicPicker } from '../interface';
2
2
  import type { IApp } from './types';
3
3
  import type { ServiceIdentifier } from '../common/explicit-binding';
4
- import { type ILegacyBindingContext } from '../legacy/binding-context';
4
+ import type { ILegacyBindingContext } from '../legacy/binding-context';
5
5
  export type TRuntimeContributionModuleRegistry = (bind: ILegacyBindingContext['bind'], unbind: (serviceIdentifier: ServiceIdentifier) => void, isBound: ILegacyBindingContext['isBound'], rebind: ILegacyBindingContext['rebind']) => void;
6
6
  export type TRuntimeContributionModule = ((context: ILegacyBindingContext) => void) | {
7
7
  registry: TRuntimeContributionModuleRegistry;
@@ -18,6 +18,8 @@ export declare function getRuntimeInstallerBindingContext(): ILegacyBindingConte
18
18
  export declare function refreshRuntimeInstallerContributions(): void;
19
19
  export declare function getRuntimeInstallerGlobal(): IGlobal;
20
20
  export declare function configureRuntimeApplicationForApp(app: IApp): void;
21
+ export { RUNTIME_INSTALLER_STATE_SYMBOL, getRuntimeInstallerState } from './runtime-installer-state';
22
+ export type { IRuntimeInstallerState } from './runtime-installer-state';
21
23
  export declare function installRuntimeGraphicRenderersToApp(app: IApp): void;
22
24
  export declare function installRuntimeDrawContributionsToApp(app: IApp): void;
23
25
  export declare function installRuntimePickersToApp<T extends IGraphicPicker>(app: IApp, serviceIdentifier: ServiceIdentifier<T>): void;
@@ -16,8 +16,6 @@ import coreModule from "../core/core-modules";
16
16
 
17
17
  import graphicModule from "../graphic/graphic-service/graphic-module";
18
18
 
19
- import { createLegacyBindingContext } from "../legacy/binding-context";
20
-
21
19
  import { getLegacyBindingContext, preLoadAllModule } from "../legacy/bootstrap";
22
20
 
23
21
  import pickModule from "../picker/pick-modules";
@@ -42,14 +40,12 @@ import { AutoEnablePlugins } from "../plugins/constants";
42
40
 
43
41
  import { DefaultPluginService } from "../plugins/plugin-service";
44
42
 
45
- const runtimeInstallerContext = createLegacyBindingContext();
46
-
47
- let runtimeGlobal, runtimeInstallerPreloaded = !1;
43
+ import { getRuntimeInstallerState } from "./runtime-installer-state";
48
44
 
49
- 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 = () => {};
45
+ const runtimeInstallerState = getRuntimeInstallerState(), runtimeInstallerContext = runtimeInstallerState.runtimeInstallerContext, RUNTIME_RENDERER_NAMESPACE = "vrender:runtime-renderer", RUNTIME_PICKER_NAMESPACE = "vrender:runtime-picker", runtimeEntryKeys = runtimeInstallerState.runtimeEntryKeys, runtimeDrawContributions = runtimeInstallerState.runtimeDrawContributions, loadedRuntimeContributionModules = runtimeInstallerState.loadedRuntimeContributionModules, DEFAULT_RUNTIME_CONTRIBUTION_TARGETS = [ "graphic-renderer" ], noopUnbindRuntimeContributionService = () => {};
50
46
 
51
47
  function ensureRuntimeInstallerPreloaded() {
52
- runtimeInstallerPreloaded || (runtimeInstallerPreloaded = !0, coreModule({
48
+ runtimeInstallerState.preloaded || (runtimeInstallerState.preloaded = !0, coreModule({
53
49
  bind: runtimeInstallerContext.bind
54
50
  }), graphicModule({
55
51
  bind: runtimeInstallerContext.bind
@@ -102,8 +98,9 @@ export function refreshRuntimeInstallerContributions() {
102
98
  }
103
99
 
104
100
  export function getRuntimeInstallerGlobal() {
105
- return ensureRuntimeInstallerPreloaded(), null != runtimeGlobal || (runtimeGlobal = new DefaultGlobal(createContributionProvider(EnvContribution, runtimeInstallerContext))),
106
- runtimeGlobal;
101
+ var _a;
102
+ return ensureRuntimeInstallerPreloaded(), null !== (_a = runtimeInstallerState.runtimeGlobal) && void 0 !== _a || (runtimeInstallerState.runtimeGlobal = new DefaultGlobal(createContributionProvider(EnvContribution, runtimeInstallerContext))),
103
+ runtimeInstallerState.runtimeGlobal;
107
104
  }
108
105
 
109
106
  export function configureRuntimeApplicationForApp(app) {
@@ -117,6 +114,8 @@ export function configureRuntimeApplicationForApp(app) {
117
114
  }), application.incrementalDrawContributionFactory = () => new DefaultIncrementalDrawContribution([], new DefaultIncrementalCanvasLineRender, new DefaultIncrementalCanvasAreaRender(createContributionProvider(AreaRenderContribution, bindingContext)), createAppRegistryContributionProvider(app, DrawItemInterceptor));
118
115
  }
119
116
 
117
+ export { RUNTIME_INSTALLER_STATE_SYMBOL, getRuntimeInstallerState } from "./runtime-installer-state";
118
+
120
119
  export function installRuntimeGraphicRenderersToApp(app) {
121
120
  var _a;
122
121
  const bindingContext = getRuntimeInstallerBindingContext();
@@ -1 +1 @@
1
- {"version":3,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,EAAE;QAC5B,oCAAoC,CAAC,GAAG,CAAC,CAAC;KAC3C;IACD,IAAI,uBAAuB,EAAE;QAC3B,mCAAmC,CAAC,GAAG,CAAC,CAAC;KAC1C;IACD,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACxC,0BAA0B,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,MAAkC,EAClC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,KAA+C,EAAE;IAE9E,MAAM,cAAc,GAAG,iCAAiC,EAAE,CAAC;IAC3D,sCAAsC,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAE/D,IAAI,MAAM,EAAE;QACV,gBAAgB,EAAE,CAAC;QACnB,sCAAsC,CAAC,uBAAuB,EAAE,EAAE,MAAM,CAAC,CAAC;KAC3E;IAED,oCAAoC,EAAE,CAAC;IAEvC,IAAI,GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC","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 installRuntimeContributionT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AAC;SACjC;aAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE;YACxC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,wBAAwB,EAAE;QAC5B,oCAAoC,CAAC,GAAG,CAAC,CAAC;KAC3C;IACD,IAAI,uBAAuB,EAAE;QAC3B,mCAAmC,CAAC,GAAG,CAAC,CAAC;KAC1C;IACD,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACxC,0BAA0B,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,MAAkC,EAClC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,KAA+C,EAAE;IAE9E,MAAM,cAAc,GAAG,iCAAiC,EAAE,CAAC;IAC3D,sCAAsC,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAE/D,IAAI,MAAM,EAAE;QACV,gBAAgB,EAAE,CAAC;QACnB,sCAAsC,CAAC,uBAAuB,EAAE,EAAE,MAAM,CAAC,CAAC;KAC3E;IAED,oCAAoC,EAAE,CAAC;IAEvC,IAAI,GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC","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 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';\nimport { getRuntimeInstallerState } from './runtime-installer-state';\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 runtimeInstallerState = getRuntimeInstallerState();\nconst runtimeInstallerContext = runtimeInstallerState.runtimeInstallerContext;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = runtimeInstallerState.runtimeEntryKeys;\nconst runtimeDrawContributions = runtimeInstallerState.runtimeDrawContributions;\nconst loadedRuntimeContributionModules = runtimeInstallerState.loadedRuntimeContributionModules;\nconst DEFAULT_RUNTIME_CONTRIBUTION_TARGETS: TRuntimeContributionInstallTarget[] = ['graphic-renderer'];\nconst noopUnbindRuntimeContributionService = (): void => undefined;\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerState.preloaded) {\n return;\n }\n\n runtimeInstallerState.preloaded = 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 runtimeInstallerState.runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeInstallerState.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 { RUNTIME_INSTALLER_STATE_SYMBOL, getRuntimeInstallerState } from './runtime-installer-state';\nexport type { IRuntimeInstallerState } from './runtime-installer-state';\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"]}
@@ -0,0 +1,5 @@
1
+ export declare const FACTORY_STATE_SYMBOL: unique symbol;
2
+ export interface IFactoryState {
3
+ pluginClasses: Record<string, any>;
4
+ }
5
+ export declare function getFactoryState(): IFactoryState;
@@ -0,0 +1,14 @@
1
+ export const FACTORY_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/factory-state");
2
+
3
+ function createFactoryState() {
4
+ return {
5
+ pluginClasses: {}
6
+ };
7
+ }
8
+
9
+ export function getFactoryState() {
10
+ const scope = globalThis;
11
+ return scope[FACTORY_STATE_SYMBOL] || (scope[FACTORY_STATE_SYMBOL] = createFactoryState()),
12
+ scope[FACTORY_STATE_SYMBOL];
13
+ }
14
+ //# sourceMappingURL=factory-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory-state.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAMvF,SAAS,kBAAkB;IACzB,OAAO;QACL,aAAa,EAAE,EAAE;KAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,UAA4E,CAAC;IAE3F,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE;QAChC,KAAK,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,EAAE,CAAC;KACpD;IAED,OAAO,KAAK,CAAC,oBAAoB,CAAkB,CAAC;AACtD,CAAC","file":"factory-state.js","sourcesContent":["export const FACTORY_STATE_SYMBOL = Symbol.for('@visactor/vrender-core/factory-state');\n\nexport interface IFactoryState {\n pluginClasses: Record<string, any>;\n}\n\nfunction createFactoryState(): IFactoryState {\n return {\n pluginClasses: {}\n };\n}\n\nexport function getFactoryState(): IFactoryState {\n const scope = globalThis as typeof globalThis & { [FACTORY_STATE_SYMBOL]?: IFactoryState };\n\n if (!scope[FACTORY_STATE_SYMBOL]) {\n scope[FACTORY_STATE_SYMBOL] = createFactoryState();\n }\n\n return scope[FACTORY_STATE_SYMBOL] as IFactoryState;\n}\n"]}
package/es/factory.d.ts CHANGED
@@ -3,4 +3,6 @@ export declare class Factory {
3
3
  static registerPlugin(pluginKey: string, pluginClass: any): void;
4
4
  static getPlugin(pluginKey: string): any;
5
5
  }
6
+ export { FACTORY_STATE_SYMBOL, getFactoryState } from './factory-state';
7
+ export type { IFactoryState } from './factory-state';
6
8
  export * from './factory/index';
package/es/factory.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { getFactoryState } from "./factory-state";
2
+
1
3
  export class Factory {
2
4
  static registerPlugin(pluginKey, pluginClass) {
3
5
  Factory._pluginClasses[pluginKey] = pluginClass;
@@ -7,7 +9,9 @@ export class Factory {
7
9
  }
8
10
  }
9
11
 
10
- Factory._pluginClasses = {};
12
+ Factory._pluginClasses = getFactoryState().pluginClasses;
13
+
14
+ export { FACTORY_STATE_SYMBOL, getFactoryState } from "./factory-state";
11
15
 
12
16
  export * from "./factory/index";
13
17
  //# sourceMappingURL=factory.js.map
package/es/factory.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,OAAO;IAGlB,MAAM,CAAC,cAAc,CAAC,SAAiB,EAAE,WAAgB;QACvD,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,SAAiB;QAChC,OAAO,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;;AARc,sBAAc,GAAwB,EAAE,CAAC;AAW1D,cAAc,iBAAiB,CAAC","file":"factory.js","sourcesContent":["export class Factory {\n private static _pluginClasses: Record<string, any> = {};\n\n static registerPlugin(pluginKey: string, pluginClass: any) {\n Factory._pluginClasses[pluginKey] = pluginClass;\n }\n\n static getPlugin(pluginKey: string) {\n return Factory._pluginClasses[pluginKey];\n }\n}\n\nexport * from './factory/index';\n"]}
1
+ {"version":3,"sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,OAAO,OAAO;IAGlB,MAAM,CAAC,cAAc,CAAC,SAAiB,EAAE,WAAgB;QACvD,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,SAAiB;QAChC,OAAO,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;;AARc,sBAAc,GAAG,eAAe,EAAE,CAAC,aAAa,CAAC;AAWlE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAExE,cAAc,iBAAiB,CAAC","file":"factory.js","sourcesContent":["import { getFactoryState } from './factory-state';\n\nexport class Factory {\n private static _pluginClasses = getFactoryState().pluginClasses;\n\n static registerPlugin(pluginKey: string, pluginClass: any) {\n Factory._pluginClasses[pluginKey] = pluginClass;\n }\n\n static getPlugin(pluginKey: string) {\n return Factory._pluginClasses[pluginKey];\n }\n}\n\nexport { FACTORY_STATE_SYMBOL, getFactoryState } from './factory-state';\nexport type { IFactoryState } from './factory-state';\nexport * from './factory/index';\n"]}
@@ -1,29 +1,2 @@
1
- import type { IArc, IArcGraphicAttribute, IArea, IAreaGraphicAttribute, ICircle, ICircleGraphicAttribute, IGroup, IGroupGraphicAttribute, IImage, IImageGraphicAttribute, ILine, ILineGraphicAttribute, IPath, IPathGraphicAttribute, IPolygon, IPolygonGraphicAttribute, IRect, IRect3d, IRect3dGraphicAttribute, IRectGraphicAttribute, IRichText, IRichTextGraphicAttribute, IShadowRoot, ISymbol, ISymbolGraphicAttribute, IText, ITextGraphicAttribute, IWrapTextGraphicAttribute } from '../interface';
2
- import type { IGraphic } from '../interface/graphic';
3
- export type IGraphicCreateCallback<TGraphic extends IGraphic = IGraphic, TAttributes = any> = (attributes: TAttributes) => TGraphic;
4
- declare class GraphicCreator {
5
- store: Map<string, IGraphicCreateCallback>;
6
- arc?: (attribute: IArcGraphicAttribute) => IArc;
7
- area?: (attribute: IAreaGraphicAttribute) => IArea;
8
- circle?: (attribute: ICircleGraphicAttribute) => ICircle;
9
- group?: (attribute: IGroupGraphicAttribute) => IGroup;
10
- image?: (attribute: IImageGraphicAttribute) => IImage;
11
- line?: (attribute: ILineGraphicAttribute) => ILine;
12
- path?: (attribute: IPathGraphicAttribute) => IPath;
13
- rect?: (attribute: IRectGraphicAttribute) => IRect;
14
- rect3d?: (attribute: IRect3dGraphicAttribute) => IRect3d;
15
- symbol?: (attribute: ISymbolGraphicAttribute) => ISymbol;
16
- text?: (attribute: ITextGraphicAttribute) => IText;
17
- richtext?: (attribute: IRichTextGraphicAttribute) => IRichText;
18
- polygon?: (attribute: IPolygonGraphicAttribute) => IPolygon;
19
- shadowRoot?: (attribute: IGroupGraphicAttribute) => IShadowRoot;
20
- wrapText?: (attribute: IWrapTextGraphicAttribute) => IText;
21
- constructor();
22
- registerStore(name: string, creator: IGraphicCreateCallback): void;
23
- RegisterGraphicCreator(name: string, creator: IGraphicCreateCallback): void;
24
- CreateGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic | null;
25
- }
26
- export declare const graphicCreator: GraphicCreator;
27
- export declare function registerGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, creator: IGraphicCreateCallback<TGraphic, TAttributes>): void;
28
- export declare function createGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic;
29
- export {};
1
+ export { createGraphic, GRAPHIC_REGISTRY_SYMBOL, graphicCreator, getGraphicRegistryState, registerGraphic } from './graphic-registry';
2
+ export type { IGraphicCreateCallback, IGraphicRegistryState } from './graphic-registry';
@@ -1,42 +1,2 @@
1
- import { GraphicFactory } from "../factory/graphic-factory";
2
-
3
- function createGraphicCtor(creator) {
4
- return class {
5
- constructor(attributes) {
6
- try {
7
- return new creator(attributes);
8
- } catch (error) {
9
- return creator(attributes);
10
- }
11
- }
12
- };
13
- }
14
-
15
- const sharedGraphicFactory = new GraphicFactory;
16
-
17
- class GraphicCreator {
18
- constructor() {
19
- this.store = new Map;
20
- }
21
- registerStore(name, creator) {
22
- this.store.set(name, creator), this[name] = creator;
23
- }
24
- RegisterGraphicCreator(name, creator) {
25
- registerGraphic(name, creator);
26
- }
27
- CreateGraphic(name, attributes) {
28
- return this.store.has(name) ? createGraphic(name, attributes) : null;
29
- }
30
- }
31
-
32
- export const graphicCreator = new GraphicCreator;
33
-
34
- export function registerGraphic(name, creator) {
35
- if (!name) throw new Error("Graphic registration requires a non-empty graphic type");
36
- graphicCreator.registerStore(name, creator), sharedGraphicFactory.register(name, createGraphicCtor(creator));
37
- }
38
-
39
- export function createGraphic(name, attributes) {
40
- return sharedGraphicFactory.create(name, attributes);
41
- }
1
+ export { createGraphic, GRAPHIC_REGISTRY_SYMBOL, graphicCreator, getGraphicRegistryState, registerGraphic } from "./graphic-registry";
42
2
  //# sourceMappingURL=graphic-creator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/graphic-creator.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAO5D,SAAS,iBAAiB,CACxB,OAAsD;IAEtD,OAAO,MAAM,qBAAqB;QAChC,YAAY,UAAuB;YACjC,IAAI;gBACF,OAAO,IAAK,OAAe,CAAC,U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C","file":"graphic-creator.js","sourcesContent":["import type {\n IArc,\n IArcGraphicAttribute,\n IArea,\n IAreaGraphicAttribute,\n ICircle,\n ICircleGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImage,\n IImageGraphicAttribute,\n ILine,\n ILineGraphicAttribute,\n IPath,\n IPathGraphicAttribute,\n IPolygon,\n IPolygonGraphicAttribute,\n IRect,\n IRect3d,\n IRect3dGraphicAttribute,\n IRectGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n IShadowRoot,\n ISymbol,\n ISymbolGraphicAttribute,\n IText,\n ITextGraphicAttribute,\n IWrapTextGraphicAttribute\n} from '../interface';\nimport { GraphicFactory } from '../factory/graphic-factory';\nimport type { IGraphic } from '../interface/graphic';\n\nexport type IGraphicCreateCallback<TGraphic extends IGraphic = IGraphic, TAttributes = any> = (\n attributes: TAttributes\n) => TGraphic;\n\nfunction createGraphicCtor<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n creator: IGraphicCreateCallback<TGraphic, TAttributes>\n) {\n return class RegisteredGraphicCtor {\n constructor(attributes: TAttributes) {\n try {\n return new (creator as any)(attributes);\n } catch (error) {\n return creator(attributes);\n }\n }\n } as any;\n}\n\nconst sharedGraphicFactory = new GraphicFactory();\n\nclass GraphicCreator {\n declare store: Map<string, IGraphicCreateCallback>;\n declare arc?: (attribute: IArcGraphicAttribute) => IArc;\n declare area?: (attribute: IAreaGraphicAttribute) => IArea;\n declare circle?: (attribute: ICircleGraphicAttribute) => ICircle;\n declare group?: (attribute: IGroupGraphicAttribute) => IGroup;\n declare image?: (attribute: IImageGraphicAttribute) => IImage;\n declare line?: (attribute: ILineGraphicAttribute) => ILine;\n declare path?: (attribute: IPathGraphicAttribute) => IPath;\n declare rect?: (attribute: IRectGraphicAttribute) => IRect;\n declare rect3d?: (attribute: IRect3dGraphicAttribute) => IRect3d;\n declare symbol?: (attribute: ISymbolGraphicAttribute) => ISymbol;\n declare text?: (attribute: ITextGraphicAttribute) => IText;\n declare richtext?: (attribute: IRichTextGraphicAttribute) => IRichText;\n declare polygon?: (attribute: IPolygonGraphicAttribute) => IPolygon;\n declare shadowRoot?: (attribute: IGroupGraphicAttribute) => IShadowRoot;\n declare wrapText?: (attribute: IWrapTextGraphicAttribute) => IText;\n\n constructor() {\n this.store = new Map();\n }\n\n registerStore(name: string, creator: IGraphicCreateCallback) {\n this.store.set(name, creator);\n (this as any)[name] = creator;\n }\n\n RegisterGraphicCreator(name: string, creator: IGraphicCreateCallback) {\n registerGraphic(name, creator);\n }\n\n CreateGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n attributes: TAttributes\n ): TGraphic | null {\n if (!this.store.has(name)) {\n return null;\n }\n\n return createGraphic<TGraphic, TAttributes>(name, attributes);\n }\n}\n\nexport const graphicCreator = new GraphicCreator();\n\nexport function registerGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n creator: IGraphicCreateCallback<TGraphic, TAttributes>\n) {\n if (!name) {\n throw new Error('Graphic registration requires a non-empty graphic type');\n }\n\n graphicCreator.registerStore(name, creator as IGraphicCreateCallback);\n sharedGraphicFactory.register(name, createGraphicCtor(creator));\n}\n\nexport function createGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n attributes: TAttributes\n): TGraphic {\n return sharedGraphicFactory.create<TGraphic, TAttributes>(name, attributes);\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/graphic-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,uBAAuB,EACvB,eAAe,EAChB,MAAM,oBAAoB,CAAC","file":"graphic-creator.js","sourcesContent":["export {\n createGraphic,\n GRAPHIC_REGISTRY_SYMBOL,\n graphicCreator,\n getGraphicRegistryState,\n registerGraphic\n} from './graphic-registry';\nexport type { IGraphicCreateCallback, IGraphicRegistryState } from './graphic-registry';\n"]}
@@ -0,0 +1,36 @@
1
+ import { GraphicFactory } from '../factory/graphic-factory';
2
+ import type { IArc, IArcGraphicAttribute, IArea, IAreaGraphicAttribute, ICircle, ICircleGraphicAttribute, IGroup, IGroupGraphicAttribute, IImage, IImageGraphicAttribute, ILine, ILineGraphicAttribute, IPath, IPathGraphicAttribute, IPolygon, IPolygonGraphicAttribute, IRect, IRect3d, IRect3dGraphicAttribute, IRectGraphicAttribute, IRichText, IRichTextGraphicAttribute, IShadowRoot, ISymbol, ISymbolGraphicAttribute, IText, ITextGraphicAttribute, IWrapTextGraphicAttribute } from '../interface';
3
+ import type { IGraphic } from '../interface/graphic';
4
+ export type IGraphicCreateCallback<TGraphic extends IGraphic = IGraphic, TAttributes = any> = (attributes: TAttributes) => TGraphic;
5
+ declare class GraphicCreator {
6
+ store: Map<string, IGraphicCreateCallback>;
7
+ arc?: (attribute: IArcGraphicAttribute) => IArc;
8
+ area?: (attribute: IAreaGraphicAttribute) => IArea;
9
+ circle?: (attribute: ICircleGraphicAttribute) => ICircle;
10
+ group?: (attribute: IGroupGraphicAttribute) => IGroup;
11
+ image?: (attribute: IImageGraphicAttribute) => IImage;
12
+ line?: (attribute: ILineGraphicAttribute) => ILine;
13
+ path?: (attribute: IPathGraphicAttribute) => IPath;
14
+ rect?: (attribute: IRectGraphicAttribute) => IRect;
15
+ rect3d?: (attribute: IRect3dGraphicAttribute) => IRect3d;
16
+ symbol?: (attribute: ISymbolGraphicAttribute) => ISymbol;
17
+ text?: (attribute: ITextGraphicAttribute) => IText;
18
+ richtext?: (attribute: IRichTextGraphicAttribute) => IRichText;
19
+ polygon?: (attribute: IPolygonGraphicAttribute) => IPolygon;
20
+ shadowRoot?: (attribute: IGroupGraphicAttribute) => IShadowRoot;
21
+ wrapText?: (attribute: IWrapTextGraphicAttribute) => IText;
22
+ constructor();
23
+ registerStore(name: string, creator: IGraphicCreateCallback): void;
24
+ RegisterGraphicCreator(name: string, creator: IGraphicCreateCallback): void;
25
+ CreateGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic | null;
26
+ }
27
+ export declare const GRAPHIC_REGISTRY_SYMBOL: unique symbol;
28
+ export interface IGraphicRegistryState {
29
+ graphicCreator: GraphicCreator;
30
+ graphicFactory: GraphicFactory;
31
+ }
32
+ export declare function getGraphicRegistryState(): IGraphicRegistryState;
33
+ export declare const graphicCreator: GraphicCreator;
34
+ export declare function registerGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, creator: IGraphicCreateCallback<TGraphic, TAttributes>): void;
35
+ export declare function createGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic;
36
+ export {};
@@ -0,0 +1,57 @@
1
+ import { GraphicFactory } from "../factory/graphic-factory";
2
+
3
+ function createGraphicCtor(creator) {
4
+ return class {
5
+ constructor(attributes) {
6
+ try {
7
+ return new creator(attributes);
8
+ } catch (error) {
9
+ return creator(attributes);
10
+ }
11
+ }
12
+ };
13
+ }
14
+
15
+ class GraphicCreator {
16
+ constructor() {
17
+ this.store = new Map;
18
+ }
19
+ registerStore(name, creator) {
20
+ this.store.set(name, creator), this[name] = creator;
21
+ }
22
+ RegisterGraphicCreator(name, creator) {
23
+ registerGraphic(name, creator);
24
+ }
25
+ CreateGraphic(name, attributes) {
26
+ return this.store.has(name) ? createGraphic(name, attributes) : null;
27
+ }
28
+ }
29
+
30
+ export const GRAPHIC_REGISTRY_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-registry");
31
+
32
+ function createGraphicRegistryState() {
33
+ return {
34
+ graphicCreator: new GraphicCreator,
35
+ graphicFactory: new GraphicFactory
36
+ };
37
+ }
38
+
39
+ export function getGraphicRegistryState() {
40
+ const scope = globalThis;
41
+ return scope[GRAPHIC_REGISTRY_SYMBOL] || (scope[GRAPHIC_REGISTRY_SYMBOL] = createGraphicRegistryState()),
42
+ scope[GRAPHIC_REGISTRY_SYMBOL];
43
+ }
44
+
45
+ const sharedGraphicRegistry = getGraphicRegistryState();
46
+
47
+ export const graphicCreator = sharedGraphicRegistry.graphicCreator;
48
+
49
+ export function registerGraphic(name, creator) {
50
+ if (!name) throw new Error("Graphic registration requires a non-empty graphic type");
51
+ graphicCreator.registerStore(name, creator), sharedGraphicRegistry.graphicFactory.register(name, createGraphicCtor(creator));
52
+ }
53
+
54
+ export function createGraphic(name, attributes) {
55
+ return sharedGraphicRegistry.graphicFactory.create(name, attributes);
56
+ }
57
+ //# sourceMappingURL=graphic-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graphic/graphic-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAqC5D,SAAS,iBAAiB,CACxB,OAAsD;IAEtD,OAAO,MAAM,qBAAqB;QAChC,YAAY,UAAuB;YACjC,IAAI;gBACF,OAAO,IAAK,OAAe,CAAC,UAAU,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;aAC5B;QACH,CAAC;KACK,CAAC;AACX,CAAC;AAED,MAAM,cAAc;IAkBlB;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,aAAa,CAAC,IAAY,EAAE,OAA+B;QACzD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,sBAAsB,CAAC,IAAY,EAAE,OAA+B;QAClE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,aAAa,CACX,IAAY,EACZ,UAAuB;QAEvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,aAAa,CAAwB,IAAI,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;CACF;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAO7F,SAAS,0BAA0B;IACjC,OAAO;QACL,cAAc,EAAE,IAAI,cAAc,EAAE;QACpC,cAAc,EAAE,IAAI,cAAc,EAAE;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAG,UAAuF,CAAC;IAEtG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE;QACnC,KAAK,CAAC,uBAAuB,CAAC,GAAG,0BAA0B,EAAE,CAAC;KAC/D;IAED,OAAO,KAAK,CAAC,uBAAuB,CAA0B,CAAC;AACjE,CAAC;AAED,MAAM,qBAAqB,GAAG,uBAAuB,EAAE,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC;AAEnE,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,OAAsD;IAEtD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,cAAc,CAAC,aAAa,CAAC,IAAI,EAAE,OAAiC,CAAC,CAAC;IACtE,qBAAqB,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,UAAuB;IAEvB,OAAO,qBAAqB,CAAC,cAAc,CAAC,MAAM,CAAwB,IAAI,EAAE,UAAU,CAAC,CAAC;AAC9F,CAAC","file":"graphic-registry.js","sourcesContent":["import { GraphicFactory } from '../factory/graphic-factory';\nimport type {\n IArc,\n IArcGraphicAttribute,\n IArea,\n IAreaGraphicAttribute,\n ICircle,\n ICircleGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImage,\n IImageGraphicAttribute,\n ILine,\n ILineGraphicAttribute,\n IPath,\n IPathGraphicAttribute,\n IPolygon,\n IPolygonGraphicAttribute,\n IRect,\n IRect3d,\n IRect3dGraphicAttribute,\n IRectGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n IShadowRoot,\n ISymbol,\n ISymbolGraphicAttribute,\n IText,\n ITextGraphicAttribute,\n IWrapTextGraphicAttribute\n} from '../interface';\nimport type { IGraphic } from '../interface/graphic';\n\nexport type IGraphicCreateCallback<TGraphic extends IGraphic = IGraphic, TAttributes = any> = (\n attributes: TAttributes\n) => TGraphic;\n\nfunction createGraphicCtor<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n creator: IGraphicCreateCallback<TGraphic, TAttributes>\n) {\n return class RegisteredGraphicCtor {\n constructor(attributes: TAttributes) {\n try {\n return new (creator as any)(attributes);\n } catch (error) {\n return creator(attributes);\n }\n }\n } as any;\n}\n\nclass GraphicCreator {\n declare store: Map<string, IGraphicCreateCallback>;\n declare arc?: (attribute: IArcGraphicAttribute) => IArc;\n declare area?: (attribute: IAreaGraphicAttribute) => IArea;\n declare circle?: (attribute: ICircleGraphicAttribute) => ICircle;\n declare group?: (attribute: IGroupGraphicAttribute) => IGroup;\n declare image?: (attribute: IImageGraphicAttribute) => IImage;\n declare line?: (attribute: ILineGraphicAttribute) => ILine;\n declare path?: (attribute: IPathGraphicAttribute) => IPath;\n declare rect?: (attribute: IRectGraphicAttribute) => IRect;\n declare rect3d?: (attribute: IRect3dGraphicAttribute) => IRect3d;\n declare symbol?: (attribute: ISymbolGraphicAttribute) => ISymbol;\n declare text?: (attribute: ITextGraphicAttribute) => IText;\n declare richtext?: (attribute: IRichTextGraphicAttribute) => IRichText;\n declare polygon?: (attribute: IPolygonGraphicAttribute) => IPolygon;\n declare shadowRoot?: (attribute: IGroupGraphicAttribute) => IShadowRoot;\n declare wrapText?: (attribute: IWrapTextGraphicAttribute) => IText;\n\n constructor() {\n this.store = new Map();\n }\n\n registerStore(name: string, creator: IGraphicCreateCallback) {\n this.store.set(name, creator);\n (this as any)[name] = creator;\n }\n\n RegisterGraphicCreator(name: string, creator: IGraphicCreateCallback) {\n registerGraphic(name, creator);\n }\n\n CreateGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n attributes: TAttributes\n ): TGraphic | null {\n if (!this.store.has(name)) {\n return null;\n }\n\n return createGraphic<TGraphic, TAttributes>(name, attributes);\n }\n}\n\nexport const GRAPHIC_REGISTRY_SYMBOL = Symbol.for('@visactor/vrender-core/graphic-registry');\n\nexport interface IGraphicRegistryState {\n graphicCreator: GraphicCreator;\n graphicFactory: GraphicFactory;\n}\n\nfunction createGraphicRegistryState(): IGraphicRegistryState {\n return {\n graphicCreator: new GraphicCreator(),\n graphicFactory: new GraphicFactory()\n };\n}\n\nexport function getGraphicRegistryState(): IGraphicRegistryState {\n const scope = globalThis as typeof globalThis & { [GRAPHIC_REGISTRY_SYMBOL]?: IGraphicRegistryState };\n\n if (!scope[GRAPHIC_REGISTRY_SYMBOL]) {\n scope[GRAPHIC_REGISTRY_SYMBOL] = createGraphicRegistryState();\n }\n\n return scope[GRAPHIC_REGISTRY_SYMBOL] as IGraphicRegistryState;\n}\n\nconst sharedGraphicRegistry = getGraphicRegistryState();\n\nexport const graphicCreator = sharedGraphicRegistry.graphicCreator;\n\nexport function registerGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n creator: IGraphicCreateCallback<TGraphic, TAttributes>\n) {\n if (!name) {\n throw new Error('Graphic registration requires a non-empty graphic type');\n }\n\n graphicCreator.registerStore(name, creator as IGraphicCreateCallback);\n sharedGraphicRegistry.graphicFactory.register(name, createGraphicCtor(creator));\n}\n\nexport function createGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(\n name: string,\n attributes: TAttributes\n): TGraphic {\n return sharedGraphicRegistry.graphicFactory.create<TGraphic, TAttributes>(name, attributes);\n}\n"]}
@@ -22,6 +22,8 @@ export * from './shadow-root';
22
22
  export * from './config';
23
23
  export * from './graphic-service/graphic-service';
24
24
  export * from './graphic-creator';
25
+ export { GRAPHIC_REGISTRY_SYMBOL, getGraphicRegistryState } from './graphic-registry';
26
+ export type { IGraphicRegistryState } from './graphic-registry';
25
27
  export * from './builtin-symbol';
26
28
  export * from './graphic';
27
29
  export * from './bounds';
@@ -46,6 +46,8 @@ export * from "./graphic-service/graphic-service";
46
46
 
47
47
  export * from "./graphic-creator";
48
48
 
49
+ export { GRAPHIC_REGISTRY_SYMBOL, getGraphicRegistryState } from "./graphic-registry";
50
+
49
51
  export * from "./builtin-symbol";
50
52
 
51
53
  export * from "./graphic";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC","file":"index.js","sourcesContent":["export * from './node-tree';\nexport * from './circle';\nexport * from './text';\nexport * from './wrap-text';\nexport * from './symbol';\nexport * from './builtin-symbol';\nexport * from './line';\nexport * from './rect';\nexport * from './rect3d';\nexport * from './glyph';\nexport * from './richtext';\nexport * from './path';\nexport * from './area';\nexport * from './image';\nexport * from './arc';\nexport * from './star';\nexport * from './arc3d';\nexport * from './group';\nexport * from './polygon';\nexport * from './pyramid3d';\nexport * from './shadow-root';\nexport * from './config';\nexport * from './graphic-service/graphic-service';\nexport * from './graphic-creator';\nexport * from './builtin-symbol';\nexport * from './graphic';\nexport * from './bounds';\nexport * from './theme';\nexport * from './tools';\nexport * from './constants';\nexport { StateEngine } from './state/state-engine';\nexport { StateDefinitionCompiler } from './state/state-definition-compiler';\nexport type {\n StateDefinition,\n CompiledStateDefinition,\n StateResolveContext,\n StateDefinitionsInput,\n StateTransitionResult,\n IStateEngineOptions\n} from './state/state-definition';\n"]}
1
+ {"version":3,"sources":["../src/graphic/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC","file":"index.js","sourcesContent":["export * from './node-tree';\nexport * from './circle';\nexport * from './text';\nexport * from './wrap-text';\nexport * from './symbol';\nexport * from './builtin-symbol';\nexport * from './line';\nexport * from './rect';\nexport * from './rect3d';\nexport * from './glyph';\nexport * from './richtext';\nexport * from './path';\nexport * from './area';\nexport * from './image';\nexport * from './arc';\nexport * from './star';\nexport * from './arc3d';\nexport * from './group';\nexport * from './polygon';\nexport * from './pyramid3d';\nexport * from './shadow-root';\nexport * from './config';\nexport * from './graphic-service/graphic-service';\nexport * from './graphic-creator';\nexport { GRAPHIC_REGISTRY_SYMBOL, getGraphicRegistryState } from './graphic-registry';\nexport type { IGraphicRegistryState } from './graphic-registry';\nexport * from './builtin-symbol';\nexport * from './graphic';\nexport * from './bounds';\nexport * from './theme';\nexport * from './tools';\nexport * from './constants';\nexport { StateEngine } from './state/state-engine';\nexport { StateDefinitionCompiler } from './state/state-definition-compiler';\nexport type {\n StateDefinition,\n CompiledStateDefinition,\n StateResolveContext,\n StateDefinitionsInput,\n StateTransitionResult,\n IStateEngineOptions\n} from './state/state-definition';\n"]}