@visactor/vrender-core 1.1.3 → 1.1.4-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) 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/contribution-provider.d.ts +2 -1
  11. package/cjs/common/contribution-provider.js +20 -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/custom-path2d.js +1 -2
  17. package/cjs/common/module-guard.js +1 -1
  18. package/cjs/common/morphing-utils.js +1 -1
  19. package/cjs/common/path-svg.js +1 -1
  20. package/cjs/common/performance-raf.js +1 -1
  21. package/cjs/common/polygon.js +2 -2
  22. package/cjs/common/rect-utils.js +1 -1
  23. package/cjs/common/render-area.js +1 -1
  24. package/cjs/common/render-command-list.js +2 -1
  25. package/cjs/common/render-curve.js +1 -1
  26. package/cjs/common/render-utils.js +1 -1
  27. package/cjs/common/seg-context.js +1 -1
  28. package/cjs/common/simplify.js +1 -1
  29. package/cjs/common/sort.js +1 -1
  30. package/cjs/common/split-path.js +1 -1
  31. package/cjs/common/text.js +1 -1
  32. package/cjs/core/camera.js +1 -1
  33. package/cjs/core/constants.js +1 -1
  34. package/cjs/core/core-modules.js +1 -2
  35. package/cjs/core/global.js +1 -1
  36. package/cjs/core/graphic-utils.js +1 -1
  37. package/cjs/core/index.js +1 -1
  38. package/cjs/core/layer-service.js +1 -1
  39. package/cjs/core/layer.js +1 -1
  40. package/cjs/core/light.js +1 -1
  41. package/cjs/core/stage.js +1 -1
  42. package/cjs/core/window.js +1 -1
  43. package/cjs/entries/runtime-installer-state.d.ts +12 -0
  44. package/cjs/entries/runtime-installer-state.js +27 -0
  45. package/cjs/entries/runtime-installer-state.js.map +1 -0
  46. package/cjs/entries/runtime-installer.d.ts +3 -1
  47. package/cjs/entries/runtime-installer.js +23 -13
  48. package/cjs/entries/runtime-installer.js.map +1 -1
  49. package/cjs/factory-state.d.ts +5 -0
  50. package/cjs/factory-state.js +19 -0
  51. package/cjs/factory-state.js.map +1 -0
  52. package/cjs/factory.d.ts +2 -0
  53. package/cjs/factory.js +18 -2
  54. package/cjs/factory.js.map +1 -1
  55. package/cjs/graphic/graphic-creator.d.ts +2 -29
  56. package/cjs/graphic/graphic-creator.js +24 -38
  57. package/cjs/graphic/graphic-creator.js.map +1 -1
  58. package/cjs/graphic/graphic-registry.d.ts +36 -0
  59. package/cjs/graphic/graphic-registry.js +65 -0
  60. package/cjs/graphic/graphic-registry.js.map +1 -0
  61. package/cjs/graphic/graphic.d.ts +8 -1
  62. package/cjs/graphic/graphic.js +22 -7
  63. package/cjs/graphic/graphic.js.map +1 -1
  64. package/cjs/graphic/index.d.ts +2 -0
  65. package/cjs/graphic/index.js +29 -16
  66. package/cjs/graphic/index.js.map +1 -1
  67. package/cjs/legacy/bootstrap-state.d.ts +7 -0
  68. package/cjs/legacy/bootstrap-state.js +24 -0
  69. package/cjs/legacy/bootstrap-state.js.map +1 -0
  70. package/cjs/legacy/bootstrap.d.ts +3 -4
  71. package/cjs/legacy/bootstrap.js +20 -7
  72. package/cjs/legacy/bootstrap.js.map +1 -1
  73. package/dist/index.es.js +126 -25
  74. package/es/allocator/bounds-allocate.js +1 -2
  75. package/es/allocator/graphic-allocate.js +2 -1
  76. package/es/animate/config.js +1 -1
  77. package/es/application-state.d.ts +27 -0
  78. package/es/application-state.js +17 -0
  79. package/es/application-state.js.map +1 -0
  80. package/es/application.d.ts +2 -22
  81. package/es/application.js +2 -3
  82. package/es/application.js.map +1 -1
  83. package/es/common/contribution-provider.d.ts +2 -1
  84. package/es/common/contribution-provider.js +6 -1
  85. package/es/common/contribution-provider.js.map +1 -1
  86. package/es/common/contribution-store-state.d.ts +6 -0
  87. package/es/common/contribution-store-state.js +14 -0
  88. package/es/common/contribution-store-state.js.map +1 -0
  89. package/es/common/custom-path2d.js +1 -2
  90. package/es/common/module-guard.js +1 -1
  91. package/es/common/morphing-utils.js +1 -1
  92. package/es/common/path-svg.js +1 -1
  93. package/es/common/performance-raf.js +1 -1
  94. package/es/common/polygon.js +1 -1
  95. package/es/common/rect-utils.js +1 -1
  96. package/es/common/render-area.js +1 -1
  97. package/es/common/render-command-list.js +2 -1
  98. package/es/common/render-curve.js +1 -1
  99. package/es/common/render-utils.js +1 -1
  100. package/es/common/seg-context.js +1 -1
  101. package/es/common/simplify.js +1 -1
  102. package/es/common/sort.js +1 -1
  103. package/es/common/split-path.js +1 -1
  104. package/es/common/text.js +1 -1
  105. package/es/core/camera.js +1 -1
  106. package/es/core/constants.js +1 -1
  107. package/es/core/core-modules.js +1 -2
  108. package/es/core/global.js +1 -1
  109. package/es/core/graphic-utils.js +1 -1
  110. package/es/core/index.js +1 -1
  111. package/es/core/layer-service.js +1 -1
  112. package/es/core/layer.js +1 -1
  113. package/es/core/light.js +1 -1
  114. package/es/core/stage.js +1 -1
  115. package/es/core/window.js +1 -1
  116. package/es/entries/runtime-installer-state.d.ts +12 -0
  117. package/es/entries/runtime-installer-state.js +20 -0
  118. package/es/entries/runtime-installer-state.js.map +1 -0
  119. package/es/entries/runtime-installer.d.ts +3 -1
  120. package/es/entries/runtime-installer.js +8 -9
  121. package/es/entries/runtime-installer.js.map +1 -1
  122. package/es/factory-state.d.ts +5 -0
  123. package/es/factory-state.js +14 -0
  124. package/es/factory-state.js.map +1 -0
  125. package/es/factory.d.ts +2 -0
  126. package/es/factory.js +5 -1
  127. package/es/factory.js.map +1 -1
  128. package/es/graphic/graphic-creator.d.ts +2 -29
  129. package/es/graphic/graphic-creator.js +1 -41
  130. package/es/graphic/graphic-creator.js.map +1 -1
  131. package/es/graphic/graphic-registry.d.ts +36 -0
  132. package/es/graphic/graphic-registry.js +57 -0
  133. package/es/graphic/graphic-registry.js.map +1 -0
  134. package/es/graphic/graphic.d.ts +8 -1
  135. package/es/graphic/graphic.js +22 -3
  136. package/es/graphic/graphic.js.map +1 -1
  137. package/es/graphic/index.d.ts +2 -0
  138. package/es/graphic/index.js +2 -0
  139. package/es/graphic/index.js.map +1 -1
  140. package/es/legacy/bootstrap-state.d.ts +7 -0
  141. package/es/legacy/bootstrap-state.js +17 -0
  142. package/es/legacy/bootstrap-state.js.map +1 -0
  143. package/es/legacy/bootstrap.d.ts +3 -4
  144. package/es/legacy/bootstrap.js +5 -5
  145. package/es/legacy/bootstrap.js.map +1 -1
  146. package/package.json +11 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[],"mappings":";;;;;;AAUA,gDAA6C;AAC7C,mDAAsE;AACtE,2EAAgG;AAEhG,4CAA+C;AAC/C,4EAAqE;AACrE,2CAA+C;AAC/C,2CAA0E;AAC1E,wEAA8C;AAC9C,+FAAsE;AACtE,+DAAmG;AACnG,mDAAgF;AAChF,0EAAgD;AAChD,sFAAgG;AAChG,sFAAsF;AACtF,oGAA4G;AAC5G,gHAAkH;AAClH,oGAA4G;AAC5G,8EAAoD;AACpD,kEAAsE;AACtE,8EAAsE;AACtE,oDAAyD;AACzD,8DAAiE;AA4BjE,MAAM,uBAAuB,GAAG,IAAA,4CAA0B,GAAE,CAAC;AAC7D,IAAI,yBAAyB,GAAG,KAAK,CAAC;AACtC,IAAI,aAAkC,CAAC;AACvC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAC9D,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAoC,CAAC;AACzE,MAAM,wBAAwB,GAAG,IAAI,OAAO,EA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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,SAAgB,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,IAAA,4BAAgB,GAAE,CAAC;QACnB,sCAAsC,CAAC,IAAA,mCAAuB,GAAE,EAAE,MAAM,CAAC,CAAC;KAC3E;IAED,oCAAoC,EAAE,CAAC;IAEvC,IAAI,GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC;AAjBD,4EAiBC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport { createLegacyBindingContext, type ILegacyBindingContext } from '../legacy/binding-context';\nimport { getLegacyBindingContext, preLoadAllModule } from '../legacy/bootstrap';\nimport pickModule from '../picker/pick-modules';\nimport { AreaRenderContribution } from '../render/contributions/render/contributions/constants';\nimport { DrawItemInterceptor } from '../render/contributions/render/draw-interceptor';\nimport { DefaultIncrementalCanvasAreaRender } from '../render/contributions/render/incremental-area-render';\nimport { DefaultIncrementalDrawContribution } from '../render/contributions/render/incremental-draw-contribution';\nimport { DefaultIncrementalCanvasLineRender } from '../render/contributions/render/incremental-line-render';\nimport renderModule from '../render/render-modules';\nimport { GraphicRender } from '../render/contributions/render/symbol';\nimport loadRenderContributions from '../render/contributions/modules';\nimport { AutoEnablePlugins } from '../plugins/constants';\nimport { DefaultPluginService } from '../plugins/plugin-service';\n\nexport type TRuntimeContributionModuleRegistry = (\n bind: ILegacyBindingContext['bind'],\n unbind: (serviceIdentifier: ServiceIdentifier) => void,\n isBound: ILegacyBindingContext['isBound'],\n rebind: ILegacyBindingContext['rebind']\n) => void;\n\nexport type TRuntimeContributionModule =\n | ((context: ILegacyBindingContext) => void)\n | {\n registry: TRuntimeContributionModuleRegistry;\n };\n\nexport type TRuntimeContributionInstallTarget =\n | 'graphic-renderer'\n | 'draw-contribution'\n | {\n picker: ServiceIdentifier<IGraphicPicker>;\n };\n\nexport interface IRuntimeContributionModuleInstallOptions {\n app?: IApp;\n legacy?: boolean;\n targets?: TRuntimeContributionInstallTarget[];\n}\n\nconst runtimeInstallerContext = createLegacyBindingContext();\nlet runtimeInstallerPreloaded = false;\nlet runtimeGlobal: IGlobal | undefined;\nconst RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';\nconst RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';\nconst runtimeEntryKeys = new WeakMap<object, Map<string, Set<string>>>();\nconst runtimeDrawContributions = new WeakMap<object, Set<IDrawItemInterceptorContribution>>();\nconst loadedRuntimeContributionModules = new WeakMap<object, WeakSet<object>>();\nconst DEFAULT_RUNTIME_CONTRIBUTION_TARGETS: TRuntimeContributionInstallTarget[] = ['graphic-renderer'];\nconst noopUnbindRuntimeContributionService = (): void => undefined;\n\nfunction ensureRuntimeInstallerPreloaded(): void {\n if (runtimeInstallerPreloaded) {\n return;\n }\n\n runtimeInstallerPreloaded = true;\n coreModule({ bind: runtimeInstallerContext.bind });\n graphicModule({ bind: runtimeInstallerContext.bind });\n renderModule({ bind: runtimeInstallerContext.bind });\n pickModule({ bind: runtimeInstallerContext.bind, isBound: runtimeInstallerContext.isBound });\n loadBuiltinContributions(runtimeInstallerContext);\n loadRenderContributions(runtimeInstallerContext);\n}\n\nfunction resolveRuntimeNamed<T>(serviceIdentifier: ServiceIdentifier<T>, name: string): T {\n const bindingContext = getRuntimeInstallerBindingContext();\n const instance = bindingContext.getNamed(serviceIdentifier, name);\n\n if (instance == null) {\n throw new Error(`${String(serviceIdentifier)} is not configured for ${name}`);\n }\n\n return instance;\n}\n\nfunction registerRuntimeEntries<T extends { type?: string }>(\n register: (key: string, value: T) => void,\n entries: T[],\n prefix: string\n): void {\n entries.forEach((entry, index) => {\n const name = entry?.type ?? entry?.constructor?.name ?? `${prefix}-entry`;\n register(`${prefix}:${String(name)}:${index}`, entry);\n });\n}\n\nfunction getTrackedEntryKeys(registry: object, namespace: string): Set<string> {\n let namespaces = runtimeEntryKeys.get(registry);\n if (!namespaces) {\n namespaces = new Map();\n runtimeEntryKeys.set(registry, namespaces);\n }\n\n let keys = namespaces.get(namespace);\n if (!keys) {\n keys = new Set();\n namespaces.set(namespace, keys);\n }\n\n return keys;\n}\n\nfunction clearTrackedEntryKeys(registry: object, namespace: string, unregister?: (key: string) => void): void {\n const keys = getTrackedEntryKeys(registry, namespace);\n if (unregister) {\n keys.forEach(key => unregister(key));\n }\n keys.clear();\n}\n\nfunction createAppRegistryContributionProvider<T>(app: IApp, key: ServiceIdentifier<T>): IContributionProvider<T> {\n return {\n getContributions: () => app.context.registry.contribution.get(key as any) as T[]\n };\n}\n\nexport function getRuntimeInstallerBindingContext(): ILegacyBindingContext {\n ensureRuntimeInstallerPreloaded();\n return runtimeInstallerContext;\n}\n\nexport function refreshRuntimeInstallerContributions(): void {\n ContributionStore.refreshAllContributions();\n}\n\nexport function getRuntimeInstallerGlobal(): IGlobal {\n ensureRuntimeInstallerPreloaded();\n runtimeGlobal ??= new DefaultGlobal(\n createContributionProvider<IEnvContribution>(EnvContribution, runtimeInstallerContext)\n );\n return runtimeGlobal;\n}\n\nexport function configureRuntimeApplicationForApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n const global = getRuntimeInstallerGlobal();\n\n application.global = global;\n application.canvasFactory = env => bindingContext.getNamed(CanvasFactory, env);\n application.context2dFactory = env => bindingContext.getNamed(Context2dFactory, env);\n application.windowHandlerFactory = env => resolveRuntimeNamed(WindowHandlerContribution, env);\n application.windowFactory = () =>\n new DefaultWindow(global, env => resolveRuntimeNamed(WindowHandlerContribution, env));\n application.pluginServiceFactory = () =>\n new DefaultPluginService(createContributionProvider<IPlugin>(AutoEnablePlugins, bindingContext), {\n pluginRegistry: app.context.registry.plugin as any\n });\n application.incrementalDrawContributionFactory = () =>\n new DefaultIncrementalDrawContribution(\n [],\n new DefaultIncrementalCanvasLineRender(),\n new DefaultIncrementalCanvasAreaRender(\n createContributionProvider<IAreaRenderContribution>(AreaRenderContribution, bindingContext)\n ),\n createAppRegistryContributionProvider<IDrawItemInterceptorContribution>(app, DrawItemInterceptor)\n );\n}\n\nexport function installRuntimeGraphicRenderersToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const renderers = bindingContext.getAll(GraphicRender);\n const registeredKeys = getTrackedEntryKeys(app.registry.renderer as object, RUNTIME_RENDERER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.renderer as object,\n RUNTIME_RENDERER_NAMESPACE,\n app.registry.renderer.unregister?.bind(app.registry.renderer)\n );\n\n registerRuntimeEntries(\n (key, renderer) => {\n renderer?.reInit?.();\n app.registry.renderer.register(key, renderer);\n registeredKeys.add(key);\n },\n renderers as any[],\n RUNTIME_RENDERER_NAMESPACE\n );\n}\n\nexport function installRuntimeDrawContributionsToApp(app: IApp): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const contributions = bindingContext.getAll(DrawItemInterceptor) as IDrawItemInterceptorContribution[];\n const tracked =\n runtimeDrawContributions.get(app.context.registry.contribution as object) ??\n new Set<IDrawItemInterceptorContribution>();\n tracked.forEach(contribution => {\n app.context.registry.contribution.unregister?.(DrawItemInterceptor, contribution);\n });\n tracked.clear();\n runtimeDrawContributions.set(app.context.registry.contribution as object, tracked);\n const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));\n\n contributions.forEach(contribution => {\n if (!registered.has(contribution)) {\n app.context.registry.contribution.register(DrawItemInterceptor, contribution);\n registered.add(contribution);\n }\n tracked.add(contribution);\n });\n}\n\nexport function installRuntimePickersToApp<T extends IGraphicPicker>(\n app: IApp,\n serviceIdentifier: ServiceIdentifier<T>\n): void {\n const bindingContext = getRuntimeInstallerBindingContext();\n refreshRuntimeInstallerContributions();\n const pickers = bindingContext.getAll(serviceIdentifier);\n const registeredKeys = getTrackedEntryKeys(app.registry.picker as object, RUNTIME_PICKER_NAMESPACE);\n\n clearTrackedEntryKeys(\n app.registry.picker as object,\n RUNTIME_PICKER_NAMESPACE,\n app.registry.picker.unregister?.bind(app.registry.picker)\n );\n\n registerRuntimeEntries(\n (key, picker) => {\n app.registry.picker.register(key, picker);\n registeredKeys.add(key);\n },\n pickers as any[],\n RUNTIME_PICKER_NAMESPACE\n );\n}\n\nfunction getRuntimeContributionModuleIdentity(module: TRuntimeContributionModule): object {\n return module as object;\n}\n\nfunction hasLoadedRuntimeContributionModule(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): boolean {\n return loadedRuntimeContributionModules.get(context)?.has(getRuntimeContributionModuleIdentity(module)) ?? false;\n}\n\nfunction markRuntimeContributionModuleLoaded(context: ILegacyBindingContext, module: TRuntimeContributionModule): void {\n let modules = loadedRuntimeContributionModules.get(context);\n if (!modules) {\n modules = new WeakSet<object>();\n loadedRuntimeContributionModules.set(context, modules);\n }\n modules.add(getRuntimeContributionModuleIdentity(module));\n}\n\nfunction loadRuntimeContributionModuleToContext(\n context: ILegacyBindingContext,\n module: TRuntimeContributionModule\n): void {\n if (hasLoadedRuntimeContributionModule(context, module)) {\n return;\n }\n\n if (typeof module === 'function') {\n module(context);\n } else {\n module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind);\n }\n\n markRuntimeContributionModuleLoaded(context, module);\n}\n\nfunction isRuntimePickerTarget(\n target: TRuntimeContributionInstallTarget\n): target is { picker: ServiceIdentifier<IGraphicPicker> } {\n return typeof target === 'object' && target !== null && 'picker' in target;\n}\n\nfunction installRuntimeContributionTargetsToApp(\n app: IApp,\n targets: TRuntimeContributionInstallTarget[] | undefined\n): void {\n const resolvedTargets = targets ?? DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;\n let installGraphicRenderers = false;\n let installDrawContributions = false;\n const pickerTargets = new Set<ServiceIdentifier<IGraphicPicker>>();\n\n resolvedTargets.forEach(target => {\n if (target === 'graphic-renderer') {\n installGraphicRenderers = true;\n } else if (target === 'draw-contribution') {\n installDrawContributions = true;\n } else if (isRuntimePickerTarget(target)) {\n pickerTargets.add(target.picker);\n }\n });\n\n if (installDrawContributions) {\n installRuntimeDrawContributionsToApp(app);\n }\n if (installGraphicRenderers) {\n installRuntimeGraphicRenderersToApp(app);\n }\n pickerTargets.forEach(serviceIdentifier => {\n installRuntimePickersToApp(app, serviceIdentifier);\n });\n}\n\nexport function installRuntimeContributionModule(\n module: TRuntimeContributionModule,\n { app, legacy = true, targets }: IRuntimeContributionModuleInstallOptions = {}\n): void {\n const runtimeContext = getRuntimeInstallerBindingContext();\n loadRuntimeContributionModuleToContext(runtimeContext, module);\n\n if (legacy) {\n preLoadAllModule();\n loadRuntimeContributionModuleToContext(getLegacyBindingContext(), module);\n }\n\n refreshRuntimeInstallerContributions();\n\n if (app) {\n installRuntimeContributionTargetsToApp(app, targets);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/entries/runtime-installer.ts"],"names":[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EAAE,MAAM,CAAC,CAAC;KAC3E;IAED,oCAAoC,EAAE,CAAC;IAEvC,IAAI,GAAG,EAAE;QACP,sCAAsC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACtD;AACH,CAAC;AAjBD,4EAiBC","file":"runtime-installer.js","sourcesContent":["import type {\n IContributionProvider,\n IAreaRenderContribution,\n IDrawItemInterceptorContribution,\n IEnvContribution,\n IGlobal,\n IGraphicPicker,\n IPlugin\n} from '../interface';\nimport type { IApp } from './types';\nimport { application } from '../application';\nimport { CanvasFactory, Context2dFactory } from '../canvas/constants';\nimport { ContributionStore, createContributionProvider } from '../common/contribution-provider';\nimport type { ServiceIdentifier } from '../common/explicit-binding';\nimport { EnvContribution } from '../constants';\nimport loadBuiltinContributions from '../core/contributions/modules';\nimport { DefaultGlobal } from '../core/global';\nimport { WindowHandlerContribution, DefaultWindow } from '../core/window';\nimport coreModule from '../core/core-modules';\nimport graphicModule from '../graphic/graphic-service/graphic-module';\nimport 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,19 @@
1
+ "use strict";
2
+
3
+ function createFactoryState() {
4
+ return {
5
+ pluginClasses: {}
6
+ };
7
+ }
8
+
9
+ function getFactoryState() {
10
+ const scope = globalThis;
11
+ return scope[exports.FACTORY_STATE_SYMBOL] || (scope[exports.FACTORY_STATE_SYMBOL] = createFactoryState()),
12
+ scope[exports.FACTORY_STATE_SYMBOL];
13
+ }
14
+
15
+ Object.defineProperty(exports, "__esModule", {
16
+ value: !0
17
+ }), exports.getFactoryState = exports.FACTORY_STATE_SYMBOL = void 0, exports.FACTORY_STATE_SYMBOL = Symbol.for("@visactor/vrender-core/factory-state"),
18
+ exports.getFactoryState = getFactoryState;
19
+ //# sourceMappingURL=factory-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory-state.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAMvF,SAAS,kBAAkB;IACzB,OAAO;QACL,aAAa,EAAE,EAAE;KAClB,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,KAAK,GAAG,UAA4E,CAAC;IAE3F,IAAI,CAAC,KAAK,CAAC,4BAAoB,CAAC,EAAE;QAChC,KAAK,CAAC,4BAAoB,CAAC,GAAG,kBAAkB,EAAE,CAAC;KACpD;IAED,OAAO,KAAK,CAAC,4BAAoB,CAAkB,CAAC;AACtD,CAAC;AARD,0CAQC","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/cjs/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/cjs/factory.js CHANGED
@@ -17,7 +17,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), exports.Factory = void 0;
20
+ }), exports.getFactoryState = exports.FACTORY_STATE_SYMBOL = exports.Factory = void 0;
21
+
22
+ const factory_state_1 = require("./factory-state");
21
23
 
