@visactor/vrender-core 1.1.3 → 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 (100) hide show
  1. package/cjs/allocator/bounds-allocate.js +1 -2
  2. package/cjs/allocator/graphic-allocate.js +2 -1
  3. package/cjs/animate/config.js +1 -1
  4. package/cjs/application-state.d.ts +27 -0
  5. package/cjs/application-state.js +22 -0
  6. package/cjs/application-state.js.map +1 -0
  7. package/cjs/application.d.ts +2 -22
  8. package/cjs/application.js +24 -3
  9. package/cjs/application.js.map +1 -1
  10. package/cjs/common/bounds-context.js +1 -2
  11. package/cjs/common/contribution-provider.d.ts +2 -1
  12. package/cjs/common/contribution-provider.js +20 -2
  13. package/cjs/common/contribution-provider.js.map +1 -1
  14. package/cjs/common/contribution-store-state.d.ts +6 -0
  15. package/cjs/common/contribution-store-state.js +20 -0
  16. package/cjs/common/contribution-store-state.js.map +1 -0
  17. package/cjs/common/performance-raf.js +1 -2
  18. package/cjs/common/render-command-list.js +2 -1
  19. package/cjs/common/simplify.js +1 -1
  20. package/cjs/common/sort.js +1 -1
  21. package/cjs/common/split-path.js +1 -1
  22. package/cjs/common/text.js +1 -1
  23. package/cjs/entries/runtime-installer-state.d.ts +12 -0
  24. package/cjs/entries/runtime-installer-state.js +27 -0
  25. package/cjs/entries/runtime-installer-state.js.map +1 -0
  26. package/cjs/entries/runtime-installer.d.ts +3 -1
  27. package/cjs/entries/runtime-installer.js +23 -13
  28. package/cjs/entries/runtime-installer.js.map +1 -1
  29. package/cjs/factory-state.d.ts +5 -0
  30. package/cjs/factory-state.js +19 -0
  31. package/cjs/factory-state.js.map +1 -0
  32. package/cjs/factory.d.ts +2 -0
  33. package/cjs/factory.js +18 -2
  34. package/cjs/factory.js.map +1 -1
  35. package/cjs/graphic/graphic-creator.d.ts +2 -29
  36. package/cjs/graphic/graphic-creator.js +24 -38
  37. package/cjs/graphic/graphic-creator.js.map +1 -1
  38. package/cjs/graphic/graphic-registry.d.ts +36 -0
  39. package/cjs/graphic/graphic-registry.js +65 -0
  40. package/cjs/graphic/graphic-registry.js.map +1 -0
  41. package/cjs/graphic/index.d.ts +2 -0
  42. package/cjs/graphic/index.js +29 -16
  43. package/cjs/graphic/index.js.map +1 -1
  44. package/cjs/legacy/bootstrap-state.d.ts +7 -0
  45. package/cjs/legacy/bootstrap-state.js +24 -0
  46. package/cjs/legacy/bootstrap-state.js.map +1 -0
  47. package/cjs/legacy/bootstrap.d.ts +3 -4
  48. package/cjs/legacy/bootstrap.js +20 -7
  49. package/cjs/legacy/bootstrap.js.map +1 -1
  50. package/dist/index.es.js +110 -22
  51. package/es/allocator/bounds-allocate.js +1 -2
  52. package/es/allocator/graphic-allocate.js +2 -1
  53. package/es/animate/config.js +1 -1
  54. package/es/application-state.d.ts +27 -0
  55. package/es/application-state.js +17 -0
  56. package/es/application-state.js.map +1 -0
  57. package/es/application.d.ts +2 -22
  58. package/es/application.js +2 -3
  59. package/es/application.js.map +1 -1
  60. package/es/common/bounds-context.js +1 -2
  61. package/es/common/contribution-provider.d.ts +2 -1
  62. package/es/common/contribution-provider.js +6 -1
  63. package/es/common/contribution-provider.js.map +1 -1
  64. package/es/common/contribution-store-state.d.ts +6 -0
  65. package/es/common/contribution-store-state.js +14 -0
  66. package/es/common/contribution-store-state.js.map +1 -0
  67. package/es/common/performance-raf.js +1 -2
  68. package/es/common/render-command-list.js +2 -1
  69. package/es/common/simplify.js +1 -1
  70. package/es/common/sort.js +1 -1
  71. package/es/common/split-path.js +1 -1
  72. package/es/common/text.js +1 -1
  73. package/es/entries/runtime-installer-state.d.ts +12 -0
  74. package/es/entries/runtime-installer-state.js +20 -0
  75. package/es/entries/runtime-installer-state.js.map +1 -0
  76. package/es/entries/runtime-installer.d.ts +3 -1
  77. package/es/entries/runtime-installer.js +8 -9
  78. package/es/entries/runtime-installer.js.map +1 -1
  79. package/es/factory-state.d.ts +5 -0
  80. package/es/factory-state.js +14 -0
  81. package/es/factory-state.js.map +1 -0
  82. package/es/factory.d.ts +2 -0
  83. package/es/factory.js +5 -1
  84. package/es/factory.js.map +1 -1
  85. package/es/graphic/graphic-creator.d.ts +2 -29
  86. package/es/graphic/graphic-creator.js +1 -41
  87. package/es/graphic/graphic-creator.js.map +1 -1
  88. package/es/graphic/graphic-registry.d.ts +36 -0
  89. package/es/graphic/graphic-registry.js +57 -0
  90. package/es/graphic/graphic-registry.js.map +1 -0
  91. package/es/graphic/index.d.ts +2 -0
  92. package/es/graphic/index.js +2 -0
  93. package/es/graphic/index.js.map +1 -1
  94. package/es/legacy/bootstrap-state.d.ts +7 -0
  95. package/es/legacy/bootstrap-state.js +17 -0
  96. package/es/legacy/bootstrap-state.js.map +1 -0
  97. package/es/legacy/bootstrap.d.ts +3 -4
  98. package/es/legacy/bootstrap.js +5 -5
  99. package/es/legacy/bootstrap.js.map +1 -1
  100. package/package.json +11 -3
