@visactor/vrender-core 1.1.0-alpha.24 → 1.1.0-alpha.26
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.
- package/cjs/common/event-listener-manager.js +1 -2
- package/cjs/common/event-transformer.js +2 -1
- package/cjs/common/performance-raf.js +1 -1
- package/cjs/common/xml/is-xml.d.ts +2 -0
- package/cjs/common/xml/is-xml.js +14 -0
- package/cjs/common/xml/is-xml.js.map +1 -0
- package/cjs/common/xml/parser.d.ts +2 -2
- package/cjs/common/xml/parser.js +14 -11
- package/cjs/common/xml/parser.js.map +1 -1
- package/cjs/container.d.ts +2 -0
- package/cjs/container.js +50 -0
- package/cjs/container.js.map +1 -0
- package/cjs/core/graphic-utils.js +1 -2
- package/cjs/core/layer-service.js +2 -1
- package/cjs/core/stage.d.ts +0 -9
- package/cjs/core/stage.js +11 -29
- package/cjs/core/stage.js.map +1 -1
- package/cjs/entries/miniapp.d.ts +0 -1
- package/cjs/entries/miniapp.js +1 -5
- package/cjs/entries/miniapp.js.map +1 -1
- package/cjs/entries/node.d.ts +0 -1
- package/cjs/entries/node.js +1 -5
- package/cjs/entries/node.js.map +1 -1
- package/cjs/env.d.ts +1 -0
- package/cjs/env.js +25 -0
- package/cjs/env.js.map +1 -0
- package/cjs/event/public-constant.d.ts +7 -0
- package/cjs/event/public-constant.js +100 -0
- package/cjs/event/public-constant.js.map +1 -0
- package/cjs/event/util.d.ts +1 -1
- package/cjs/graphic/base.d.ts +2 -0
- package/cjs/graphic/base.js +15 -0
- package/cjs/graphic/base.js.map +1 -0
- package/cjs/graphic/creator.d.ts +16 -0
- package/cjs/graphic/creator.js +160 -0
- package/cjs/graphic/creator.js.map +1 -0
- package/cjs/graphic/glyph.js +4 -8
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +0 -1
- package/cjs/graphic/graphic-service/graphic-service.js +1 -8
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +19 -29
- package/cjs/graphic/graphic.js +123 -201
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.d.ts +1 -3
- package/cjs/graphic/group.js +22 -28
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/modules.d.ts +16 -0
- package/cjs/graphic/modules.js +150 -0
- package/cjs/graphic/modules.js.map +1 -0
- package/cjs/graphic/node-tree.d.ts +3 -3
- package/cjs/graphic/node-tree.js +1 -0
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/state/shared-state-refresh.js +11 -32
- package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
- package/cjs/graphic/state/shared-state-scope.d.ts +2 -5
- package/cjs/graphic/state/shared-state-scope.js +8 -27
- package/cjs/graphic/state/shared-state-scope.js.map +1 -1
- package/cjs/graphic/state/state-definition-compiler.js +4 -5
- package/cjs/graphic/state/state-definition-compiler.js.map +1 -1
- package/cjs/graphic/state/state-definition.d.ts +2 -5
- package/cjs/graphic/state/state-definition.js.map +1 -1
- package/cjs/graphic/state/state-engine.d.ts +0 -5
- package/cjs/graphic/state/state-engine.js +20 -70
- package/cjs/graphic/state/state-engine.js.map +1 -1
- package/cjs/graphic/state/state-transition-orchestrator.d.ts +7 -9
- package/cjs/graphic/state/state-transition-orchestrator.js +10 -13
- package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
- package/cjs/graphic/tools.js +3 -3
- package/cjs/graphic/tools.js.map +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/interface/graphic/group.d.ts +0 -2
- package/cjs/interface/graphic/group.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -5
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/index.js.map +1 -1
- package/cjs/interface/node-tree.d.ts +3 -0
- package/cjs/interface/node-tree.js.map +1 -1
- package/cjs/interface/stage.d.ts +0 -7
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/interpolate.d.ts +2 -0
- package/cjs/interpolate.js +34 -0
- package/cjs/interpolate.js.map +1 -0
- package/cjs/modules.js.map +1 -1
- package/cjs/path.d.ts +4 -0
- package/cjs/path.js +33 -0
- package/cjs/path.js.map +1 -0
- package/cjs/plugin/3d.d.ts +3 -0
- package/cjs/plugin/3d.js +33 -0
- package/cjs/plugin/3d.js.map +1 -0
- package/cjs/plugin/attribute.d.ts +2 -0
- package/cjs/plugin/attribute.js +24 -0
- package/cjs/plugin/attribute.js.map +1 -0
- package/cjs/plugin/flex-layout.d.ts +1 -0
- package/cjs/plugin/flex-layout.js +15 -0
- package/cjs/plugin/flex-layout.js.map +1 -0
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/index.d.ts +0 -4
- package/cjs/plugins/index.js +1 -3
- package/cjs/plugins/index.js.map +1 -1
- package/cjs/plugins/plugin-service.d.ts +0 -1
- package/cjs/plugins/plugin-service.js +2 -3
- package/cjs/plugins/plugin-service.js.map +1 -1
- package/cjs/plugins/types.d.ts +1 -8
- package/cjs/plugins/types.js.map +1 -1
- package/cjs/register/graphic.d.ts +19 -0
- package/cjs/register/graphic.js +177 -0
- package/cjs/register/graphic.js.map +1 -0
- package/cjs/registry/contribution-registry.d.ts +0 -1
- package/cjs/registry/contribution-registry.js +0 -3
- package/cjs/registry/contribution-registry.js.map +1 -1
- package/cjs/registry/picker-registry.d.ts +0 -1
- package/cjs/registry/picker-registry.js +0 -3
- package/cjs/registry/picker-registry.js.map +1 -1
- package/cjs/registry/renderer-registry.d.ts +0 -1
- package/cjs/registry/renderer-registry.js +0 -3
- package/cjs/registry/renderer-registry.js.map +1 -1
- package/cjs/registry/types.d.ts +0 -3
- package/cjs/registry/types.js.map +1 -1
- package/cjs/svg.d.ts +1 -0
- package/cjs/svg.js +15 -0
- package/cjs/svg.js.map +1 -0
- package/cjs/text.d.ts +2 -0
- package/cjs/text.js +29 -0
- package/cjs/text.js.map +1 -0
- package/dist/index.es.js +897 -2213
- package/es/common/event-listener-manager.js +1 -2
- package/es/common/event-transformer.js +2 -1
- package/es/common/performance-raf.js +1 -1
- package/es/common/xml/is-xml.d.ts +2 -0
- package/es/common/xml/is-xml.js +8 -0
- package/es/common/xml/is-xml.js.map +1 -0
- package/es/common/xml/parser.d.ts +2 -2
- package/es/common/xml/parser.js +3 -7
- package/es/common/xml/parser.js.map +1 -1
- package/es/container.d.ts +2 -0
- package/es/container.js +2 -0
- package/es/container.js.map +1 -0
- package/es/core/graphic-utils.js +1 -2
- package/es/core/layer-service.js +2 -1
- package/es/core/stage.d.ts +0 -9
- package/es/core/stage.js +9 -30
- package/es/core/stage.js.map +1 -1
- package/es/entries/miniapp.d.ts +0 -1
- package/es/entries/miniapp.js +1 -5
- package/es/entries/miniapp.js.map +1 -1
- package/es/entries/node.d.ts +0 -1
- package/es/entries/node.js +1 -5
- package/es/entries/node.js.map +1 -1
- package/es/env.d.ts +1 -0
- package/es/env.js +2 -0
- package/es/env.js.map +1 -0
- package/es/event/public-constant.d.ts +7 -0
- package/es/event/public-constant.js +12 -0
- package/es/event/public-constant.js.map +1 -0
- package/es/event/util.d.ts +1 -1
- package/es/graphic/base.d.ts +2 -0
- package/es/graphic/base.js +2 -0
- package/es/graphic/base.js.map +1 -0
- package/es/graphic/creator.d.ts +16 -0
- package/es/graphic/creator.js +32 -0
- package/es/graphic/creator.js.map +1 -0
- package/es/graphic/glyph.js +4 -8
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +0 -1
- package/es/graphic/graphic-service/graphic-service.js +0 -10
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +19 -29
- package/es/graphic/graphic.js +123 -207
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.d.ts +1 -3
- package/es/graphic/group.js +22 -28
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/modules.d.ts +16 -0
- package/es/graphic/modules.js +32 -0
- package/es/graphic/modules.js.map +1 -0
- package/es/graphic/node-tree.d.ts +3 -3
- package/es/graphic/node-tree.js +1 -0
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/state/shared-state-refresh.js +8 -28
- package/es/graphic/state/shared-state-refresh.js.map +1 -1
- package/es/graphic/state/shared-state-scope.d.ts +2 -5
- package/es/graphic/state/shared-state-scope.js +7 -28
- package/es/graphic/state/shared-state-scope.js.map +1 -1
- package/es/graphic/state/state-definition-compiler.js +4 -5
- package/es/graphic/state/state-definition-compiler.js.map +1 -1
- package/es/graphic/state/state-definition.d.ts +2 -5
- package/es/graphic/state/state-definition.js.map +1 -1
- package/es/graphic/state/state-engine.d.ts +0 -5
- package/es/graphic/state/state-engine.js +17 -67
- package/es/graphic/state/state-engine.js.map +1 -1
- package/es/graphic/state/state-transition-orchestrator.d.ts +7 -9
- package/es/graphic/state/state-transition-orchestrator.js +10 -13
- package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
- package/es/graphic/tools.js +3 -3
- package/es/graphic/tools.js.map +1 -1
- package/es/index.js.map +1 -1
- package/es/interface/graphic/group.d.ts +0 -2
- package/es/interface/graphic/group.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -5
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/index.js.map +1 -1
- package/es/interface/node-tree.d.ts +3 -0
- package/es/interface/node-tree.js.map +1 -1
- package/es/interface/stage.d.ts +0 -7
- package/es/interface/stage.js.map +1 -1
- package/es/interpolate.d.ts +2 -0
- package/es/interpolate.js +4 -0
- package/es/interpolate.js.map +1 -0
- package/es/modules.js.map +1 -1
- package/es/path.d.ts +4 -0
- package/es/path.js +6 -0
- package/es/path.js.map +1 -0
- package/es/plugin/3d.d.ts +3 -0
- package/es/plugin/3d.js +6 -0
- package/es/plugin/3d.js.map +1 -0
- package/es/plugin/attribute.d.ts +2 -0
- package/es/plugin/attribute.js +4 -0
- package/es/plugin/attribute.js.map +1 -0
- package/es/plugin/flex-layout.d.ts +1 -0
- package/es/plugin/flex-layout.js +2 -0
- package/es/plugin/flex-layout.js.map +1 -0
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/index.d.ts +0 -4
- package/es/plugins/index.js +0 -8
- package/es/plugins/index.js.map +1 -1
- package/es/plugins/plugin-service.d.ts +0 -1
- package/es/plugins/plugin-service.js +2 -3
- package/es/plugins/plugin-service.js.map +1 -1
- package/es/plugins/types.d.ts +1 -8
- package/es/plugins/types.js.map +1 -1
- package/es/register/graphic.d.ts +19 -0
- package/es/register/graphic.js +38 -0
- package/es/register/graphic.js.map +1 -0
- package/es/registry/contribution-registry.d.ts +0 -1
- package/es/registry/contribution-registry.js +0 -3
- package/es/registry/contribution-registry.js.map +1 -1
- package/es/registry/picker-registry.d.ts +0 -1
- package/es/registry/picker-registry.js +0 -3
- package/es/registry/picker-registry.js.map +1 -1
- package/es/registry/renderer-registry.d.ts +0 -1
- package/es/registry/renderer-registry.js +0 -3
- package/es/registry/renderer-registry.js.map +1 -1
- package/es/registry/types.d.ts +0 -3
- package/es/registry/types.js.map +1 -1
- package/es/svg.d.ts +1 -0
- package/es/svg.js +2 -0
- package/es/svg.js.map +1 -0
- package/es/text.d.ts +2 -0
- package/es/text.js +4 -0
- package/es/text.js.map +1 -0
- package/package.json +245 -1
- package/cjs/allocator/constants.d.ts +0 -9
- package/cjs/allocator/constants.js +0 -11
- package/cjs/allocator/constants.js.map +0 -1
- package/cjs/common/Reflect-metadata.d.ts +0 -2
- package/cjs/common/Reflect-metadata.js +0 -182
- package/cjs/common/Reflect-metadata.js.map +0 -1
- package/cjs/common/segment/curve/arc.d.ts +0 -17
- package/cjs/common/segment/curve/arc.js +0 -38
- package/cjs/common/segment/curve/arc.js.map +0 -1
- package/cjs/common/segment/curve/ellipse.d.ts +0 -21
- package/cjs/common/segment/curve/ellipse.js +0 -39
- package/cjs/common/segment/curve/ellipse.js.map +0 -1
- package/cjs/common/segment/curve/move.d.ts +0 -16
- package/cjs/common/segment/curve/move.js +0 -37
- package/cjs/common/segment/curve/move.js.map +0 -1
- package/cjs/common/store.d.ts +0 -2
- package/cjs/common/store.js +0 -2
- package/cjs/common/store.js.map +0 -1
- package/cjs/core/application.d.ts +0 -1
- package/cjs/core/application.js +0 -6
- package/cjs/core/application.js.map +0 -1
- package/cjs/core/global-module.d.ts +0 -1
- package/cjs/core/global-module.js +0 -1
- package/cjs/core/global-module.js.map +0 -1
- package/cjs/export.d.ts +0 -1
- package/cjs/export.js +0 -1
- package/cjs/export.js.map +0 -1
- package/cjs/graphic/state/state-batch-scheduler.d.ts +0 -42
- package/cjs/graphic/state/state-batch-scheduler.js +0 -285
- package/cjs/graphic/state/state-batch-scheduler.js.map +0 -1
- package/cjs/graphic/state/state-model.d.ts +0 -43
- package/cjs/graphic/state/state-model.js +0 -143
- package/cjs/graphic/state/state-model.js.map +0 -1
- package/cjs/graphic/state/state-perf-monitor.d.ts +0 -120
- package/cjs/graphic/state/state-perf-monitor.js +0 -224
- package/cjs/graphic/state/state-perf-monitor.js.map +0 -1
- package/cjs/graphic/state/state-style-resolver.d.ts +0 -13
- package/cjs/graphic/state/state-style-resolver.js +0 -50
- package/cjs/graphic/state/state-style-resolver.js.map +0 -1
- package/cjs/interface/animate.d.ts +0 -1
- package/cjs/interface/animate.js +0 -3
- package/cjs/interface/animate.js.map +0 -1
- package/cjs/interface/creator.d.ts +0 -4
- package/cjs/interface/creator.js +0 -6
- package/cjs/interface/creator.js.map +0 -1
- package/cjs/interface/graphic/dynamic-path.d.ts +0 -1
- package/cjs/interface/graphic/dynamic-path.js +0 -3
- package/cjs/interface/graphic/dynamic-path.js.map +0 -1
- package/cjs/interface/graphic-utils.d.ts +0 -1
- package/cjs/interface/graphic-utils.js +0 -3
- package/cjs/interface/graphic-utils.js.map +0 -1
- package/cjs/interface/theme-service.d.ts +0 -1
- package/cjs/interface/theme-service.js +0 -3
- package/cjs/interface/theme-service.js.map +0 -1
- package/cjs/plugins/base-plugin.d.ts +0 -8
- package/cjs/plugins/base-plugin.js +0 -15
- package/cjs/plugins/base-plugin.js.map +0 -1
- package/cjs/plugins/browser-env-plugin.d.ts +0 -8
- package/cjs/plugins/browser-env-plugin.js +0 -24
- package/cjs/plugins/browser-env-plugin.js.map +0 -1
- package/cjs/plugins/builtin-plugin/poptip-plugin.d.ts +0 -1
- package/cjs/plugins/builtin-plugin/poptip-plugin.js +0 -3
- package/cjs/plugins/builtin-plugin/poptip-plugin.js.map +0 -1
- package/cjs/plugins/picker-plugin.d.ts +0 -7
- package/cjs/plugins/picker-plugin.js +0 -19
- package/cjs/plugins/picker-plugin.js.map +0 -1
- package/cjs/plugins/renderer-plugin.d.ts +0 -7
- package/cjs/plugins/renderer-plugin.js +0 -19
- package/cjs/plugins/renderer-plugin.js.map +0 -1
- package/cjs/render/contributions/render/clear-screen.d.ts +0 -1
- package/cjs/render/contributions/render/clear-screen.js +0 -3
- package/cjs/render/contributions/render/clear-screen.js.map +0 -1
- package/cjs/render/contributions/render/render-slector.d.ts +0 -1
- package/cjs/render/contributions/render/render-slector.js +0 -3
- package/cjs/render/contributions/render/render-slector.js.map +0 -1
- package/es/allocator/constants.d.ts +0 -9
- package/es/allocator/constants.js +0 -18
- package/es/allocator/constants.js.map +0 -1
- package/es/common/Reflect-metadata.d.ts +0 -2
- package/es/common/Reflect-metadata.js +0 -178
- package/es/common/Reflect-metadata.js.map +0 -1
- package/es/common/segment/curve/arc.d.ts +0 -17
- package/es/common/segment/curve/arc.js +0 -31
- package/es/common/segment/curve/arc.js.map +0 -1
- package/es/common/segment/curve/ellipse.d.ts +0 -21
- package/es/common/segment/curve/ellipse.js +0 -33
- package/es/common/segment/curve/ellipse.js.map +0 -1
- package/es/common/segment/curve/move.d.ts +0 -16
- package/es/common/segment/curve/move.js +0 -31
- package/es/common/segment/curve/move.js.map +0 -1
- package/es/common/store.d.ts +0 -2
- package/es/common/store.js +0 -2
- package/es/common/store.js.map +0 -1
- package/es/core/application.d.ts +0 -1
- package/es/core/application.js +0 -2
- package/es/core/application.js.map +0 -1
- package/es/core/global-module.d.ts +0 -1
- package/es/core/global-module.js +0 -1
- package/es/core/global-module.js.map +0 -1
- package/es/export.d.ts +0 -1
- package/es/export.js +0 -1
- package/es/export.js.map +0 -1
- package/es/graphic/state/state-batch-scheduler.d.ts +0 -42
- package/es/graphic/state/state-batch-scheduler.js +0 -278
- package/es/graphic/state/state-batch-scheduler.js.map +0 -1
- package/es/graphic/state/state-model.d.ts +0 -43
- package/es/graphic/state/state-model.js +0 -135
- package/es/graphic/state/state-model.js.map +0 -1
- package/es/graphic/state/state-perf-monitor.d.ts +0 -120
- package/es/graphic/state/state-perf-monitor.js +0 -214
- package/es/graphic/state/state-perf-monitor.js.map +0 -1
- package/es/graphic/state/state-style-resolver.d.ts +0 -13
- package/es/graphic/state/state-style-resolver.js +0 -42
- package/es/graphic/state/state-style-resolver.js.map +0 -1
- package/es/interface/animate.d.ts +0 -1
- package/es/interface/animate.js +0 -3
- package/es/interface/animate.js.map +0 -1
- package/es/interface/creator.d.ts +0 -4
- package/es/interface/creator.js +0 -2
- package/es/interface/creator.js.map +0 -1
- package/es/interface/graphic/dynamic-path.d.ts +0 -1
- package/es/interface/graphic/dynamic-path.js +0 -3
- package/es/interface/graphic/dynamic-path.js.map +0 -1
- package/es/interface/graphic-utils.d.ts +0 -1
- package/es/interface/graphic-utils.js +0 -3
- package/es/interface/graphic-utils.js.map +0 -1
- package/es/interface/theme-service.d.ts +0 -1
- package/es/interface/theme-service.js +0 -3
- package/es/interface/theme-service.js.map +0 -1
- package/es/plugins/base-plugin.d.ts +0 -8
- package/es/plugins/base-plugin.js +0 -7
- package/es/plugins/base-plugin.js.map +0 -1
- package/es/plugins/browser-env-plugin.d.ts +0 -8
- package/es/plugins/browser-env-plugin.js +0 -16
- package/es/plugins/browser-env-plugin.js.map +0 -1
- package/es/plugins/builtin-plugin/poptip-plugin.d.ts +0 -1
- package/es/plugins/builtin-plugin/poptip-plugin.js +0 -3
- package/es/plugins/builtin-plugin/poptip-plugin.js.map +0 -1
- package/es/plugins/picker-plugin.d.ts +0 -7
- package/es/plugins/picker-plugin.js +0 -11
- package/es/plugins/picker-plugin.js.map +0 -1
- package/es/plugins/renderer-plugin.d.ts +0 -7
- package/es/plugins/renderer-plugin.js +0 -11
- package/es/plugins/renderer-plugin.js.map +0 -1
- package/es/render/contributions/render/clear-screen.d.ts +0 -1
- package/es/render/contributions/render/clear-screen.js +0 -3
- package/es/render/contributions/render/clear-screen.js.map +0 -1
- package/es/render/contributions/render/render-slector.d.ts +0 -1
- package/es/render/contributions/render/render-slector.js +0 -3
- package/es/render/contributions/render/render-slector.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/stage.ts"],"names":[],"mappings":"","file":"stage.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { ILayer, LayerMode } from './layer';\nimport type { IColor } from './color';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/interface/stage.ts"],"names":[],"mappings":"","file":"stage.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { ILayer, LayerMode } from './layer';\nimport type { IColor } from './color';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport type { ICamera } from './camera';\nimport type { vec3 } from './matrix';\nimport type { IDirectionLight } from './light';\nimport type { ISyncHook } from './sync-hook';\nimport type { IDrawContext, IRenderService, IRenderServiceDrawParams } from './render';\nimport type { ITicker, ITimeline } from './animation';\nimport type { IPickerService, PickResult } from './picker';\nimport type { IPlugin, IPluginService } from './plugin';\nimport type { IWindow } from './window';\nimport type { ILayerService } from './core';\nimport type { IFullThemeSpec } from './graphic/theme';\nimport type { IGraphicService } from './graphic-service';\nimport type { SharedStateScope } from '../graphic/state/shared-state-scope';\n\nexport type IExportType = 'canvas' | 'imageData';\n\nexport type IStageCreateContext = {\n appName?: 'vchart' | 'vgrammar' | 'vtable' | string;\n};\nexport interface IStageParams {\n // x: number;\n // y: number;\n // // 视口的宽高\n // viewWidth: number;\n // viewHeight: number;\n\n // 视口的宽高\n viewBox: IBoundsLike;\n // 总的宽高\n width: number;\n height: number;\n dpr: number;\n // stage的背景\n background: string | IColor;\n // 外部的canvas\n canvas: string | HTMLCanvasElement;\n // canvas的container容器,如果不传入canvas,那就会在容器中创建canvas\n container: string | HTMLElement;\n // 是否是受控制的canvas,如果不是的话,不会进行resize等操作,也不会修改canvas的样式\n canvasControled: boolean;\n title: string;\n // 是否开启自动渲染\n autoRender: boolean;\n // 是否开启自动刷新\n autoRefresh: boolean;\n // 是否开启布局支持\n enableLayout: boolean;\n // 是否关闭脏矩形检测\n disableDirtyBounds: boolean;\n // 是否支持interactiveLayer,默认为true\n interactiveLayer: boolean;\n // 是否支持HTML属性\n enableHtmlAttribute: string | boolean | HTMLElement;\n // 是否支持react-dom(传入ReactDOM)\n ReactDOM: any;\n // 是否支持滚动条\n enableScroll: boolean;\n poptip: boolean;\n // 绘制之前的钩子函数\n beforeRender: (stage: IStage) => void;\n // 绘制之后的钩子函数\n afterRender: (stage: IStage) => void;\n // 清屏之后的钩子函数\n afterClearScreen: (drawParams: any) => void;\n // 清除矩形区域之后的钩子函数\n afterClearRect: (drawParams: any) => void;\n\n renderStyle?: string;\n ticker?: ITicker;\n pluginList?: string[];\n // 优化配置\n optimize?: IOptimizeType;\n /**\n * 事件系统相关配置\n */\n event?: EventConfig;\n\n /**\n * @since 0.17.15\n * 是否支持touch事件,不支持就不监听touch事件\n */\n supportsTouchEvents?: boolean;\n\n /**\n * @since 0.17.15\n * 是否支持pointer事件,不支持就监听mouse事件\n */\n supportsPointerEvents?: boolean;\n\n context?: IStageCreateContext;\n\n // 被分配的rafId,用于renderNextFrame,避免使用大量原生的RAF\n rafId?: number;\n}\n\nexport type EventConfig = {\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /**\n * 多次点击之间的最大时间,默认为 200 ms\n * @default 200\n */\n clickInterval?: number;\n [key: string]: any;\n};\n\nexport type IOptimizeType = {\n // 视口不在可视区,跳过渲染,默认为true\n skipRenderWithOutRange?: boolean;\n // 跳过图元在区间外的判断\n // 不存在dirtyBounds的时候,根据该配置判断是否关闭图元的超出边界判定\n // 如果有dirtyBounds那么该配置不生效\n disableCheckGraphicWidthOutRange?: boolean;\n // tick渲染模式,effect会在tick之后立刻执行render,保证动画效果正常。performance模式中tick和render均是RAF,属性可能会被篡改\n // 是否开启高性能动画,默认开启\n // 开启后不会执行某些安全校验,比如跳帧处理\n // 开启后会自动降帧,最高60fps\n tickRenderMode?: 'effect' | 'performance';\n};\n\nexport interface IOption3D {\n enableView3dTransform?: boolean; // 是否开启view3d自动旋转\n alpha?: number; // x轴的转角\n beta?: number; // y轴的转角\n gama?: number; // z轴的转角\n center?: { x?: number; y?: number; z?: number; dx?: number; dy?: number; dz?: number }; // 中心位置\n fieldRatio?: number; // 透视的视域缩放比例\n fieldDepth?: number;\n light?: {\n dir?: vec3;\n color?: string;\n ambient?: number;\n };\n // 配置相机后,alpha、beta、gamma配置会失效\n camera?: any; // 相机配置\n}\n\n// TODO 命名方式\nexport interface IStage extends INode {\n stage?: IStage;\n parent: IStage | null;\n // rootNode: IStage;\n x: number;\n y: number;\n\n params: Partial<IStageParams>;\n\n window: IWindow;\n\n width: number;\n height: number;\n viewWidth: number;\n viewHeight: number;\n defaultLayer: ILayer;\n dirtyBounds: IBounds | null;\n\n autoRender: boolean;\n renderCount: number;\n\n hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n afterClearScreen: ISyncHook<[IRenderServiceDrawParams]>;\n afterClearRect: ISyncHook<[IRenderServiceDrawParams]>;\n };\n\n option3d?: IOption3D;\n\n set3dOptions: (options: IOption3D) => void;\n light?: IDirectionLight;\n camera?: ICamera;\n\n dpr: number;\n\n viewBox: IBoundsLike;\n background: string | IColor;\n ticker: ITicker;\n increaseAutoRender: boolean;\n readonly renderService: IRenderService;\n readonly graphicService: IGraphicService;\n getPickerService: () => IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n rootSharedStateScope?: SharedStateScope<Record<string, any>>;\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer: (canvasId?: string, layerMode?: LayerMode) => ILayer;\n getLayer: (name: string) => ILayer;\n sortLayer: (cb: (layer1: ILayer, layer2: ILayer) => number) => void;\n removeLayer: (layerId: number) => ILayer | false;\n\n getTimeline: () => ITimeline;\n\n render: (layers?: ILayer[], params?: Partial<IDrawContext>) => void;\n /**\n * 下一帧渲染\n * @param layers 渲染的图层\n * @param force 是否强行下一帧渲染,不采取优化方案\n * @returns\n */\n renderNextFrame: (layers?: ILayer[], force?: boolean) => void;\n tryInitInteractiveLayer: () => void;\n\n // 画布操作\n resize: (w: number, h: number, rerender?: boolean) => void;\n resizeWindow: (w: number, h: number, rerender?: boolean) => void;\n resizeView: (w: number, h: number, rerender?: boolean) => void;\n setViewBox:\n | ((viewBox: IBoundsLike, rerender: boolean) => void)\n | ((x: number, y: number, w: number, h: number, rerender: boolean) => void)\n | ((x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean) => void);\n setDpr: (dpr: number, rerender?: boolean) => void;\n setOrigin: (x: number, y: number) => void;\n export: (type: IExportType) => HTMLCanvasElement | ImageData;\n pick: (x: number, y: number) => PickResult | false;\n\n // 动画相关\n startAnimate: (t: number) => void;\n setToFrame: (t: number) => void;\n dirty: (b: IBounds, matrix?: IMatrix) => void;\n // 考虑操作回放\n\n renderTo: (window: IWindow, params: { x: number; y: number; width: number; height: number }) => void;\n\n renderToNewWindow: (fullImage?: boolean) => IWindow;\n\n toCanvas: (fullImage?: boolean, viewBox?: IAABBBounds) => HTMLCanvasElement | null;\n\n setBeforeRender: (cb: (stage: IStage) => void) => void;\n removeBeforeRender: (cb: (stage: IStage) => void) => void;\n setAfterRender: (cb: (stage: IStage) => void) => void;\n removeAfterRender: (cb: (stage: IStage) => void) => void;\n afterNextRender: (cb: (stage: IStage) => void) => void;\n enableAutoRender: () => void;\n disableAutoRender: () => void;\n enableIncrementalAutoRender: () => void;\n disableIncrementalAutoRender: () => void;\n enableDirtyBounds: () => void;\n disableDirtyBounds: () => void;\n enableView3dTransform: () => void;\n disableView3dTranform: () => void;\n getPluginsByName: (name: string) => IPlugin[];\n clearViewBox: (color?: string) => void;\n release: () => void;\n setStage: (stage?: IStage) => void;\n\n pauseRender: (sk?: number) => void;\n resumeRender: () => void;\n\n setCursor: (mode?: string) => void;\n\n getTheme: () => IFullThemeSpec;\n eventPointTransform: (e: PointerEvent | WheelEvent | TouchEvent) => { x: number; y: number };\n pauseTriggerEvent: () => void;\n resumeTriggerEvent: () => void;\n\n pauseAnimation?: (deep?: boolean) => void;\n resumeAnimation?: (deep?: boolean) => void;\n stopAnimation?: (deep?: boolean) => void;\n reApplyAnimationState?: (state: string, deep?: boolean) => this;\n}\n\nexport declare function combineStage(srages: IStage[], params: { canvas: string | HTMLCanvasElement }): IStage;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC","file":"interpolate.js","sourcesContent":["export { interpolateColor, interpolatePureColorArrayToStr } from './color-string';\nexport { pointInterpolation, pointsInterpolation } from './common/utils';\n"]}
|
package/es/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/modules.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,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a,CAAC,CACtD,CAAC;IACF,WAAW,CAAC,oBAAoB,GAAG,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAC/E,WAAW,CAAC,mBAAmB,GAAG,SAAS,CAAC,EAAE;QAC5C,IAAI,SAAS,KAAK,QAAQ,EAAE;YAC1B,OAAO,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;SAC/D;QACD,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,OAAO,sBAAsB,CAAC,+BAA+B,CAAC,CAAC;SAChE;QACD,OAAO,sBAAsB,CAAC,+BAA+B,CAAC,CAAC;IACjE,CAAC,CAAC;IACF,WAAW,CAAC,kCAAkC,GAAG,GAAG,EAAE,CAAC,sBAAsB,CAAC,2BAA2B,CAAC,CAAC;AAC7G,CAAC;AAED,0BAA0B,EAAE,CAAC","file":"modules.js","sourcesContent":["/**\n * @deprecated Legacy global module bootstrap retained for compatibility.\n * Prefer `createBrowserApp()`, `createNodeApp()`, or `createMiniappApp()` from `./entries`\n * instead of relying on the shared global container/module initialization path.\n */\nimport type { IGraphicService, IPluginService, IRenderService, IWindowHandlerContribution } from './interface';\nimport { application } from './application';\nimport type { IGraphicUtil, ILayerService, ITransformUtil } from './interface/core';\nimport { GraphicService } from './graphic/constants';\nimport {\n DynamicLayerHandlerContribution,\n GraphicUtil,\n LayerService,\n StaticLayerHandlerContribution,\n TransformUtil,\n VirtualLayerHandlerContribution\n} from './core/constants';\nimport { RenderService } from './render/constants';\nimport { PluginService } from './plugins/constants';\nimport { PickerService } from './picker/constants';\nimport { CanvasFactory, Context2dFactory } from './canvas/constants';\nimport { IncrementalDrawContribution } from './render/contributions/render/symbol';\nimport { DefaultWindow, WindowHandlerContribution } from './core/window';\nimport { vglobal } from './global';\nimport {\n createLegacySingletonProxy,\n getLegacyBindingContext,\n resolveLegacyNamed,\n resolveLegacySingleton\n} from './legacy/bootstrap';\n\nexport { vglobal } from './global';\nexport {\n preLoadAllModule,\n getLegacyBindingContext,\n type ILegacyBindContext,\n type ILegacyBindingContext\n} from './legacy/bootstrap';\nexport const container = getLegacyBindingContext();\nexport const graphicUtil = createLegacySingletonProxy<IGraphicUtil>(() =>\n resolveLegacySingleton<IGraphicUtil>(GraphicUtil)\n);\nexport const transformUtil = createLegacySingletonProxy<ITransformUtil>(() =>\n resolveLegacySingleton<ITransformUtil>(TransformUtil)\n);\nexport const graphicService = createLegacySingletonProxy<IGraphicService>(() =>\n resolveLegacySingleton<IGraphicService>(GraphicService)\n);\nexport const layerService = createLegacySingletonProxy<ILayerService>(() =>\n resolveLegacySingleton<ILayerService>(LayerService)\n);\n\nfunction resolveLegacyWindowHandler(env: string): IWindowHandlerContribution {\n const handler = resolveLegacyNamed<IWindowHandlerContribution>(WindowHandlerContribution, env);\n if (!handler) {\n throw new Error(`Window handler is not configured for env: ${env}`);\n }\n return handler;\n}\n\nexport function configureLegacyApplication(): void {\n application.global = vglobal;\n application.graphicUtil = graphicUtil;\n application.transformUtil = transformUtil;\n application.graphicService = graphicService;\n application.layerService = layerService;\n application.canvasFactory = env => resolveLegacyNamed(CanvasFactory, env);\n application.context2dFactory = env => resolveLegacyNamed(Context2dFactory, env);\n application.windowFactory = () => new DefaultWindow(application.global);\n application.windowHandlerFactory = env => resolveLegacyWindowHandler(env);\n application.renderServiceFactory = () => resolveLegacySingleton<IRenderService>(RenderService);\n application.renderService = createLegacySingletonProxy<IRenderService>(() =>\n resolveLegacySingleton<IRenderService>(RenderService)\n );\n application.pluginServiceFactory = () => resolveLegacySingleton<IPluginService>(PluginService);\n application.pluginService = createLegacySingletonProxy<IPluginService>(() =>\n resolveLegacySingleton<IPluginService>(PluginService)\n );\n application.pickerServiceFactory = () => resolveLegacySingleton(PickerService);\n application.layerHandlerFactory = layerMode => {\n if (layerMode === 'static') {\n return resolveLegacySingleton(StaticLayerHandlerContribution);\n }\n if (layerMode === 'dynamic') {\n return resolveLegacySingleton(DynamicLayerHandlerContribution);\n }\n return resolveLegacySingleton(VirtualLayerHandlerContribution);\n };\n application.incrementalDrawContributionFactory = () => resolveLegacySingleton(IncrementalDrawContribution);\n}\n\nconfigureLegacyApplication();\n"]}
|
package/es/path.d.ts
ADDED
package/es/path.js
ADDED
package/es/path.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC","file":"path.js","sourcesContent":["export { CustomPath2D } from './common/custom-path2d';\nexport { divideCubic } from './common/segment/curve/cubic-bezier';\nexport { CurveContext } from './common/segment/curve/curve-context';\nexport type { ICustomPath2D, IPath2D } from './interface/path';\n"]}
|
package/es/plugin/3d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin/3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC","file":"3d.js","sourcesContent":["export { registerDirectionalLight } from '../core/light';\nexport { registerOrthoCamera } from '../core/camera';\nexport { registerViewTransform3dPlugin } from '../plugins/builtin-plugin/3dview-transform-plugin';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin/attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC","file":"attribute.js","sourcesContent":["export { registerHtmlAttributePlugin } from '../plugins/builtin-plugin/html-attribute-plugin';\nexport { registerReactAttributePlugin } from '../plugins/builtin-plugin/react-attribute-plugin';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerFlexLayoutPlugin } from '../plugins/builtin-plugin/flex-layout-plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin/flex-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC","file":"flex-layout.js","sourcesContent":["export { registerFlexLayoutPlugin } from '../plugins/builtin-plugin/flex-layout-plugin';\n"]}
|
|
@@ -10,30 +10,30 @@ export class DirtyBoundsPlugin {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
|
|
12
12
|
this.key = this.name + this._uid, this.dirtyBoundsHooksRegistered = !1, this.handlePaintOnlyUpdate = graphic => {
|
|
13
|
-
var _a
|
|
13
|
+
var _a;
|
|
14
14
|
const stage = this.pluginService.stage;
|
|
15
15
|
if (!stage || stage !== graphic.stage || !stage.renderCount) return;
|
|
16
16
|
const owner = null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic;
|
|
17
17
|
if (!(owner._updateTag & UpdateTag.UPDATE_PAINT) || owner._updateTag & UpdateTag.UPDATE_BOUNDS) return;
|
|
18
18
|
const ownerBounds = this.ensurePaintDirtyBoundsCache(owner);
|
|
19
|
-
ownerBounds && !ownerBounds.empty() && stage.dirty(ownerBounds),
|
|
19
|
+
ownerBounds && !ownerBounds.empty() && stage.dirty(ownerBounds), owner.clearUpdatePaintTag();
|
|
20
20
|
const shadowRoot = owner.shadowRoot;
|
|
21
21
|
if (!shadowRoot) return;
|
|
22
22
|
const shadowBounds = this.ensurePaintDirtyBoundsCache(shadowRoot);
|
|
23
|
-
shadowBounds && !shadowBounds.empty() && stage.dirty(shadowBounds),
|
|
23
|
+
shadowBounds && !shadowBounds.empty() && stage.dirty(shadowBounds), shadowRoot.clearUpdatePaintTag();
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
ensurePaintDirtyBoundsCache(graphic) {
|
|
27
|
-
var _a
|
|
27
|
+
var _a;
|
|
28
28
|
const owner = graphic;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
return owner._AABBBounds.empty() && owner.doUpdateAABBBounds("imprecise" === (null === (_a = owner.attribute) || void 0 === _a ? void 0 : _a.boundsMode)),
|
|
30
|
+
owner._globalAABBBounds && !owner._globalAABBBounds.empty() || owner.tryUpdateGlobalAABBBounds(),
|
|
31
|
+
owner._globalAABBBounds;
|
|
32
32
|
}
|
|
33
33
|
getRemoveDirtyBounds(graphic) {
|
|
34
34
|
var _a;
|
|
35
35
|
const cachedBounds = (null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic)._globalAABBBounds;
|
|
36
|
-
if (cachedBounds &&
|
|
36
|
+
if (cachedBounds && !cachedBounds.empty()) return cachedBounds;
|
|
37
37
|
}
|
|
38
38
|
registerDirtyBoundsHooks(stage) {
|
|
39
39
|
this.dirtyBoundsHooksRegistered || (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,MAAM,YAAY,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,+BAA0B,GAAY,KA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C9G,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChG,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"dirty-bounds-plugin.js","sourcesContent":["import { AABBBounds, type IAABBBounds } from '@visactor/vutils';\nimport { UpdateTag } from '../../common/enums';\nimport { Generator } from '../../common/generator';\nimport type { IGraphic, IStage, IPlugin, IPluginService } from '../../interface';\n\nconst globalBounds = new AABBBounds();\n\nexport class DirtyBoundsPlugin implements IPlugin {\n name: 'DirtyBoundsPlugin' = 'DirtyBoundsPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n protected dirtyBoundsHooksRegistered: boolean = false;\n\n protected ensurePaintDirtyBoundsCache(graphic: IGraphic): IAABBBounds {\n const owner = graphic as any;\n const hasLocalBounds =\n owner._AABBBounds && typeof owner._AABBBounds.empty === 'function' && !owner._AABBBounds.empty();\n if (!hasLocalBounds && typeof owner.doUpdateAABBBounds === 'function') {\n owner.doUpdateAABBBounds(owner.attribute?.boundsMode === 'imprecise');\n }\n\n const hasGlobalBounds =\n owner._globalAABBBounds &&\n typeof owner._globalAABBBounds.empty === 'function' &&\n !owner._globalAABBBounds.empty();\n if (!hasGlobalBounds && typeof owner.tryUpdateGlobalAABBBounds === 'function') {\n owner.tryUpdateGlobalAABBBounds();\n }\n\n return owner._globalAABBBounds ?? owner.globalAABBBounds;\n }\n\n protected getRemoveDirtyBounds(graphic: IGraphic): IAABBBounds | undefined {\n const owner = (graphic.glyphHost ?? graphic) as any;\n const cachedBounds = owner._globalAABBBounds as IAABBBounds | undefined;\n if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {\n return cachedBounds;\n }\n }\n\n protected handlePaintOnlyUpdate = (graphic: IGraphic) => {\n const stage = this.pluginService.stage;\n if (!(stage && stage === graphic.stage && stage.renderCount)) {\n return;\n }\n\n const owner = (graphic.glyphHost ?? graphic) as any;\n if (!(owner._updateTag & UpdateTag.UPDATE_PAINT) || owner._updateTag & UpdateTag.UPDATE_BOUNDS) {\n return;\n }\n\n const ownerBounds = this.ensurePaintDirtyBoundsCache(owner);\n if (ownerBounds && !ownerBounds.empty()) {\n stage.dirty(ownerBounds);\n }\n owner.clearUpdatePaintTag?.();\n\n const shadowRoot = owner.shadowRoot as IGraphic | undefined;\n if (!shadowRoot) {\n return;\n }\n\n const shadowBounds = this.ensurePaintDirtyBoundsCache(shadowRoot);\n if (shadowBounds && !shadowBounds.empty()) {\n stage.dirty(shadowBounds);\n }\n (shadowRoot as any).clearUpdatePaintTag?.();\n };\n\n protected registerDirtyBoundsHooks(stage: IStage): void {\n if (this.dirtyBoundsHooksRegistered) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);\n stage.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds()) {\n return;\n }\n if (willUpdate) {\n globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2);\n stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);\n }\n }\n );\n stage.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !selfChange) {\n return;\n }\n stage.dirty(params.globalAABBBounds);\n }\n );\n stage.graphicService.hooks.clearAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, bounds: IAABBBounds) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(bounds);\n }\n }\n );\n stage.graphicService.hooks.onRemove.tap(this.key, (graphic: IGraphic) => {\n const stage = graphic.stage;\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n const bounds = this.getRemoveDirtyBounds(graphic);\n if (bounds && !bounds.empty()) {\n stage.dirty(bounds);\n }\n });\n this.dirtyBoundsHooksRegistered = true;\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n stage.dirtyBounds.clear();\n this.registerDirtyBoundsHooks(stage);\n });\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n if (stage.renderCount) {\n this.registerDirtyBoundsHooks(stage);\n }\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(\n item => {\n return item.name !== this.key;\n }\n );\n this.dirtyBoundsHooksRegistered = false;\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps =\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.afterUpdateAABBBounds.taps =\n stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,MAAM,YAAY,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,+BAA0B,GAAG,KAAK,CAAC;QAuBnC,0BAAqB,GAAG,CAAC,OAAiB,EAAE,EAAE;;YACtD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACvC,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW,CAAC,EAAE;gBAC5D,OAAO;aACR;YAED,MAAM,KAAK,GAAG,CAAC,MAAA,OAAO,CAAC,S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C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACnE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI;YACnD,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBAClE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC9G,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChG,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"dirty-bounds-plugin.js","sourcesContent":["import { AABBBounds, type IAABBBounds } from '@visactor/vutils';\nimport { UpdateTag } from '../../common/enums';\nimport { Generator } from '../../common/generator';\nimport type { IGraphic, IStage, IPlugin, IPluginService } from '../../interface';\n\nconst globalBounds = new AABBBounds();\n\nexport class DirtyBoundsPlugin implements IPlugin {\n name: 'DirtyBoundsPlugin' = 'DirtyBoundsPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n protected dirtyBoundsHooksRegistered = false;\n\n protected ensurePaintDirtyBoundsCache(graphic: IGraphic): IAABBBounds {\n const owner = graphic as any;\n if (owner._AABBBounds.empty()) {\n owner.doUpdateAABBBounds(owner.attribute?.boundsMode === 'imprecise');\n }\n\n if (!owner._globalAABBBounds || owner._globalAABBBounds.empty()) {\n owner.tryUpdateGlobalAABBBounds();\n }\n\n return owner._globalAABBBounds;\n }\n\n protected getRemoveDirtyBounds(graphic: IGraphic): IAABBBounds | undefined {\n const owner = (graphic.glyphHost ?? graphic) as any;\n const cachedBounds = owner._globalAABBBounds as IAABBBounds | undefined;\n if (cachedBounds && !cachedBounds.empty()) {\n return cachedBounds;\n }\n }\n\n protected handlePaintOnlyUpdate = (graphic: IGraphic) => {\n const stage = this.pluginService.stage;\n if (!(stage && stage === graphic.stage && stage.renderCount)) {\n return;\n }\n\n const owner = (graphic.glyphHost ?? graphic) as any;\n if (!(owner._updateTag & UpdateTag.UPDATE_PAINT) || owner._updateTag & UpdateTag.UPDATE_BOUNDS) {\n return;\n }\n\n const ownerBounds = this.ensurePaintDirtyBoundsCache(owner);\n if (ownerBounds && !ownerBounds.empty()) {\n stage.dirty(ownerBounds);\n }\n owner.clearUpdatePaintTag();\n\n const shadowRoot = owner.shadowRoot as IGraphic | undefined;\n if (!shadowRoot) {\n return;\n }\n\n const shadowBounds = this.ensurePaintDirtyBoundsCache(shadowRoot);\n if (shadowBounds && !shadowBounds.empty()) {\n stage.dirty(shadowBounds);\n }\n (shadowRoot as any).clearUpdatePaintTag();\n };\n\n protected registerDirtyBoundsHooks(stage: IStage): void {\n if (this.dirtyBoundsHooksRegistered) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);\n stage.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds()) {\n return;\n }\n if (willUpdate) {\n globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2);\n stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);\n }\n }\n );\n stage.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !selfChange) {\n return;\n }\n stage.dirty(params.globalAABBBounds);\n }\n );\n stage.graphicService.hooks.clearAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, bounds: IAABBBounds) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(bounds);\n }\n }\n );\n stage.graphicService.hooks.onRemove.tap(this.key, (graphic: IGraphic) => {\n const stage = graphic.stage;\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n const bounds = this.getRemoveDirtyBounds(graphic);\n if (bounds && !bounds.empty()) {\n stage.dirty(bounds);\n }\n });\n this.dirtyBoundsHooksRegistered = true;\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n stage.dirtyBounds.clear();\n this.registerDirtyBoundsHooks(stage);\n });\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n if (stage.renderCount) {\n this.registerDirtyBoundsHooks(stage);\n }\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(\n item => {\n return item.name !== this.key;\n }\n );\n this.dirtyBoundsHooksRegistered = false;\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps =\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.afterUpdateAABBBounds.taps =\n stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n"]}
|
package/es/plugins/index.d.ts
CHANGED
package/es/plugins/index.js
CHANGED
package/es/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC
|
|
1
|
+
{"version":3,"sources":["../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["export * from './types';\n"]}
|
|
@@ -7,7 +7,6 @@ interface ILegacyPluginRegistry {
|
|
|
7
7
|
}
|
|
8
8
|
interface IPluginServiceDeps {
|
|
9
9
|
pluginRegistry?: ILegacyPluginRegistry;
|
|
10
|
-
autoEnablePlugins?: IContributionProvider<IPlugin>;
|
|
11
10
|
}
|
|
12
11
|
export declare class DefaultPluginService implements IPluginService {
|
|
13
12
|
protected autoEnablePlugins: IContributionProvider<IPlugin>;
|
|
@@ -6,10 +6,9 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
|
|
|
6
6
|
|
|
7
7
|
export class DefaultPluginService {
|
|
8
8
|
constructor(autoEnablePlugins = EMPTY_AUTO_ENABLE_PROVIDER, deps = {}) {
|
|
9
|
-
var _a
|
|
9
|
+
var _a;
|
|
10
10
|
this.autoEnablePlugins = autoEnablePlugins, this.onStartupFinishedPlugin = [], this.onRegisterPlugin = [],
|
|
11
|
-
this.actived = !1, this.pluginRegistry = null !== (_a = deps.pluginRegistry) && void 0 !== _a ? _a : new PluginRegistry
|
|
12
|
-
this.autoEnablePlugins = null !== (_c = null !== (_b = deps.autoEnablePlugins) && void 0 !== _b ? _b : this.autoEnablePlugins) && void 0 !== _c ? _c : EMPTY_AUTO_ENABLE_PROVIDER;
|
|
11
|
+
this.actived = !1, this.pluginRegistry = null !== (_a = deps.pluginRegistry) && void 0 !== _a ? _a : new PluginRegistry;
|
|
13
12
|
}
|
|
14
13
|
active(stage, params) {
|
|
15
14
|
this.stage = stage, this.actived = !0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/plugin-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/plugins/plugin-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAa7C,MAAM,0BAA0B,GAAmC;IACjE,gBAAgB,EAAE,GAAG,EAAE,CAAC,EAAE;CAC3B,CAAC;AAEF,MAAM,OAAO,oBAAoB;IAO/B,YACY,oBAAoD,0BAA0B,EACxF,OAA2B,EAAE;;QADnB,sBAAiB,GAAjB,iBAAiB,CAA6D;QAGxF,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,O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MAAM,EAAE;YACnD,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC5C;QACD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,GAAG,MAAW;QACpB,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC5C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACrC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF","file":"plugin-service.js","sourcesContent":["import type { IContributionProvider, IPlugin, IPluginService, IStage } from '../interface';\nimport { PluginRegistry } from '../registry';\n\ninterface ILegacyPluginRegistry {\n install: (plugin: IPlugin) => void;\n uninstall: (name: string) => void;\n get: (name: string) => IPlugin | undefined;\n clear: () => void;\n}\n\ninterface IPluginServiceDeps {\n pluginRegistry?: ILegacyPluginRegistry;\n}\n\nconst EMPTY_AUTO_ENABLE_PROVIDER: IContributionProvider<IPlugin> = {\n getContributions: () => []\n};\n\nexport class DefaultPluginService implements IPluginService {\n declare onStartupFinishedPlugin: IPlugin[];\n declare onRegisterPlugin: IPlugin[];\n declare stage: IStage;\n declare actived: boolean;\n readonly pluginRegistry: ILegacyPluginRegistry;\n\n constructor(\n protected autoEnablePlugins: IContributionProvider<IPlugin> = EMPTY_AUTO_ENABLE_PROVIDER,\n deps: IPluginServiceDeps = {}\n ) {\n this.onStartupFinishedPlugin = [];\n this.onRegisterPlugin = [];\n this.actived = false;\n this.pluginRegistry = deps.pluginRegistry ?? (new PluginRegistry() as unknown as ILegacyPluginRegistry);\n }\n\n active(stage: IStage, params: { pluginList?: string[] }) {\n this.stage = stage;\n this.actived = true;\n\n // 启动插件\n const { pluginList } = params;\n if (pluginList?.length) {\n this.autoEnablePlugins.getContributions().forEach(p => {\n if (pluginList.includes(p.name)) {\n this.install(p);\n }\n });\n }\n }\n\n findPluginsByName(name: string): IPlugin[] {\n const arr: IPlugin[] = [];\n this.onStartupFinishedPlugin.forEach(plugin => {\n if (plugin.name === name) {\n arr.push(plugin);\n }\n });\n this.onRegisterPlugin.forEach(plugin => {\n if (plugin.name === name) {\n arr.push(plugin);\n }\n });\n return arr;\n }\n\n install(plugin: IPlugin) {\n this.register(plugin);\n }\n\n uninstall(name: string) {\n const plugins = this.findPluginsByName(name);\n plugins.forEach(plugin => {\n this.unRegister(plugin);\n });\n this.pluginRegistry.uninstall(name);\n }\n\n register(plugin: IPlugin) {\n this.pluginRegistry.install(plugin);\n if (plugin.activeEvent === 'onStartupFinished') {\n if (!this.onStartupFinishedPlugin.includes(plugin)) {\n this.onStartupFinishedPlugin.push(plugin);\n }\n } else if (plugin.activeEvent === 'onRegister') {\n if (!this.onRegisterPlugin.includes(plugin)) {\n this.onRegisterPlugin.push(plugin);\n plugin.activate(this);\n }\n }\n }\n unRegister(plugin: IPlugin) {\n if (plugin.activeEvent === 'onStartupFinished') {\n this.onStartupFinishedPlugin = this.onStartupFinishedPlugin.filter(item => item !== plugin);\n } else if (plugin.activeEvent === 'onRegister') {\n this.onRegisterPlugin = this.onRegisterPlugin.filter(item => item !== plugin);\n }\n if (this.pluginRegistry.get(plugin.name) === plugin) {\n this.pluginRegistry.uninstall(plugin.name);\n }\n plugin.deactivate(this);\n }\n\n release(...params: any): void {\n this.onStartupFinishedPlugin.forEach(plugin => {\n plugin.deactivate(this);\n });\n this.onStartupFinishedPlugin = [];\n this.onRegisterPlugin.forEach(plugin => {\n plugin.deactivate(this);\n });\n this.onRegisterPlugin = [];\n this.pluginRegistry.clear();\n }\n}\n"]}
|
package/es/plugins/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { IGraphicPicker } from '../interface/picker';
|
|
2
1
|
import type { IGraphicFactory, ILayerFactory, IStageFactory } from '../factory';
|
|
3
|
-
import type { IContributionRegistry, IPickerRegistry, IPluginRegistry, IRendererRegistry
|
|
2
|
+
import type { IContributionRegistry, IPickerRegistry, IPluginRegistry, IRendererRegistry } from '../registry';
|
|
4
3
|
export interface IPlugin {
|
|
5
4
|
readonly name: string;
|
|
6
5
|
readonly version: string;
|
|
@@ -20,9 +19,3 @@ export interface IPluginContext {
|
|
|
20
19
|
graphic: IGraphicFactory;
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
export interface IBrowserEnvPluginHooks {
|
|
24
|
-
install?: (context: IPluginContext) => void;
|
|
25
|
-
uninstall?: () => void;
|
|
26
|
-
}
|
|
27
|
-
export type IRendererPluginEntries = Iterable<[RegistryKey, IRendererRegistryEntry]>;
|
|
28
|
-
export type IPickerPluginEntries = Iterable<[RegistryKey, IGraphicPicker]>;
|
package/es/plugins/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/plugins/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["import type { IGraphicFactory, ILayerFactory, IStageFactory } from '../factory';\nimport type { IContributionRegistry, IPickerRegistry, IPluginRegistry, IRendererRegistry } from '../registry';\n\nexport interface IPlugin {\n readonly name: string;\n readonly version: string;\n install: (context: IPluginContext) => void;\n uninstall?: () => void;\n}\n\nexport interface IPluginContext {\n registry: {\n renderer: IRendererRegistry;\n picker: IPickerRegistry;\n contribution: IContributionRegistry;\n plugin: IPluginRegistry;\n };\n factory: {\n stage: IStageFactory;\n layer: ILayerFactory;\n graphic: IGraphicFactory;\n };\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { registerArcGraphic } from './register-arc';
|
|
2
|
+
export { registerArc3dGraphic } from './register-arc3d';
|
|
3
|
+
export { registerAreaGraphic } from './register-area';
|
|
4
|
+
export { registerCircleGraphic } from './register-circle';
|
|
5
|
+
export { registerGlyphGraphic } from './register-glyph';
|
|
6
|
+
export { registerGroupGraphic } from './register-group';
|
|
7
|
+
export { registerImageGraphic } from './register-image';
|
|
8
|
+
export { registerLineGraphic } from './register-line';
|
|
9
|
+
export { registerPathGraphic } from './register-path';
|
|
10
|
+
export { registerPolygonGraphic } from './register-polygon';
|
|
11
|
+
export { registerPyramid3dGraphic } from './register-pyramid3d';
|
|
12
|
+
export { registerRectGraphic } from './register-rect';
|
|
13
|
+
export { registerRect3dGraphic } from './register-rect3d';
|
|
14
|
+
export { registerRichtextGraphic } from './register-richtext';
|
|
15
|
+
export { registerShadowRootGraphic } from './register-shadowRoot';
|
|
16
|
+
export { registerStarGraphic } from './register-star';
|
|
17
|
+
export { registerSymbolGraphic } from './register-symbol';
|
|
18
|
+
export { registerTextGraphic } from './register-text';
|
|
19
|
+
export { registerWrapTextGraphic } from './register-wraptext';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { registerArcGraphic } from "./register-arc";
|
|
2
|
+
|
|
3
|
+
export { registerArc3dGraphic } from "./register-arc3d";
|
|
4
|
+
|
|
5
|
+
export { registerAreaGraphic } from "./register-area";
|
|
6
|
+
|
|
7
|
+
export { registerCircleGraphic } from "./register-circle";
|
|
8
|
+
|
|
9
|
+
export { registerGlyphGraphic } from "./register-glyph";
|
|
10
|
+
|
|
11
|
+
export { registerGroupGraphic } from "./register-group";
|
|
12
|
+
|
|
13
|
+
export { registerImageGraphic } from "./register-image";
|
|
14
|
+
|
|
15
|
+
export { registerLineGraphic } from "./register-line";
|
|
16
|
+
|
|
17
|
+
export { registerPathGraphic } from "./register-path";
|
|
18
|
+
|
|
19
|
+
export { registerPolygonGraphic } from "./register-polygon";
|
|
20
|
+
|
|
21
|
+
export { registerPyramid3dGraphic } from "./register-pyramid3d";
|
|
22
|
+
|
|
23
|
+
export { registerRectGraphic } from "./register-rect";
|
|
24
|
+
|
|
25
|
+
export { registerRect3dGraphic } from "./register-rect3d";
|
|
26
|
+
|
|
27
|
+
export { registerRichtextGraphic } from "./register-richtext";
|
|
28
|
+
|
|
29
|
+
export { registerShadowRootGraphic } from "./register-shadowRoot";
|
|
30
|
+
|
|
31
|
+
export { registerStarGraphic } from "./register-star";
|
|
32
|
+
|
|
33
|
+
export { registerSymbolGraphic } from "./register-symbol";
|
|
34
|
+
|
|
35
|
+
export { registerTextGraphic } from "./register-text";
|
|
36
|
+
|
|
37
|
+
export { registerWrapTextGraphic } from "./register-wraptext";
|
|
38
|
+
//# sourceMappingURL=graphic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register/graphic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC","file":"graphic.js","sourcesContent":["export { registerArcGraphic } from './register-arc';\nexport { registerArc3dGraphic } from './register-arc3d';\nexport { registerAreaGraphic } from './register-area';\nexport { registerCircleGraphic } from './register-circle';\nexport { registerGlyphGraphic } from './register-glyph';\nexport { registerGroupGraphic } from './register-group';\nexport { registerImageGraphic } from './register-image';\nexport { registerLineGraphic } from './register-line';\nexport { registerPathGraphic } from './register-path';\nexport { registerPolygonGraphic } from './register-polygon';\nexport { registerPyramid3dGraphic } from './register-pyramid3d';\nexport { registerRectGraphic } from './register-rect';\nexport { registerRect3dGraphic } from './register-rect3d';\nexport { registerRichtextGraphic } from './register-richtext';\nexport { registerShadowRootGraphic } from './register-shadowRoot';\nexport { registerStarGraphic } from './register-star';\nexport { registerSymbolGraphic } from './register-symbol';\nexport { registerTextGraphic } from './register-text';\nexport { registerWrapTextGraphic } from './register-wraptext';\n"]}
|
|
@@ -2,7 +2,6 @@ import type { IContributionRegistry, RegistryKey } from './types';
|
|
|
2
2
|
export declare class ContributionRegistry<T = unknown> implements IContributionRegistry<T> {
|
|
3
3
|
private readonly entries;
|
|
4
4
|
register(key: RegistryKey, contribution: T): void;
|
|
5
|
-
registerMany(entries: Iterable<[RegistryKey, T]>): void;
|
|
6
5
|
get(key: RegistryKey): T[];
|
|
7
6
|
getAll(): T[];
|
|
8
7
|
clear(key?: RegistryKey): void;
|
|
@@ -7,9 +7,6 @@ export class ContributionRegistry {
|
|
|
7
7
|
const current = null !== (_a = this.entries.get(key)) && void 0 !== _a ? _a : [];
|
|
8
8
|
current.push(contribution), this.entries.set(key, current);
|
|
9
9
|
}
|
|
10
|
-
registerMany(entries) {
|
|
11
|
-
for (const [key, contribution] of entries) this.register(key, contribution);
|
|
12
|
-
}
|
|
13
10
|
get(key) {
|
|
14
11
|
var _a;
|
|
15
12
|
return [ ...null !== (_a = this.entries.get(key)) && void 0 !== _a ? _a : [] ];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/contribution-registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IAAjC;QACmB,YAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/registry/contribution-registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IAAjC;QACmB,YAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IA0BzD,CAAC;IAxBC,QAAQ,CAAC,GAAgB,EAAE,YAAe;;QACxC,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,GAAG,CAAC,GAAgB;;QAClB,OAAO,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAM,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;YACpE,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;YACrB,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAED,KAAK,CAAC,GAAiB;QACrB,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACrB,OAAO;SACR;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF","file":"contribution-registry.js","sourcesContent":["import type { IContributionRegistry, RegistryKey } from './types';\n\nexport class ContributionRegistry<T = unknown> implements IContributionRegistry<T> {\n private readonly entries = new Map<RegistryKey, T[]>();\n\n register(key: RegistryKey, contribution: T): void {\n const current = this.entries.get(key) ?? [];\n current.push(contribution);\n this.entries.set(key, current);\n }\n\n get(key: RegistryKey): T[] {\n return [...(this.entries.get(key) ?? [])];\n }\n\n getAll(): T[] {\n return Array.from(this.entries.values()).reduce<T[]>((all, current) => {\n all.push(...current);\n return all;\n }, []);\n }\n\n clear(key?: RegistryKey): void {\n if (key == null) {\n this.entries.clear();\n return;\n }\n this.entries.delete(key);\n }\n}\n"]}
|
|
@@ -3,7 +3,6 @@ import type { IPickerRegistry, RegistryKey } from './types';
|
|
|
3
3
|
export declare class PickerRegistry implements IPickerRegistry {
|
|
4
4
|
private readonly entries;
|
|
5
5
|
register(key: RegistryKey, picker: IGraphicPicker): void;
|
|
6
|
-
registerMany(entries: Iterable<[RegistryKey, IGraphicPicker]>): void;
|
|
7
6
|
get(key: RegistryKey): IGraphicPicker | undefined;
|
|
8
7
|
getAll(): IGraphicPicker[];
|
|
9
8
|
clear(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/picker-registry.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IAA3B;QACmB,YAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/registry/picker-registry.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IAA3B;QACmB,YAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IAiBpE,CAAC;IAfC,QAAQ,CAAC,GAAgB,EAAE,MAAsB;QAC/C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,GAAgB;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF","file":"picker-registry.js","sourcesContent":["import type { IGraphicPicker } from '../interface/picker';\nimport type { IPickerRegistry, RegistryKey } from './types';\n\nexport class PickerRegistry implements IPickerRegistry {\n private readonly entries = new Map<RegistryKey, IGraphicPicker>();\n\n register(key: RegistryKey, picker: IGraphicPicker): void {\n this.entries.set(key, picker);\n }\n\n get(key: RegistryKey): IGraphicPicker | undefined {\n return this.entries.get(key);\n }\n\n getAll(): IGraphicPicker[] {\n return Array.from(this.entries.values());\n }\n\n clear(): void {\n this.entries.clear();\n }\n}\n"]}
|
|
@@ -4,7 +4,6 @@ export declare class RendererRegistry implements IRendererRegistry {
|
|
|
4
4
|
private readonly entries;
|
|
5
5
|
private readonly cache;
|
|
6
6
|
register(key: RegistryKey, renderer: IRendererRegistryEntry): void;
|
|
7
|
-
registerMany(entries: Iterable<[RegistryKey, IRendererRegistryEntry]>): void;
|
|
8
7
|
get(key: RegistryKey): IGraphicRender | undefined;
|
|
9
8
|
getAll(): IGraphicRender[];
|
|
10
9
|
clear(): void;
|
|
@@ -9,9 +9,6 @@ export class RendererRegistry {
|
|
|
9
9
|
register(key, renderer) {
|
|
10
10
|
this.entries.set(key, renderer), this.cache.delete(key);
|
|
11
11
|
}
|
|
12
|
-
registerMany(entries) {
|
|
13
|
-
for (const [key, renderer] of entries) this.register(key, renderer);
|
|
14
|
-
}
|
|
15
12
|
get(key) {
|
|
16
13
|
if (this.cache.has(key)) return this.cache.get(key);
|
|
17
14
|
const entry = this.entries.get(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/renderer-registry.ts"],"names":[],"mappings":"AAGA,SAAS,iBAAiB,CAAC,KAA6B;IACtD,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAA7B;QACmB,YAAO,GAAG,IAAI,GAAG,EAAuC,CAAC;QACzD,UAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/registry/renderer-registry.ts"],"names":[],"mappings":"AAGA,SAAS,iBAAiB,CAAC,KAA6B;IACtD,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAA7B;QACmB,YAAO,GAAG,IAAI,GAAG,EAAuC,CAAC;QACzD,UAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;IAgClE,CAAC;IA9BC,QAAQ,CAAC,GAAgB,EAAE,QAAgC;QACzD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,GAAG,CAAC,GAAgB;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAC5B;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC9B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aACnC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACzB,MAAM,CAAC,CAAC,QAAQ,EAA8B,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF","file":"renderer-registry.js","sourcesContent":["import type { IGraphicRender } from '../interface/render';\nimport type { IRendererRegistry, IRendererRegistryEntry, RegistryKey } from './types';\n\nfunction isRendererFactory(entry: IRendererRegistryEntry): entry is () => IGraphicRender {\n return typeof entry === 'function';\n}\n\nexport class RendererRegistry implements IRendererRegistry {\n private readonly entries = new Map<RegistryKey, IRendererRegistryEntry>();\n private readonly cache = new Map<RegistryKey, IGraphicRender>();\n\n register(key: RegistryKey, renderer: IRendererRegistryEntry): void {\n this.entries.set(key, renderer);\n this.cache.delete(key);\n }\n\n get(key: RegistryKey): IGraphicRender | undefined {\n if (this.cache.has(key)) {\n return this.cache.get(key);\n }\n\n const entry = this.entries.get(key);\n if (!entry) {\n return undefined;\n }\n\n const renderer = isRendererFactory(entry) ? entry() : entry;\n this.cache.set(key, renderer);\n return renderer;\n }\n\n getAll(): IGraphicRender[] {\n return Array.from(this.entries.keys())\n .map(key => this.get(key))\n .filter((renderer): renderer is IGraphicRender => !!renderer);\n }\n\n clear(): void {\n this.entries.clear();\n this.cache.clear();\n }\n}\n"]}
|
package/es/registry/types.d.ts
CHANGED
|
@@ -6,14 +6,12 @@ export type IRendererFactory = () => IGraphicRender;
|
|
|
6
6
|
export type IRendererRegistryEntry = IGraphicRender | IRendererFactory;
|
|
7
7
|
export interface IRendererRegistry {
|
|
8
8
|
register: (key: RegistryKey, renderer: IRendererRegistryEntry) => void;
|
|
9
|
-
registerMany: (entries: Iterable<[RegistryKey, IRendererRegistryEntry]>) => void;
|
|
10
9
|
get: (key: RegistryKey) => IGraphicRender | undefined;
|
|
11
10
|
getAll: () => IGraphicRender[];
|
|
12
11
|
clear: () => void;
|
|
13
12
|
}
|
|
14
13
|
export interface IPickerRegistry {
|
|
15
14
|
register: (key: RegistryKey, picker: IGraphicPicker) => void;
|
|
16
|
-
registerMany: (entries: Iterable<[RegistryKey, IGraphicPicker]>) => void;
|
|
17
15
|
get: (key: RegistryKey) => IGraphicPicker | undefined;
|
|
18
16
|
getAll: () => IGraphicPicker[];
|
|
19
17
|
clear: () => void;
|
|
@@ -27,7 +25,6 @@ export interface IPluginRegistry {
|
|
|
27
25
|
}
|
|
28
26
|
export interface IContributionRegistry<T = unknown> {
|
|
29
27
|
register: (key: RegistryKey, contribution: T) => void;
|
|
30
|
-
registerMany: (entries: Iterable<[RegistryKey, T]>) => void;
|
|
31
28
|
get: (key: RegistryKey) => T[];
|
|
32
29
|
getAll: () => T[];
|
|
33
30
|
clear: (key?: RegistryKey) => void;
|
package/es/registry/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["import type { IGraphicPicker } from '../interface/picker';\nimport type { IGraphicRender } from '../interface/render';\nimport type { IPlugin } from '../plugins/types';\n\nexport type RegistryKey = string | symbol | number;\n\nexport type IRendererFactory = () => IGraphicRender;\nexport type IRendererRegistryEntry = IGraphicRender | IRendererFactory;\n\nexport interface IRendererRegistry {\n register: (key: RegistryKey, renderer: IRendererRegistryEntry) => void;\n
|
|
1
|
+
{"version":3,"sources":["../src/registry/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["import type { IGraphicPicker } from '../interface/picker';\nimport type { IGraphicRender } from '../interface/render';\nimport type { IPlugin } from '../plugins/types';\n\nexport type RegistryKey = string | symbol | number;\n\nexport type IRendererFactory = () => IGraphicRender;\nexport type IRendererRegistryEntry = IGraphicRender | IRendererFactory;\n\nexport interface IRendererRegistry {\n register: (key: RegistryKey, renderer: IRendererRegistryEntry) => void;\n get: (key: RegistryKey) => IGraphicRender | undefined;\n getAll: () => IGraphicRender[];\n clear: () => void;\n}\n\nexport interface IPickerRegistry {\n register: (key: RegistryKey, picker: IGraphicPicker) => void;\n get: (key: RegistryKey) => IGraphicPicker | undefined;\n getAll: () => IGraphicPicker[];\n clear: () => void;\n}\n\nexport interface IPluginRegistry {\n install: (plugin: IPlugin) => void;\n uninstall: (name: string) => void;\n get: (name: string) => IPlugin | undefined;\n getAll: () => IPlugin[];\n clear: () => void;\n}\n\nexport interface IContributionRegistry<T = unknown> {\n register: (key: RegistryKey, contribution: T) => void;\n get: (key: RegistryKey) => T[];\n getAll: () => T[];\n clear: (key?: RegistryKey) => void;\n}\n"]}
|
package/es/svg.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GradientParser } from './common/color-utils';
|
package/es/svg.js
ADDED