22
24
  class Factory {
23
25
  static registerPlugin(pluginKey, pluginClass) {
@@ -28,5 +30,19 @@ class Factory {
28
30
  }
29
31
  }
30
32
 
31
- exports.Factory = Factory, Factory._pluginClasses = {}, __exportStar(require("./factory/index"), exports);
33
+ exports.Factory = Factory, Factory._pluginClasses = (0, factory_state_1.getFactoryState)().pluginClasses;
34
+
35
+ var factory_state_2 = require("./factory-state");
36
+
37
+ Object.defineProperty(exports, "FACTORY_STATE_SYMBOL", {
38
+ enumerable: !0,
39
+ get: function() {
40
+ return factory_state_2.FACTORY_STATE_SYMBOL;
41
+ }
42
+ }), Object.defineProperty(exports, "getFactoryState", {
43
+ enumerable: !0,
44
+ get: function() {
45
+ return factory_state_2.getFactoryState;
46
+ }
47
+ }), __exportStar(require("./factory/index"), exports);
32
48
  //# sourceMappingURL=factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAa,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;;AATH,0BAUC;AATgB,sBAAc,GAAwB,EAAE,CAAC;AAW1D,kDAAgC","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,mDAAkD;AAElD,MAAa,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;;AATH,0BAUC;AATgB,sBAAc,GAAG,IAAA,+BAAe,GAAE,CAAC,aAAa,CAAC;AAWlE,iDAAwE;AAA/D,qHAAA,oBAAoB,OAAA;AAAE,gHAAA,eAAe,OAAA;AAE9C,kDAAgC","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';
@@ -2,48 +2,34 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.createGraphic = exports.registerGraphic = exports.graphicCreator = void 0;
5
+ }), exports.registerGraphic = exports.getGraphicRegistryState = exports.graphicCreator = exports.GRAPHIC_REGISTRY_SYMBOL = exports.createGraphic = void 0;
6
6
 
