@visactor/vgrammar-core 0.13.5 → 0.13.7-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/component/axis.d.ts +2 -0
- package/cjs/component/axis.js +15 -1
- package/cjs/component/axis.js.map +1 -1
- package/cjs/component/grid.d.ts +2 -0
- package/cjs/component/grid.js +15 -1
- package/cjs/component/grid.js.map +1 -1
- package/cjs/component/index.d.ts +2 -2
- package/cjs/component/index.js +21 -1
- package/cjs/component/index.js.map +1 -1
- package/cjs/component/label.js +36 -20
- package/cjs/component/label.js.map +1 -1
- package/cjs/component/player.js.map +1 -1
- package/cjs/core/factory.d.ts +8 -1
- package/cjs/core/factory.js +9 -2
- package/cjs/core/factory.js.map +1 -1
- package/cjs/glyph/boxplot.js +5 -5
- package/cjs/glyph/boxplot.js.map +1 -1
- package/cjs/glyph/link-path.js +2 -2
- package/cjs/glyph/link-path.js.map +1 -1
- package/cjs/glyph/ripple.js +3 -2
- package/cjs/glyph/ripple.js.map +1 -1
- package/cjs/glyph/tree-path.js +2 -2
- package/cjs/glyph/tree-path.js.map +1 -1
- package/cjs/glyph/violin.js +4 -4
- package/cjs/glyph/violin.js.map +1 -1
- package/cjs/glyph/wave.js +3 -2
- package/cjs/glyph/wave.js.map +1 -1
- package/cjs/graph/animation/animate.js +9 -4
- package/cjs/graph/animation/animate.js.map +1 -1
- package/cjs/graph/animation/animation/fade.js +5 -4
- package/cjs/graph/animation/animation/fade.js.map +1 -1
- package/cjs/graph/animation/animation/grow-cartesian.js +14 -14
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/cjs/graph/animation/animation/grow-interval.js +9 -6
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -1
- package/cjs/graph/animation/animation/grow-points.js +9 -9
- package/cjs/graph/animation/animation/grow-points.js.map +1 -1
- package/cjs/graph/animation/animation/grow-polar.js +76 -63
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -1
- package/cjs/graph/animation/animation/move.js +6 -6
- package/cjs/graph/animation/animation/move.js.map +1 -1
- package/cjs/graph/animation/animation/rotate.js +4 -4
- package/cjs/graph/animation/animation/rotate.js.map +1 -1
- package/cjs/graph/animation/animation/scale.js +5 -4
- package/cjs/graph/animation/animation/scale.js.map +1 -1
- package/cjs/graph/animation/animation/update.js +2 -2
- package/cjs/graph/animation/animation/update.js.map +1 -1
- package/cjs/graph/animation/animator.d.ts +1 -1
- package/cjs/graph/animation/animator.js +6 -1
- package/cjs/graph/animation/animator.js.map +1 -1
- package/cjs/graph/animation/morph.d.ts +2 -12
- package/cjs/graph/animation/morph.js +76 -163
- package/cjs/graph/animation/morph.js.map +1 -1
- package/cjs/graph/attributes/line.d.ts +1 -0
- package/cjs/graph/attributes/line.js +17 -5
- package/cjs/graph/attributes/line.js.map +1 -1
- package/cjs/graph/attributes/transform.js +7 -3
- package/cjs/graph/attributes/transform.js.map +1 -1
- package/cjs/graph/canvas-renderer.d.ts +1 -1
- package/cjs/graph/canvas-renderer.js +10 -5
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/constants.d.ts +1 -0
- package/cjs/graph/constants.js +2 -2
- package/cjs/graph/constants.js.map +1 -1
- package/cjs/graph/element.d.ts +4 -0
- package/cjs/graph/element.js +59 -19
- package/cjs/graph/element.js.map +1 -1
- package/cjs/graph/glyph-element.js +11 -9
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/graph/layout/layout.d.ts +1 -0
- package/cjs/graph/layout/layout.js +8 -2
- package/cjs/graph/layout/layout.js.map +1 -1
- package/cjs/graph/mark/graphic.js +14 -8
- package/cjs/graph/mark/graphic.js.map +1 -1
- package/cjs/graph/util/events-extend.d.ts +1 -2
- package/cjs/graph/util/events-extend.js +14 -3
- package/cjs/graph/util/events-extend.js.map +1 -1
- package/cjs/graph/util/point.js +10 -26
- package/cjs/graph/util/point.js.map +1 -1
- package/cjs/graph/view-diff.d.ts +8 -0
- package/cjs/graph/view-diff.js +93 -0
- package/cjs/graph/view-diff.js.map +1 -0
- package/cjs/index.d.ts +8 -1
- package/cjs/index.js +66 -2
- package/cjs/index.js.map +1 -1
- package/cjs/interactions/base.js.map +1 -1
- package/cjs/interactions/brush-base.js +1 -2
- package/cjs/interactions/brush-filter.js +2 -1
- package/cjs/interactions/brush-highlight.js +16 -7
- package/cjs/interactions/brush-highlight.js.map +1 -1
- package/cjs/interactions/element-active-by-legend.d.ts +2 -1
- package/cjs/interactions/element-active-by-legend.js +5 -2
- package/cjs/interactions/element-active-by-legend.js.map +1 -1
- package/cjs/interactions/element-active.d.ts +3 -2
- package/cjs/interactions/element-active.js +4 -2
- package/cjs/interactions/element-active.js.map +1 -1
- package/cjs/interactions/element-highlight-by-graphic-name.d.ts +14 -0
- package/cjs/interactions/element-highlight-by-graphic-name.js +55 -0
- package/cjs/interactions/element-highlight-by-graphic-name.js.map +1 -0
- package/cjs/interactions/element-highlight-by-group.d.ts +2 -2
- package/cjs/interactions/element-highlight-by-group.js +13 -6
- package/cjs/interactions/element-highlight-by-group.js.map +1 -1
- package/cjs/interactions/element-highlight-by-key.d.ts +2 -2
- package/cjs/interactions/element-highlight-by-key.js +12 -15
- package/cjs/interactions/element-highlight-by-key.js.map +1 -1
- package/cjs/interactions/element-highlight-by-legend.d.ts +2 -1
- package/cjs/interactions/element-highlight-by-legend.js +14 -5
- package/cjs/interactions/element-highlight-by-legend.js.map +1 -1
- package/cjs/interactions/element-highlight-by-name.d.ts +2 -1
- package/cjs/interactions/element-highlight-by-name.js +14 -5
- package/cjs/interactions/element-highlight-by-name.js.map +1 -1
- package/cjs/interactions/element-highlight.d.ts +1 -1
- package/cjs/interactions/element-highlight.js +9 -6
- package/cjs/interactions/element-highlight.js.map +1 -1
- package/cjs/interactions/element-select-by-graphic-name.d.ts +7 -0
- package/cjs/interactions/element-select-by-graphic-name.js +26 -0
- package/cjs/interactions/element-select-by-graphic-name.js.map +1 -0
- package/cjs/interactions/element-select.d.ts +1 -1
- package/cjs/interactions/element-select.js +9 -10
- package/cjs/interactions/element-select.js.map +1 -1
- package/cjs/interactions/index.d.ts +2 -0
- package/cjs/interactions/index.js +17 -3
- package/cjs/interactions/index.js.map +1 -1
- package/cjs/interactions/slider-filter.js +1 -1
- package/cjs/interactions/toggle-state-mixin.js +9 -7
- package/cjs/interactions/toggle-state-mixin.js.map +1 -1
- package/cjs/interactions/tooltip.js +1 -1
- package/cjs/parse/event.d.ts +0 -2
- package/cjs/parse/event.js +4 -10
- package/cjs/parse/event.js.map +1 -1
- package/cjs/parse/util.js.map +1 -1
- package/cjs/semantic-marks/text.js.map +1 -1
- package/cjs/transforms/data/pie.js +2 -2
- package/cjs/transforms/data/pie.js.map +1 -1
- package/cjs/transforms/mark/mark-overlap.js +6 -6
- package/cjs/transforms/mark/mark-overlap.js.map +1 -1
- package/cjs/transforms/util/util.d.ts +0 -2
- package/cjs/transforms/util/util.js +3 -13
- package/cjs/transforms/util/util.js.map +1 -1
- package/cjs/types/animate.d.ts +3 -1
- package/cjs/types/animate.js.map +1 -1
- package/cjs/types/element.d.ts +7 -2
- package/cjs/types/element.js.map +1 -1
- package/cjs/types/grammar.d.ts +1 -0
- package/cjs/types/grammar.js.map +1 -1
- package/cjs/types/interaction.d.ts +4 -1
- package/cjs/types/interaction.js.map +1 -1
- package/cjs/types/mark.d.ts +2 -0
- package/cjs/types/mark.js.map +1 -1
- package/cjs/types/morph.d.ts +1 -2
- package/cjs/types/morph.js.map +1 -1
- package/cjs/types/renderer.d.ts +6 -1
- package/cjs/types/renderer.js.map +1 -1
- package/cjs/types/transform.d.ts +1 -0
- package/cjs/types/transform.js.map +1 -1
- package/cjs/types/view.d.ts +4 -1
- package/cjs/types/view.js.map +1 -1
- package/cjs/view/View.d.ts +3 -6
- package/cjs/view/View.js +73 -125
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/animate.js +2 -1
- package/cjs/view/animate.js.map +1 -1
- package/cjs/view/constants.d.ts +2 -0
- package/cjs/view/constants.js +3 -2
- package/cjs/view/constants.js.map +1 -1
- package/cjs/view/events.d.ts +0 -1
- package/cjs/view/events.js +3 -17
- package/cjs/view/events.js.map +1 -1
- package/cjs/view/glyph.d.ts +4 -0
- package/cjs/view/glyph.js +12 -3
- package/cjs/view/glyph.js.map +1 -1
- package/cjs/view/grammar-record.js +2 -3
- package/cjs/view/grammar-record.js.map +1 -1
- package/cjs/view/group.js +9 -6
- package/cjs/view/group.js.map +1 -1
- package/cjs/view/mark-animate-mixin.d.ts +1 -0
- package/cjs/view/mark-animate-mixin.js +29 -0
- package/cjs/view/mark-animate-mixin.js.map +1 -0
- package/cjs/view/mark.d.ts +4 -1
- package/cjs/view/mark.js +104 -68
- package/cjs/view/mark.js.map +1 -1
- package/cjs/view/view-animate-mixin.d.ts +1 -0
- package/cjs/view/view-animate-mixin.js +26 -0
- package/cjs/view/view-animate-mixin.js.map +1 -0
- package/cjs/view/view-event-mixin.d.ts +1 -0
- package/cjs/view/view-event-mixin.js +92 -0
- package/cjs/view/view-event-mixin.js.map +1 -0
- package/cjs/view/view-morph-mixin.d.ts +1 -0
- package/cjs/view/view-morph-mixin.js +32 -0
- package/cjs/view/view-morph-mixin.js.map +1 -0
- package/es/component/axis.d.ts +2 -0
- package/es/component/axis.js +10 -0
- package/es/component/axis.js.map +1 -1
- package/es/component/grid.d.ts +2 -0
- package/es/component/grid.js +10 -0
- package/es/component/grid.js.map +1 -1
- package/es/component/index.d.ts +2 -2
- package/es/component/index.js +2 -2
- package/es/component/index.js.map +1 -1
- package/es/component/label.js +35 -19
- package/es/component/label.js.map +1 -1
- package/es/component/player.js.map +1 -1
- package/es/core/factory.d.ts +8 -1
- package/es/core/factory.js +10 -2
- package/es/core/factory.js.map +1 -1
- package/es/glyph/boxplot.js +4 -2
- package/es/glyph/boxplot.js.map +1 -1
- package/es/glyph/link-path.js +4 -2
- package/es/glyph/link-path.js.map +1 -1
- package/es/glyph/ripple.js +3 -1
- package/es/glyph/ripple.js.map +1 -1
- package/es/glyph/tree-path.js +4 -2
- package/es/glyph/tree-path.js.map +1 -1
- package/es/glyph/violin.js +4 -2
- package/es/glyph/violin.js.map +1 -1
- package/es/glyph/wave.js +3 -1
- package/es/glyph/wave.js.map +1 -1
- package/es/graph/animation/animate.js +9 -4
- package/es/graph/animation/animate.js.map +1 -1
- package/es/graph/animation/animation/fade.js +5 -4
- package/es/graph/animation/animation/fade.js.map +1 -1
- package/es/graph/animation/animation/grow-cartesian.js +14 -14
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/es/graph/animation/animation/grow-interval.js +9 -6
- package/es/graph/animation/animation/grow-interval.js.map +1 -1
- package/es/graph/animation/animation/grow-points.js +9 -9
- package/es/graph/animation/animation/grow-points.js.map +1 -1
- package/es/graph/animation/animation/grow-polar.js +76 -63
- package/es/graph/animation/animation/grow-polar.js.map +1 -1
- package/es/graph/animation/animation/move.js +6 -6
- package/es/graph/animation/animation/move.js.map +1 -1
- package/es/graph/animation/animation/rotate.js +3 -3
- package/es/graph/animation/animation/rotate.js.map +1 -1
- package/es/graph/animation/animation/scale.js +5 -4
- package/es/graph/animation/animation/scale.js.map +1 -1
- package/es/graph/animation/animation/update.js +1 -3
- package/es/graph/animation/animation/update.js.map +1 -1
- package/es/graph/animation/animator.d.ts +1 -1
- package/es/graph/animation/animator.js +6 -1
- package/es/graph/animation/animator.js.map +1 -1
- package/es/graph/animation/morph.d.ts +2 -12
- package/es/graph/animation/morph.js +72 -159
- package/es/graph/animation/morph.js.map +1 -1
- package/es/graph/attributes/line.d.ts +1 -0
- package/es/graph/attributes/line.js +14 -3
- package/es/graph/attributes/line.js.map +1 -1
- package/es/graph/attributes/transform.js +7 -3
- package/es/graph/attributes/transform.js.map +1 -1
- package/es/graph/canvas-renderer.d.ts +1 -1
- package/es/graph/canvas-renderer.js +11 -6
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/constants.d.ts +1 -0
- package/es/graph/constants.js +2 -0
- package/es/graph/constants.js.map +1 -1
- package/es/graph/element.d.ts +4 -0
- package/es/graph/element.js +59 -22
- package/es/graph/element.js.map +1 -1
- package/es/graph/glyph-element.js +10 -11
- package/es/graph/glyph-element.js.map +1 -1
- package/es/graph/layout/layout.d.ts +1 -0
- package/es/graph/layout/layout.js +6 -0
- package/es/graph/layout/layout.js.map +1 -1
- package/es/graph/mark/graphic.js +13 -7
- package/es/graph/mark/graphic.js.map +1 -1
- package/es/graph/util/events-extend.d.ts +1 -2
- package/es/graph/util/events-extend.js +16 -3
- package/es/graph/util/events-extend.js.map +1 -1
- package/es/graph/util/point.js +10 -26
- package/es/graph/util/point.js.map +1 -1
- package/es/graph/view-diff.d.ts +8 -0
- package/es/graph/view-diff.js +89 -0
- package/es/graph/view-diff.js.map +1 -0
- package/es/index.d.ts +8 -1
- package/es/index.js +29 -1
- package/es/index.js.map +1 -1
- package/es/interactions/base.js.map +1 -1
- package/es/interactions/brush-filter.js +2 -1
- package/es/interactions/brush-highlight.js +16 -7
- package/es/interactions/brush-highlight.js.map +1 -1
- package/es/interactions/element-active-by-legend.d.ts +2 -1
- package/es/interactions/element-active-by-legend.js +5 -2
- package/es/interactions/element-active-by-legend.js.map +1 -1
- package/es/interactions/element-active.d.ts +3 -2
- package/es/interactions/element-active.js +5 -4
- package/es/interactions/element-active.js.map +1 -1
- package/es/interactions/element-highlight-by-graphic-name.d.ts +14 -0
- package/es/interactions/element-highlight-by-graphic-name.js +51 -0
- package/es/interactions/element-highlight-by-graphic-name.js.map +1 -0
- package/es/interactions/element-highlight-by-group.d.ts +2 -2
- package/es/interactions/element-highlight-by-group.js +13 -6
- package/es/interactions/element-highlight-by-group.js.map +1 -1
- package/es/interactions/element-highlight-by-key.d.ts +2 -2
- package/es/interactions/element-highlight-by-key.js +12 -15
- package/es/interactions/element-highlight-by-key.js.map +1 -1
- package/es/interactions/element-highlight-by-legend.d.ts +2 -1
- package/es/interactions/element-highlight-by-legend.js +14 -5
- package/es/interactions/element-highlight-by-legend.js.map +1 -1
- package/es/interactions/element-highlight-by-name.d.ts +2 -1
- package/es/interactions/element-highlight-by-name.js +14 -5
- package/es/interactions/element-highlight-by-name.js.map +1 -1
- package/es/interactions/element-highlight.d.ts +1 -1
- package/es/interactions/element-highlight.js +9 -6
- package/es/interactions/element-highlight.js.map +1 -1
- package/es/interactions/element-select-by-graphic-name.d.ts +7 -0
- package/es/interactions/element-select-by-graphic-name.js +20 -0
- package/es/interactions/element-select-by-graphic-name.js.map +1 -0
- package/es/interactions/element-select.d.ts +1 -1
- package/es/interactions/element-select.js +9 -9
- package/es/interactions/element-select.js.map +1 -1
- package/es/interactions/filter.js +1 -1
- package/es/interactions/fish-eye.js +1 -1
- package/es/interactions/index.d.ts +2 -0
- package/es/interactions/index.js +14 -1
- package/es/interactions/index.js.map +1 -1
- package/es/interactions/legend-filter.js +1 -1
- package/es/interactions/player-filter.js +1 -1
- package/es/interactions/roll-up.js +1 -1
- package/es/interactions/scrollbar-filter.js +1 -1
- package/es/interactions/slider-filter.js +1 -1
- package/es/interactions/toggle-state-mixin.js +9 -7
- package/es/interactions/toggle-state-mixin.js.map +1 -1
- package/es/interactions/tooltip.js +1 -1
- package/es/parse/coordinate.js +1 -1
- package/es/parse/event.d.ts +0 -2
- package/es/parse/event.js +4 -8
- package/es/parse/event.js.map +1 -1
- package/es/parse/mark.js +1 -1
- package/es/parse/option.js +1 -2
- package/es/parse/scale.js +1 -1
- package/es/parse/transform.js +1 -1
- package/es/parse/util.js +1 -1
- package/es/parse/util.js.map +1 -1
- package/es/parse/view.js +1 -1
- package/es/semantic-marks/text.js.map +1 -1
- package/es/transforms/data/pie.js +1 -1
- package/es/transforms/data/pie.js.map +1 -1
- package/es/transforms/mark/mark-overlap.js +6 -6
- package/es/transforms/mark/mark-overlap.js.map +1 -1
- package/es/transforms/util/util.d.ts +0 -2
- package/es/transforms/util/util.js +0 -10
- package/es/transforms/util/util.js.map +1 -1
- package/es/types/animate.d.ts +3 -1
- package/es/types/animate.js.map +1 -1
- package/es/types/element.d.ts +7 -2
- package/es/types/element.js.map +1 -1
- package/es/types/grammar.d.ts +1 -0
- package/es/types/grammar.js.map +1 -1
- package/es/types/interaction.d.ts +4 -1
- package/es/types/interaction.js.map +1 -1
- package/es/types/mark.d.ts +2 -0
- package/es/types/mark.js.map +1 -1
- package/es/types/morph.d.ts +1 -2
- package/es/types/morph.js.map +1 -1
- package/es/types/renderer.d.ts +6 -1
- package/es/types/renderer.js.map +1 -1
- package/es/types/transform.d.ts +1 -0
- package/es/types/transform.js.map +1 -1
- package/es/types/view.d.ts +4 -1
- package/es/types/view.js.map +1 -1
- package/es/view/View.d.ts +3 -6
- package/es/view/View.js +63 -124
- package/es/view/View.js.map +1 -1
- package/es/view/animate.js +2 -1
- package/es/view/animate.js.map +1 -1
- package/es/view/constants.d.ts +2 -0
- package/es/view/constants.js +4 -0
- package/es/view/constants.js.map +1 -1
- package/es/view/events.d.ts +0 -1
- package/es/view/events.js +1 -15
- package/es/view/events.js.map +1 -1
- package/es/view/glyph.d.ts +4 -0
- package/es/view/glyph.js +11 -0
- package/es/view/glyph.js.map +1 -1
- package/es/view/grammar-record.js +2 -3
- package/es/view/grammar-record.js.map +1 -1
- package/es/view/group.js +8 -7
- package/es/view/group.js.map +1 -1
- package/es/view/mark-animate-mixin.d.ts +1 -0
- package/es/view/mark-animate-mixin.js +25 -0
- package/es/view/mark-animate-mixin.js.map +1 -0
- package/es/view/mark.d.ts +4 -1
- package/es/view/mark.js +102 -70
- package/es/view/mark.js.map +1 -1
- package/es/view/view-animate-mixin.d.ts +1 -0
- package/es/view/view-animate-mixin.js +16 -0
- package/es/view/view-animate-mixin.js.map +1 -0
- package/es/view/view-event-mixin.d.ts +1 -0
- package/es/view/view-event-mixin.js +90 -0
- package/es/view/view-event-mixin.js.map +1 -0
- package/es/view/view-morph-mixin.d.ts +1 -0
- package/es/view/view-morph-mixin.js +22 -0
- package/es/view/view-morph-mixin.js.map +1 -0
- package/package.json +10 -10
- package/cjs/graph/util/element.d.ts +0 -2
- package/cjs/graph/util/element.js +0 -10
- package/cjs/graph/util/element.js.map +0 -1
- package/es/graph/util/element.d.ts +0 -2
- package/es/graph/util/element.js +0 -8
- package/es/graph/util/element.js.map +0 -1
package/cjs/view/View.js
CHANGED
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
value: !0
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), data_1 = require("./data"),
|
|
13
|
+
const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), data_1 = require("./data"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_1 = require("./constants"), signal_1 = require("./signal"), view_1 = require("../parse/view"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), grammar_record_1 = require("./grammar-record"), enums_1 = require("../graph/enums"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory"), component_1 = require("./component"), graphic_1 = require("../graph/util/graphic"), view_diff_1 = require("../graph/view-diff");
|
|
14
14
|
|
|
15
15
|
class View extends vutils_1.EventEmitter {
|
|
16
16
|
static useRegisters(comps) {
|
|
@@ -23,16 +23,14 @@ class View extends vutils_1.EventEmitter {
|
|
|
23
23
|
const size = this._getContainerSize();
|
|
24
24
|
size && this.resize(size.width, size.height);
|
|
25
25
|
}), 100), this.delegateEvent = (event, type) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
events_extend_1.default)(this, event, activeElement, type, constants_2.EVENT_SOURCE_VIEW);
|
|
29
|
-
this.emit(type, extendedEvt, activeElement);
|
|
26
|
+
const extendedEvt = (0, events_extend_1.default)(this, event, type, constants_1.EVENT_SOURCE_VIEW);
|
|
27
|
+
this.emit(type, extendedEvt, event.element);
|
|
30
28
|
}, this.handleProgressiveFrame = () => {
|
|
31
29
|
this._progressiveMarks.length && this._progressiveMarks.forEach((mark => {
|
|
32
30
|
mark.isDoingProgressive() && mark.evaluateProgressive();
|
|
33
31
|
})), this.doPreProgressive();
|
|
34
32
|
}, this._config = config, this._options = Object.assign({
|
|
35
|
-
mode:
|
|
33
|
+
mode: constants_1.BROWSER
|
|
36
34
|
}, options), this.initialize();
|
|
37
35
|
}
|
|
38
36
|
getGrammarById(id) {
|
|
@@ -73,11 +71,11 @@ class View extends vutils_1.EventEmitter {
|
|
|
73
71
|
const selectors = (0, vutils_1.array)(selector), res = [];
|
|
74
72
|
return selectors.forEach((selectorStr => {
|
|
75
73
|
if ((0, util_1.isGrammar)(selectorStr)) return void res.push(selectorStr);
|
|
76
|
-
if (selectorStr[0] ===
|
|
74
|
+
if (selectorStr[0] === constants_1.ID_PREFIX) {
|
|
77
75
|
const mark = this.getMarkById(selectorStr.slice(1));
|
|
78
76
|
return void (mark && res.push(mark));
|
|
79
77
|
}
|
|
80
|
-
const marks = selectorStr[0] ===
|
|
78
|
+
const marks = selectorStr[0] === constants_1.NAME_PREFIX ? this.getMarksByName(selectorStr.slice(1)) : (0,
|
|
81
79
|
graphic_1.isMarkType)(selectorStr) ? this.getMarksByType(selectorStr) : null;
|
|
82
80
|
marks && marks.length && marks.forEach((mark => {
|
|
83
81
|
res.push(mark);
|
|
@@ -115,7 +113,8 @@ class View extends vutils_1.EventEmitter {
|
|
|
115
113
|
break;
|
|
116
114
|
|
|
117
115
|
case enums_1.GrammarMarkType.glyph:
|
|
118
|
-
|
|
116
|
+
const GlyphMark = factory_1.Factory.getMark(enums_1.GrammarMarkType.glyph);
|
|
117
|
+
GlyphMark && (mark = new GlyphMark(this, null == markOptions ? void 0 : markOptions.glyphType, groupMark));
|
|
119
118
|
break;
|
|
120
119
|
|
|
121
120
|
case enums_1.GrammarMarkType.component:
|
|
@@ -221,13 +220,13 @@ class View extends vutils_1.EventEmitter {
|
|
|
221
220
|
})), this;
|
|
222
221
|
}
|
|
223
222
|
parseSpec(spec) {
|
|
224
|
-
var _a, _b, _c, _d, _e, _f;
|
|
223
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
225
224
|
if (this.emit(enums_1.HOOK_EVENT.BEFORE_PARSE_VIEW), this._spec = spec, (0, view_1.normalizeMarkTree)(spec),
|
|
226
225
|
spec.theme ? this.theme(spec.theme) : this.theme(theme_manager_1.ThemeManager.getDefaultTheme()),
|
|
227
226
|
spec.width && this.width(spec.width), spec.height && this.height(spec.height), this.padding(null !== (_b = null !== (_a = spec.padding) && void 0 !== _a ? _a : this._options.padding) && void 0 !== _b ? _b : this._theme.padding),
|
|
228
227
|
!this.width() || !this.height()) {
|
|
229
228
|
const size = this._getContainerSize();
|
|
230
|
-
size && (this.updateSignal(
|
|
229
|
+
size && (this.updateSignal(constants_1.SIGNAL_WIDTH, size.width), this.updateSignal(constants_1.SIGNAL_HEIGHT, size.height));
|
|
231
230
|
}
|
|
232
231
|
(null === (_c = spec.signals) || void 0 === _c ? void 0 : _c.length) && spec.signals.forEach((signal => {
|
|
233
232
|
this.signal().parse(signal);
|
|
@@ -249,12 +248,13 @@ class View extends vutils_1.EventEmitter {
|
|
|
249
248
|
})), spec.marks && spec.marks.length && spec.marks.forEach((mark => {
|
|
250
249
|
this.parseMarkSpec(mark);
|
|
251
250
|
})), spec.events && spec.events.length && spec.events.forEach((eventConfig => {
|
|
252
|
-
|
|
251
|
+
var _b;
|
|
252
|
+
null === (_b = this.event) || void 0 === _b || _b.call(this, eventConfig);
|
|
253
253
|
})), spec.interactions && spec.interactions.length && spec.interactions.forEach((interaction => {
|
|
254
254
|
this.interaction(interaction.type, interaction);
|
|
255
|
-
})), !1 === spec.animation ? this.animate.disable() : this.animate
|
|
256
|
-
this.
|
|
257
|
-
this;
|
|
255
|
+
})), !1 === spec.animation ? null === (_g = this.animate) || void 0 === _g || _g.disable() : null === (_h = this.animate) || void 0 === _h || _h.enable(),
|
|
256
|
+
this.emit(enums_1.HOOK_EVENT.AFTER_PARSE_VIEW), this._needBuildLayoutTree = !0,
|
|
257
|
+
this._layoutState = enums_1.LayoutState.before, this;
|
|
258
258
|
}
|
|
259
259
|
updateSpec(spec) {
|
|
260
260
|
return this.removeAllInteractions(), this.removeAllGrammars(), this.parseSpec(spec);
|
|
@@ -318,17 +318,17 @@ class View extends vutils_1.EventEmitter {
|
|
|
318
318
|
value) : this._background;
|
|
319
319
|
}
|
|
320
320
|
width(value) {
|
|
321
|
-
const signal = this.getSignalById(
|
|
321
|
+
const signal = this.getSignalById(constants_1.SIGNAL_WIDTH);
|
|
322
322
|
return arguments.length ? (this._options.width = value, this.updateSignal(signal, value),
|
|
323
323
|
value) : signal.output();
|
|
324
324
|
}
|
|
325
325
|
height(value) {
|
|
326
|
-
const signal = this.getSignalById(
|
|
326
|
+
const signal = this.getSignalById(constants_1.SIGNAL_HEIGHT);
|
|
327
327
|
return arguments.length ? (this._options.height = value, this.updateSignal(signal, value),
|
|
328
328
|
value) : signal.output();
|
|
329
329
|
}
|
|
330
330
|
viewWidth(value) {
|
|
331
|
-
const signal = this.getSignalById(
|
|
331
|
+
const signal = this.getSignalById(constants_1.SIGNAL_VIEW_WIDTH);
|
|
332
332
|
if (arguments.length) {
|
|
333
333
|
const padding = this.padding();
|
|
334
334
|
return this.width(value + padding.left + padding.right), value;
|
|
@@ -336,7 +336,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
336
336
|
return signal.output();
|
|
337
337
|
}
|
|
338
338
|
viewHeight(value) {
|
|
339
|
-
const signal = this.getSignalById(
|
|
339
|
+
const signal = this.getSignalById(constants_1.SIGNAL_VIEW_HEIGHT);
|
|
340
340
|
if (arguments.length) {
|
|
341
341
|
const padding = this.padding();
|
|
342
342
|
return this.height(value + padding.top + padding.bottom), value;
|
|
@@ -344,7 +344,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
344
344
|
return signal.output();
|
|
345
345
|
}
|
|
346
346
|
padding(value) {
|
|
347
|
-
const signal = this.getSignalById(
|
|
347
|
+
const signal = this.getSignalById(constants_1.SIGNAL_PADDING);
|
|
348
348
|
if (arguments.length) {
|
|
349
349
|
const padding = (0, view_1.normalizePadding)(value);
|
|
350
350
|
return this.updateSignal(signal, padding), padding;
|
|
@@ -352,11 +352,11 @@ class View extends vutils_1.EventEmitter {
|
|
|
352
352
|
return (0, view_1.normalizePadding)(signal.output());
|
|
353
353
|
}
|
|
354
354
|
autoFit(value) {
|
|
355
|
-
const signal = this.getSignalById(
|
|
355
|
+
const signal = this.getSignalById(constants_1.SIGNAL_AUTOFIT);
|
|
356
356
|
return arguments.length ? (this.updateSignal(signal, value), value) : signal.output();
|
|
357
357
|
}
|
|
358
358
|
getViewBox() {
|
|
359
|
-
const signal = this.getSignalById(
|
|
359
|
+
const signal = this.getSignalById(constants_1.SIGNAL_VIEW_BOX);
|
|
360
360
|
return null == signal ? void 0 : signal.output();
|
|
361
361
|
}
|
|
362
362
|
updateLayoutTag() {
|
|
@@ -374,7 +374,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
374
374
|
}
|
|
375
375
|
doLayout() {
|
|
376
376
|
var _a;
|
|
377
|
-
const doLayout = this._options.doLayout ||
|
|
377
|
+
const doLayout = this._options.doLayout || factory_1.Factory.getDefaultLayout();
|
|
378
378
|
doLayout && (null === (_a = this._layoutMarks) || void 0 === _a ? void 0 : _a.length) && (this.emit(enums_1.HOOK_EVENT.BEFORE_DO_LAYOUT),
|
|
379
379
|
doLayout(this._layoutMarks, this._options, this), this.emit(enums_1.HOOK_EVENT.AFTER_DO_LAYOUT));
|
|
380
380
|
}
|
|
@@ -397,11 +397,12 @@ class View extends vutils_1.EventEmitter {
|
|
|
397
397
|
return this.evaluate(runningConfig), this;
|
|
398
398
|
}
|
|
399
399
|
doRender(immediately) {
|
|
400
|
-
this.emit(enums_1.HOOK_EVENT.BEFORE_DO_RENDER), this.renderer && (this._progressiveMarks
|
|
401
|
-
|
|
400
|
+
this.emit(enums_1.HOOK_EVENT.BEFORE_DO_RENDER), this.renderer && (!this._progressiveMarks && this.animate ? this.animate.animate() : this.traverseMarkTree((mark => {
|
|
401
|
+
mark.cleanExitElements();
|
|
402
|
+
}), null, !0), this.renderer.render(immediately), this.handleRenderEnd()), this.emit(enums_1.HOOK_EVENT.AFTER_DO_RENDER);
|
|
402
403
|
}
|
|
403
404
|
evaluate(runningConfig) {
|
|
404
|
-
var _a,
|
|
405
|
+
var _a, _c;
|
|
405
406
|
const normalizedRunningConfig = (0, view_1.normalizeRunningConfig)(runningConfig), grammarWillDetach = this._cachedGrammars.size() > 0;
|
|
406
407
|
grammarWillDetach && (this.reuseCachedGrammars(normalizedRunningConfig), this.detachCachedGrammar());
|
|
407
408
|
const hasResize = this._resizeRenderer(), hasUpdate = this._dataflow.hasCommitted();
|
|
@@ -410,28 +411,28 @@ class View extends vutils_1.EventEmitter {
|
|
|
410
411
|
this._needBuildLayoutTree = !1), this._layoutState && (this._layoutState = enums_1.LayoutState.layouting,
|
|
411
412
|
this.doLayout(), this._dataflow.hasCommitted() && (this._layoutState = enums_1.LayoutState.reevaluate,
|
|
412
413
|
this._dataflow.evaluate()), this._layoutState = enums_1.LayoutState.after, (null === (_a = this._layoutMarks) || void 0 === _a ? void 0 : _a.length) && this.handleLayoutEnd()),
|
|
413
|
-
this._layoutState = null, this.findProgressiveMarks(), this._resizeRenderer(), null === (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
this.doRender(!0), this.doPreProgressive(), this) : this;
|
|
414
|
+
this._layoutState = null, this.findProgressiveMarks(), this._resizeRenderer(), null === (_c = this.morph) || void 0 === _c || _c.call(this, normalizedRunningConfig),
|
|
415
|
+
this.releaseCachedGrammars(normalizedRunningConfig), this.doRender(!0), this.doPreProgressive(),
|
|
416
|
+
this) : this;
|
|
417
417
|
}
|
|
418
418
|
reuseCachedGrammars(runningConfig) {
|
|
419
|
-
if (
|
|
419
|
+
if (runningConfig.reuse) {
|
|
420
420
|
const reuseDiffUpdate = diff => {
|
|
421
421
|
diff.next.reuse(diff.prev), diff.prev.detachAll(), diff.prev.clear(), this._cachedGrammars.unrecord(diff.prev);
|
|
422
422
|
};
|
|
423
|
-
this.
|
|
424
|
-
this.
|
|
425
|
-
this.
|
|
426
|
-
this.
|
|
423
|
+
this._differ.diffGrammar(this._cachedGrammars.getAllSignals(), this.grammars.getAllSignals().filter((signal => !view_1.BuiltInSignalID.includes(signal.id())))).update.forEach(reuseDiffUpdate);
|
|
424
|
+
this._differ.diffGrammar(this._cachedGrammars.getAllData(), this.grammars.getAllData()).update.forEach(reuseDiffUpdate);
|
|
425
|
+
this._differ.diffGrammar(this._cachedGrammars.getAllScales(), this.grammars.getAllScales()).update.forEach(reuseDiffUpdate);
|
|
426
|
+
this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(), this.grammars.getAllCoordinates()).update.forEach(reuseDiffUpdate);
|
|
427
427
|
}
|
|
428
|
-
this.
|
|
428
|
+
this._differ.diffMark(this._cachedGrammars.getAllMarks(), this.grammars.getAllMarks().filter((mark => "root" !== mark.id())), runningConfig).update.forEach((diff => {
|
|
429
|
+
var _b;
|
|
429
430
|
const matched = 1 === diff.prev.length && 1 === diff.next.length && diff.prev[0].markType === diff.next[0].markType, enableMarkMorphConfig = diff.prev.every((mark => mark.getMorphConfig().morph)) && diff.next.every((mark => mark.getMorphConfig().morph));
|
|
430
|
-
|
|
431
|
-
diff.prev[0].clear(), this._cachedGrammars.unrecord(diff.prev[0])) : (runningConfig.morph && enableMarkMorphConfig || runningConfig.morphAll) && this._willMorphMarks.push({
|
|
431
|
+
this.morph && (runningConfig.morph && enableMarkMorphConfig || runningConfig.morphAll) ? null === (_b = this.addMorphMarks) || void 0 === _b || _b.call(this, {
|
|
432
432
|
prev: diff.prev,
|
|
433
433
|
next: diff.next
|
|
434
|
-
})
|
|
434
|
+
}) : matched && runningConfig.reuse && (diff.next[0].reuse(diff.prev[0]), diff.prev[0].detachAll(),
|
|
435
|
+
diff.prev[0].clear(), this._cachedGrammars.unrecord(diff.prev[0]));
|
|
435
436
|
}));
|
|
436
437
|
}
|
|
437
438
|
detachCachedGrammar() {
|
|
@@ -449,10 +450,11 @@ class View extends vutils_1.EventEmitter {
|
|
|
449
450
|
}));
|
|
450
451
|
const markNodes = this._cachedGrammars.getAllMarkNodes();
|
|
451
452
|
markNodes.forEach((node => {
|
|
452
|
-
|
|
453
|
+
var _a;
|
|
454
|
+
null === (_a = node.mark.animate) || void 0 === _a || _a.stop(), runningConfig.enableExitAnimation && this.animate && this.animate.animateAddition(node.mark);
|
|
453
455
|
}));
|
|
454
456
|
const releaseUp = node => {
|
|
455
|
-
if (node.mark.view && 0 === node.mark.animate.getAnimatorCount() && (!node.children || 0 === node.children.length)) {
|
|
457
|
+
if (node.mark.view && (!node.mark.animate || 0 === node.mark.animate.getAnimatorCount()) && (!node.children || 0 === node.children.length)) {
|
|
456
458
|
node.mark.release();
|
|
457
459
|
const parent = node.parent;
|
|
458
460
|
parent && (node.parent.children = node.parent.children.filter((n => n !== node)),
|
|
@@ -461,9 +463,9 @@ class View extends vutils_1.EventEmitter {
|
|
|
461
463
|
};
|
|
462
464
|
markNodes.forEach((node => {
|
|
463
465
|
const mark = node.mark;
|
|
464
|
-
0
|
|
465
|
-
0 === mark.animate.getAnimatorCount() && releaseUp(node);
|
|
466
|
-
}));
|
|
466
|
+
mark.animate && 0 !== mark.animate.getAnimatorCount() ? mark.addEventListener("animationEnd", (() => {
|
|
467
|
+
mark.animate && 0 === mark.animate.getAnimatorCount() && releaseUp(node);
|
|
468
|
+
})) : releaseUp(node);
|
|
467
469
|
})), this._cachedGrammars.clear();
|
|
468
470
|
}
|
|
469
471
|
runAfter(callback) {
|
|
@@ -519,9 +521,11 @@ class View extends vutils_1.EventEmitter {
|
|
|
519
521
|
}
|
|
520
522
|
resize(width, height, render = !0) {
|
|
521
523
|
let needDataflow = !1;
|
|
522
|
-
return width !== this.width() && (needDataflow = !0, this.updateSignal(
|
|
523
|
-
height !== this.height() && (needDataflow = !0, this.updateSignal(
|
|
524
|
-
needDataflow && (render ? this.evaluate(
|
|
524
|
+
return width !== this.width() && (needDataflow = !0, this.updateSignal(constants_1.SIGNAL_WIDTH, width)),
|
|
525
|
+
height !== this.height() && (needDataflow = !0, this.updateSignal(constants_1.SIGNAL_HEIGHT, height)),
|
|
526
|
+
needDataflow && (render ? this.evaluate({
|
|
527
|
+
morph: !1
|
|
528
|
+
}) : this._dataflow.evaluate()), this;
|
|
525
529
|
}
|
|
526
530
|
_resizeRenderer() {
|
|
527
531
|
const width = this.width(), height = this.height();
|
|
@@ -531,75 +535,6 @@ class View extends vutils_1.EventEmitter {
|
|
|
531
535
|
height: height
|
|
532
536
|
}), !0);
|
|
533
537
|
}
|
|
534
|
-
bindEvents(eventSpec) {
|
|
535
|
-
if (this._eventConfig.disable) return;
|
|
536
|
-
const {type: evtType, filter: filter, callback: callback, throttle: throttle, debounce: debounce, consume: consume, target: target, dependency: dependency} = eventSpec, eventSelector = (0,
|
|
537
|
-
event_1.parseEventSelector)(evtType);
|
|
538
|
-
if (!eventSelector) return;
|
|
539
|
-
const {source: source, type: type} = eventSelector, markFilter = (0, event_1.generateFilterByMark)(eventSelector), validateSignals = (Array.isArray(target) && target.length ? target.map((entry => ({
|
|
540
|
-
signal: this.getSignalById(entry.target),
|
|
541
|
-
callback: entry.callback
|
|
542
|
-
}))) : [ {
|
|
543
|
-
signal: (0, vutils_1.isString)(target) ? this.getSignalById(target) : null,
|
|
544
|
-
callback: callback
|
|
545
|
-
} ]).filter((entry => entry.signal || entry.callback)), refs = (0, util_1.parseReference)(dependency, this), send = (0,
|
|
546
|
-
event_1.parseHandler)(((evt, element) => {
|
|
547
|
-
const needPreventDefault = source === constants_2.EVENT_SOURCE_VIEW && (0, events_1.prevent)(this._eventConfig, type) || consume && (void 0 === evt.cancelable || evt.cancelable);
|
|
548
|
-
source === constants_2.EVENT_SOURCE_WINDOW && (evt = (0, events_extend_1.default)(this, evt, element, type, constants_2.EVENT_SOURCE_WINDOW));
|
|
549
|
-
let hasCommitted = !1;
|
|
550
|
-
if ((!filter || filter(evt)) && (!markFilter || markFilter(element)) && validateSignals.length) {
|
|
551
|
-
const params = refs.reduce(((params, ref) => (params[ref.id()] = ref.output(), params)), {});
|
|
552
|
-
validateSignals.forEach((entry => {
|
|
553
|
-
if (entry.callback && entry.signal) {
|
|
554
|
-
entry.signal.set(entry.callback(evt, params)) && (this.commit(entry.signal), hasCommitted = !0);
|
|
555
|
-
} else entry.callback ? entry.callback(evt, params) : (this.commit(entry.signal),
|
|
556
|
-
hasCommitted = !0);
|
|
557
|
-
}));
|
|
558
|
-
}
|
|
559
|
-
needPreventDefault && evt.preventDefault(), consume && evt.stopPropagation(), hasCommitted && this.run();
|
|
560
|
-
}), {
|
|
561
|
-
throttle: throttle,
|
|
562
|
-
debounce: debounce
|
|
563
|
-
});
|
|
564
|
-
if (source === constants_2.EVENT_SOURCE_VIEW) {
|
|
565
|
-
if ((0, events_1.permit)(this._eventConfig, constants_2.EVENT_SOURCE_VIEW, type)) return this.addEventListener(type, send, constants_2.NO_TRAP),
|
|
566
|
-
() => {
|
|
567
|
-
this.removeEventListener(type, send);
|
|
568
|
-
};
|
|
569
|
-
} else if (source === constants_2.EVENT_SOURCE_WINDOW) return vrender_core_1.vglobal.addEventListener(type, send),
|
|
570
|
-
this._eventListeners.push({
|
|
571
|
-
type: type,
|
|
572
|
-
source: vrender_core_1.vglobal,
|
|
573
|
-
handler: send
|
|
574
|
-
}), () => {
|
|
575
|
-
vrender_core_1.vglobal.removeEventListener(type, send);
|
|
576
|
-
const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source === vrender_core_1.vglobal && entry.handler === send));
|
|
577
|
-
index >= 0 && this._eventListeners.splice(index, 1);
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
event(eventSpec) {
|
|
581
|
-
if ("between" in eventSpec) {
|
|
582
|
-
const [starEvent, endEvent] = eventSpec.between, id = `${starEvent.type}-${eventSpec.type}-${endEvent.type}`;
|
|
583
|
-
let unbindEndEvent;
|
|
584
|
-
this.bindEvents(Object.assign({}, starEvent, {
|
|
585
|
-
callback: () => {
|
|
586
|
-
if (this._eventCache || (this._eventCache = {}), !this._eventCache[id]) {
|
|
587
|
-
const unbindEvent = this.bindEvents(eventSpec);
|
|
588
|
-
this._eventCache[id] = unbindEvent;
|
|
589
|
-
}
|
|
590
|
-
unbindEndEvent || (unbindEndEvent = this.bindEvents(Object.assign({}, endEvent, {
|
|
591
|
-
callback: () => {
|
|
592
|
-
this._eventCache[id] && (this._eventCache[id](), this._eventCache[id] = null);
|
|
593
|
-
}
|
|
594
|
-
})));
|
|
595
|
-
}
|
|
596
|
-
}));
|
|
597
|
-
} else "merge" in eventSpec ? eventSpec.merge.forEach((entry => {
|
|
598
|
-
const singleEvent = Object.assign({}, eventSpec);
|
|
599
|
-
(0, vutils_1.isString)(entry) ? singleEvent.type = entry : (0, vutils_1.isObject)(entry) && Object.assign(singleEvent, entry),
|
|
600
|
-
singleEvent.debounce = 50, this.bindEvents(singleEvent);
|
|
601
|
-
})) : this.bindEvents(eventSpec);
|
|
602
|
-
}
|
|
603
538
|
interaction(type, spec) {
|
|
604
539
|
const interaction = factory_1.Factory.createInteraction(type, this, spec);
|
|
605
540
|
return interaction && (interaction.bind(), this._boundInteractions || (this._boundInteractions = []),
|
|
@@ -622,6 +557,18 @@ class View extends vutils_1.EventEmitter {
|
|
|
622
557
|
instance.unbind();
|
|
623
558
|
})), this._boundInteractions = null), this;
|
|
624
559
|
}
|
|
560
|
+
initializeEventConfig(config) {
|
|
561
|
+
const eventsConfig = Object.assign({
|
|
562
|
+
defaults: {}
|
|
563
|
+
}, config), unpack = (obj, keys) => {
|
|
564
|
+
keys.forEach((k => {
|
|
565
|
+
(0, vutils_1.isArray)(obj[k]) && (obj[k] = obj[k].reduce(((set, key) => (set[key] = !0,
|
|
566
|
+
set)), {}));
|
|
567
|
+
}));
|
|
568
|
+
};
|
|
569
|
+
return unpack(eventsConfig.defaults, [ "prevent", "allow" ]), unpack(eventsConfig, [ constants_1.EVENT_SOURCE_VIEW, constants_1.EVENT_SOURCE_WINDOW ]),
|
|
570
|
+
eventsConfig;
|
|
571
|
+
}
|
|
625
572
|
initEvent() {
|
|
626
573
|
const stage = this.renderer.stage();
|
|
627
574
|
stage && stage.on("*", this.delegateEvent);
|
|
@@ -644,15 +591,15 @@ class View extends vutils_1.EventEmitter {
|
|
|
644
591
|
this.renderer = new canvas_renderer_1.default(this), this.renderer.initialize(width, height, this._options, this._eventConfig).background(this._background);
|
|
645
592
|
}
|
|
646
593
|
initialize() {
|
|
647
|
-
var _a;
|
|
594
|
+
var _a, _c;
|
|
648
595
|
this.grammars = new grammar_record_1.RecordedGrammars((grammar => grammar.id()), ((key, grammar) => this.logger.warn(`Grammar id '${key}' has been occupied`, grammar))),
|
|
649
596
|
this._cachedGrammars = new grammar_record_1.RecordedTreeGrammars((grammar => grammar.id())),
|
|
650
597
|
this._options.logger && vutils_1.Logger.setInstance(this._options.logger), this.logger = vutils_1.Logger.getInstance(null !== (_a = this._options.logLevel) && void 0 !== _a ? _a : 0),
|
|
651
|
-
this._dataflow = new dataflow_1.default, this.animate =
|
|
652
|
-
this.
|
|
598
|
+
this._dataflow = new dataflow_1.default, this.animate = null === (_c = this.initAnimate) || void 0 === _c ? void 0 : _c.call(this, this),
|
|
599
|
+
this._differ = new view_diff_1.ViewDiff, this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
|
|
653
600
|
this.on(key, this._options.hooks[key]);
|
|
654
601
|
})), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
|
|
655
|
-
this._eventListeners = [], this._eventConfig =
|
|
602
|
+
this._eventListeners = [], this._eventConfig = this.initializeEventConfig(this._options.eventConfig),
|
|
656
603
|
this._theme = this._options.disableTheme ? null : theme_manager_1.ThemeManager.getDefaultTheme(),
|
|
657
604
|
this.parseBuiltIn(), (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(),
|
|
658
605
|
this._eventConfig.disable || this.initEvent(), this._bindResizeEvent(), this._needBuildLayoutTree = !0,
|
|
@@ -679,7 +626,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
679
626
|
if (this._progressiveMarks && this._progressiveMarks.some((mark => mark.isDoingProgressive()))) {
|
|
680
627
|
const raf = vrender_core_1.vglobal.getRequestAnimationFrame();
|
|
681
628
|
this._progressiveRafId = raf(this.handleProgressiveFrame);
|
|
682
|
-
}
|
|
629
|
+
} else this._progressiveMarks && this.animate && this._progressiveMarks.every((mark => mark.canAnimateAfterProgressive())) ? this.animate.animate() : this._progressiveMarks && (this._progressiveMarks = null);
|
|
683
630
|
}
|
|
684
631
|
clearProgressive() {
|
|
685
632
|
if (this._progressiveRafId) {
|
|
@@ -690,13 +637,14 @@ class View extends vutils_1.EventEmitter {
|
|
|
690
637
|
})), this._progressiveMarks = null);
|
|
691
638
|
}
|
|
692
639
|
release() {
|
|
693
|
-
var _a, _b, _c;
|
|
640
|
+
var _a, _b, _c, _d;
|
|
694
641
|
this.removeAllInteractions(), this.releaseStageEvent(), this._unBindResizeEvent(),
|
|
695
642
|
this.clearProgressive(), factory_1.Factory.unregisterRuntimeTransforms(), vutils_1.Logger.setInstance(null),
|
|
696
|
-
|
|
697
|
-
this.
|
|
643
|
+
null === (_a = this.animate) || void 0 === _a || _a.stop(), this.grammars.release(),
|
|
644
|
+
this._cachedGrammars.release(), this._dataflow.release(), this._dataflow = null,
|
|
645
|
+
null === (_c = null === (_b = this.renderer) || void 0 === _b ? void 0 : _b.release) || void 0 === _c || _c.call(_b),
|
|
698
646
|
this.renderer = null, this._boundInteractions = null, this.removeAllListeners(),
|
|
699
|
-
null === (
|
|
647
|
+
null === (_d = this._eventListeners) || void 0 === _d || _d.forEach((listener => {
|
|
700
648
|
listener.source.removeEventListener(listener.type, listener.handler);
|
|
701
649
|
})), this._eventListeners = null;
|
|
702
650
|
}
|