@@ -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,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAA8B,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,wDAAwD,CAAC;AAC5G,OAAO,EAAE,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAClH,OAAO,EAAE,kCAAkC,EAAE,MAAM,wDAAwD,CAAC;AAC5G,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,uBAAuB,MAAM,iCAAiC,CAAC;A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AC;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 { 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"]}
1
+ {"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,aAAa,MAAM,2CAA2C,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,wDAAwD,CAAC;AAC5G,OAAO,EAAE,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAClH,OAAO,EAAE,kCAAkC,EAAE,MAAM,wDAAwD,CAAC;AAC5G,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,uBAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,E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MAAM,CAAC,EAAE;QAC/B,IAAI,MAAM,KAAK,kBAAkB,EAAE;YACjC,uBAAuB,GAAG,IAAI,CAAC;SAChC;aAAM,IAAI,MAAM,KAAK,mBAAmB,EAAE;YACzC,wBAAwB,GAAG,IAAI,CAAC;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,E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,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,UAAuB;IAEvB,OAAO,oBAAoB,CAAC,MAAM,CAAwB,IAAI,EAAE,UAAU,CAAC,CAAC;AAC9E,CAAC","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,C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icAttribute,\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"]}
@@ -0,0 +1,7 @@
1
+ import { type ILegacyBindingContext } from './binding-context';
2
+ export declare const LEGACY_BOOTSTRAP_STATE_SYMBOL: unique symbol;
3
+ export interface ILegacyBootstrapState {
4
+ legacyBindingContext: ILegacyBindingContext;
5
+ preloaded: boolean;
6
+ }
7
+ export declare function getLegacyBootstrapState(): ILegacyBootstrapState;
@@ -0,0 +1,17 @@
1
+ import { createLegacyBindingContext } from "./binding-context";
2
+
3
+ export const LEGACY_BOOTSTRAP_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");
4
+
5
+ function createLegacyBootstrapState() {
6
+ return {
7
+ legacyBindingContext: createLegacyBindingContext(),
8
+ preloaded: !1
9
+ };
10
+ }
11
+
12
+ export function getLegacyBootstrapState() {
13
+ const scope = globalThis;
14
+ return scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] || (scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] = createLegacyBootstrapState()),
15
+ scope[LEGACY_BOOTSTRAP_STATE_SYMBOL];
16
+ }
17
+ //# sourceMappingURL=bootstrap-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/legacy/bootstrap-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAA8B,MAAM,mBAAmB,CAAC;AAE3F,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;AAOzG,SAAS,0BAA0B;IACjC,OAAO;QACL,oBAAoB,EAAE,0BAA0B,EAAE;QAClD,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAG,UAA6F,CAAC;IAE5G,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE;QACzC,KAAK,CAAC,6BAA6B,CAAC,GAAG,0BAA0B,EAAE,CAAC;KACrE;IAED,OAAO,KAAK,CAAC,6BAA6B,CAA0B,CAAC;AACvE,CAAC","file":"bootstrap-state.js","sourcesContent":["import { createLegacyBindingContext, type ILegacyBindingContext } from './binding-context';\n\nexport const LEGACY_BOOTSTRAP_STATE_SYMBOL = Symbol.for('@visactor/vrender-core/legacy-bootstrap-state');\n\nexport interface ILegacyBootstrapState {\n legacyBindingContext: ILegacyBindingContext;\n preloaded: boolean;\n}\n\nfunction createLegacyBootstrapState(): ILegacyBootstrapState {\n return {\n legacyBindingContext: createLegacyBindingContext(),\n preloaded: false\n };\n}\n\nexport function getLegacyBootstrapState(): ILegacyBootstrapState {\n const scope = globalThis as typeof globalThis & { [LEGACY_BOOTSTRAP_STATE_SYMBOL]?: ILegacyBootstrapState };\n\n if (!scope[LEGACY_BOOTSTRAP_STATE_SYMBOL]) {\n scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] = createLegacyBootstrapState();\n }\n\n return scope[LEGACY_BOOTSTRAP_STATE_SYMBOL] as ILegacyBootstrapState;\n}\n"]}
@@ -1,10 +1,9 @@
1
- import { type ILegacyBindingContext } from './binding-context';
1
+ import type { ILegacyBindingContext } from './binding-context';
2
2
  export type { ILegacyBindContext, ILegacyBindingContext } from './binding-context';