7
- const graphic_factory_1 = require("../factory/graphic-factory");
7
+ var graphic_registry_1 = require("./graphic-registry");
8
8
 
9
- function createGraphicCtor(creator) {
10
- return class {
11
- constructor(attributes) {
12
- try {
13
- return new creator(attributes);
14
- } catch (error) {
15
- return creator(attributes);
16
- }
17
- }
18
- };
19
- }
20
-
21
- const sharedGraphicFactory = new graphic_factory_1.GraphicFactory;
22
-
23
- class GraphicCreator {
24
- constructor() {
25
- this.store = new Map;
9
+ Object.defineProperty(exports, "createGraphic", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return graphic_registry_1.createGraphic;
26
13
  }
27
- registerStore(name, creator) {
28
- this.store.set(name, creator), this[name] = creator;
14
+ }), Object.defineProperty(exports, "GRAPHIC_REGISTRY_SYMBOL", {
15
+ enumerable: !0,
16
+ get: function() {
17
+ return graphic_registry_1.GRAPHIC_REGISTRY_SYMBOL;
29
18
  }
30
- RegisterGraphicCreator(name, creator) {
31
- registerGraphic(name, creator);
19
+ }), Object.defineProperty(exports, "graphicCreator", {
20
+ enumerable: !0,
21
+ get: function() {
22
+ return graphic_registry_1.graphicCreator;
32
23
  }
33
- CreateGraphic(name, attributes) {
34
- return this.store.has(name) ? createGraphic(name, attributes) : null;
24
+ }), Object.defineProperty(exports, "getGraphicRegistryState", {
25
+ enumerable: !0,
26
+ get: function() {
27
+ return graphic_registry_1.getGraphicRegistryState;
35
28
  }
36
- }
37
-
38
- function registerGraphic(name, creator) {
39
- if (!name) throw new Error("Graphic registration requires a non-empty graphic type");
40
- exports.graphicCreator.registerStore(name, creator), sharedGraphicFactory.register(name, createGraphicCtor(creator));
41
- }
42
-
43
- function createGraphic(name, attributes) {
44
- return sharedGraphicFactory.create(name, attributes);
45
- }
46
-
47
- exports.graphicCreator = new GraphicCreator, exports.registerGraphic = registerGraphic,
48
- exports.createGraphic = createGraphic;
29
+ }), Object.defineProperty(exports, "registerGraphic", {
30
+ enumerable: !0,
31
+ get: function() {
32
+ return graphic_registry_1.registerGraphic;
33
+ }
34
+ });
49
35
  //# sourceMappingURL=graphic-creator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/graphic-creator.ts"],"names":[],"mappings":";;;AA8BA,gEAA4D;AAO5D,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,oBAAoB,GAAG,IAAI,gCAAc,EAAE,CAAC;AAElD,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;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;AAEnD,SAAgB,eAAe,CAC7B,IAAY,EACZ,OAAsD;IAEtD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,sBAAc,CAAC,aAAa,CAAC,IAAI,EAAE,OAAiC,CAAC,CAAC;IACtE,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AAVD,0CAUC;AAED,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAAuB;IAEvB,OAAO,oBAAoB,CAAC,MAAM,CAAwB,IAAI,EAAE,UAAU,CAAC,CAAC;AAC9E,CAAC;AALD,sCAKC","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,uDAM4B;AAL1B,iHAAA,aAAa,OAAA;AACb,2HAAA,uBAAuB,OAAA;AACvB,kHAAA,cAAc,OAAA;AACd,2HAAA,uBAAuB,OAAA;AACvB,mHAAA,eAAe,OAAA","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,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.createGraphic = exports.registerGraphic = exports.graphicCreator = exports.getGraphicRegistryState = exports.GRAPHIC_REGISTRY_SYMBOL = void 0;
6
+
7
+ const graphic_factory_1 = require("../factory/graphic-factory");
8
+
9
+ function createGraphicCtor(creator) {
10
+ return class {
11
+ constructor(attributes) {
12
+ try {
13
+ return new creator(attributes);
14
+ } catch (error) {
15
+ return creator(attributes);
16
+ }
17
+ }
18
+ };
19
+ }
20
+
21
+ class GraphicCreator {
22
+ constructor() {
23
+ this.store = new Map;
24
+ }
25
+ registerStore(name, creator) {
26
+ this.store.set(name, creator), this[name] = creator;
27
+ }
28
+ RegisterGraphicCreator(name, creator) {
29
+ registerGraphic(name, creator);
30
+ }
31
+ CreateGraphic(name, attributes) {
32
+ return this.store.has(name) ? createGraphic(name, attributes) : null;
33
+ }
34
+ }
35
+
36
+ function createGraphicRegistryState() {
37
+ return {
38
+ graphicCreator: new GraphicCreator,
39
+ graphicFactory: new graphic_factory_1.GraphicFactory
40
+ };
41
+ }
42
+
43
+ function getGraphicRegistryState() {
44
+ const scope = globalThis;
45
+ return scope[exports.GRAPHIC_REGISTRY_SYMBOL] || (scope[exports.GRAPHIC_REGISTRY_SYMBOL] = createGraphicRegistryState()),
46
+ scope[exports.GRAPHIC_REGISTRY_SYMBOL];
47
+ }
48
+
49
+ exports.GRAPHIC_REGISTRY_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-registry"),
50
+ exports.getGraphicRegistryState = getGraphicRegistryState;
51
+
52
+ const sharedGraphicRegistry = getGraphicRegistryState();
53
+
54
+ function registerGraphic(name, creator) {
55
+ if (!name) throw new Error("Graphic registration requires a non-empty graphic type");
56
+ exports.graphicCreator.registerStore(name, creator), sharedGraphicRegistry.graphicFactory.register(name, createGraphicCtor(creator));
57
+ }
58
+
59
+ function createGraphic(name, attributes) {
60
+ return sharedGraphicRegistry.graphicFactory.create(name, attributes);
61
+ }
62
+
63
+ exports.graphicCreator = sharedGraphicRegistry.graphicCreator, exports.registerGraphic = registerGraphic,
64
+ exports.createGraphic = createGraphic;
65
+ //# sourceMappingURL=graphic-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graphic/graphic-registry.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAqC5D,SAAS,iBAAiB,CACxB,OAAsD;IAEtD,OAAO,MAAM,qBAAqB;QA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B,EAAE,CAAC;AAE3C,QAAA,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC;AAEnE,SAAgB,eAAe,CAC7B,IAAY,EACZ,OAAsD;IAEtD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,sBAAc,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;AAVD,0CAUC;AAED,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAAuB;IAEvB,OAAO,qBAAqB,CAAC,cAAc,CAAC,MAAM,CAAwB,IAAI,EAAE,UAAU,CAAC,CAAC;AAC9F,CAAC;AALD,sCAKC","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"]}
@@ -57,7 +57,7 @@ export declare const NOWORK_ANIMATE_ATTR: {
57
57
  cursor: number;
58
58
  html: number;
59
59
  };
60
- export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> extends Node implements IGraphic<T>, IAnimateTarget {
60
+ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> extends Node implements IGraphic<T>, IAnimateTarget {
61
61
  static mixin(source: Dict<any>): void;
62
62
  _events?: any;
63
63
  context?: Record<string, any>;
@@ -320,4 +320,11 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
320
320
  abstract clone(): IGraphic<any>;
321
321
  toCustomPath(): ICustomPath2D;
322
322
  }
323
+ export type Graphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> = GraphicImpl<T>;
324
+ export declare const GRAPHIC_CLASS_SYMBOL: unique symbol;
325
+ export interface IGraphicClassState {
326
+ Graphic: typeof GraphicImpl;
327
+ }
328
+ export declare function getGraphicClassState(): IGraphicClassState;
329
+ export declare const Graphic: typeof GraphicImpl;
323
330
  export {};
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.Graphic = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
5
+ }), exports.Graphic = exports.getGraphicClassState = exports.GRAPHIC_CLASS_SYMBOL = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), builtin_symbol_1 = require("./builtin-symbol"), xml_1 = require("../common/xml"), constants_1 = require("./constants"), config_2 = require("../animate/config"), canvas_1 = require("../canvas"), state_definition_compiler_1 = require("./state/state-definition-compiler"), state_engine_1 = require("./state/state-engine"), attribute_update_classifier_1 = require("./state/attribute-update-classifier"), state_transition_orchestrator_1 = require("./state/state-transition-orchestrator"), shared_state_scope_1 = require("./state/shared-state-scope"), shared_state_refresh_1 = require("./state/shared-state-refresh"), _tempBounds = new vutils_1.AABBBounds, loadShadowRootFactory = () => require("./shadow-root"), tempMatrix = new vutils_1.Matrix;
8
8
 
