@visactor/vrender-core 1.1.0-alpha.23 → 1.1.0-alpha.25
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/allocator/bounds-allocate.js +1 -2
- package/cjs/canvas/constants.js +2 -1
- package/cjs/common/bezier-utils.js +1 -2
- package/cjs/common/event-transformer.js +2 -1
- package/cjs/common/module-guard.d.ts +1 -0
- package/cjs/common/module-guard.js +11 -0
- package/cjs/common/module-guard.js.map +1 -0
- package/cjs/common/performance-raf.js +1 -2
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -1
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +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/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +2 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.js +1 -1
- package/cjs/core/stage.d.ts +0 -9
- package/cjs/core/stage.js +12 -30
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +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/arc.js +6 -4
- package/cjs/graphic/arc.js.map +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/config.js +1 -0
- package/cjs/graphic/config.js.map +1 -1
- 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.d.ts +19 -28
- package/cjs/graphic/graphic.js +122 -193
- 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/interface/graphic/arc.d.ts +1 -0
- package/cjs/interface/graphic/arc.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/render/contributions/render/arc-module.js +2 -4
- package/cjs/render/contributions/render/arc-module.js.map +1 -1
- package/cjs/render/contributions/render/arc3d-module.js +2 -4
- package/cjs/render/contributions/render/arc3d-module.js.map +1 -1
- package/cjs/render/contributions/render/area-module.js +2 -4
- package/cjs/render/contributions/render/area-module.js.map +1 -1
- package/cjs/render/contributions/render/circle-module.js +2 -4
- package/cjs/render/contributions/render/circle-module.js.map +1 -1
- package/cjs/render/contributions/render/glyph-module.js +2 -4
- package/cjs/render/contributions/render/glyph-module.js.map +1 -1
- package/cjs/render/contributions/render/image-module.js +2 -4
- package/cjs/render/contributions/render/image-module.js.map +1 -1
- package/cjs/render/contributions/render/line-module.js +2 -4
- package/cjs/render/contributions/render/line-module.js.map +1 -1
- package/cjs/render/contributions/render/path-module.js +2 -4
- package/cjs/render/contributions/render/path-module.js.map +1 -1
- package/cjs/render/contributions/render/polygon-module.js +2 -4
- package/cjs/render/contributions/render/polygon-module.js.map +1 -1
- package/cjs/render/contributions/render/pyramid3d-module.js +2 -4
- package/cjs/render/contributions/render/pyramid3d-module.js.map +1 -1
- package/cjs/render/contributions/render/rect-module.js +2 -4
- package/cjs/render/contributions/render/rect-module.js.map +1 -1
- package/cjs/render/contributions/render/rect3d-module.js +2 -4
- package/cjs/render/contributions/render/rect3d-module.js.map +1 -1
- package/cjs/render/contributions/render/richtext-module.js +2 -4
- package/cjs/render/contributions/render/richtext-module.js.map +1 -1
- package/cjs/render/contributions/render/star-module.js +2 -4
- package/cjs/render/contributions/render/star-module.js.map +1 -1
- package/cjs/render/contributions/render/symbol-module.js +2 -4
- package/cjs/render/contributions/render/symbol-module.js.map +1 -1
- package/cjs/render/contributions/render/text-module.js +2 -4
- package/cjs/render/contributions/render/text-module.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 +328 -1630
- package/es/allocator/bounds-allocate.js +1 -2
- package/es/canvas/constants.js +2 -1
- package/es/common/bezier-utils.js +1 -2
- package/es/common/event-transformer.js +2 -1
- package/es/common/module-guard.d.ts +1 -0
- package/es/common/module-guard.js +5 -0
- package/es/common/module-guard.js.map +1 -0
- package/es/common/performance-raf.js +1 -2
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -1
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +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/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +2 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.js +1 -1
- package/es/core/stage.d.ts +0 -9
- package/es/core/stage.js +10 -31
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +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/arc.js +5 -4
- package/es/graphic/arc.js.map +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/config.js +1 -0
- package/es/graphic/config.js.map +1 -1
- 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.d.ts +19 -28
- package/es/graphic/graphic.js +121 -198
- 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/interface/graphic/arc.d.ts +1 -0
- package/es/interface/graphic/arc.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/render/contributions/render/arc-module.js +4 -2
- package/es/render/contributions/render/arc-module.js.map +1 -1
- package/es/render/contributions/render/arc3d-module.js +4 -2
- package/es/render/contributions/render/arc3d-module.js.map +1 -1
- package/es/render/contributions/render/area-module.js +4 -2
- package/es/render/contributions/render/area-module.js.map +1 -1
- package/es/render/contributions/render/circle-module.js +4 -2
- package/es/render/contributions/render/circle-module.js.map +1 -1
- package/es/render/contributions/render/glyph-module.js +4 -2
- package/es/render/contributions/render/glyph-module.js.map +1 -1
- package/es/render/contributions/render/image-module.js +4 -2
- package/es/render/contributions/render/image-module.js.map +1 -1
- package/es/render/contributions/render/line-module.js +4 -2
- package/es/render/contributions/render/line-module.js.map +1 -1
- package/es/render/contributions/render/path-module.js +4 -2
- package/es/render/contributions/render/path-module.js.map +1 -1
- package/es/render/contributions/render/polygon-module.js +4 -2
- package/es/render/contributions/render/polygon-module.js.map +1 -1
- package/es/render/contributions/render/pyramid3d-module.js +4 -2
- package/es/render/contributions/render/pyramid3d-module.js.map +1 -1
- package/es/render/contributions/render/rect-module.js +4 -2
- package/es/render/contributions/render/rect-module.js.map +1 -1
- package/es/render/contributions/render/rect3d-module.js +4 -2
- package/es/render/contributions/render/rect3d-module.js.map +1 -1
- package/es/render/contributions/render/richtext-module.js +4 -2
- package/es/render/contributions/render/richtext-module.js.map +1 -1
- package/es/render/contributions/render/star-module.js +4 -2
- package/es/render/contributions/render/star-module.js.map +1 -1
- package/es/render/contributions/render/symbol-module.js +4 -2
- package/es/render/contributions/render/symbol-module.js.map +1 -1
- package/es/render/contributions/render/text-module.js +4 -2
- package/es/render/contributions/render/text-module.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/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/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/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/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/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/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
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function isPlainObject(value) {
|
|
4
|
-
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function cloneValue(value) {
|
|
8
|
-
if (!isPlainObject(value)) return value;
|
|
9
|
-
const clone = {};
|
|
10
|
-
for (const key in value) Object.prototype.hasOwnProperty.call(value, key) && (clone[key] = cloneValue(value[key]));
|
|
11
|
-
return clone;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function deepMerge(base, value) {
|
|
15
|
-
const result = cloneValue(base) || {};
|
|
16
|
-
for (const key in value) {
|
|
17
|
-
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
18
|
-
const nextValue = value[key], previousValue = result[key];
|
|
19
|
-
isPlainObject(previousValue) && isPlainObject(nextValue) ? result[key] = deepMerge(previousValue, nextValue) : result[key] = cloneValue(nextValue);
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "__esModule", {
|
|
25
|
-
value: !0
|
|
26
|
-
}), exports.StateStyleResolver = void 0;
|
|
27
|
-
|
|
28
|
-
class StateStyleResolver {
|
|
29
|
-
constructor(options = {}) {
|
|
30
|
-
this.options = options;
|
|
31
|
-
}
|
|
32
|
-
resolve(normalAttrs, states, stateProxy, currentStates, stateSort) {
|
|
33
|
-
var _a;
|
|
34
|
-
const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow", sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice(), resolvedAttrs = {};
|
|
35
|
-
return sortedStates.forEach((stateName => {
|
|
36
|
-
const attrs = stateProxy ? stateProxy(stateName, sortedStates) : null == states ? void 0 : states[stateName];
|
|
37
|
-
if (null != attrs) for (const key in attrs) {
|
|
38
|
-
if (!Object.prototype.hasOwnProperty.call(attrs, key)) continue;
|
|
39
|
-
const nextValue = attrs[key];
|
|
40
|
-
if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || isPlainObject(normalAttrs[key]))) {
|
|
41
|
-
const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
|
|
42
|
-
resolvedAttrs[key] = deepMerge(baseValue, nextValue);
|
|
43
|
-
} else resolvedAttrs[key] = cloneValue(nextValue);
|
|
44
|
-
}
|
|
45
|
-
})), resolvedAttrs;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.StateStyleResolver = StateStyleResolver;
|
|
50
|
-
//# sourceMappingURL=state-style-resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/state/state-style-resolver.ts"],"names":[],"mappings":";;;AAkBA,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YACrD,SAAS;SACV;QACD,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,CAAE,KAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;KAC9D;IACD,OAAO,KAAU,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAAC,IAAyB,EAAE,KAA0B;IACtE,MAAM,MAAM,GAAwB,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAE3D,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YACrD,SAAS;SACV;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,aAAa,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,EAAE;YAC5D,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SACnD;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;SACrC;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAa,kBAAkB;IAC7B,YAA6B,UAAsC,EAAE;QAAxC,YAAO,GAAP,OAAO,CAAiC;IAAG,CAAC;IAEzE,OAAO,CACL,WAAuB,EACvB,MAA8C,EAC9C,UAAqC,EACrC,aAAuB,EACvB,SAAqB;;QAErB,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,mCAAI,SAAS,CAAC;QACtD,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC/F,MAAM,aAAa,GAAe,EAAE,CAAC;QAErC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC/B,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,SAAS,CAAC,CAAC;YAErF,IAAI,KAAK,IAAI,IAAI,EAAE;gBACjB,OAAO;aACR;YAED,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;oBACrD,SAAS;iBACV;gBAED,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;gBAE7B,IACE,SAAS,KAAK,MAAM;oBACpB,aAAa,CAAC,SAAS,CAAC;oBACxB,CAAC,aAAa,CAAE,aAAqC,CAAC,GAAG,CAAC,CAAC;wBACzD,aAAa,CAAE,WAAmC,CAAC,GAAG,CAAC,CAAC,CAAC,EAC3D;oBACA,MAAM,SAAS,GAAG,aAAa,CAAE,aAAqC,CAAC,GAAG,CAAC,CAAC;wBAC1E,CAAC,CAAE,aAAqC,CAAC,GAAG,CAAC;wBAC7C,CAAC,CAAC,aAAa,CAAE,WAAmC,CAAC,GAAG,CAAC,CAAC;4BAC1D,CAAC,CAAE,WAAmC,CAAC,GAAG,CAAC;4BAC3C,CAAC,CAAC,EAAE,CAAC;oBACN,aAAqC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;iBAC/E;qBAAM;oBACJ,aAAqC,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;iBACrE;aACF;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAhDD,gDAgDC","file":"state-style-resolver.js","sourcesContent":["import type { StateProxy, StateSort } from './state-model';\n\nexport type StateMergeMode = 'shallow' | 'deep';\n\nexport interface IStateStyleResolverOptions {\n mergeMode?: StateMergeMode;\n}\n\nexport interface IStateStyleResolver<T> {\n resolve: (\n normalAttrs: Partial<T>,\n states: Record<string, Partial<T>> | undefined,\n stateProxy: StateProxy<T> | undefined,\n currentStates: string[],\n stateSort?: StateSort\n ) => Partial<T>;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction cloneValue<T>(value: T): T {\n if (!isPlainObject(value)) {\n return value;\n }\n\n const clone: Record<string, any> = {};\n for (const key in value) {\n if (!Object.prototype.hasOwnProperty.call(value, key)) {\n continue;\n }\n clone[key] = cloneValue((value as Record<string, any>)[key]);\n }\n return clone as T;\n}\n\nfunction deepMerge(base: Record<string, any>, value: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = cloneValue(base) || {};\n\n for (const key in value) {\n if (!Object.prototype.hasOwnProperty.call(value, key)) {\n continue;\n }\n\n const nextValue = value[key];\n const previousValue = result[key];\n\n if (isPlainObject(previousValue) && isPlainObject(nextValue)) {\n result[key] = deepMerge(previousValue, nextValue);\n } else {\n result[key] = cloneValue(nextValue);\n }\n }\n\n return result;\n}\n\nexport class StateStyleResolver<T extends Record<string, any> = Record<string, any>> implements IStateStyleResolver<T> {\n constructor(private readonly options: IStateStyleResolverOptions = {}) {}\n\n resolve(\n normalAttrs: Partial<T>,\n states: Record<string, Partial<T>> | undefined,\n stateProxy: StateProxy<T> | undefined,\n currentStates: string[],\n stateSort?: StateSort\n ): Partial<T> {\n const mergeMode = this.options.mergeMode ?? 'shallow';\n const sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice();\n const resolvedAttrs: Partial<T> = {};\n\n sortedStates.forEach(stateName => {\n const attrs = stateProxy ? stateProxy(stateName, sortedStates) : states?.[stateName];\n\n if (attrs == null) {\n return;\n }\n\n for (const key in attrs) {\n if (!Object.prototype.hasOwnProperty.call(attrs, key)) {\n continue;\n }\n\n const nextValue = attrs[key];\n\n if (\n mergeMode === 'deep' &&\n isPlainObject(nextValue) &&\n (isPlainObject((resolvedAttrs as Record<string, any>)[key]) ||\n isPlainObject((normalAttrs as Record<string, any>)[key]))\n ) {\n const baseValue = isPlainObject((resolvedAttrs as Record<string, any>)[key])\n ? (resolvedAttrs as Record<string, any>)[key]\n : isPlainObject((normalAttrs as Record<string, any>)[key])\n ? (normalAttrs as Record<string, any>)[key]\n : {};\n (resolvedAttrs as Record<string, any>)[key] = deepMerge(baseValue, nextValue);\n } else {\n (resolvedAttrs as Record<string, any>)[key] = cloneValue(nextValue);\n }\n }\n });\n\n return resolvedAttrs;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/cjs/interface/animate.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["// import type { EventEmitter } from '@visactor/vutils';\n// import type { AnimateStepType } from '../common/enums';\n// import type { Releaseable } from './common';\n// import type { IGraphic } from './graphic';\n\n// enum AnimateStatus {\n// INITIAL = 0,\n// RUNNING = 1,\n// PAUSED = 2,\n// END = 3\n// }\n\n// enum AnimateMode {\n// NORMAL = 0b0000,\n// SET_ATTR_IMMEDIATELY = 0b0001\n// }\n\n// // export type EasingType = (...args: any) => any;\n\n// // export declare class Easing {\n// // static linear(t: number): number;\n// // static none(): typeof Easing.linear;\n// // /**\n// // * 获取缓动函数,amount指示这个缓动函数的插值方式\n// // * @param amount\n// // * @returns\n// // */\n// // static get(amount: number): (t: number) => number;\n// // static getPowIn(pow: number): (t: number) => number;\n// // static getPowOut(pow: number): (t: number) => number;\n// // static getPowInOut(pow: number): (t: number) => number;\n// // static quadIn: (t: number) => number;\n// // static quadOut: (t: number) => number;\n// // static quadInOut: (t: number) => number;\n// // static cubicIn: (t: number) => number;\n// // static cubicOut: (t: number) => number;\n// // static cubicInOut: (t: number) => number;\n// // static quartIn: (t: number) => number;\n// // static quartOut: (t: number) => number;\n// // static quartInOut: (t: number) => number;\n// // static quintIn: (t: number) => number;\n// // static quintOut: (t: number) => number;\n// // static quintInOut: (t: number) => number;\n// // static getBackIn(amount: number): (t: number) => number;\n// // static getBackOut(amount: number): (t: number) => number;\n// // static getBackInOut(amount: number): (t: number) => number;\n// // static backIn: (t: number) => number;\n// // static backOut: (t: number) => number;\n// // static backInOut: (t: number) => number;\n// // static circIn(t: number): number;\n// // static circOut(t: number): number;\n// // static circInOut(t: number): number;\n// // static bounceOut(t: number): number;\n// // static bounceIn(t: number): number;\n// // static bounceInOut(t: number): number;\n// // static getElasticIn(amplitude: number, period: number): (t: number) => number;\n// // static getElasticOut(amplitude: number, period: number): (t: number) => number;\n// // static getElasticInOut(amplitude: number, period: number): (t: number) => number;\n// // static elasticIn: (t: number) => number;\n// // static elasticOut: (t: number) => number;\n// // static elasticInOut: (t: number) => number;\n// // }\n\n// // timeline管理一堆的animate,多个timeline互不影响\n// // timeline主要作用是基于layer层面的整体管理\n// // 每个layer默认带有一个timeline\n// export interface Timeline {\n// AnimateList: IAnimate[];\n// }\n\n// type IStopType = 'end' | 'start' | 'current';\n\n// // TODO: 提供options配置可序列化\n// interface AnimateSpecItem {\n// type: 'to' | 'delay' | 'stop' | 'any';\n// params: any[];\n// }\n\n// export type EasingTypeStr =\n// | 'linear'\n// | 'quadIn'\n// | 'quadOut'\n// | 'quadInOut'\n// | 'quadInOut'\n// | 'cubicIn'\n// | 'cubicOut'\n// | 'cubicInOut'\n// | 'quartIn'\n// | 'quartOut'\n// | 'quartInOut'\n// | 'quintIn'\n// | 'quintOut'\n// | 'quintInOut'\n// | 'backIn'\n// | 'backOut'\n// | 'backInOut'\n// | 'circIn'\n// | 'circOut'\n// | 'circInOut'\n// | 'bounceOut'\n// | 'bounceIn'\n// | 'bounceInOut'\n// | 'elasticIn'\n// | 'elasticOut'\n// | 'elasticInOut'\n// | 'sineIn'\n// | 'sineOut'\n// | 'sineInOut'\n// | 'expoIn'\n// | 'expoOut'\n// | 'expoInOut'\n// // @since 0.21.0\n// | 'easeInOutQuad'\n// | 'easeOutElastic'\n// | 'easeInOutElastic'\n// | '';\n// export type EasingTypeFunc = (t: number) => number;\n\n// export type EasingType = EasingTypeStr | EasingTypeFunc;\n\n// export type IAnimateStepType = keyof typeof AnimateStepType;\n\n// export interface IStep {\n// type: IAnimateStepType;\n// prev?: IStep;\n// // 持续时间\n// duration: number;\n// // 在animate中的位置\n// position: number;\n// next?: IStep;\n// props?: any;\n// parsedProps?: any;\n// propKeys?: string[];\n// easing?: EasingTypeFunc;\n// customAnimate?: ICustomAnimate;\n\n// append: (step: IStep) => void;\n// getLastProps: () => any;\n// }\n\n// export interface IStepConfig {\n// tempProps?: boolean; // props为临时props,可以直接使用不用拷贝\n// noPreventAttrs?: boolean;\n// }\n\n// export interface IAnimateTarget {\n// onAnimateBind?: (animte: IAnimate | ISubAnimate) => void;\n// // 获取属性\n// getComputedAttribute: (name: string) => any;\n// // 获取默认属性\n// getDefaultAttribute: (name: string) => any;\n// onStop: (props?: Record<string, any>) => void;\n// animates: Map<string | number, IAnimate>;\n// [key: string]: any;\n// }\n\n// export interface ICustomAnimate {\n// duration: number;\n// easing: EasingType;\n// step?: IStep;\n// mode?: AnimateMode;\n\n// bind: (target: IAnimateTarget, subAni: ISubAnimate) => void;\n// // 在第一次调用的时候触发\n// onBind: () => void;\n// // 第一次执行的时候调用\n// onFirstRun: () => void;\n// // 开始执行的时候调用(如果有循环,那每个周期都会调用)\n// onStart: () => void;\n// // 结束执行的时候调用(如果有循环,那每个周期都会调用)\n// onEnd: () => void;\n// onUpdate: (end: boolean, ratio: number, out: Record<string, any>) => void;\n// update: (end: boolean, ratio: number, out: Record<string, any>) => void;\n// getEndProps: () => Record<string, any> | void;\n// getFromProps: () => Record<string, any> | void;\n// getMergedEndProps: () => Record<string, any> | void;\n// }\n\n// export type IAnimateConstructor = new (...args: any[]) => IAnimate;\n\n// // 每一个animate绑定一个graphic,用于描述这个graphic的动画内容\n// // 在timeline层面,animate相当于是一段timeslice\n// export interface IAnimate {\n// readonly id: string | number;\n// status: AnimateStatus;\n\n// interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n\n// _onStart?: (() => void)[];\n// _onFrame?: ((step: IStep, ratio: number) => void)[];\n// _onEnd?: (() => void)[];\n// _onRemove?: (() => void)[];\n\n// getStartProps: () => Record<string, any>;\n// getEndProps: () => Record<string, any>;\n\n// setTimeline: (timeline: ITimeline) => void;\n// // getTimeline: () => ITimeline;\n// readonly timeline: ITimeline;\n\n// bind: (target: IAnimateTarget) => this;\n// to: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n// from: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n// pause: () => void;\n// resume: () => void;\n// onStart: (cb: () => void) => void;\n// onEnd: (cb: () => void) => void;\n// onFrame: (cb: (step: IStep, ratio: number) => void) => void;\n// onRemove: (cb: () => void) => void;\n// // 屏蔽属性\n// preventAttr: (key: string) => void;\n// // 屏蔽属性\n// preventAttrs: (key: string[]) => void;\n// // 属性是否合法\n// validAttr: (key: string) => boolean;\n\n// runCb: (cb: (a: IAnimate, step: IStep) => void) => IAnimate;\n\n// // 自定义插值,返回false表示没有匹配上\n// customInterpolate: (\n// key: string,\n// ratio: number,\n// from: any,\n// to: any,\n// target: IAnimateTarget,\n// ret: Record<string, any>\n// ) => boolean;\n// //\n// play: (customAnimate: ICustomAnimate) => this;\n\n// // 获取该属性的上一个值\n// // getLastPropByName: (name: string, step: IStep) => any;\n// // delay: (duration: number) => IAnimate;\n// stop: (type?: 'start' | 'end' | Record<string, any>) => void;\n// /** 打上END标志,下一帧被删除 */\n// release: () => void;\n// // 获取持续的时长\n// getDuration: () => number;\n// // 获取动画开始时间(注意并不是子动画的startAt)\n// getStartTime: () => number;\n// // done: (cb: (_: any) => any) => IAnimate;\n// // pause: () => IAnimate;\n// // spec: (spec: AnimateSpecItem[]) => IAnimate;\n// // start: () => void; // 有start方法,避免动画提前开始(VGrammar需要时间处理数据)\n// wait: (delay: number) => this;\n\n// // // 编排\n// afterAll: (list: IAnimate[]) => this;\n// after: (animate: IAnimate) => this;\n// parallel: (animate: IAnimate) => this;\n\n// // // timislice (getter)\n// // startTime: number;\n// // endTime: number;\n// // startTimes: number[];\n// // endTimes: number[];\n\n// // // 高级参数,frame到frameEnd之间可以进行reverse,loop,bounce效果\n// // frame: () => IAnimate;\n// // frameEnd: () => IAnimate;\n// reversed: (r: boolean) => IAnimate;\n// loop: (n: number) => IAnimate;\n// bounce: (b: boolean) => IAnimate;\n\n// nextAnimate?: IAnimate;\n// prevAnimate?: IAnimate;\n\n// advance: (delta: number) => void;\n\n// startAt: (t: number) => IAnimate;\n\n// // // 语法糖\n// // create: (duration: number) => IAnimate;\n// // fadeIn: (duration: number) => IAnimate;\n// }\n\n// export interface ISubAnimate {\n// getLastStep: () => IStep;\n// animate: IAnimate;\n// // 获取该属性的上一个值\n// getLastPropByName: (name: string, step: IStep) => any;\n// }\n\n// // rect.animate().abc().to({}, 1000).delay(1000).frame().to().delay().to().frameEnd().loop().bounce()\n\n// export interface BaseAnimateConfig {\n// id?: number | string;\n// interpolate?: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n// onStart?: () => void;\n// onFrame?: (step: IStep, ratio: number) => void;\n// onEnd?: () => void;\n// onRemove?: () => void;\n// }\n\n// // VGrammar和 vrender命名不一致,好尴尬\n// export interface MorphingAnimateConfig extends Omit<BaseAnimateConfig, 'interpolate'> {\n// duration?: number;\n// easing?: EasingType; // 统一到easing\n// delay?: number;\n// }\n\n// export interface MultiMorphingAnimateConfig extends MorphingAnimateConfig {\n// splitPath?: 'clone' | ((graphic: IGraphic, count: number, needAppend?: boolean) => IGraphic[]);\n// individualDelay?: (index: number, count: number, fromGraphic: IGraphic, toGraphic: IGraphic) => number;\n// }\n\n// export interface ITimeline {\n// id: number;\n// animateCount: number;\n// isGlobal: boolean;\n// addAnimate: (animate: IAnimate) => void;\n// removeAnimate: (animate: IAnimate, release?: boolean) => void;\n// tick: (delta: number) => void;\n// clear: () => void;\n// pause: () => void;\n// resume: () => void;\n// }\n\n// export type ITimelineConstructor = new (...args: any[]) => ITimeline;\n\n// export type ITickerConstructor = new (...args: any[]) => ITicker;\n\n// export interface ITickHandler extends Releaseable {\n// avaliable: () => boolean;\n// /**\n// * 开始执行tick\n// * @param interval 延时 ms\n// * @param cb 执行的回调\n// */\n// tick: (interval: number, cb: (handler: ITickHandler) => void) => void; // 开始\n// tickTo?: (t: number, cb: (handler: ITickHandler, params?: { once: boolean }) => void) => void;\n// getTime: () => number; // 获取时间\n// }\n\n// export interface ITickerHandlerStatic {\n// Avaliable: () => boolean;\n// new (): ITickHandler;\n// }\n\n// export interface ITicker extends EventEmitter {\n// setFPS?: (fps: number) => void;\n// setInterval?: (interval: number) => void;\n// getFPS?: () => number;\n// getInterval?: () => number;\n// tick: (interval: number) => void;\n// tickAt?: (time: number) => void;\n// pause: () => boolean;\n// resume: () => boolean;\n// /**\n// * 开启tick,force为true强制开启,否则如果timeline为空则不开启\n// */\n// start: (force?: boolean) => boolean;\n// stop: () => void;\n// addTimeline: (timeline: ITimeline) => void;\n// remTimeline: (timeline: ITimeline) => void;\n// trySyncTickStatus: () => void;\n// getTimelines: () => ITimeline[];\n\n// release: () => void;\n\n// // 是否自动停止,默认为true\n// autoStop: boolean;\n// }\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IPlugin, IPluginContext } from './types';
|
|
2
|
-
export declare abstract class BasePlugin implements IPlugin {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly version: string;
|
|
5
|
-
constructor(name: string, version?: string);
|
|
6
|
-
abstract install(context: IPluginContext): void;
|
|
7
|
-
uninstall(): void;
|
|
8
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.BasePlugin = void 0;
|
|
6
|
-
|
|
7
|
-
class BasePlugin {
|
|
8
|
-
constructor(name, version = "1.0.0") {
|
|
9
|
-
this.name = name, this.version = version;
|
|
10
|
-
}
|
|
11
|
-
uninstall() {}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.BasePlugin = BasePlugin;
|
|
15
|
-
//# sourceMappingURL=base-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/base-plugin.ts"],"names":[],"mappings":";;;AAEA,MAAsB,UAAU;IAC9B,YAA4B,IAAY,EAAkB,UAAkB,OAAO;QAAvD,SAAI,GAAJ,IAAI,CAAQ;QAAkB,YAAO,GAAP,OAAO,CAAkB;IAAG,CAAC;IAIvF,SAAS;QACP,OAAO;IACT,CAAC;CACF;AARD,gCAQC","file":"base-plugin.js","sourcesContent":["import type { IPlugin, IPluginContext } from './types';\n\nexport abstract class BasePlugin implements IPlugin {\n constructor(public readonly name: string, public readonly version: string = '1.0.0') {}\n\n abstract install(context: IPluginContext): void;\n\n uninstall(): void {\n return;\n }\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BasePlugin } from './base-plugin';
|
|
2
|
-
import type { IBrowserEnvPluginHooks, IPluginContext } from './types';
|
|
3
|
-
export declare class BrowserEnvPlugin extends BasePlugin {
|
|
4
|
-
private readonly hooks;
|
|
5
|
-
constructor(name: string, hooks?: IBrowserEnvPluginHooks, version?: string);
|
|
6
|
-
install(context: IPluginContext): void;
|
|
7
|
-
uninstall(): void;
|
|
8
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.BrowserEnvPlugin = void 0;
|
|
6
|
-
|
|
7
|
-
const base_plugin_1 = require("./base-plugin");
|
|
8
|
-
|
|
9
|
-
class BrowserEnvPlugin extends base_plugin_1.BasePlugin {
|
|
10
|
-
constructor(name, hooks = {}, version) {
|
|
11
|
-
super(name, version), this.hooks = hooks;
|
|
12
|
-
}
|
|
13
|
-
install(context) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
null === (_b = (_a = this.hooks).install) || void 0 === _b || _b.call(_a, context);
|
|
16
|
-
}
|
|
17
|
-
uninstall() {
|
|
18
|
-
var _a, _b;
|
|
19
|
-
null === (_b = (_a = this.hooks).uninstall) || void 0 === _b || _b.call(_a);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.BrowserEnvPlugin = BrowserEnvPlugin;
|
|
24
|
-
//# sourceMappingURL=browser-env-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/browser-env-plugin.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,MAAa,gBAAiB,SAAQ,wBAAU;IAC9C,YAAY,IAAY,EAAmB,QAAgC,EAAE,EAAE,OAAgB;QAC7F,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADoB,UAAK,GAAL,KAAK,CAA6B;IAE7E,CAAC;IAED,OAAO,CAAC,OAAuB;;QAC7B,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,OAAO,mDAAG,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,SAAS;;QACP,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,SAAS,kDAAI,CAAC;IAC3B,CAAC;CACF;AAZD,4CAYC","file":"browser-env-plugin.js","sourcesContent":["import { BasePlugin } from './base-plugin';\nimport type { IBrowserEnvPluginHooks, IPluginContext } from './types';\n\nexport class BrowserEnvPlugin extends BasePlugin {\n constructor(name: string, private readonly hooks: IBrowserEnvPluginHooks = {}, version?: string) {\n super(name, version);\n }\n\n install(context: IPluginContext): void {\n this.hooks.install?.(context);\n }\n\n uninstall(): void {\n this.hooks.uninstall?.();\n }\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BasePlugin } from './base-plugin';
|
|
2
|
-
import type { IPickerPluginEntries, IPluginContext } from './types';
|
|
3
|
-
export declare class PickerPlugin extends BasePlugin {
|
|
4
|
-
private readonly entries;
|
|
5
|
-
constructor(name: string, entries: IPickerPluginEntries, version?: string);
|
|
6
|
-
install(context: IPluginContext): void;
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.PickerPlugin = void 0;
|
|
6
|
-
|
|
7
|
-
const base_plugin_1 = require("./base-plugin");
|
|
8
|
-
|
|
9
|
-
class PickerPlugin extends base_plugin_1.BasePlugin {
|
|
10
|
-
constructor(name, entries, version) {
|
|
11
|
-
super(name, version), this.entries = entries;
|
|
12
|
-
}
|
|
13
|
-
install(context) {
|
|
14
|
-
context.registry.picker.registerMany(this.entries);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.PickerPlugin = PickerPlugin;
|
|
19
|
-
//# sourceMappingURL=picker-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/picker-plugin.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,MAAa,YAAa,SAAQ,wBAAU;IAC1C,YAAY,IAAY,EAAmB,OAA6B,EAAE,OAAgB;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAsB;IAExE,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AARD,oCAQC","file":"picker-plugin.js","sourcesContent":["import { BasePlugin } from './base-plugin';\nimport type { IPickerPluginEntries, IPluginContext } from './types';\n\nexport class PickerPlugin extends BasePlugin {\n constructor(name: string, private readonly entries: IPickerPluginEntries, version?: string) {\n super(name, version);\n }\n\n install(context: IPluginContext): void {\n context.registry.picker.registerMany(this.entries);\n }\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BasePlugin } from './base-plugin';
|
|
2
|
-
import type { IPluginContext, IRendererPluginEntries } from './types';
|
|
3
|
-
export declare class RendererPlugin extends BasePlugin {
|
|
4
|
-
private readonly entries;
|
|
5
|
-
constructor(name: string, entries: IRendererPluginEntries, version?: string);
|
|
6
|
-
install(context: IPluginContext): void;
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.RendererPlugin = void 0;
|
|
6
|
-
|
|
7
|
-
const base_plugin_1 = require("./base-plugin");
|
|
8
|
-
|
|
9
|
-
class RendererPlugin extends base_plugin_1.BasePlugin {
|
|
10
|
-
constructor(name, entries, version) {
|
|
11
|
-
super(name, version), this.entries = entries;
|
|
12
|
-
}
|
|
13
|
-
install(context) {
|
|
14
|
-
context.registry.renderer.registerMany(this.entries);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.RendererPlugin = RendererPlugin;
|
|
19
|
-
//# sourceMappingURL=renderer-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/renderer-plugin.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAG3C,MAAa,cAAe,SAAQ,wBAAU;IAC5C,YAAY,IAAY,EAAmB,OAA+B,EAAE,OAAgB;QAC1F,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAwB;IAE1E,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AARD,wCAQC","file":"renderer-plugin.js","sourcesContent":["import { BasePlugin } from './base-plugin';\nimport type { IPluginContext, IRendererPluginEntries } from './types';\n\nexport class RendererPlugin extends BasePlugin {\n constructor(name: string, private readonly entries: IRendererPluginEntries, version?: string) {\n super(name, version);\n }\n\n install(context: IPluginContext): void {\n context.registry.renderer.registerMany(this.entries);\n }\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { IGraphic, IGroup, ILayer, IStage } from '../../interface';
|
|
2
|
-
import { type IDeferredStateConfig, type StatePerfMonitor } from './state-perf-monitor';
|
|
3
|
-
type StateBatchJobKind = 'apply_states';
|
|
4
|
-
type StateBatchIntentKey = string;
|
|
5
|
-
export interface IStateBatchJob {
|
|
6
|
-
id: number;
|
|
7
|
-
kind: StateBatchJobKind;
|
|
8
|
-
intentKey: StateBatchIntentKey;
|
|
9
|
-
status: 'pending' | 'running' | 'completed' | 'cancelled';
|
|
10
|
-
targetStates: string[];
|
|
11
|
-
targetStatesKey: string;
|
|
12
|
-
pendingGraphics: Set<IGraphic>;
|
|
13
|
-
orderedGraphics: IGraphic[];
|
|
14
|
-
config: Required<IDeferredStateConfig>;
|
|
15
|
-
contextOwner: IStage | ILayer | IGroup;
|
|
16
|
-
contextOwnerId: number;
|
|
17
|
-
configFingerprint: string;
|
|
18
|
-
createdAt: number;
|
|
19
|
-
processedCount: number;
|
|
20
|
-
}
|
|
21
|
-
export declare class StateBatchScheduler {
|
|
22
|
-
private readonly stage;
|
|
23
|
-
private readonly perfMonitor?;
|
|
24
|
-
readonly jobsByIntentKey: Map<string, IStateBatchJob>;
|
|
25
|
-
readonly pendingIntentByGraphic: Map<IGraphic<Partial<import("../../interface").IGraphicAttribute>>, string>;
|
|
26
|
-
private nextJobId;
|
|
27
|
-
private readonly runningJobs;
|
|
28
|
-
constructor(stage: IStage, perfMonitor?: StatePerfMonitor);
|
|
29
|
-
schedule(graphics: IGraphic[], targetStates: string[]): void;
|
|
30
|
-
release(): void;
|
|
31
|
-
private resolveEligibility;
|
|
32
|
-
private resolveDeferredContext;
|
|
33
|
-
private classifyGraphicTargetStates;
|
|
34
|
-
private enqueueDeferredIntent;
|
|
35
|
-
private removeGraphicFromPending;
|
|
36
|
-
private removeGraphicFromIntentJob;
|
|
37
|
-
private ensureJobRunning;
|
|
38
|
-
private runJob;
|
|
39
|
-
private waitForNextFrame;
|
|
40
|
-
private commitSynchronously;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2
|
-
return new (P || (P = Promise))((function(resolve, reject) {
|
|
3
|
-
function fulfilled(value) {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function rejected(value) {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function step(result) {
|
|
18
|
-
var value;
|
|
19
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
|
|
20
|
-
resolve(value);
|
|
21
|
-
}))).then(fulfilled, rejected);
|
|
22
|
-
}
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
import { UpdateCategory, classifyAffectedKeys } from "./attribute-update-classifier";
|
|
28
|
-
|
|
29
|
-
import { fingerprintDeferredStateConfig, normalizeDeferredStateConfig, normalizeDeferredStateOwnerConfig } from "./state-perf-monitor";
|
|
30
|
-
|
|
31
|
-
function isRenderableGraphic(graphic) {
|
|
32
|
-
return !!graphic.stage && "released" !== graphic.releaseStatus;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function createTargetStatesKey(targetStates) {
|
|
36
|
-
return targetStates.length ? targetStates.join("|") : "__clear__";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function createIntentKey(contextOwnerId, configFingerprint, targetStatesKey) {
|
|
40
|
-
return `${contextOwnerId}:${configFingerprint}:${targetStatesKey}`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function hasMeaningfulDeferredConfig(config) {
|
|
44
|
-
const normalized = normalizeDeferredStateOwnerConfig(config);
|
|
45
|
-
return !!normalized && (null != normalized.localEnabled || null != normalized.deferred);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getGraphicCompiledDefinitions(graphic) {
|
|
49
|
-
const graphicAny = graphic;
|
|
50
|
-
if ("function" == typeof graphicAny.resolveEffectiveCompiledDefinitions) {
|
|
51
|
-
const result = graphicAny.resolveEffectiveCompiledDefinitions();
|
|
52
|
-
return {
|
|
53
|
-
compiledDefinitions: result.compiledDefinitions,
|
|
54
|
-
stateProxyEligibility: result.stateProxyEligibility
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function getCurrentStateNames(graphic) {
|
|
61
|
-
var _a, _b;
|
|
62
|
-
return null !== (_b = null === (_a = graphic.currentStates) || void 0 === _a ? void 0 : _a.slice()) && void 0 !== _b ? _b : [];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export class StateBatchScheduler {
|
|
66
|
-
constructor(stage, perfMonitor) {
|
|
67
|
-
this.stage = stage, this.perfMonitor = perfMonitor, this.jobsByIntentKey = new Map,
|
|
68
|
-
this.pendingIntentByGraphic = new Map, this.nextJobId = 1, this.runningJobs = new Map;
|
|
69
|
-
}
|
|
70
|
-
schedule(graphics, targetStates) {
|
|
71
|
-
const batchOperation = graphics.length > 1;
|
|
72
|
-
graphics.forEach((graphic => {
|
|
73
|
-
const eligibility = this.resolveEligibility(graphic, targetStates, batchOperation, !0);
|
|
74
|
-
if ("reason" in eligibility) return this.removeGraphicFromPending(graphic), void ("graphic_unavailable" !== eligibility.reason && this.commitSynchronously(graphic, targetStates));
|
|
75
|
-
this.enqueueDeferredIntent(graphic, targetStates, eligibility.context, eligibility.targetStatesKey);
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
release() {
|
|
79
|
-
var _a;
|
|
80
|
-
this.jobsByIntentKey.forEach((job => {
|
|
81
|
-
job.status = "cancelled";
|
|
82
|
-
})), this.jobsByIntentKey.clear(), this.pendingIntentByGraphic.clear(), this.runningJobs.clear(),
|
|
83
|
-
null === (_a = this.perfMonitor) || void 0 === _a || _a.updateBatchPending(0);
|
|
84
|
-
}
|
|
85
|
-
resolveEligibility(graphic, targetStates, batchOperation, recordObservability) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f;
|
|
87
|
-
if (!isRenderableGraphic(graphic)) return recordObservability && (null === (_a = this.perfMonitor) || void 0 === _a || _a.recordDeferredIneligible("graphic_unavailable")),
|
|
88
|
-
{
|
|
89
|
-
eligible: !1,
|
|
90
|
-
reason: "graphic_unavailable"
|
|
91
|
-
};
|
|
92
|
-
if (!batchOperation) return recordObservability && (null === (_b = this.perfMonitor) || void 0 === _b || _b.recordDeferredIneligible("non_batch_operation")),
|
|
93
|
-
{
|
|
94
|
-
eligible: !1,
|
|
95
|
-
reason: "non_batch_operation"
|
|
96
|
-
};
|
|
97
|
-
const context = this.resolveDeferredContext(graphic);
|
|
98
|
-
if (!context) return recordObservability && (null === (_c = this.perfMonitor) || void 0 === _c || _c.recordDeferredIneligible("graphic_unavailable")),
|
|
99
|
-
{
|
|
100
|
-
eligible: !1,
|
|
101
|
-
reason: "graphic_unavailable"
|
|
102
|
-
};
|
|
103
|
-
if (!context.config.enabled) {
|
|
104
|
-
const normalizedOwnerConfig = normalizeDeferredStateOwnerConfig(context.contextOwner.deferredStateConfig), reason = !1 === (null == normalizedOwnerConfig ? void 0 : normalizedOwnerConfig.localEnabled) ? "context_disabled" : "config_disabled";
|
|
105
|
-
return recordObservability && (null === (_d = this.perfMonitor) || void 0 === _d || _d.recordDeferredIneligible(reason)),
|
|
106
|
-
{
|
|
107
|
-
eligible: !1,
|
|
108
|
-
reason: reason
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
const classification = this.classifyGraphicTargetStates(graphic, targetStates);
|
|
112
|
-
return classification.reason ? (recordObservability && (null === (_e = this.perfMonitor) || void 0 === _e || _e.recordDeferredIneligible(classification.reason)),
|
|
113
|
-
{
|
|
114
|
-
eligible: !1,
|
|
115
|
-
reason: classification.reason
|
|
116
|
-
}) : classification.category !== UpdateCategory.PAINT ? (recordObservability && (null === (_f = this.perfMonitor) || void 0 === _f || _f.recordDeferredIneligible("mixed_update_category")),
|
|
117
|
-
{
|
|
118
|
-
eligible: !1,
|
|
119
|
-
reason: "mixed_update_category"
|
|
120
|
-
}) : {
|
|
121
|
-
eligible: !0,
|
|
122
|
-
context: context,
|
|
123
|
-
targetStatesKey: createTargetStatesKey(targetStates)
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
resolveDeferredContext(graphic) {
|
|
127
|
-
var _a;
|
|
128
|
-
const stage = graphic.stage;
|
|
129
|
-
if (!stage) return;
|
|
130
|
-
let owner = stage, config = normalizeDeferredStateConfig(void 0);
|
|
131
|
-
const ownerConfigs = [ stage ], parents = [];
|
|
132
|
-
let parent = graphic.parent;
|
|
133
|
-
for (;parent && parent !== stage; ) parents.push(parent), parent = parent.parent;
|
|
134
|
-
parents.reverse().forEach((current => ownerConfigs.push(current))), ownerConfigs.forEach((current => {
|
|
135
|
-
const deferredStateConfig = normalizeDeferredStateOwnerConfig(current.deferredStateConfig);
|
|
136
|
-
deferredStateConfig && (deferredStateConfig.deferred && (config = Object.assign(Object.assign({}, config), deferredStateConfig.deferred)),
|
|
137
|
-
null != deferredStateConfig.localEnabled && (config.enabled = deferredStateConfig.localEnabled),
|
|
138
|
-
hasMeaningfulDeferredConfig(current.deferredStateConfig) && (owner = current));
|
|
139
|
-
}));
|
|
140
|
-
const normalized = normalizeDeferredStateConfig(config);
|
|
141
|
-
return {
|
|
142
|
-
contextOwner: owner,
|
|
143
|
-
contextOwnerId: null !== (_a = owner._uid) && void 0 !== _a ? _a : 0,
|
|
144
|
-
config: normalized,
|
|
145
|
-
configFingerprint: fingerprintDeferredStateConfig(normalized)
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
classifyGraphicTargetStates(graphic, targetStates) {
|
|
149
|
-
const {compiledDefinitions: compiledDefinitions, stateProxyEligibility: stateProxyEligibility} = getGraphicCompiledDefinitions(graphic), candidateStates = Array.from(new Set([ ...getCurrentStateNames(graphic), ...targetStates ]));
|
|
150
|
-
let category = UpdateCategory.NONE;
|
|
151
|
-
return candidateStates.forEach((stateName => {
|
|
152
|
-
if (null == stateProxyEligibility ? void 0 : stateProxyEligibility(stateName)) return void (category = UpdateCategory.NONE);
|
|
153
|
-
const definition = null == compiledDefinitions ? void 0 : compiledDefinitions.get(stateName);
|
|
154
|
-
definition && (definition.hasResolver && 0 === definition.affectedKeys.size ? category = UpdateCategory.NONE : category |= classifyAffectedKeys(definition.affectedKeys));
|
|
155
|
-
})), candidateStates.some((stateName => null == stateProxyEligibility ? void 0 : stateProxyEligibility(stateName))) || candidateStates.some((stateName => {
|
|
156
|
-
const definition = null == compiledDefinitions ? void 0 : compiledDefinitions.get(stateName);
|
|
157
|
-
return !!(null == definition ? void 0 : definition.hasResolver) && 0 === definition.affectedKeys.size;
|
|
158
|
-
})) ? {
|
|
159
|
-
category: UpdateCategory.NONE,
|
|
160
|
-
reason: "resolver_unstable_keys"
|
|
161
|
-
} : {
|
|
162
|
-
category: category === UpdateCategory.NONE ? UpdateCategory.PAINT : category
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
enqueueDeferredIntent(graphic, targetStates, context, targetStatesKey) {
|
|
166
|
-
var _a, _b, _c, _d, _e, _f;
|
|
167
|
-
const nextIntentKey = createIntentKey(context.contextOwnerId, context.configFingerprint, targetStatesKey), prevIntentKey = this.pendingIntentByGraphic.get(graphic);
|
|
168
|
-
if (prevIntentKey === nextIntentKey) return void (null === (_a = this.perfMonitor) || void 0 === _a || _a.incrementCounter("deferredJobsCoalesced"));
|
|
169
|
-
prevIntentKey && this.removeGraphicFromIntentJob(graphic, prevIntentKey);
|
|
170
|
-
let job = this.jobsByIntentKey.get(nextIntentKey);
|
|
171
|
-
job ? null === (_d = this.perfMonitor) || void 0 === _d || _d.incrementCounter("deferredJobsCoalesced") : (job = {
|
|
172
|
-
id: this.nextJobId++,
|
|
173
|
-
kind: "apply_states",
|
|
174
|
-
intentKey: nextIntentKey,
|
|
175
|
-
status: "pending",
|
|
176
|
-
targetStates: [ ...targetStates ],
|
|
177
|
-
targetStatesKey: targetStatesKey,
|
|
178
|
-
pendingGraphics: new Set,
|
|
179
|
-
orderedGraphics: [],
|
|
180
|
-
config: context.config,
|
|
181
|
-
contextOwner: context.contextOwner,
|
|
182
|
-
contextOwnerId: context.contextOwnerId,
|
|
183
|
-
configFingerprint: context.configFingerprint,
|
|
184
|
-
createdAt: Date.now(),
|
|
185
|
-
processedCount: 0
|
|
186
|
-
}, this.jobsByIntentKey.set(nextIntentKey, job), null === (_b = this.perfMonitor) || void 0 === _b || _b.incrementCounter("deferredJobsCreated"),
|
|
187
|
-
null === (_c = this.perfMonitor) || void 0 === _c || _c.updateBatchPending(this.jobsByIntentKey.size)),
|
|
188
|
-
job.pendingGraphics.has(graphic) || (job.pendingGraphics.add(graphic), job.orderedGraphics.push(graphic),
|
|
189
|
-
this.pendingIntentByGraphic.set(graphic, nextIntentKey), null === (_e = this.perfMonitor) || void 0 === _e || _e.recordAllocation("batchEntriesCreated"),
|
|
190
|
-
null === (_f = this.perfMonitor) || void 0 === _f || _f.updateMaxGraphicsInJob(job.pendingGraphics.size)),
|
|
191
|
-
this.ensureJobRunning(job);
|
|
192
|
-
}
|
|
193
|
-
removeGraphicFromPending(graphic) {
|
|
194
|
-
const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
|
|
195
|
-
prevIntentKey && this.removeGraphicFromIntentJob(graphic, prevIntentKey);
|
|
196
|
-
}
|
|
197
|
-
removeGraphicFromIntentJob(graphic, intentKey) {
|
|
198
|
-
var _a, _b, _c;
|
|
199
|
-
const job = this.jobsByIntentKey.get(intentKey);
|
|
200
|
-
job ? (job.pendingGraphics.delete(graphic), this.pendingIntentByGraphic.get(graphic) === intentKey && this.pendingIntentByGraphic.delete(graphic),
|
|
201
|
-
0 === job.pendingGraphics.size && "completed" !== job.status && (job.status = "cancelled",
|
|
202
|
-
this.jobsByIntentKey.delete(intentKey), null === (_a = this.perfMonitor) || void 0 === _a || _a.incrementCounter("deferredJobsCancelled"),
|
|
203
|
-
null === (_b = this.perfMonitor) || void 0 === _b || _b.recordEvent("deferred-job-cancel", {
|
|
204
|
-
intentKey: intentKey,
|
|
205
|
-
jobId: job.id
|
|
206
|
-
}), null === (_c = this.perfMonitor) || void 0 === _c || _c.updateBatchPending(this.jobsByIntentKey.size))) : this.pendingIntentByGraphic.delete(graphic);
|
|
207
|
-
}
|
|
208
|
-
ensureJobRunning(job) {
|
|
209
|
-
if (this.runningJobs.has(job.intentKey)) return;
|
|
210
|
-
const runner = this.runJob(job).then((() => {
|
|
211
|
-
this.runningJobs.delete(job.intentKey);
|
|
212
|
-
}), (() => {
|
|
213
|
-
this.runningJobs.delete(job.intentKey);
|
|
214
|
-
}));
|
|
215
|
-
this.runningJobs.set(job.intentKey, runner);
|
|
216
|
-
}
|
|
217
|
-
runJob(job) {
|
|
218
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
219
|
-
return __awaiter(this, void 0, void 0, (function*() {
|
|
220
|
-
if ("cancelled" === job.status) return;
|
|
221
|
-
if (yield this.waitForNextFrame(), "cancelled" === job.status) return;
|
|
222
|
-
job.status = "running", null === (_a = this.perfMonitor) || void 0 === _a || _a.recordEvent("deferred-job-start", {
|
|
223
|
-
intentKey: job.intentKey,
|
|
224
|
-
jobId: job.id
|
|
225
|
-
});
|
|
226
|
-
let index = 0, frameStart = performance.now(), processedInFrame = 0, committedInSlice = 0;
|
|
227
|
-
for (;index < job.orderedGraphics.length; ) {
|
|
228
|
-
if ("cancelled" === job.status) return;
|
|
229
|
-
processedInFrame > 0 && (processedInFrame >= job.config.maxGraphicsPerFrame || performance.now() - frameStart >= job.config.frameBudget) && (null === (_b = this.perfMonitor) || void 0 === _b || _b.incrementCounter("deferredBudgetYields"),
|
|
230
|
-
null === (_c = this.perfMonitor) || void 0 === _c || _c.recordCost("batchSlice", performance.now() - frameStart),
|
|
231
|
-
null === (_d = this.perfMonitor) || void 0 === _d || _d.recordEvent("deferred-job-yield", {
|
|
232
|
-
intentKey: job.intentKey,
|
|
233
|
-
jobId: job.id,
|
|
234
|
-
processedInFrame: processedInFrame
|
|
235
|
-
}), committedInSlice > 0 && this.stage.renderNextFrame(), yield this.waitForNextFrame(),
|
|
236
|
-
frameStart = performance.now(), processedInFrame = 0, committedInSlice = 0);
|
|
237
|
-
const graphic = job.orderedGraphics[index++];
|
|
238
|
-
if (!job.pendingGraphics.has(graphic)) continue;
|
|
239
|
-
if (!isRenderableGraphic(graphic)) {
|
|
240
|
-
job.pendingGraphics.delete(graphic), this.pendingIntentByGraphic.get(graphic) === job.intentKey && this.pendingIntentByGraphic.delete(graphic);
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
if (this.pendingIntentByGraphic.get(graphic) !== job.intentKey) {
|
|
244
|
-
job.pendingGraphics.delete(graphic);
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
const nextEligibility = this.resolveEligibility(graphic, job.targetStates, !0, !1);
|
|
248
|
-
if (!nextEligibility.eligible) {
|
|
249
|
-
job.pendingGraphics.delete(graphic), this.pendingIntentByGraphic.delete(graphic),
|
|
250
|
-
this.commitSynchronously(graphic, job.targetStates);
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
createIntentKey(nextEligibility.context.contextOwnerId, nextEligibility.context.configFingerprint, nextEligibility.targetStatesKey) === job.intentKey ? (this.commitSynchronously(graphic, job.targetStates),
|
|
254
|
-
job.pendingGraphics.delete(graphic), this.pendingIntentByGraphic.delete(graphic),
|
|
255
|
-
job.processedCount += 1, processedInFrame += 1, committedInSlice += 1, null === (_e = this.perfMonitor) || void 0 === _e || _e.incrementCounter("deferredGraphicsCommitted")) : (job.pendingGraphics.delete(graphic),
|
|
256
|
-
this.pendingIntentByGraphic.delete(graphic), this.enqueueDeferredIntent(graphic, job.targetStates, nextEligibility.context, nextEligibility.targetStatesKey));
|
|
257
|
-
}
|
|
258
|
-
processedInFrame > 0 && (null === (_f = this.perfMonitor) || void 0 === _f || _f.recordCost("batchSlice", performance.now() - frameStart),
|
|
259
|
-
this.stage.renderNextFrame()), 0 === job.pendingGraphics.size && this.jobsByIntentKey.get(job.intentKey) === job && (job.status = "completed",
|
|
260
|
-
this.jobsByIntentKey.delete(job.intentKey), null === (_g = this.perfMonitor) || void 0 === _g || _g.incrementCounter("deferredJobsCompleted"),
|
|
261
|
-
null === (_h = this.perfMonitor) || void 0 === _h || _h.recordEvent("deferred-job-complete", {
|
|
262
|
-
intentKey: job.intentKey,
|
|
263
|
-
jobId: job.id,
|
|
264
|
-
processedCount: job.processedCount
|
|
265
|
-
}), null === (_j = this.perfMonitor) || void 0 === _j || _j.updateBatchPending(this.jobsByIntentKey.size));
|
|
266
|
-
}));
|
|
267
|
-
}
|
|
268
|
-
waitForNextFrame() {
|
|
269
|
-
const stageGlobal = this.stage.global;
|
|
270
|
-
return (null == stageGlobal ? void 0 : stageGlobal.getSpecifiedPerformanceRAF) ? stageGlobal.getSpecifiedPerformanceRAF(this.stage.rafId).wait() : new Promise((resolve => {
|
|
271
|
-
null == stageGlobal || stageGlobal.getSpecifiedRequestAnimationFrame(this.stage.rafId)((() => resolve()));
|
|
272
|
-
}));
|
|
273
|
-
}
|
|
274
|
-
commitSynchronously(graphic, targetStates) {
|
|
275
|
-
isRenderableGraphic(graphic) && (targetStates.length ? graphic.useStates(targetStates, !1) : graphic.clearStates(!1));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
//# sourceMappingURL=state-batch-scheduler.js.map
|