3
3
  export declare function preLoadAllModule(): void;
4
- export declare namespace preLoadAllModule {
5
- var __loaded: boolean;
6
- }
7
4
  export declare function getLegacyBindingContext(): ILegacyBindingContext;
8
5
  export declare function resolveLegacySingleton<T>(serviceIdentifier: any): T;
6
+ export { LEGACY_BOOTSTRAP_STATE_SYMBOL, getLegacyBootstrapState } from './bootstrap-state';
7
+ export type { ILegacyBootstrapState } from './bootstrap-state';
9
8
  export declare function resolveLegacyNamed<T>(serviceIdentifier: any, name: string): T | undefined;
10
9
  export declare function createLegacySingletonProxy<T extends object>(resolver: () => T): T;
@@ -12,9 +12,9 @@ import loadBuiltinContributions from "../core/contributions/modules";
12
12
 
13
13
  import loadRenderContributions from "../render/contributions/modules";
14
14
 
15
- import { createLegacyBindingContext } from "./binding-context";
15
+ import { getLegacyBootstrapState } from "./bootstrap-state";
16
16
 
17
- const legacyBindingContext = createLegacyBindingContext();
17
+ const legacyBootstrapState = getLegacyBootstrapState(), legacyBindingContext = legacyBootstrapState.legacyBindingContext;
18
18
 