@@ -78,12 +78,12 @@ exports.NOWORK_ANIMATE_ATTR = {
78
78
  html: 1
79
79
  };
80
80
 
81
- class Graphic extends node_tree_1.Node {
81
+ class GraphicImpl extends node_tree_1.Node {
82
82
  static mixin(source) {
83
83
  const keys = Object.keys(source);
84
84
  for (let i = 0; i < keys.length; ++i) {
85
85
  const propertyName = keys[i];
86
- Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
86
+ Object.defineProperty(this.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
87
87
  }
88
88
  }
89
89
  get AABBBounds() {
@@ -522,7 +522,7 @@ class Graphic extends node_tree_1.Node {
522
522
  if (!symbolType) return null;
523
523
  let path = builtin_symbol_1.builtinSymbolsMap[symbolType];
524
524
  if (path) return path;
525
- if (path = Graphic.userSymbolMap[symbolType], path) return path;
525
+ if (path = exports.Graphic.userSymbolMap[symbolType], path) return path;
526
526
  symbolType = builtin_symbol_1.builtInSymbolStrMap[symbolType] || symbolType;
527
527
  if (!0 === (0, xml_1.isSvg)(symbolType)) {
528
528
  const parser = new xml_1.XMLParser, {svg: svg} = parser.parse(symbolType);
@@ -543,13 +543,13 @@ class Graphic extends node_tree_1.Node {
543
543
  vutils_1.max)(width, height);
544
544
  cacheList.forEach((cache => cache.path.transform(0, 0, scale, scale)));
545
545
  const _parsedPath = new builtin_symbol_1.CustomSymbolClass(symbolType, cacheList, !0);
546
- return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
546
+ return exports.Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
547
547
  }
548
548
  const cache = (new custom_path2d_1.CustomPath2D).fromString(symbolType), width = cache.bounds.width(), height = cache.bounds.height(), scale = 1 / (0,
549
549
  vutils_1.max)(width, height);
550
550
  cache.transform(0, 0, scale, scale);
551
551
  const _parsedPath = new builtin_symbol_1.CustomSymbolClass(symbolType, cache);
552
- return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
552
+ return exports.Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
553
553
  }
554
554
  doUpdateAABBBounds(full, graphicTheme) {
555
555
  this.updateAABBBoundsStamp++;
@@ -1325,6 +1325,19 @@ class Graphic extends node_tree_1.Node {
1325
1325
  }
1326
1326
  }
1327
1327
 
1328
+ function createGraphicClassState() {
1329
+ return {
1330
+ Graphic: GraphicImpl
1331
+ };
1332
+ }
1333
+
1334
+ function getGraphicClassState() {
1335
+ var _a;
1336
+ const globalScope = globalThis;
1337
+ return null !== (_a = globalScope[exports.GRAPHIC_CLASS_SYMBOL]) && void 0 !== _a || (globalScope[exports.GRAPHIC_CLASS_SYMBOL] = createGraphicClassState()),
1338
+ globalScope[exports.GRAPHIC_CLASS_SYMBOL];
1339
+ }
1340
+
1328
1341
  function backgroundNotImage(image) {
1329
1342
  return "string" == typeof image ? !(image.startsWith("<svg") || (0, vutils_1.isValidUrl)(image) || image.includes("/") || (0,
1330
1343
  vutils_1.isBase64)(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
@@ -1336,5 +1349,7 @@ function isExternalTexture(texture) {
1336
1349
  vutils_1.isObject)(texture));
1337
1350
  }
1338
1351
 
1339
- exports.Graphic = Graphic, Graphic.userSymbolMap = {}, Graphic.mixin(event_1.EventTarget);
1352
+ GraphicImpl.userSymbolMap = {}, exports.GRAPHIC_CLASS_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-class"),
1353
+ exports.getGraphicClassState = getGraphicClassState, exports.Graphic = getGraphicClassState().Graphic,
1354
+ exports.Graphic.mixin(event_1.EventTarget);
1340
1355
  //# sourceMappingURL=graphic.js.map