19
19
  function getLegacyTarget(resolver) {
20
20
  let target;
@@ -22,7 +22,7 @@ function getLegacyTarget(resolver) {
22
22
  }
23
23
 
24
24
  export function preLoadAllModule() {
25
- preLoadAllModule.__loaded || (preLoadAllModule.__loaded = !0, coreModule({
25
+ legacyBootstrapState.preloaded || (legacyBootstrapState.preloaded = !0, coreModule({
26
26
  bind: legacyBindingContext.bind
27
27
  }), graphicModule({
28
28
  bind: legacyBindingContext.bind
@@ -36,8 +36,6 @@ export function preLoadAllModule() {
36
36
  }), loadBuiltinContributions(legacyBindingContext), loadRenderContributions(legacyBindingContext));
37
37
  }
38
38
 
39
- preLoadAllModule.__loaded = !1;
40
-
41
39
  export function getLegacyBindingContext() {
42
40
  return legacyBindingContext;
43
41
  }
@@ -48,6 +46,8 @@ export function resolveLegacySingleton(serviceIdentifier) {
48
46
  return instance;
49
47
  }
50
48
 
49
+ export { LEGACY_BOOTSTRAP_STATE_SYMBOL, getLegacyBootstrapState } from "./bootstrap-state";
50
+
51
51
  export function resolveLegacyNamed(serviceIdentifier, name) {
52
52
  return preLoadAllModule(), legacyBindingContext.getNamed(serviceIdentifier, name);
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/legacy/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,uBAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAuD,MAAM,mBAAmB,CAAC;AAIpH,MAAM,oBAAoB,GAAG,0BAA0B,EAAE,CAAC;AAE1D,SAAS,eAA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CAAC,QAAQ,CAAI,iBAAiB,EAAE,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAmB,QAAiB;IAC5E,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE5C,OAAO,IAAI,KAAK,CAAC,EAAO,EAAE;QACxB,GAAG,CAAC,OAAO,EAAE,QAAQ;YACnB,MAAM,KAAK,GAAI,SAAS,EAAU,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,CAAC;QACD,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK;YACzB,SAAS,EAAU,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,CAAC,OAAO,EAAE,QAAQ;YACnB,OAAO,QAAQ,IAAK,SAAS,EAAU,CAAC;QAC1C,CAAC;QACD,OAAO;YACL,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAS,CAAC,CAAC;QAC7C,CAAC;QACD,wBAAwB,CAAC,OAAO,EAAE,QAAQ;YACxC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAS,EAAE,QAAQ,CAAC,CAAC;YAEjF,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO,SAAS,CAAC;aAClB;YAED,uCACK,UAAU,KACb,YAAY,EAAE,IAAI,IAClB;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC","file":"bootstrap.js","sourcesContent":["import coreModule from '../core/core-modules';\nimport renderModule from '../render/render-modules';\nimport pickModule from '../picker/pick-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport pluginModule from '../plugins/plugin-modules';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { createLegacyBindingContext, type ILegacyBindContext, type ILegacyBindingContext } from './binding-context';\n\nexport type { ILegacyBindContext, ILegacyBindingContext } from './binding-context';\n\nconst legacyBindingContext = createLegacyBindingContext();\n\nfunction getLegacyTarget<T>(resolver: () => T): () => T {\n let target: T | undefined;\n\n return () => {\n if (target === undefined) {\n target = resolver();\n }\n\n return target;\n };\n}\n\nexport function preLoadAllModule() {\n if (preLoadAllModule.__loaded) {\n return;\n }\n preLoadAllModule.__loaded = true;\n coreModule({ bind: legacyBindingContext.bind });\n graphicModule({ bind: legacyBindingContext.bind });\n renderModule({ bind: legacyBindingContext.bind });\n pickModule({ bind: legacyBindingContext.bind, isBound: legacyBindingContext.isBound });\n pluginModule({ bind: legacyBindingContext.bind });\n loadBuiltinContributions(legacyBindingContext);\n loadRenderContributions(legacyBindingContext);\n}\n\npreLoadAllModule.__loaded = false;\n\nexport function getLegacyBindingContext(): ILegacyBindingContext {\n return legacyBindingContext;\n}\n\nexport function resolveLegacySingleton<T>(serviceIdentifier: any): T {\n preLoadAllModule();\n const [instance] = legacyBindingContext.getAll<T>(serviceIdentifier);\n return instance;\n}\n\nexport function resolveLegacyNamed<T>(serviceIdentifier: any, name: string): T | undefined {\n preLoadAllModule();\n return legacyBindingContext.getNamed<T>(serviceIdentifier, name);\n}\n\nexport function createLegacySingletonProxy<T extends object>(resolver: () => T): T {\n const getTarget = getLegacyTarget(resolver);\n\n return new Proxy({} as T, {\n get(_target, property) {\n const value = (getTarget() as any)[property];\n return typeof value === 'function' ? value.bind(getTarget()) : value;\n },\n set(_target, property, value) {\n (getTarget() as any)[property] = value;\n return true;\n },\n has(_target, property) {\n return property in (getTarget() as any);\n },\n ownKeys() {\n return Reflect.ownKeys(getTarget() as any);\n },\n getOwnPropertyDescriptor(_target, property) {\n const descriptor = Object.getOwnPropertyDescriptor(getTarget() as any, property);\n\n if (!descriptor) {\n return undefined;\n }\n\n return {\n ...descriptor,\n configurable: true\n };\n }\n });\n}\n"]}
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,CAAC,SAAS,EAAS,CAAC,CAAC;QAC7C,CAAC;QACD,wBAAwB,CAAC,OAAO,EAAE,QAAQ;YACxC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAS,EAAE,QAAQ,CAAC,CAAC;YAEjF,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO,SAAS,CAAC;aAClB;YAED,uCACK,UAAU,KACb,YAAY,EAAE,IAAI,IAClB;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC","file":"bootstrap.js","sourcesContent":["import coreModule from '../core/core-modules';\nimport renderModule from '../render/render-modules';\nimport pickModule from '../picker/pick-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport pluginModule from '../plugins/plugin-modules';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport loadRenderContributions from '../render/contributions/modules';\nimport type { ILegacyBindContext, ILegacyBindingContext } from './binding-context';\nimport { getLegacyBootstrapState } from './bootstrap-state';\n\nexport type { ILegacyBindContext, ILegacyBindingContext } from './binding-context';\n\nconst legacyBootstrapState = getLegacyBootstrapState();\nconst legacyBindingContext = legacyBootstrapState.legacyBindingContext;\n\nfunction getLegacyTarget<T>(resolver: () => T): () => T {\n let target: T | undefined;\n\n return () => {\n if (target === undefined) {\n target = resolver();\n }\n\n return target;\n };\n}\n\nexport function preLoadAllModule() {\n if (legacyBootstrapState.preloaded) {\n return;\n }\n legacyBootstrapState.preloaded = true;\n coreModule({ bind: legacyBindingContext.bind });\n graphicModule({ bind: legacyBindingContext.bind });\n renderModule({ bind: legacyBindingContext.bind });\n pickModule({ bind: legacyBindingContext.bind, isBound: legacyBindingContext.isBound });\n pluginModule({ bind: legacyBindingContext.bind });\n loadBuiltinContributions(legacyBindingContext);\n loadRenderContributions(legacyBindingContext);\n}\n\nexport function getLegacyBindingContext(): ILegacyBindingContext {\n return legacyBindingContext;\n}\n\nexport function resolveLegacySingleton<T>(serviceIdentifier: any): T {\n preLoadAllModule();\n const [instance] = legacyBindingContext.getAll<T>(serviceIdentifier);\n return instance;\n}\n\nexport { LEGACY_BOOTSTRAP_STATE_SYMBOL, getLegacyBootstrapState } from './bootstrap-state';\nexport type { ILegacyBootstrapState } from './bootstrap-state';\n\nexport function resolveLegacyNamed<T>(serviceIdentifier: any, name: string): T | undefined {\n preLoadAllModule();\n return legacyBindingContext.getNamed<T>(serviceIdentifier, name);\n}\n\nexport function createLegacySingletonProxy<T extends object>(resolver: () => T): T {\n const getTarget = getLegacyTarget(resolver);\n\n return new Proxy({} as T, {\n get(_target, property) {\n const value = (getTarget() as any)[property];\n return typeof value === 'function' ? value.bind(getTarget()) : value;\n },\n set(_target, property, value) {\n (getTarget() as any)[property] = value;\n return true;\n },\n has(_target, property) {\n return property in (getTarget() as any);\n },\n ownKeys() {\n return Reflect.ownKeys(getTarget() as any);\n },\n getOwnPropertyDescriptor(_target, property) {\n const descriptor = Object.getOwnPropertyDescriptor(getTarget() as any, property);\n\n if (!descriptor) {\n return undefined;\n }\n\n return {\n ...descriptor,\n configurable: true\n };\n }\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-core",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-alpha.0",
4
4
  "description": "",
5
5
  "sideEffects": [
6
6
  "./src/modules.ts",
@@ -57,6 +57,9 @@
57
57
  "graphic/creator": [
58
58
  "es/graphic/creator.d.ts"
59
59
  ],
60
+ "graphic/graphic-registry": [
61
+ "es/graphic/graphic-registry.d.ts"
62
+ ],
60
63
  "graphic/group": [
61
64
  "es/graphic/group.d.ts"
62
65
  ],
@@ -129,9 +132,9 @@
129
132
  "vite": "3.2.6",
130
133
  "typescript": "4.9.5",
131
134
  "cross-env": "^7.0.3",
135
+ "@internal/bundler": "0.0.1",
132
136
  "@internal/eslint-config": "0.0.1",
133
- "@internal/ts-config": "0.0.1",
134
- "@internal/bundler": "0.0.1"
137
+ "@internal/ts-config": "0.0.1"
135
138
  },
136
139
  "keywords": [
137
140
  "VisActor",
@@ -231,6 +234,11 @@
231
234
  "import": "./es/graphic/creator.js",
232
235
  "require": "./cjs/graphic/creator.js"
233
236
  },
237
+ "./graphic/graphic-registry": {
238
+ "types": "./es/graphic/graphic-registry.d.ts",
239
+ "import": "./es/graphic/graphic-registry.js",
240
+ "require": "./cjs/graphic/graphic-registry.js"
241
+ },
234
242
  "./graphic/group": {
235
243
  "types": "./es/graphic/group.d.ts",
236
244
  "import": "./es/graphic/group.js",