@visactor/vgrammar-core 0.7.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/README.md +160 -0
- package/README.zh-CN.md +11 -0
- package/cjs/component/axis.d.ts +26 -0
- package/cjs/component/axis.js +164 -0
- package/cjs/component/axis.js.map +1 -0
- package/cjs/component/crosshair.d.ts +50 -0
- package/cjs/component/crosshair.js +281 -0
- package/cjs/component/crosshair.js.map +1 -0
- package/cjs/component/datazoom.d.ts +19 -0
- package/cjs/component/datazoom.js +166 -0
- package/cjs/component/datazoom.js.map +1 -0
- package/cjs/component/grid.d.ts +27 -0
- package/cjs/component/grid.js +190 -0
- package/cjs/component/grid.js.map +1 -0
- package/cjs/component/index.d.ts +11 -0
- package/cjs/component/index.js +105 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/component/label.d.ts +19 -0
- package/cjs/component/label.js +121 -0
- package/cjs/component/label.js.map +1 -0
- package/cjs/component/legend.d.ts +26 -0
- package/cjs/component/legend.js +170 -0
- package/cjs/component/legend.js.map +1 -0
- package/cjs/component/player.d.ts +25 -0
- package/cjs/component/player.js +138 -0
- package/cjs/component/player.js.map +1 -0
- package/cjs/component/scale.d.ts +8 -0
- package/cjs/component/scale.js +25 -0
- package/cjs/component/scale.js.map +1 -0
- package/cjs/component/scrollbar.d.ts +23 -0
- package/cjs/component/scrollbar.js +187 -0
- package/cjs/component/scrollbar.js.map +1 -0
- package/cjs/component/slider.d.ts +19 -0
- package/cjs/component/slider.js +86 -0
- package/cjs/component/slider.js.map +1 -0
- package/cjs/component/title.d.ts +15 -0
- package/cjs/component/title.js +56 -0
- package/cjs/component/title.js.map +1 -0
- package/cjs/component/tooltip.d.ts +62 -0
- package/cjs/component/tooltip.js +305 -0
- package/cjs/component/tooltip.js.map +1 -0
- package/cjs/core/factory.d.ts +35 -0
- package/cjs/core/factory.js +73 -0
- package/cjs/core/factory.js.map +1 -0
- package/cjs/glyph/boxplot.d.ts +10 -0
- package/cjs/glyph/boxplot.js +418 -0
- package/cjs/glyph/boxplot.js.map +1 -0
- package/cjs/glyph/index.d.ts +7 -0
- package/cjs/glyph/index.js +64 -0
- package/cjs/glyph/index.js.map +1 -0
- package/cjs/glyph/link-path.d.ts +7 -0
- package/cjs/glyph/link-path.js +138 -0
- package/cjs/glyph/link-path.js.map +1 -0
- package/cjs/glyph/ripple.d.ts +1 -0
- package/cjs/glyph/ripple.js +44 -0
- package/cjs/glyph/ripple.js.map +1 -0
- package/cjs/glyph/tree-path.d.ts +7 -0
- package/cjs/glyph/tree-path.js +152 -0
- package/cjs/glyph/tree-path.js.map +1 -0
- package/cjs/glyph/violin.d.ts +1 -0
- package/cjs/glyph/violin.js +165 -0
- package/cjs/glyph/violin.js.map +1 -0
- package/cjs/glyph/wave.d.ts +1 -0
- package/cjs/glyph/wave.js +67 -0
- package/cjs/glyph/wave.js.map +1 -0
- package/cjs/graph/animation/animate.d.ts +48 -0
- package/cjs/graph/animation/animate.js +250 -0
- package/cjs/graph/animation/animate.js.map +1 -0
- package/cjs/graph/animation/animation/clip.d.ts +4 -0
- package/cjs/graph/animation/animation/clip.js +54 -0
- package/cjs/graph/animation/animation/clip.js.map +1 -0
- package/cjs/graph/animation/animation/fade.d.ts +4 -0
- package/cjs/graph/animation/animation/fade.js +42 -0
- package/cjs/graph/animation/animation/fade.js.map +1 -0
- package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
- package/cjs/graph/animation/animation/grow-interval.js +194 -0
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
- package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-points.js +118 -0
- package/cjs/graph/animation/animation/grow-points.js.map +1 -0
- package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
- package/cjs/graph/animation/animation/grow-polar.js +164 -0
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
- package/cjs/graph/animation/animation/index.d.ts +11 -0
- package/cjs/graph/animation/animation/index.js +191 -0
- package/cjs/graph/animation/animation/index.js.map +1 -0
- package/cjs/graph/animation/animation/move.d.ts +3 -0
- package/cjs/graph/animation/animation/move.js +90 -0
- package/cjs/graph/animation/animation/move.js.map +1 -0
- package/cjs/graph/animation/animation/rotate.d.ts +3 -0
- package/cjs/graph/animation/animation/rotate.js +42 -0
- package/cjs/graph/animation/animation/rotate.js.map +1 -0
- package/cjs/graph/animation/animation/scale.d.ts +3 -0
- package/cjs/graph/animation/animation/scale.js +84 -0
- package/cjs/graph/animation/animation/scale.js.map +1 -0
- package/cjs/graph/animation/animation/update.d.ts +6 -0
- package/cjs/graph/animation/animation/update.js +22 -0
- package/cjs/graph/animation/animation/update.js.map +1 -0
- package/cjs/graph/animation/animator.d.ts +26 -0
- package/cjs/graph/animation/animator.js +88 -0
- package/cjs/graph/animation/animator.js.map +1 -0
- package/cjs/graph/animation/arranger.d.ts +13 -0
- package/cjs/graph/animation/arranger.js +38 -0
- package/cjs/graph/animation/arranger.js.map +1 -0
- package/cjs/graph/animation/attribute.d.ts +27 -0
- package/cjs/graph/animation/attribute.js +124 -0
- package/cjs/graph/animation/attribute.js.map +1 -0
- package/cjs/graph/animation/config.d.ts +5 -0
- package/cjs/graph/animation/config.js +92 -0
- package/cjs/graph/animation/config.js.map +1 -0
- package/cjs/graph/animation/morph.d.ts +12 -0
- package/cjs/graph/animation/morph.js +174 -0
- package/cjs/graph/animation/morph.js.map +1 -0
- package/cjs/graph/attributes/common.d.ts +2 -0
- package/cjs/graph/attributes/common.js +22 -0
- package/cjs/graph/attributes/common.js.map +1 -0
- package/cjs/graph/attributes/helpers.d.ts +17 -0
- package/cjs/graph/attributes/helpers.js +86 -0
- package/cjs/graph/attributes/helpers.js.map +1 -0
- package/cjs/graph/attributes/index.d.ts +10 -0
- package/cjs/graph/attributes/index.js +257 -0
- package/cjs/graph/attributes/index.js.map +1 -0
- package/cjs/graph/canvas-renderer.d.ts +34 -0
- package/cjs/graph/canvas-renderer.js +121 -0
- package/cjs/graph/canvas-renderer.js.map +1 -0
- package/cjs/graph/constants.d.ts +23 -0
- package/cjs/graph/constants.js +21 -0
- package/cjs/graph/constants.js.map +1 -0
- package/cjs/graph/element.d.ts +66 -0
- package/cjs/graph/element.js +297 -0
- package/cjs/graph/element.js.map +1 -0
- package/cjs/graph/enums.d.ts +153 -0
- package/cjs/graph/enums.js +85 -0
- package/cjs/graph/enums.js.map +1 -0
- package/cjs/graph/glyph-element.d.ts +53 -0
- package/cjs/graph/glyph-element.js +202 -0
- package/cjs/graph/glyph-element.js.map +1 -0
- package/cjs/graph/index.d.ts +3 -0
- package/cjs/graph/index.js +44 -0
- package/cjs/graph/index.js.map +1 -0
- package/cjs/graph/layout/grid.d.ts +3 -0
- package/cjs/graph/layout/grid.js +75 -0
- package/cjs/graph/layout/grid.js.map +1 -0
- package/cjs/graph/layout/layout.d.ts +3 -0
- package/cjs/graph/layout/layout.js +33 -0
- package/cjs/graph/layout/layout.js.map +1 -0
- package/cjs/graph/layout/relative.d.ts +3 -0
- package/cjs/graph/layout/relative.js +86 -0
- package/cjs/graph/layout/relative.js.map +1 -0
- package/cjs/graph/mark/differ.d.ts +20 -0
- package/cjs/graph/mark/differ.js +110 -0
- package/cjs/graph/mark/differ.js.map +1 -0
- package/cjs/graph/mark/encode.d.ts +10 -0
- package/cjs/graph/mark/encode.js +95 -0
- package/cjs/graph/mark/encode.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +10 -0
- package/cjs/graph/mark/large-rects.js +31 -0
- package/cjs/graph/mark/large-rects.js.map +1 -0
- package/cjs/graph/mark/large-symbols.d.ts +11 -0
- package/cjs/graph/mark/large-symbols.js +33 -0
- package/cjs/graph/mark/large-symbols.js.map +1 -0
- package/cjs/graph/mark-tree.d.ts +2 -0
- package/cjs/graph/mark-tree.js +21 -0
- package/cjs/graph/mark-tree.js.map +1 -0
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/env.d.ts +2 -0
- package/cjs/graph/util/env.js +14 -0
- package/cjs/graph/util/env.js.map +1 -0
- package/cjs/graph/util/events-extend.d.ts +5 -0
- package/cjs/graph/util/events-extend.js +18 -0
- package/cjs/graph/util/events-extend.js.map +1 -0
- package/cjs/graph/util/graphic.d.ts +9 -0
- package/cjs/graph/util/graphic.js +59 -0
- package/cjs/graph/util/graphic.js.map +1 -0
- package/cjs/graph/util/point.d.ts +1 -0
- package/cjs/graph/util/point.js +75 -0
- package/cjs/graph/util/point.js.map +1 -0
- package/cjs/index.d.ts +14 -0
- package/cjs/index.js +111 -0
- package/cjs/index.js.map +1 -0
- package/cjs/parse/coordinate.d.ts +7 -0
- package/cjs/parse/coordinate.js +70 -0
- package/cjs/parse/coordinate.js.map +1 -0
- package/cjs/parse/event.d.ts +8 -0
- package/cjs/parse/event.js +33 -0
- package/cjs/parse/event.js.map +1 -0
- package/cjs/parse/mark.d.ts +4 -0
- package/cjs/parse/mark.js +25 -0
- package/cjs/parse/mark.js.map +1 -0
- package/cjs/parse/option.d.ts +3 -0
- package/cjs/parse/option.js +19 -0
- package/cjs/parse/option.js.map +1 -0
- package/cjs/parse/scale.d.ts +8 -0
- package/cjs/parse/scale.js +365 -0
- package/cjs/parse/scale.js.map +1 -0
- package/cjs/parse/transform.d.ts +5 -0
- package/cjs/parse/transform.js +103 -0
- package/cjs/parse/transform.js.map +1 -0
- package/cjs/parse/util.d.ts +13 -0
- package/cjs/parse/util.js +82 -0
- package/cjs/parse/util.js.map +1 -0
- package/cjs/parse/view.d.ts +17 -0
- package/cjs/parse/view.js +108 -0
- package/cjs/parse/view.js.map +1 -0
- package/cjs/semantic-marks/cell.d.ts +13 -0
- package/cjs/semantic-marks/cell.js +61 -0
- package/cjs/semantic-marks/cell.js.map +1 -0
- package/cjs/semantic-marks/interval.d.ts +14 -0
- package/cjs/semantic-marks/interval.js +80 -0
- package/cjs/semantic-marks/interval.js.map +1 -0
- package/cjs/semantic-marks/text.d.ts +10 -0
- package/cjs/semantic-marks/text.js +25 -0
- package/cjs/semantic-marks/text.js.map +1 -0
- package/cjs/theme/common/component.d.ts +15 -0
- package/cjs/theme/common/component.js +493 -0
- package/cjs/theme/common/component.js.map +1 -0
- package/cjs/theme/common/constants.d.ts +1 -0
- package/cjs/theme/common/constants.js +6 -0
- package/cjs/theme/common/constants.js.map +1 -0
- package/cjs/theme/common/mark.d.ts +2 -0
- package/cjs/theme/common/mark.js +15 -0
- package/cjs/theme/common/mark.js.map +1 -0
- package/cjs/theme/dark.d.ts +2 -0
- package/cjs/theme/dark.js +94 -0
- package/cjs/theme/dark.js.map +1 -0
- package/cjs/theme/default.d.ts +2 -0
- package/cjs/theme/default.js +18 -0
- package/cjs/theme/default.js.map +1 -0
- package/cjs/theme/theme-manager.d.ts +8 -0
- package/cjs/theme/theme-manager.js +26 -0
- package/cjs/theme/theme-manager.js.map +1 -0
- package/cjs/transforms/data/bin.d.ts +2 -0
- package/cjs/transforms/data/bin.js +21 -0
- package/cjs/transforms/data/bin.js.map +1 -0
- package/cjs/transforms/data/circular-relation.d.ts +2 -0
- package/cjs/transforms/data/circular-relation.js +56 -0
- package/cjs/transforms/data/circular-relation.js.map +1 -0
- package/cjs/transforms/data/contour.d.ts +2 -0
- package/cjs/transforms/data/contour.js +115 -0
- package/cjs/transforms/data/contour.js.map +1 -0
- package/cjs/transforms/data/filter.d.ts +2 -0
- package/cjs/transforms/data/filter.js +10 -0
- package/cjs/transforms/data/filter.js.map +1 -0
- package/cjs/transforms/data/fold.d.ts +2 -0
- package/cjs/transforms/data/fold.js +24 -0
- package/cjs/transforms/data/fold.js.map +1 -0
- package/cjs/transforms/data/funnel.d.ts +2 -0
- package/cjs/transforms/data/funnel.js +25 -0
- package/cjs/transforms/data/funnel.js.map +1 -0
- package/cjs/transforms/data/join.d.ts +2 -0
- package/cjs/transforms/data/join.js +33 -0
- package/cjs/transforms/data/join.js.map +1 -0
- package/cjs/transforms/data/kde.d.ts +2 -0
- package/cjs/transforms/data/kde.js +90 -0
- package/cjs/transforms/data/kde.js.map +1 -0
- package/cjs/transforms/data/map.d.ts +2 -0
- package/cjs/transforms/data/map.js +23 -0
- package/cjs/transforms/data/map.js.map +1 -0
- package/cjs/transforms/data/pick.d.ts +2 -0
- package/cjs/transforms/data/pick.js +20 -0
- package/cjs/transforms/data/pick.js.map +1 -0
- package/cjs/transforms/data/pie.d.ts +2 -0
- package/cjs/transforms/data/pie.js +24 -0
- package/cjs/transforms/data/pie.js.map +1 -0
- package/cjs/transforms/data/range.d.ts +4 -0
- package/cjs/transforms/data/range.js +15 -0
- package/cjs/transforms/data/range.js.map +1 -0
- package/cjs/transforms/data/sort.d.ts +2 -0
- package/cjs/transforms/data/sort.js +17 -0
- package/cjs/transforms/data/sort.js.map +1 -0
- package/cjs/transforms/data/stack.d.ts +2 -0
- package/cjs/transforms/data/stack.js +74 -0
- package/cjs/transforms/data/stack.js.map +1 -0
- package/cjs/transforms/data/unfold.d.ts +2 -0
- package/cjs/transforms/data/unfold.js +49 -0
- package/cjs/transforms/data/unfold.js.map +1 -0
- package/cjs/transforms/index.d.ts +23 -0
- package/cjs/transforms/index.js +213 -0
- package/cjs/transforms/index.js.map +1 -0
- package/cjs/transforms/mark/dodge.d.ts +2 -0
- package/cjs/transforms/mark/dodge.js +81 -0
- package/cjs/transforms/mark/dodge.js.map +1 -0
- package/cjs/transforms/mark/jitter.d.ts +4 -0
- package/cjs/transforms/mark/jitter.js +53 -0
- package/cjs/transforms/mark/jitter.js.map +1 -0
- package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
- package/cjs/transforms/mark/lttb-sample.js +68 -0
- package/cjs/transforms/mark/lttb-sample.js.map +1 -0
- package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
- package/cjs/transforms/mark/mark-overlap.js +79 -0
- package/cjs/transforms/mark/mark-overlap.js.map +1 -0
- package/cjs/transforms/mark/symmetry.d.ts +2 -0
- package/cjs/transforms/mark/symmetry.js +25 -0
- package/cjs/transforms/mark/symmetry.js.map +1 -0
- package/cjs/transforms/util/util.d.ts +5 -0
- package/cjs/transforms/util/util.js +41 -0
- package/cjs/transforms/util/util.js.map +1 -0
- package/cjs/transforms/view/identifier.d.ts +2 -0
- package/cjs/transforms/view/identifier.js +17 -0
- package/cjs/transforms/view/identifier.js.map +1 -0
- package/cjs/types/animate.d.ts +224 -0
- package/cjs/types/animate.js +6 -0
- package/cjs/types/animate.js.map +1 -0
- package/cjs/types/base.d.ts +36 -0
- package/cjs/types/base.js +6 -0
- package/cjs/types/base.js.map +1 -0
- package/cjs/types/component.d.ts +240 -0
- package/cjs/types/component.js +6 -0
- package/cjs/types/component.js.map +1 -0
- package/cjs/types/coordinate.d.ts +15 -0
- package/cjs/types/coordinate.js +6 -0
- package/cjs/types/coordinate.js.map +1 -0
- package/cjs/types/data.d.ts +55 -0
- package/cjs/types/data.js +5 -0
- package/cjs/types/data.js.map +1 -0
- package/cjs/types/dataflow.d.ts +13 -0
- package/cjs/types/dataflow.js +6 -0
- package/cjs/types/dataflow.js.map +1 -0
- package/cjs/types/element.d.ts +117 -0
- package/cjs/types/element.js +6 -0
- package/cjs/types/element.js.map +1 -0
- package/cjs/types/event.d.ts +58 -0
- package/cjs/types/event.js +6 -0
- package/cjs/types/event.js.map +1 -0
- package/cjs/types/glyph.d.ts +29 -0
- package/cjs/types/glyph.js +6 -0
- package/cjs/types/glyph.js.map +1 -0
- package/cjs/types/grammar.d.ts +184 -0
- package/cjs/types/grammar.js +6 -0
- package/cjs/types/grammar.js.map +1 -0
- package/cjs/types/hooks.d.ts +45 -0
- package/cjs/types/hooks.js +6 -0
- package/cjs/types/hooks.js.map +1 -0
- package/cjs/types/index.d.ts +22 -0
- package/cjs/types/index.js +31 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/layout.d.ts +5 -0
- package/cjs/types/layout.js +6 -0
- package/cjs/types/layout.js.map +1 -0
- package/cjs/types/mark.d.ts +344 -0
- package/cjs/types/mark.js +6 -0
- package/cjs/types/mark.js.map +1 -0
- package/cjs/types/morph.d.ts +29 -0
- package/cjs/types/morph.js +6 -0
- package/cjs/types/morph.js.map +1 -0
- package/cjs/types/plot.d.ts +326 -0
- package/cjs/types/plot.js +6 -0
- package/cjs/types/plot.js.map +1 -0
- package/cjs/types/projection.d.ts +61 -0
- package/cjs/types/projection.js +6 -0
- package/cjs/types/projection.js.map +1 -0
- package/cjs/types/renderer.d.ts +19 -0
- package/cjs/types/renderer.js +6 -0
- package/cjs/types/renderer.js.map +1 -0
- package/cjs/types/scale.d.ts +111 -0
- package/cjs/types/scale.js +6 -0
- package/cjs/types/scale.js.map +1 -0
- package/cjs/types/signal.d.ts +20 -0
- package/cjs/types/signal.js +6 -0
- package/cjs/types/signal.js.map +1 -0
- package/cjs/types/theme.d.ts +41 -0
- package/cjs/types/theme.js +6 -0
- package/cjs/types/theme.js.map +1 -0
- package/cjs/types/transform.d.ts +291 -0
- package/cjs/types/transform.js +6 -0
- package/cjs/types/transform.js.map +1 -0
- package/cjs/types/view.d.ts +217 -0
- package/cjs/types/view.js +6 -0
- package/cjs/types/view.js.map +1 -0
- package/cjs/util/data.d.ts +3 -0
- package/cjs/util/data.js +64 -0
- package/cjs/util/data.js.map +1 -0
- package/cjs/util/grammar-heap.d.ts +14 -0
- package/cjs/util/grammar-heap.js +66 -0
- package/cjs/util/grammar-heap.js.map +1 -0
- package/cjs/util/text.d.ts +19 -0
- package/cjs/util/text.js +32 -0
- package/cjs/util/text.js.map +1 -0
- package/cjs/util/unique-list.d.ts +12 -0
- package/cjs/util/unique-list.js +37 -0
- package/cjs/util/unique-list.js.map +1 -0
- package/cjs/view/View.d.ts +157 -0
- package/cjs/view/View.js +800 -0
- package/cjs/view/View.js.map +1 -0
- package/cjs/view/animate.d.ts +20 -0
- package/cjs/view/animate.js +106 -0
- package/cjs/view/animate.js.map +1 -0
- package/cjs/view/component.d.ts +26 -0
- package/cjs/view/component.js +64 -0
- package/cjs/view/component.js.map +1 -0
- package/cjs/view/constants.d.ts +17 -0
- package/cjs/view/constants.js +13 -0
- package/cjs/view/constants.js.map +1 -0
- package/cjs/view/coordinate.d.ts +23 -0
- package/cjs/view/coordinate.js +59 -0
- package/cjs/view/coordinate.js.map +1 -0
- package/cjs/view/data.d.ts +37 -0
- package/cjs/view/data.js +198 -0
- package/cjs/view/data.js.map +1 -0
- package/cjs/view/dataflow.d.ts +32 -0
- package/cjs/view/dataflow.js +146 -0
- package/cjs/view/dataflow.js.map +1 -0
- package/cjs/view/events.d.ts +4 -0
- package/cjs/view/events.js +34 -0
- package/cjs/view/events.js.map +1 -0
- package/cjs/view/glyph-meta.d.ts +29 -0
- package/cjs/view/glyph-meta.js +45 -0
- package/cjs/view/glyph-meta.js.map +1 -0
- package/cjs/view/glyph.d.ts +14 -0
- package/cjs/view/glyph.js +29 -0
- package/cjs/view/glyph.js.map +1 -0
- package/cjs/view/grammar-base.d.ts +46 -0
- package/cjs/view/grammar-base.js +171 -0
- package/cjs/view/grammar-base.js.map +1 -0
- package/cjs/view/grammar-record.d.ts +39 -0
- package/cjs/view/grammar-record.js +180 -0
- package/cjs/view/grammar-record.js.map +1 -0
- package/cjs/view/group.d.ts +13 -0
- package/cjs/view/group.js +39 -0
- package/cjs/view/group.js.map +1 -0
- package/cjs/view/index.d.ts +1 -0
- package/cjs/view/index.js +21 -0
- package/cjs/view/index.js.map +1 -0
- package/cjs/view/mark.d.ts +112 -0
- package/cjs/view/mark.js +600 -0
- package/cjs/view/mark.js.map +1 -0
- package/cjs/view/scale.d.ts +26 -0
- package/cjs/view/scale.js +86 -0
- package/cjs/view/scale.js.map +1 -0
- package/cjs/view/signal.d.ts +18 -0
- package/cjs/view/signal.js +56 -0
- package/cjs/view/signal.js.map +1 -0
- package/es/component/axis.d.ts +26 -0
- package/es/component/axis.js +162 -0
- package/es/component/axis.js.map +1 -0
- package/es/component/crosshair.d.ts +50 -0
- package/es/component/crosshair.js +275 -0
- package/es/component/crosshair.js.map +1 -0
- package/es/component/datazoom.d.ts +19 -0
- package/es/component/datazoom.js +161 -0
- package/es/component/datazoom.js.map +1 -0
- package/es/component/grid.d.ts +27 -0
- package/es/component/grid.js +193 -0
- package/es/component/grid.js.map +1 -0
- package/es/component/index.d.ts +11 -0
- package/es/component/index.js +22 -0
- package/es/component/index.js.map +1 -0
- package/es/component/label.d.ts +19 -0
- package/es/component/label.js +124 -0
- package/es/component/label.js.map +1 -0
- package/es/component/legend.d.ts +26 -0
- package/es/component/legend.js +169 -0
- package/es/component/legend.js.map +1 -0
- package/es/component/player.d.ts +25 -0
- package/es/component/player.js +136 -0
- package/es/component/player.js.map +1 -0
- package/es/component/scale.d.ts +8 -0
- package/es/component/scale.js +19 -0
- package/es/component/scale.js.map +1 -0
- package/es/component/scrollbar.d.ts +23 -0
- package/es/component/scrollbar.js +184 -0
- package/es/component/scrollbar.js.map +1 -0
- package/es/component/slider.d.ts +19 -0
- package/es/component/slider.js +86 -0
- package/es/component/slider.js.map +1 -0
- package/es/component/title.d.ts +15 -0
- package/es/component/title.js +58 -0
- package/es/component/title.js.map +1 -0
- package/es/component/tooltip.d.ts +62 -0
- package/es/component/tooltip.js +303 -0
- package/es/component/tooltip.js.map +1 -0
- package/es/core/factory.d.ts +35 -0
- package/es/core/factory.js +67 -0
- package/es/core/factory.js.map +1 -0
- package/es/glyph/boxplot.d.ts +10 -0
- package/es/glyph/boxplot.js +410 -0
- package/es/glyph/boxplot.js.map +1 -0
- package/es/glyph/index.d.ts +7 -0
- package/es/glyph/index.js +11 -0
- package/es/glyph/index.js.map +1 -0
- package/es/glyph/link-path.d.ts +7 -0
- package/es/glyph/link-path.js +132 -0
- package/es/glyph/link-path.js.map +1 -0
- package/es/glyph/ripple.d.ts +1 -0
- package/es/glyph/ripple.js +38 -0
- package/es/glyph/ripple.js.map +1 -0
- package/es/glyph/tree-path.d.ts +7 -0
- package/es/glyph/tree-path.js +146 -0
- package/es/glyph/tree-path.js.map +1 -0
- package/es/glyph/violin.d.ts +1 -0
- package/es/glyph/violin.js +163 -0
- package/es/glyph/violin.js.map +1 -0
- package/es/glyph/wave.d.ts +1 -0
- package/es/glyph/wave.js +61 -0
- package/es/glyph/wave.js.map +1 -0
- package/es/graph/animation/animate.d.ts +48 -0
- package/es/graph/animation/animate.js +247 -0
- package/es/graph/animation/animate.js.map +1 -0
- package/es/graph/animation/animation/clip.d.ts +4 -0
- package/es/graph/animation/animation/clip.js +44 -0
- package/es/graph/animation/animation/clip.js.map +1 -0
- package/es/graph/animation/animation/fade.d.ts +4 -0
- package/es/graph/animation/animation/fade.js +32 -0
- package/es/graph/animation/animation/fade.js.map +1 -0
- package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/es/graph/animation/animation/grow-cartesian.js +272 -0
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/es/graph/animation/animation/grow-interval.d.ts +3 -0
- package/es/graph/animation/animation/grow-interval.js +184 -0
- package/es/graph/animation/animation/grow-interval.js.map +1 -0
- package/es/graph/animation/animation/grow-points.d.ts +7 -0
- package/es/graph/animation/animation/grow-points.js +107 -0
- package/es/graph/animation/animation/grow-points.js.map +1 -0
- package/es/graph/animation/animation/grow-polar.d.ts +5 -0
- package/es/graph/animation/animation/grow-polar.js +160 -0
- package/es/graph/animation/animation/grow-polar.js.map +1 -0
- package/es/graph/animation/animation/index.d.ts +11 -0
- package/es/graph/animation/animation/index.js +22 -0
- package/es/graph/animation/animation/index.js.map +1 -0
- package/es/graph/animation/animation/move.d.ts +3 -0
- package/es/graph/animation/animation/move.js +78 -0
- package/es/graph/animation/animation/move.js.map +1 -0
- package/es/graph/animation/animation/rotate.d.ts +3 -0
- package/es/graph/animation/animation/rotate.js +32 -0
- package/es/graph/animation/animation/rotate.js.map +1 -0
- package/es/graph/animation/animation/scale.d.ts +3 -0
- package/es/graph/animation/animation/scale.js +74 -0
- package/es/graph/animation/animation/scale.js.map +1 -0
- package/es/graph/animation/animation/update.d.ts +6 -0
- package/es/graph/animation/animation/update.js +20 -0
- package/es/graph/animation/animation/update.js.map +1 -0
- package/es/graph/animation/animator.d.ts +26 -0
- package/es/graph/animation/animator.js +83 -0
- package/es/graph/animation/animator.js.map +1 -0
- package/es/graph/animation/arranger.d.ts +13 -0
- package/es/graph/animation/arranger.js +29 -0
- package/es/graph/animation/arranger.js.map +1 -0
- package/es/graph/animation/attribute.d.ts +27 -0
- package/es/graph/animation/attribute.js +114 -0
- package/es/graph/animation/attribute.js.map +1 -0
- package/es/graph/animation/config.d.ts +5 -0
- package/es/graph/animation/config.js +84 -0
- package/es/graph/animation/config.js.map +1 -0
- package/es/graph/animation/morph.d.ts +12 -0
- package/es/graph/animation/morph.js +171 -0
- package/es/graph/animation/morph.js.map +1 -0
- package/es/graph/attributes/common.d.ts +2 -0
- package/es/graph/attributes/common.js +13 -0
- package/es/graph/attributes/common.js.map +1 -0
- package/es/graph/attributes/helpers.d.ts +17 -0
- package/es/graph/attributes/helpers.js +75 -0
- package/es/graph/attributes/helpers.js.map +1 -0
- package/es/graph/attributes/index.d.ts +10 -0
- package/es/graph/attributes/index.js +231 -0
- package/es/graph/attributes/index.js.map +1 -0
- package/es/graph/canvas-renderer.d.ts +34 -0
- package/es/graph/canvas-renderer.js +115 -0
- package/es/graph/canvas-renderer.js.map +1 -0
- package/es/graph/constants.d.ts +23 -0
- package/es/graph/constants.js +47 -0
- package/es/graph/constants.js.map +1 -0
- package/es/graph/element.d.ts +66 -0
- package/es/graph/element.js +292 -0
- package/es/graph/element.js.map +1 -0
- package/es/graph/enums.d.ts +153 -0
- package/es/graph/enums.js +129 -0
- package/es/graph/enums.js.map +1 -0
- package/es/graph/glyph-element.d.ts +53 -0
- package/es/graph/glyph-element.js +206 -0
- package/es/graph/glyph-element.js.map +1 -0
- package/es/graph/index.d.ts +3 -0
- package/es/graph/index.js +6 -0
- package/es/graph/index.js.map +1 -0
- package/es/graph/layout/grid.d.ts +3 -0
- package/es/graph/layout/grid.js +66 -0
- package/es/graph/layout/grid.js.map +1 -0
- package/es/graph/layout/layout.d.ts +3 -0
- package/es/graph/layout/layout.js +33 -0
- package/es/graph/layout/layout.js.map +1 -0
- package/es/graph/layout/relative.d.ts +3 -0
- package/es/graph/layout/relative.js +85 -0
- package/es/graph/layout/relative.js.map +1 -0
- package/es/graph/mark/differ.d.ts +20 -0
- package/es/graph/mark/differ.js +104 -0
- package/es/graph/mark/differ.js.map +1 -0
- package/es/graph/mark/encode.d.ts +10 -0
- package/es/graph/mark/encode.js +92 -0
- package/es/graph/mark/encode.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +10 -0
- package/es/graph/mark/large-rects.js +23 -0
- package/es/graph/mark/large-rects.js.map +1 -0
- package/es/graph/mark/large-symbols.d.ts +11 -0
- package/es/graph/mark/large-symbols.js +27 -0
- package/es/graph/mark/large-symbols.js.map +1 -0
- package/es/graph/mark-tree.d.ts +2 -0
- package/es/graph/mark-tree.js +15 -0
- package/es/graph/mark-tree.js.map +1 -0
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/env.d.ts +2 -0
- package/es/graph/util/env.js +6 -0
- package/es/graph/util/env.js.map +1 -0
- package/es/graph/util/events-extend.d.ts +5 -0
- package/es/graph/util/events-extend.js +12 -0
- package/es/graph/util/events-extend.js.map +1 -0
- package/es/graph/util/graphic.d.ts +9 -0
- package/es/graph/util/graphic.js +59 -0
- package/es/graph/util/graphic.js.map +1 -0
- package/es/graph/util/point.d.ts +1 -0
- package/es/graph/util/point.js +67 -0
- package/es/graph/util/point.js.map +1 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +27 -0
- package/es/index.js.map +1 -0
- package/es/parse/coordinate.d.ts +7 -0
- package/es/parse/coordinate.js +65 -0
- package/es/parse/coordinate.js.map +1 -0
- package/es/parse/event.d.ts +8 -0
- package/es/parse/event.js +23 -0
- package/es/parse/event.js.map +1 -0
- package/es/parse/mark.d.ts +4 -0
- package/es/parse/mark.js +19 -0
- package/es/parse/mark.js.map +1 -0
- package/es/parse/option.d.ts +3 -0
- package/es/parse/option.js +10 -0
- package/es/parse/option.js.map +1 -0
- package/es/parse/scale.d.ts +8 -0
- package/es/parse/scale.js +347 -0
- package/es/parse/scale.js.map +1 -0
- package/es/parse/transform.d.ts +5 -0
- package/es/parse/transform.js +102 -0
- package/es/parse/transform.js.map +1 -0
- package/es/parse/util.d.ts +13 -0
- package/es/parse/util.js +65 -0
- package/es/parse/util.js.map +1 -0
- package/es/parse/view.d.ts +17 -0
- package/es/parse/view.js +98 -0
- package/es/parse/view.js.map +1 -0
- package/es/semantic-marks/cell.d.ts +13 -0
- package/es/semantic-marks/cell.js +57 -0
- package/es/semantic-marks/cell.js.map +1 -0
- package/es/semantic-marks/interval.d.ts +14 -0
- package/es/semantic-marks/interval.js +87 -0
- package/es/semantic-marks/interval.js.map +1 -0
- package/es/semantic-marks/text.d.ts +10 -0
- package/es/semantic-marks/text.js +22 -0
- package/es/semantic-marks/text.js.map +1 -0
- package/es/theme/common/component.d.ts +15 -0
- package/es/theme/common/component.js +510 -0
- package/es/theme/common/component.js.map +1 -0
- package/es/theme/common/constants.d.ts +1 -0
- package/es/theme/common/constants.js +2 -0
- package/es/theme/common/constants.js.map +1 -0
- package/es/theme/common/mark.d.ts +2 -0
- package/es/theme/common/mark.js +11 -0
- package/es/theme/common/mark.js.map +1 -0
- package/es/theme/dark.d.ts +2 -0
- package/es/theme/dark.js +96 -0
- package/es/theme/dark.js.map +1 -0
- package/es/theme/default.d.ts +2 -0
- package/es/theme/default.js +16 -0
- package/es/theme/default.js.map +1 -0
- package/es/theme/theme-manager.d.ts +8 -0
- package/es/theme/theme-manager.js +22 -0
- package/es/theme/theme-manager.js.map +1 -0
- package/es/transforms/data/bin.d.ts +2 -0
- package/es/transforms/data/bin.js +16 -0
- package/es/transforms/data/bin.js.map +1 -0
- package/es/transforms/data/circular-relation.d.ts +2 -0
- package/es/transforms/data/circular-relation.js +44 -0
- package/es/transforms/data/circular-relation.js.map +1 -0
- package/es/transforms/data/contour.d.ts +2 -0
- package/es/transforms/data/contour.js +111 -0
- package/es/transforms/data/contour.js.map +1 -0
- package/es/transforms/data/filter.d.ts +2 -0
- package/es/transforms/data/filter.js +2 -0
- package/es/transforms/data/filter.js.map +1 -0
- package/es/transforms/data/fold.d.ts +2 -0
- package/es/transforms/data/fold.js +16 -0
- package/es/transforms/data/fold.js.map +1 -0
- package/es/transforms/data/funnel.d.ts +2 -0
- package/es/transforms/data/funnel.js +17 -0
- package/es/transforms/data/funnel.js.map +1 -0
- package/es/transforms/data/join.d.ts +2 -0
- package/es/transforms/data/join.js +26 -0
- package/es/transforms/data/join.js.map +1 -0
- package/es/transforms/data/kde.d.ts +2 -0
- package/es/transforms/data/kde.js +80 -0
- package/es/transforms/data/kde.js.map +1 -0
- package/es/transforms/data/map.d.ts +2 -0
- package/es/transforms/data/map.js +16 -0
- package/es/transforms/data/map.js.map +1 -0
- package/es/transforms/data/pick.d.ts +2 -0
- package/es/transforms/data/pick.js +15 -0
- package/es/transforms/data/pick.js.map +1 -0
- package/es/transforms/data/pie.d.ts +2 -0
- package/es/transforms/data/pie.js +18 -0
- package/es/transforms/data/pie.js.map +1 -0
- package/es/transforms/data/range.d.ts +4 -0
- package/es/transforms/data/range.js +9 -0
- package/es/transforms/data/range.js.map +1 -0
- package/es/transforms/data/sort.d.ts +2 -0
- package/es/transforms/data/sort.js +13 -0
- package/es/transforms/data/sort.js.map +1 -0
- package/es/transforms/data/stack.d.ts +2 -0
- package/es/transforms/data/stack.js +72 -0
- package/es/transforms/data/stack.js.map +1 -0
- package/es/transforms/data/unfold.d.ts +2 -0
- package/es/transforms/data/unfold.js +45 -0
- package/es/transforms/data/unfold.js.map +1 -0
- package/es/transforms/index.d.ts +23 -0
- package/es/transforms/index.js +205 -0
- package/es/transforms/index.js.map +1 -0
- package/es/transforms/mark/dodge.d.ts +2 -0
- package/es/transforms/mark/dodge.js +74 -0
- package/es/transforms/mark/dodge.js.map +1 -0
- package/es/transforms/mark/jitter.d.ts +4 -0
- package/es/transforms/mark/jitter.js +48 -0
- package/es/transforms/mark/jitter.js.map +1 -0
- package/es/transforms/mark/lttb-sample.d.ts +2 -0
- package/es/transforms/mark/lttb-sample.js +60 -0
- package/es/transforms/mark/lttb-sample.js.map +1 -0
- package/es/transforms/mark/mark-overlap.d.ts +2 -0
- package/es/transforms/mark/mark-overlap.js +71 -0
- package/es/transforms/mark/mark-overlap.js.map +1 -0
- package/es/transforms/mark/symmetry.d.ts +2 -0
- package/es/transforms/mark/symmetry.js +20 -0
- package/es/transforms/mark/symmetry.js.map +1 -0
- package/es/transforms/util/util.d.ts +5 -0
- package/es/transforms/util/util.js +33 -0
- package/es/transforms/util/util.js.map +1 -0
- package/es/transforms/view/identifier.d.ts +2 -0
- package/es/transforms/view/identifier.js +13 -0
- package/es/transforms/view/identifier.js.map +1 -0
- package/es/types/animate.d.ts +224 -0
- package/es/types/animate.js +2 -0
- package/es/types/animate.js.map +1 -0
- package/es/types/base.d.ts +36 -0
- package/es/types/base.js +2 -0
- package/es/types/base.js.map +1 -0
- package/es/types/component.d.ts +240 -0
- package/es/types/component.js +2 -0
- package/es/types/component.js.map +1 -0
- package/es/types/coordinate.d.ts +15 -0
- package/es/types/coordinate.js +2 -0
- package/es/types/coordinate.js.map +1 -0
- package/es/types/data.d.ts +55 -0
- package/es/types/data.js +1 -0
- package/es/types/data.js.map +1 -0
- package/es/types/dataflow.d.ts +13 -0
- package/es/types/dataflow.js +2 -0
- package/es/types/dataflow.js.map +1 -0
- package/es/types/element.d.ts +117 -0
- package/es/types/element.js +2 -0
- package/es/types/element.js.map +1 -0
- package/es/types/event.d.ts +58 -0
- package/es/types/event.js +2 -0
- package/es/types/event.js.map +1 -0
- package/es/types/glyph.d.ts +29 -0
- package/es/types/glyph.js +2 -0
- package/es/types/glyph.js.map +1 -0
- package/es/types/grammar.d.ts +184 -0
- package/es/types/grammar.js +2 -0
- package/es/types/grammar.js.map +1 -0
- package/es/types/hooks.d.ts +45 -0
- package/es/types/hooks.js +2 -0
- package/es/types/hooks.js.map +1 -0
- package/es/types/index.d.ts +22 -0
- package/es/types/index.js +44 -0
- package/es/types/index.js.map +1 -0
- package/es/types/layout.d.ts +5 -0
- package/es/types/layout.js +2 -0
- package/es/types/layout.js.map +1 -0
- package/es/types/mark.d.ts +344 -0
- package/es/types/mark.js +2 -0
- package/es/types/mark.js.map +1 -0
- package/es/types/morph.d.ts +29 -0
- package/es/types/morph.js +2 -0
- package/es/types/morph.js.map +1 -0
- package/es/types/plot.d.ts +326 -0
- package/es/types/plot.js +2 -0
- package/es/types/plot.js.map +1 -0
- package/es/types/projection.d.ts +61 -0
- package/es/types/projection.js +2 -0
- package/es/types/projection.js.map +1 -0
- package/es/types/renderer.d.ts +19 -0
- package/es/types/renderer.js +2 -0
- package/es/types/renderer.js.map +1 -0
- package/es/types/scale.d.ts +111 -0
- package/es/types/scale.js +2 -0
- package/es/types/scale.js.map +1 -0
- package/es/types/signal.d.ts +20 -0
- package/es/types/signal.js +2 -0
- package/es/types/signal.js.map +1 -0
- package/es/types/theme.d.ts +41 -0
- package/es/types/theme.js +2 -0
- package/es/types/theme.js.map +1 -0
- package/es/types/transform.d.ts +291 -0
- package/es/types/transform.js +2 -0
- package/es/types/transform.js.map +1 -0
- package/es/types/view.d.ts +217 -0
- package/es/types/view.js +2 -0
- package/es/types/view.js.map +1 -0
- package/es/util/data.d.ts +3 -0
- package/es/util/data.js +60 -0
- package/es/util/data.js.map +1 -0
- package/es/util/grammar-heap.d.ts +14 -0
- package/es/util/grammar-heap.js +58 -0
- package/es/util/grammar-heap.js.map +1 -0
- package/es/util/text.d.ts +19 -0
- package/es/util/text.js +25 -0
- package/es/util/text.js.map +1 -0
- package/es/util/unique-list.d.ts +12 -0
- package/es/util/unique-list.js +29 -0
- package/es/util/unique-list.js.map +1 -0
- package/es/view/View.d.ts +157 -0
- package/es/view/View.js +836 -0
- package/es/view/View.js.map +1 -0
- package/es/view/animate.d.ts +20 -0
- package/es/view/animate.js +98 -0
- package/es/view/animate.js.map +1 -0
- package/es/view/component.d.ts +26 -0
- package/es/view/component.js +64 -0
- package/es/view/component.js.map +1 -0
- package/es/view/constants.d.ts +17 -0
- package/es/view/constants.js +32 -0
- package/es/view/constants.js.map +1 -0
- package/es/view/coordinate.d.ts +23 -0
- package/es/view/coordinate.js +52 -0
- package/es/view/coordinate.js.map +1 -0
- package/es/view/data.d.ts +37 -0
- package/es/view/data.js +195 -0
- package/es/view/data.js.map +1 -0
- package/es/view/dataflow.d.ts +32 -0
- package/es/view/dataflow.js +141 -0
- package/es/view/dataflow.js.map +1 -0
- package/es/view/events.d.ts +4 -0
- package/es/view/events.js +26 -0
- package/es/view/events.js.map +1 -0
- package/es/view/glyph-meta.d.ts +29 -0
- package/es/view/glyph-meta.js +37 -0
- package/es/view/glyph-meta.js.map +1 -0
- package/es/view/glyph.d.ts +14 -0
- package/es/view/glyph.js +27 -0
- package/es/view/glyph.js.map +1 -0
- package/es/view/grammar-base.d.ts +46 -0
- package/es/view/grammar-base.js +165 -0
- package/es/view/grammar-base.js.map +1 -0
- package/es/view/grammar-record.d.ts +39 -0
- package/es/view/grammar-record.js +170 -0
- package/es/view/grammar-record.js.map +1 -0
- package/es/view/group.d.ts +13 -0
- package/es/view/group.js +39 -0
- package/es/view/group.js.map +1 -0
- package/es/view/index.d.ts +1 -0
- package/es/view/index.js +2 -0
- package/es/view/index.js.map +1 -0
- package/es/view/mark.d.ts +112 -0
- package/es/view/mark.js +604 -0
- package/es/view/mark.js.map +1 -0
- package/es/view/scale.d.ts +26 -0
- package/es/view/scale.js +82 -0
- package/es/view/scale.js.map +1 -0
- package/es/view/signal.d.ts +18 -0
- package/es/view/signal.js +52 -0
- package/es/view/signal.js.map +1 -0
- package/package.json +67 -0
package/cjs/view/View.js
ADDED
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
4
|
+
return new (P || (P = Promise))((function(resolve, reject) {
|
|
5
|
+
function fulfilled(value) {
|
|
6
|
+
try {
|
|
7
|
+
step(generator.next(value));
|
|
8
|
+
} catch (e) {
|
|
9
|
+
reject(e);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function rejected(value) {
|
|
13
|
+
try {
|
|
14
|
+
step(generator.throw(value));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
reject(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function step(result) {
|
|
20
|
+
var value;
|
|
21
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
|
|
22
|
+
resolve(value);
|
|
23
|
+
}))).then(fulfilled, rejected);
|
|
24
|
+
}
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
}));
|
|
27
|
+
}, __importDefault = this && this.__importDefault || function(mod) {
|
|
28
|
+
return mod && mod.__esModule ? mod : {
|
|
29
|
+
default: mod
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, "__esModule", {
|
|
34
|
+
value: !0
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const vutils_1 = require("@visactor/vutils"), vrender_1 = require("@visactor/vrender"), data_1 = require("./data"), events_1 = require("./events"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), constants_1 = require("../graph/constants"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_2 = require("./constants"), signal_1 = require("./signal"), scale_1 = require("./scale"), view_1 = require("../parse/view"), event_1 = require("../parse/event"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), layout_1 = require("../graph/layout/layout"), glyph_1 = require("./glyph"), coordinate_1 = require("./coordinate"), morph_1 = require("../graph/animation/morph"), grammar_record_1 = require("./grammar-record"), animate_1 = require("./animate"), enums_1 = require("../graph/enums"), interval_1 = require("../semantic-marks/interval"), cell_1 = require("../semantic-marks/cell"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory");
|
|
38
|
+
|
|
39
|
+
class View extends vutils_1.EventEmitter {
|
|
40
|
+
static useRegisters(comps) {
|
|
41
|
+
comps.forEach((fn => {
|
|
42
|
+
fn();
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
static useAnimations(comps) {
|
|
46
|
+
comps.forEach((comp => {
|
|
47
|
+
factory_1.Factory.registerAnimationType(comp.name, comp);
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
constructor(options = {}, config = {}) {
|
|
51
|
+
super(), this._observer = null, this._onResize = (0, vutils_1.debounce)(((...args) => {
|
|
52
|
+
const size = this._getContainerSize();
|
|
53
|
+
size && this.resize(size.width, size.height);
|
|
54
|
+
}), 100), this.delegateEvent = (event, type) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const activeElement = null === (_a = event.target) || void 0 === _a ? void 0 : _a[constants_1.BridgeElementKey], extendedEvt = (0,
|
|
57
|
+
events_extend_1.default)(this, event, activeElement, type, constants_2.EVENT_SOURCE_VIEW);
|
|
58
|
+
this.emit(type, extendedEvt, activeElement);
|
|
59
|
+
}, this.handleProgressiveFrame = () => {
|
|
60
|
+
this._progressiveMarks.length && this._progressiveMarks.forEach((mark => {
|
|
61
|
+
mark.isDoingProgressive() && mark.evaluateProgressive();
|
|
62
|
+
})), this.doPreProgressive();
|
|
63
|
+
}, this._config = config, this._options = Object.assign({
|
|
64
|
+
mode: constants_2.BROWSER,
|
|
65
|
+
cursor: !0
|
|
66
|
+
}, options), this.initialize();
|
|
67
|
+
}
|
|
68
|
+
getGrammarById(id) {
|
|
69
|
+
return this.grammars.getGrammar(id);
|
|
70
|
+
}
|
|
71
|
+
getSignalById(id) {
|
|
72
|
+
return this.grammars.getSignal(id);
|
|
73
|
+
}
|
|
74
|
+
getDataById(id) {
|
|
75
|
+
return this.grammars.getData(id);
|
|
76
|
+
}
|
|
77
|
+
getScaleById(id) {
|
|
78
|
+
return this.grammars.getScale(id);
|
|
79
|
+
}
|
|
80
|
+
getCoordinateById(id) {
|
|
81
|
+
return this.grammars.getCoordinate(id);
|
|
82
|
+
}
|
|
83
|
+
getMarkById(id) {
|
|
84
|
+
return this.grammars.getMark(id);
|
|
85
|
+
}
|
|
86
|
+
getCustomizedById(id) {
|
|
87
|
+
return this.grammars.getCustomized(id);
|
|
88
|
+
}
|
|
89
|
+
getGrammarsByName(name) {
|
|
90
|
+
return this.grammars.filter((grammar => grammar.name() === name));
|
|
91
|
+
}
|
|
92
|
+
getGrammarsByType(grammarType) {
|
|
93
|
+
return this.grammars.filter((grammar => grammar.grammarType === grammarType));
|
|
94
|
+
}
|
|
95
|
+
getMarksByType(markType) {
|
|
96
|
+
return this.grammars.getAllMarks().filter((mark => mark.markType === markType));
|
|
97
|
+
}
|
|
98
|
+
updateSignal(signal, value) {
|
|
99
|
+
(0, vutils_1.isString)(signal) && (signal = this.getSignalById(signal)), signal.set(value),
|
|
100
|
+
this.commit(signal);
|
|
101
|
+
}
|
|
102
|
+
signal(value, update) {
|
|
103
|
+
const signal = new signal_1.Signal(this);
|
|
104
|
+
return arguments.length >= 1 && signal.value(value), arguments.length >= 2 && signal.update(update),
|
|
105
|
+
this.grammars.record(signal), this._dataflow.add(signal), signal;
|
|
106
|
+
}
|
|
107
|
+
data(values) {
|
|
108
|
+
const data = new data_1.Data(this, values);
|
|
109
|
+
return this.grammars.record(data), this._dataflow.add(data), data;
|
|
110
|
+
}
|
|
111
|
+
scale(type) {
|
|
112
|
+
const scale = new scale_1.Scale(this, type);
|
|
113
|
+
return this.grammars.record(scale), this._dataflow.add(scale), scale;
|
|
114
|
+
}
|
|
115
|
+
coordinate(type) {
|
|
116
|
+
const coordinate = new coordinate_1.Coordinate(this, type);
|
|
117
|
+
return this.grammars.record(coordinate), this._dataflow.add(coordinate), coordinate;
|
|
118
|
+
}
|
|
119
|
+
mark(type, group, markOptions) {
|
|
120
|
+
const groupMark = (0, vutils_1.isString)(group) ? this.getMarkById(group) : group;
|
|
121
|
+
let mark;
|
|
122
|
+
switch (type) {
|
|
123
|
+
case enums_1.GrammarMarkType.group:
|
|
124
|
+
mark = new group_1.GroupMark(this, groupMark);
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case enums_1.GrammarMarkType.glyph:
|
|
128
|
+
mark = new glyph_1.GlyphMark(this, null == markOptions ? void 0 : markOptions.glyphType, groupMark);
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case enums_1.GrammarMarkType.component:
|
|
132
|
+
mark = factory_1.Factory.createComponent(null == markOptions ? void 0 : markOptions.componentType, this, groupMark, null == markOptions ? void 0 : markOptions.mode);
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case enums_1.GrammarMarkType.interval:
|
|
136
|
+
mark = new interval_1.Interval(this, type, groupMark);
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
case enums_1.GrammarMarkType.cell:
|
|
140
|
+
mark = new cell_1.Cell(this, type, groupMark);
|
|
141
|
+
break;
|
|
142
|
+
|
|
143
|
+
case enums_1.GrammarMarkType.text:
|
|
144
|
+
mark = new text_1.Text(this, type, groupMark);
|
|
145
|
+
break;
|
|
146
|
+
|
|
147
|
+
default:
|
|
148
|
+
mark = new mark_1.Mark(this, type, groupMark);
|
|
149
|
+
}
|
|
150
|
+
return this.grammars.record(mark), this._dataflow.add(mark), mark;
|
|
151
|
+
}
|
|
152
|
+
group(group) {
|
|
153
|
+
return this.mark(enums_1.GrammarMarkType.group, group);
|
|
154
|
+
}
|
|
155
|
+
glyph(glyphType, group) {
|
|
156
|
+
return this.mark(enums_1.GrammarMarkType.glyph, group, {
|
|
157
|
+
glyphType: glyphType
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
component(componentType, group, mode = "2d") {
|
|
161
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
162
|
+
componentType: componentType,
|
|
163
|
+
mode: mode
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
axis(group, mode = "2d") {
|
|
167
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
168
|
+
componentType: enums_1.ComponentEnum.axis,
|
|
169
|
+
mode: mode
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
grid(group, mode = "2d") {
|
|
173
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
174
|
+
componentType: enums_1.ComponentEnum.grid,
|
|
175
|
+
mode: mode
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
legend(group) {
|
|
179
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
180
|
+
componentType: enums_1.ComponentEnum.legend
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
crosshair(group) {
|
|
184
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
185
|
+
componentType: enums_1.ComponentEnum.crosshair
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
slider(group) {
|
|
189
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
190
|
+
componentType: enums_1.ComponentEnum.slider
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
label(group) {
|
|
194
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
195
|
+
componentType: enums_1.ComponentEnum.label
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
datazoom(group) {
|
|
199
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
200
|
+
componentType: enums_1.ComponentEnum.datazoom
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
player(group) {
|
|
204
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
205
|
+
componentType: enums_1.ComponentEnum.player
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
tooltip(group) {
|
|
209
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
210
|
+
componentType: enums_1.ComponentEnum.tooltip
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
dimensionTooltip(group) {
|
|
214
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
215
|
+
componentType: enums_1.ComponentEnum.dimensionTooltip
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
title(group) {
|
|
219
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
220
|
+
componentType: enums_1.ComponentEnum.title
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
scrollbar(group) {
|
|
224
|
+
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
225
|
+
componentType: enums_1.ComponentEnum.scrollbar
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
customized(type, spec) {
|
|
229
|
+
const grammar = factory_1.Factory.createGrammar(type, this);
|
|
230
|
+
if (grammar) return grammar.parse(spec), this.grammars.record(grammar), this._dataflow.add(grammar),
|
|
231
|
+
grammar;
|
|
232
|
+
}
|
|
233
|
+
addGrammar(grammar) {
|
|
234
|
+
return this.grammars.find((storedGrammar => storedGrammar.uid === grammar.uid)) || (this.grammars.record(grammar),
|
|
235
|
+
this._dataflow.add(grammar), grammar.parse(grammar.getSpec()), this._needBuildLayoutTree = !0),
|
|
236
|
+
this;
|
|
237
|
+
}
|
|
238
|
+
removeGrammar(grammar) {
|
|
239
|
+
const recordedGrammar = (0, vutils_1.isString)(grammar) ? this.getGrammarById(grammar) : grammar;
|
|
240
|
+
return recordedGrammar && this.grammars.find((storedGrammar => storedGrammar.uid === recordedGrammar.uid)) ? ("mark" === recordedGrammar.grammarType && recordedGrammar.prepareRelease(),
|
|
241
|
+
this._cachedGrammars.record(recordedGrammar), this._dataflow.remove(recordedGrammar),
|
|
242
|
+
this.grammars.unrecord(recordedGrammar), this._needBuildLayoutTree = !0, this) : this;
|
|
243
|
+
}
|
|
244
|
+
removeAllGrammars() {
|
|
245
|
+
return this.grammars.traverse((grammar => {
|
|
246
|
+
"signal" === grammar.grammarType && view_1.BuiltInSignalID.includes(grammar.id()) || "mark" === grammar.grammarType && "root" === grammar.id() || this.removeGrammar(grammar);
|
|
247
|
+
})), this;
|
|
248
|
+
}
|
|
249
|
+
parseSpec(spec) {
|
|
250
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
251
|
+
if (this.emit(enums_1.HOOK_EVENT.BEFORE_PARSE_VIEW), this._spec = spec, (0, view_1.normalizeMarkTree)(spec),
|
|
252
|
+
spec.theme ? this.theme(spec.theme) : this.theme(theme_manager_1.ThemeManager.getDefaultTheme()),
|
|
253
|
+
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),
|
|
254
|
+
!this.width() || !this.height()) {
|
|
255
|
+
const size = this._getContainerSize();
|
|
256
|
+
size && (this.updateSignal(constants_2.SIGNAL_WIDTH, size.width), this.updateSignal(constants_2.SIGNAL_HEIGHT, size.height));
|
|
257
|
+
}
|
|
258
|
+
(null === (_c = spec.signals) || void 0 === _c ? void 0 : _c.length) && spec.signals.forEach((signal => {
|
|
259
|
+
this.signal().parse(signal);
|
|
260
|
+
})), (null === (_d = spec.data) || void 0 === _d ? void 0 : _d.length) && spec.data.forEach((data => {
|
|
261
|
+
this.data(null).parse(data);
|
|
262
|
+
})), (null === (_e = spec.coordinates) || void 0 === _e ? void 0 : _e.length) && spec.coordinates.forEach((coordinate => {
|
|
263
|
+
this.coordinate(coordinate.type).parse(coordinate);
|
|
264
|
+
})), (null === (_f = spec.scales) || void 0 === _f ? void 0 : _f.length) && spec.scales.forEach((scale => {
|
|
265
|
+
this.scale(scale.type).parse(scale);
|
|
266
|
+
}));
|
|
267
|
+
const customizedGrammars = factory_1.Factory.getGrammars();
|
|
268
|
+
return Object.keys(customizedGrammars).forEach((key => {
|
|
269
|
+
var _a;
|
|
270
|
+
const {specKey: specKey} = customizedGrammars[key];
|
|
271
|
+
(null === (_a = spec[specKey]) || void 0 === _a ? void 0 : _a.length) && spec[specKey].forEach((specValue => {
|
|
272
|
+
this.customized(key, specValue);
|
|
273
|
+
}));
|
|
274
|
+
})), (null === (_g = spec.marks) || void 0 === _g ? void 0 : _g.length) && spec.marks.forEach((mark => {
|
|
275
|
+
this.parseMarkSpec(mark);
|
|
276
|
+
})), (null === (_h = spec.events) || void 0 === _h ? void 0 : _h.length) && spec.events.forEach((eventConfig => {
|
|
277
|
+
this.event(eventConfig);
|
|
278
|
+
})), this.emit(enums_1.HOOK_EVENT.AFTER_PARSE_VIEW), this._needBuildLayoutTree = !0,
|
|
279
|
+
this._layoutState = enums_1.LayoutState.before, this;
|
|
280
|
+
}
|
|
281
|
+
updateSpec(spec) {
|
|
282
|
+
return this.removeAllGrammars(), this.parseSpec(spec);
|
|
283
|
+
}
|
|
284
|
+
parseBuiltIn() {
|
|
285
|
+
(0, view_1.builtInSignals)(this._options, this._config, this.getCurrentTheme()).map((signalSpec => {
|
|
286
|
+
const signal = this.signal().parse(signalSpec);
|
|
287
|
+
signalSpec.value && signal.set(signalSpec.value);
|
|
288
|
+
}));
|
|
289
|
+
this.parseMarkSpec({
|
|
290
|
+
id: "root",
|
|
291
|
+
type: "group",
|
|
292
|
+
encode: {
|
|
293
|
+
enter: {
|
|
294
|
+
x: 0,
|
|
295
|
+
y: 0
|
|
296
|
+
},
|
|
297
|
+
update: {
|
|
298
|
+
width: {
|
|
299
|
+
signal: "width"
|
|
300
|
+
},
|
|
301
|
+
height: {
|
|
302
|
+
signal: "height"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}), this.rootMark = this.getMarkById("root");
|
|
307
|
+
}
|
|
308
|
+
parseMarkSpec(spec) {
|
|
309
|
+
var _a;
|
|
310
|
+
const markOptions = spec.type === enums_1.GrammarMarkType.glyph ? {
|
|
311
|
+
glyphType: spec.glyphType
|
|
312
|
+
} : spec.type === enums_1.GrammarMarkType.component ? {
|
|
313
|
+
componentType: spec.componentType,
|
|
314
|
+
mode: spec.mode
|
|
315
|
+
} : null;
|
|
316
|
+
this.mark(spec.type, spec.group, markOptions).parse(spec), null === (_a = spec.marks) || void 0 === _a || _a.forEach((childSpec => {
|
|
317
|
+
this.parseMarkSpec(childSpec);
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
theme(theme) {
|
|
321
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
322
|
+
return (0, vutils_1.isString)(theme) ? this._theme = null !== (_a = theme_manager_1.ThemeManager.getTheme(theme)) && void 0 !== _a ? _a : theme_manager_1.ThemeManager.getDefaultTheme() : this._theme = theme,
|
|
323
|
+
this.background(null !== (_d = null !== (_c = null === (_b = this._spec) || void 0 === _b ? void 0 : _b.background) && void 0 !== _c ? _c : this._options.background) && void 0 !== _d ? _d : this._theme.background),
|
|
324
|
+
this.padding(null !== (_g = null !== (_f = null === (_e = this._spec) || void 0 === _e ? void 0 : _e.padding) && void 0 !== _f ? _f : this._options.padding) && void 0 !== _g ? _g : this._theme.padding),
|
|
325
|
+
null === (_j = null === (_h = this.renderer.stage()) || void 0 === _h ? void 0 : _h.setTheme) || void 0 === _j || _j.call(_h, Object.assign({}, this._theme.marks)),
|
|
326
|
+
this;
|
|
327
|
+
}
|
|
328
|
+
getCurrentTheme() {
|
|
329
|
+
return this._theme;
|
|
330
|
+
}
|
|
331
|
+
setCurrentTheme(theme, render = !0) {
|
|
332
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
333
|
+
return this.theme(theme), this.grammars.getAllMarks().forEach((mark => {
|
|
334
|
+
mark.commit();
|
|
335
|
+
})), render ? (yield this.evaluate(), this.renderer.render(!0)) : yield this._dataflow.evaluate(),
|
|
336
|
+
this;
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
background(value) {
|
|
340
|
+
return arguments.length ? (this._background = value, this.renderer.background(value),
|
|
341
|
+
value) : this._background;
|
|
342
|
+
}
|
|
343
|
+
width(value) {
|
|
344
|
+
const signal = this.getSignalById(constants_2.SIGNAL_WIDTH);
|
|
345
|
+
return arguments.length ? (this._options.width = value, this.updateSignal(signal, value),
|
|
346
|
+
value) : signal.output();
|
|
347
|
+
}
|
|
348
|
+
height(value) {
|
|
349
|
+
const signal = this.getSignalById(constants_2.SIGNAL_HEIGHT);
|
|
350
|
+
return arguments.length ? (this._options.height = value, this.updateSignal(signal, value),
|
|
351
|
+
value) : signal.output();
|
|
352
|
+
}
|
|
353
|
+
viewWidth(value) {
|
|
354
|
+
const signal = this.getSignalById(constants_2.SIGNAL_VIEW_WIDTH);
|
|
355
|
+
if (arguments.length) {
|
|
356
|
+
const padding = this.padding();
|
|
357
|
+
return this.width(value + padding.left + padding.right), value;
|
|
358
|
+
}
|
|
359
|
+
return signal.output();
|
|
360
|
+
}
|
|
361
|
+
viewHeight(value) {
|
|
362
|
+
const signal = this.getSignalById(constants_2.SIGNAL_VIEW_HEIGHT);
|
|
363
|
+
if (arguments.length) {
|
|
364
|
+
const padding = this.padding();
|
|
365
|
+
return this.height(value + padding.top + padding.bottom), value;
|
|
366
|
+
}
|
|
367
|
+
return signal.output();
|
|
368
|
+
}
|
|
369
|
+
padding(value) {
|
|
370
|
+
const signal = this.getSignalById(constants_2.SIGNAL_PADDING);
|
|
371
|
+
if (arguments.length) {
|
|
372
|
+
const padding = (0, view_1.normalizePadding)(value);
|
|
373
|
+
return this.updateSignal(signal, padding), padding;
|
|
374
|
+
}
|
|
375
|
+
return (0, view_1.normalizePadding)(signal.output());
|
|
376
|
+
}
|
|
377
|
+
autoFit(value) {
|
|
378
|
+
const signal = this.getSignalById(constants_2.SIGNAL_AUTOFIT);
|
|
379
|
+
return arguments.length ? (this.updateSignal(signal, value), value) : signal.output();
|
|
380
|
+
}
|
|
381
|
+
getViewBox() {
|
|
382
|
+
const signal = this.getSignalById(constants_2.SIGNAL_VIEW_BOX);
|
|
383
|
+
return null == signal ? void 0 : signal.output();
|
|
384
|
+
}
|
|
385
|
+
updateLayoutTag() {
|
|
386
|
+
return this._layoutState = enums_1.LayoutState.before, this;
|
|
387
|
+
}
|
|
388
|
+
getLayoutState() {
|
|
389
|
+
return this._layoutState;
|
|
390
|
+
}
|
|
391
|
+
buildLayoutTree() {
|
|
392
|
+
const markMap = {}, rootMarks = [];
|
|
393
|
+
this.traverseMarkTree((mark => {
|
|
394
|
+
markMap[mark.id()] = !0, mark.group && markMap[mark.group.id()] || rootMarks.push(mark),
|
|
395
|
+
mark.markType === enums_1.GrammarMarkType.group && mark.updateLayoutChildren();
|
|
396
|
+
}), (mark => mark.needLayout())), this._layoutMarks = rootMarks;
|
|
397
|
+
}
|
|
398
|
+
doLayout() {
|
|
399
|
+
var _a;
|
|
400
|
+
const doLayout = this._options.doLayout || layout_1.defaultDoLayout;
|
|
401
|
+
doLayout && (null === (_a = this._layoutMarks) || void 0 === _a ? void 0 : _a.length) && (this.emit(enums_1.HOOK_EVENT.BEFORE_DO_LAYOUT),
|
|
402
|
+
doLayout(this._layoutMarks, this._options, this), this.emit(enums_1.HOOK_EVENT.AFTER_DO_LAYOUT));
|
|
403
|
+
}
|
|
404
|
+
handleLayoutEnd() {
|
|
405
|
+
this.emit(enums_1.HOOK_EVENT.BEFORE_MARK_LAYOUT_END), this._layoutMarks.forEach((layoutMark => {
|
|
406
|
+
(0, mark_tree_1.traverseMarkTree)(layoutMark, "layoutChildren", (mark => {
|
|
407
|
+
mark.handleLayoutEnd();
|
|
408
|
+
}), (mark => mark !== layoutMark));
|
|
409
|
+
})), this.emit(enums_1.HOOK_EVENT.AFTER_MARK_LAYOUT_END);
|
|
410
|
+
}
|
|
411
|
+
handleRenderEnd() {
|
|
412
|
+
this.emit(enums_1.HOOK_EVENT.BEFORE_MARK_RENDER_END), (0, mark_tree_1.traverseMarkTree)(this.rootMark, "children", (mark => {
|
|
413
|
+
mark.handleRenderEnd();
|
|
414
|
+
})), this.emit(enums_1.HOOK_EVENT.AFTER_MARK_RENDER_END);
|
|
415
|
+
}
|
|
416
|
+
commit(grammar) {
|
|
417
|
+
return this._dataflow.commit(grammar), this;
|
|
418
|
+
}
|
|
419
|
+
run(runningConfig) {
|
|
420
|
+
return this.evaluate(runningConfig), this;
|
|
421
|
+
}
|
|
422
|
+
runSync(runningConfig) {
|
|
423
|
+
return this.evaluateSync(runningConfig), this;
|
|
424
|
+
}
|
|
425
|
+
isRunning() {
|
|
426
|
+
return this._running;
|
|
427
|
+
}
|
|
428
|
+
runAsync(runningConfig) {
|
|
429
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
430
|
+
for (;this._running; ) yield this._running;
|
|
431
|
+
const clear = () => {
|
|
432
|
+
this._running = null;
|
|
433
|
+
};
|
|
434
|
+
return (this._running = this.evaluate(runningConfig)).then(clear, clear), this._running;
|
|
435
|
+
}));
|
|
436
|
+
}
|
|
437
|
+
runNextTick(runningConfig) {
|
|
438
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
439
|
+
return this._currentDataflow || (this._currentDataflow = Promise.resolve().then((() => this.runAsync(runningConfig).then((() => {
|
|
440
|
+
this._currentDataflow = null;
|
|
441
|
+
})).catch((e => {
|
|
442
|
+
this._currentDataflow = null, this.logger.error(e);
|
|
443
|
+
}))))), yield this._currentDataflow, this;
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
doRender(immediately) {
|
|
447
|
+
this.emit(enums_1.HOOK_EVENT.BEFORE_DO_RENDER), this.renderer && (this._progressiveMarks || this.animate.animate(),
|
|
448
|
+
this.renderer.render(immediately), this.handleRenderEnd()), this.emit(enums_1.HOOK_EVENT.AFTER_DO_RENDER);
|
|
449
|
+
}
|
|
450
|
+
evaluate(runningConfig) {
|
|
451
|
+
var _a, _b;
|
|
452
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
453
|
+
const normalizedRunningConfig = (0, view_1.normalizeRunningConfig)(runningConfig);
|
|
454
|
+
this.reuseCachedGrammars(normalizedRunningConfig);
|
|
455
|
+
const grammarWillDetach = this._cachedGrammars.size() > 0;
|
|
456
|
+
this.detachCachedGrammar();
|
|
457
|
+
const hasResize = this._resizeRenderer(), hasUpdate = this._dataflow.hasCommitted();
|
|
458
|
+
return grammarWillDetach || hasUpdate || this._layoutState || hasResize ? (this.clearProgressive(),
|
|
459
|
+
yield this._dataflow.evaluate(), this._needBuildLayoutTree && (this.buildLayoutTree(),
|
|
460
|
+
this._needBuildLayoutTree = !1), this._layoutState && (this._layoutState = enums_1.LayoutState.layouting,
|
|
461
|
+
this.doLayout(), this._dataflow.hasCommitted() && (this._layoutState = enums_1.LayoutState.reevaluate,
|
|
462
|
+
yield this._dataflow.evaluate()), this._layoutState = enums_1.LayoutState.after,
|
|
463
|
+
(null === (_a = this._layoutMarks) || void 0 === _a ? void 0 : _a.length) && this.handleLayoutEnd()),
|
|
464
|
+
this._layoutState = null, this.findProgressiveMarks(), this._resizeRenderer(), this.doRender(!1),
|
|
465
|
+
null === (_b = this._willMorphMarks) || void 0 === _b || _b.forEach((morphMarks => {
|
|
466
|
+
this._morph.morph(morphMarks.prev, morphMarks.next, normalizedRunningConfig);
|
|
467
|
+
})), this._willMorphMarks = null, this.releaseCachedGrammars(normalizedRunningConfig),
|
|
468
|
+
this.doPreProgressive(), this) : this;
|
|
469
|
+
}));
|
|
470
|
+
}
|
|
471
|
+
evaluateSync(runningConfig) {
|
|
472
|
+
var _a, _b;
|
|
473
|
+
const normalizedRunningConfig = (0, view_1.normalizeRunningConfig)(runningConfig);
|
|
474
|
+
this.reuseCachedGrammars(normalizedRunningConfig);
|
|
475
|
+
const grammarWillDetach = this._cachedGrammars.size() > 0;
|
|
476
|
+
this.detachCachedGrammar();
|
|
477
|
+
const hasResize = this._resizeRenderer(), hasUpdate = this._dataflow.hasCommitted();
|
|
478
|
+
return grammarWillDetach || hasUpdate || this._layoutState || hasResize ? (this.clearProgressive(),
|
|
479
|
+
this._dataflow.evaluateSync(), this._needBuildLayoutTree && (this.buildLayoutTree(),
|
|
480
|
+
this._needBuildLayoutTree = !1), this._layoutState && (this._layoutState = enums_1.LayoutState.layouting,
|
|
481
|
+
this.doLayout(), this._dataflow.hasCommitted() && (this._layoutState = enums_1.LayoutState.reevaluate,
|
|
482
|
+
this._dataflow.evaluateSync()), this._layoutState = enums_1.LayoutState.after, (null === (_a = this._layoutMarks) || void 0 === _a ? void 0 : _a.length) && this.handleLayoutEnd()),
|
|
483
|
+
this._layoutState = null, this.findProgressiveMarks(), this._resizeRenderer(), this.doRender(!0),
|
|
484
|
+
null === (_b = this._willMorphMarks) || void 0 === _b || _b.forEach((morphMarks => {
|
|
485
|
+
this._morph.morph(morphMarks.prev, morphMarks.next, normalizedRunningConfig);
|
|
486
|
+
})), this._willMorphMarks = null, this.releaseCachedGrammars(normalizedRunningConfig),
|
|
487
|
+
this.doPreProgressive(), this) : this;
|
|
488
|
+
}
|
|
489
|
+
reuseCachedGrammars(runningConfig) {
|
|
490
|
+
if (this._willMorphMarks || (this._willMorphMarks = []), runningConfig.reuse) {
|
|
491
|
+
const reuseDiffUpdate = diff => {
|
|
492
|
+
diff.next.reuse(diff.prev), diff.prev.detachAll(), diff.prev.clear(), this._cachedGrammars.unrecord(diff.prev);
|
|
493
|
+
};
|
|
494
|
+
this._morph.diffGrammar(this._cachedGrammars.getAllSignals(), this.grammars.getAllSignals().filter((signal => !view_1.BuiltInSignalID.includes(signal.id())))).update.forEach(reuseDiffUpdate);
|
|
495
|
+
this._morph.diffGrammar(this._cachedGrammars.getAllData(), this.grammars.getAllData()).update.forEach(reuseDiffUpdate);
|
|
496
|
+
this._morph.diffGrammar(this._cachedGrammars.getAllScales(), this.grammars.getAllScales()).update.forEach(reuseDiffUpdate);
|
|
497
|
+
this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(), this.grammars.getAllCoordinates()).update.forEach(reuseDiffUpdate);
|
|
498
|
+
}
|
|
499
|
+
this._morph.diffMark(this._cachedGrammars.getAllMarks(), this.grammars.getAllMarks().filter((mark => "root" !== mark.id())), runningConfig).update.forEach((diff => {
|
|
500
|
+
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));
|
|
501
|
+
matched && runningConfig.reuse ? (diff.next[0].reuse(diff.prev[0]), diff.prev[0].detachAll(),
|
|
502
|
+
diff.prev[0].clear(), this._cachedGrammars.unrecord(diff.prev[0])) : (runningConfig.morph && enableMarkMorphConfig || runningConfig.morphAll) && this._willMorphMarks.push({
|
|
503
|
+
prev: diff.prev,
|
|
504
|
+
next: diff.next
|
|
505
|
+
});
|
|
506
|
+
}));
|
|
507
|
+
}
|
|
508
|
+
detachCachedGrammar() {
|
|
509
|
+
this._cachedGrammars.traverse((grammar => {
|
|
510
|
+
var _a, _b;
|
|
511
|
+
if (grammar.detachAll(), "mark" === grammar.grammarType) {
|
|
512
|
+
const mark = grammar;
|
|
513
|
+
null === (_b = null === (_a = mark.group) || void 0 === _a ? void 0 : _a.removeChild) || void 0 === _b || _b.call(_a, mark);
|
|
514
|
+
}
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
releaseCachedGrammars(runningConfig) {
|
|
518
|
+
this._cachedGrammars.traverse((grammar => {
|
|
519
|
+
"mark" !== grammar.grammarType && grammar.release();
|
|
520
|
+
}));
|
|
521
|
+
const markNodes = this._cachedGrammars.getAllMarkNodes();
|
|
522
|
+
markNodes.forEach((node => {
|
|
523
|
+
node.mark.animate.stop(), runningConfig.enableExitAnimation && this.animate.animateAddition(node.mark);
|
|
524
|
+
}));
|
|
525
|
+
const releaseUp = node => {
|
|
526
|
+
if (node.mark.view && 0 === node.mark.animate.getAnimatorCount() && (!node.children || 0 === node.children.length)) {
|
|
527
|
+
node.mark.release();
|
|
528
|
+
const parent = node.parent;
|
|
529
|
+
parent && (node.parent.children = node.parent.children.filter((n => n !== node)),
|
|
530
|
+
node.parent = null, releaseUp(parent));
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
markNodes.forEach((node => {
|
|
534
|
+
const mark = node.mark;
|
|
535
|
+
0 === mark.animate.getAnimatorCount() ? releaseUp(node) : mark.addEventListener("animationEnd", (() => {
|
|
536
|
+
0 === mark.animate.getAnimatorCount() && releaseUp(node);
|
|
537
|
+
}));
|
|
538
|
+
})), this._cachedGrammars.clear();
|
|
539
|
+
}
|
|
540
|
+
runAfter(callback) {
|
|
541
|
+
return this._dataflow.runAfter((() => {
|
|
542
|
+
callback.call(null, this);
|
|
543
|
+
})), this;
|
|
544
|
+
}
|
|
545
|
+
runBefore(callback) {
|
|
546
|
+
return this._dataflow.runBefore((() => {
|
|
547
|
+
callback.call(null, this);
|
|
548
|
+
})), this;
|
|
549
|
+
}
|
|
550
|
+
getImageBuffer() {
|
|
551
|
+
var _a, _b;
|
|
552
|
+
if ("node" !== this._options.mode) return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));
|
|
553
|
+
const stage = null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.stage) || void 0 === _b ? void 0 : _b.call(_a);
|
|
554
|
+
if (stage) {
|
|
555
|
+
stage.render();
|
|
556
|
+
return stage.window.getImageBuffer();
|
|
557
|
+
}
|
|
558
|
+
return this.logger.error(new ReferenceError("render is not defined")), null;
|
|
559
|
+
}
|
|
560
|
+
traverseMarkTree(apply, filter, leafFirst) {
|
|
561
|
+
return (0, mark_tree_1.traverseMarkTree)(this.rootMark, "children", apply, filter, leafFirst),
|
|
562
|
+
this;
|
|
563
|
+
}
|
|
564
|
+
_bindResizeEvent() {
|
|
565
|
+
var _a, _b, _c, _d, _e, _f;
|
|
566
|
+
if (this.autoFit()) {
|
|
567
|
+
const container = null === (_e = null === (_d = null === (_c = null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.stage) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c.window) || void 0 === _d ? void 0 : _d.getContainer) || void 0 === _e ? void 0 : _e.call(_d);
|
|
568
|
+
if (container) {
|
|
569
|
+
const ResizeObserverWindow = window.ResizeObserver;
|
|
570
|
+
this._observer = new ResizeObserverWindow(this._onResize), null === (_f = this._observer) || void 0 === _f || _f.observe(container);
|
|
571
|
+
}
|
|
572
|
+
window.addEventListener("resize", this._onResize);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
_unBindResizeEvent() {
|
|
576
|
+
this.autoFit() && (window.removeEventListener("resize", this._onResize), this._observer && (this._observer.disconnect(),
|
|
577
|
+
this._observer = null));
|
|
578
|
+
}
|
|
579
|
+
_getContainerSize() {
|
|
580
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
581
|
+
const container = null === (_e = null === (_d = null === (_c = null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.stage) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c.window) || void 0 === _d ? void 0 : _d.getContainer) || void 0 === _e ? void 0 : _e.call(_d);
|
|
582
|
+
if (container) {
|
|
583
|
+
const {width: containerWidth, height: containerHeight} = (0, vutils_1.getContainerSize)(container);
|
|
584
|
+
return {
|
|
585
|
+
width: null !== (_h = null !== (_g = null === (_f = this._spec) || void 0 === _f ? void 0 : _f.width) && void 0 !== _g ? _g : this._options.width) && void 0 !== _h ? _h : containerWidth,
|
|
586
|
+
height: null !== (_l = null !== (_k = null === (_j = this._spec) || void 0 === _j ? void 0 : _j.height) && void 0 !== _k ? _k : this._options.height) && void 0 !== _l ? _l : containerHeight
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
resize(width, height, render = !0) {
|
|
592
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
593
|
+
let needDataflow = !1;
|
|
594
|
+
return width !== this.width() && (needDataflow = !0, this.updateSignal(constants_2.SIGNAL_WIDTH, width)),
|
|
595
|
+
height !== this.height() && (needDataflow = !0, this.updateSignal(constants_2.SIGNAL_HEIGHT, height)),
|
|
596
|
+
needDataflow && (render ? yield this.evaluate() : yield this._dataflow.evaluate()),
|
|
597
|
+
this;
|
|
598
|
+
}));
|
|
599
|
+
}
|
|
600
|
+
_resizeRenderer() {
|
|
601
|
+
const width = this.width(), height = this.height();
|
|
602
|
+
return !!this.renderer.shouldResize(width, height) && (this.renderer.resize(width, height),
|
|
603
|
+
this.emit("resize", {}, {
|
|
604
|
+
width: width,
|
|
605
|
+
height: height
|
|
606
|
+
}), !0);
|
|
607
|
+
}
|
|
608
|
+
bindEvents(eventSpec) {
|
|
609
|
+
if (this._eventConfig.disable) return;
|
|
610
|
+
const {type: evtType, filter: filter, callback: callback, throttle: throttle, debounce: debounce, consume: consume, target: target, dependency: dependency} = eventSpec, eventSelector = (0,
|
|
611
|
+
event_1.parseEventSelector)(evtType);
|
|
612
|
+
if (!eventSelector) return;
|
|
613
|
+
const {source: source, type: type} = eventSelector, markFilter = (0, event_1.generateFilterByMark)(eventSelector), validateSignals = (Array.isArray(target) && target.length ? target.map((entry => ({
|
|
614
|
+
signal: this.getSignalById(entry.target),
|
|
615
|
+
callback: entry.callback
|
|
616
|
+
}))) : [ {
|
|
617
|
+
signal: (0, vutils_1.isString)(target) ? this.getSignalById(target) : null,
|
|
618
|
+
callback: callback
|
|
619
|
+
} ]).filter((entry => entry.signal || entry.callback)), refs = (0, util_1.parseReference)(dependency, this), send = (0,
|
|
620
|
+
event_1.parseHandler)(((evt, element) => {
|
|
621
|
+
const needPreventDefault = source === constants_2.EVENT_SOURCE_VIEW && (0, events_1.prevent)(this._eventConfig, type) || consume && (void 0 === evt.cancelable || evt.cancelable);
|
|
622
|
+
source === constants_2.EVENT_SOURCE_WINDOW && (evt = (0, events_extend_1.default)(this, evt, element, type, constants_2.EVENT_SOURCE_WINDOW));
|
|
623
|
+
let hasCommitted = !1;
|
|
624
|
+
if ((!filter || filter(evt)) && (!markFilter || markFilter(element)) && validateSignals.length) {
|
|
625
|
+
const params = refs.reduce(((params, ref) => (params[ref.id()] = ref.output(), params)), {});
|
|
626
|
+
validateSignals.forEach((entry => {
|
|
627
|
+
if (entry.callback && entry.signal) {
|
|
628
|
+
entry.signal.set(entry.callback(evt, params)) && (this.commit(entry.signal), hasCommitted = !0);
|
|
629
|
+
} else entry.callback ? entry.callback(evt, params) : (this.commit(entry.signal),
|
|
630
|
+
hasCommitted = !0);
|
|
631
|
+
}));
|
|
632
|
+
}
|
|
633
|
+
needPreventDefault && evt.preventDefault(), consume && evt.stopPropagation(), hasCommitted && this.runAsync();
|
|
634
|
+
}), {
|
|
635
|
+
throttle: throttle,
|
|
636
|
+
debounce: debounce
|
|
637
|
+
});
|
|
638
|
+
if (source === constants_2.EVENT_SOURCE_VIEW) {
|
|
639
|
+
if ((0, events_1.permit)(this._eventConfig, constants_2.EVENT_SOURCE_VIEW, type)) return this.addEventListener(type, send, constants_2.NO_TRAP),
|
|
640
|
+
() => {
|
|
641
|
+
this.removeEventListener(type, send);
|
|
642
|
+
};
|
|
643
|
+
} else if (source === constants_2.EVENT_SOURCE_WINDOW) return vrender_1.vglobal.addEventListener(type, send),
|
|
644
|
+
this._eventListeners.push({
|
|
645
|
+
type: type,
|
|
646
|
+
source: vrender_1.vglobal,
|
|
647
|
+
handler: send
|
|
648
|
+
}), () => {
|
|
649
|
+
vrender_1.vglobal.removeEventListener(type, send);
|
|
650
|
+
const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source === vrender_1.vglobal && entry.handler === send));
|
|
651
|
+
index >= 0 && this._eventListeners.splice(index, 1);
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
event(eventSpec) {
|
|
655
|
+
if ("between" in eventSpec) {
|
|
656
|
+
const [starEvent, endEvent] = eventSpec.between, id = `${starEvent.type}-${eventSpec.type}-${endEvent.type}`;
|
|
657
|
+
let unbindEndEvent;
|
|
658
|
+
this.bindEvents(Object.assign({}, starEvent, {
|
|
659
|
+
callback: () => {
|
|
660
|
+
if (this._eventCache || (this._eventCache = {}), !this._eventCache[id]) {
|
|
661
|
+
const unbindEvent = this.bindEvents(eventSpec);
|
|
662
|
+
this._eventCache[id] = unbindEvent;
|
|
663
|
+
}
|
|
664
|
+
unbindEndEvent || (unbindEndEvent = this.bindEvents(Object.assign({}, endEvent, {
|
|
665
|
+
callback: () => {
|
|
666
|
+
this._eventCache[id] && (this._eventCache[id](), this._eventCache[id] = null);
|
|
667
|
+
}
|
|
668
|
+
})));
|
|
669
|
+
}
|
|
670
|
+
}));
|
|
671
|
+
} else "merge" in eventSpec ? eventSpec.merge.forEach((entry => {
|
|
672
|
+
const singleEvent = Object.assign({}, eventSpec);
|
|
673
|
+
(0, vutils_1.isString)(entry) ? singleEvent.type = entry : (0, vutils_1.isObject)(entry) && Object.assign(singleEvent, entry),
|
|
674
|
+
singleEvent.debounce = 50, this.bindEvents(singleEvent);
|
|
675
|
+
})) : this.bindEvents(eventSpec);
|
|
676
|
+
}
|
|
677
|
+
hover(hoverState) {
|
|
678
|
+
const state = hoverState || constants_2.DEFAULT_HOVER_STATE;
|
|
679
|
+
return this.addEventListener("pointerover", (evt => {
|
|
680
|
+
if (!evt.element) return;
|
|
681
|
+
evt.element.addState(state);
|
|
682
|
+
})), this.addEventListener("pointerout", (evt => {
|
|
683
|
+
if (!evt.element) return;
|
|
684
|
+
evt.element.removeState(state);
|
|
685
|
+
})), this;
|
|
686
|
+
}
|
|
687
|
+
cursor() {
|
|
688
|
+
this._cursorValue = {
|
|
689
|
+
user: constants_2.CURSOR_DEFAULT,
|
|
690
|
+
element: null
|
|
691
|
+
}, this.addEventListener("mousemove", (evt => {
|
|
692
|
+
var _a, _b, _c;
|
|
693
|
+
const elementCursor = null === (_b = null === (_a = null == evt ? void 0 : evt.element) || void 0 === _a ? void 0 : _a.graphicItem) || void 0 === _b ? void 0 : _b.cursor, value = this._cursorValue, user = value ? (0,
|
|
694
|
+
vutils_1.isString)(value) ? value : value.user : constants_2.CURSOR_DEFAULT, nextValue = value && user === value.user && (elementCursor === value.element || (0,
|
|
695
|
+
vutils_1.isNil)(elementCursor) && (0, vutils_1.isNil)(value.element)) ? value : {
|
|
696
|
+
user: user,
|
|
697
|
+
element: elementCursor
|
|
698
|
+
};
|
|
699
|
+
nextValue !== value && (this._cursorValue = nextValue, this.setCursor(nextValue.user && nextValue.user !== constants_2.CURSOR_DEFAULT ? nextValue.user : null !== (_c = nextValue.element) && void 0 !== _c ? _c : nextValue.user));
|
|
700
|
+
}));
|
|
701
|
+
}
|
|
702
|
+
initEvent() {
|
|
703
|
+
const stage = this.renderer.stage();
|
|
704
|
+
stage && stage.on("*", this.delegateEvent);
|
|
705
|
+
}
|
|
706
|
+
addEventListener(type, handler, options) {
|
|
707
|
+
let callback = handler;
|
|
708
|
+
return options && !1 === options.trap || (callback = handler, callback.raw = handler),
|
|
709
|
+
options && options.target && (callback.target = options.target), this.on(type, callback),
|
|
710
|
+
this;
|
|
711
|
+
}
|
|
712
|
+
removeEventListener(type, handler) {
|
|
713
|
+
return handler ? this.off(type, handler) : this.off(type), this;
|
|
714
|
+
}
|
|
715
|
+
setCursor(cursor) {
|
|
716
|
+
if (this._options.domBridge && this._options.domBridge.setCursor) return void this._options.domBridge.setCursor(cursor);
|
|
717
|
+
const el = this.globalCursor() ? !(0, vutils_1.isNil)(document) && document.body : this.container;
|
|
718
|
+
return el ? (0, vutils_1.isNil)(cursor) ? el.style.removeProperty("cursor") : el.style.cursor = cursor : void 0;
|
|
719
|
+
}
|
|
720
|
+
globalCursor(_) {
|
|
721
|
+
if (arguments.length) {
|
|
722
|
+
if (this._globalCursor !== !!_) {
|
|
723
|
+
const prev = this.setCursor(null);
|
|
724
|
+
this._globalCursor = !!_, prev && this.setCursor(prev);
|
|
725
|
+
}
|
|
726
|
+
return this;
|
|
727
|
+
}
|
|
728
|
+
return this._globalCursor;
|
|
729
|
+
}
|
|
730
|
+
initializeRenderer() {
|
|
731
|
+
const width = this._options.width, height = this._options.height;
|
|
732
|
+
this.renderer = new canvas_renderer_1.default(this), this.renderer.initialize(width, height, this._options, this._eventConfig).background(this._background);
|
|
733
|
+
}
|
|
734
|
+
initializeBuiltEvents() {
|
|
735
|
+
this._options.cursor && this.cursor(), this._options.hover && this.hover(), this._bindResizeEvent();
|
|
736
|
+
}
|
|
737
|
+
initialize() {
|
|
738
|
+
var _a;
|
|
739
|
+
this.grammars = new grammar_record_1.RecordedGrammars((grammar => grammar.id()), ((key, grammar) => this.logger.warn(`Grammar id '${key}' has been occupied`, grammar))),
|
|
740
|
+
this._cachedGrammars = new grammar_record_1.RecordedTreeGrammars((grammar => grammar.id())),
|
|
741
|
+
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),
|
|
742
|
+
this._dataflow = new dataflow_1.default, this.animate = new animate_1.ViewAnimate(this),
|
|
743
|
+
this._morph = new morph_1.Morph, this._theme = theme_manager_1.ThemeManager.getDefaultTheme(),
|
|
744
|
+
this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
|
|
745
|
+
this.on(key, this._options.hooks[key]);
|
|
746
|
+
})), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
|
|
747
|
+
this._globalCursor = !1, this._eventListeners = [], this._eventConfig = (0, events_1.initializeEventConfig)(this._options.eventConfig),
|
|
748
|
+
this.globalCursor(this._eventConfig.globalCursor), this._theme = theme_manager_1.ThemeManager.getDefaultTheme(),
|
|
749
|
+
this.parseBuiltIn(), (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(),
|
|
750
|
+
this._eventConfig.disable || this.initEvent(), this.initializeBuiltEvents(), this._currentDataflow = null,
|
|
751
|
+
this._needBuildLayoutTree = !0, this._layoutState = enums_1.LayoutState.before,
|
|
752
|
+
this.theme(this._theme);
|
|
753
|
+
}
|
|
754
|
+
normalBrowserEnv() {
|
|
755
|
+
return "browser" === this._options.mode;
|
|
756
|
+
}
|
|
757
|
+
pauseProgressive() {
|
|
758
|
+
return !1;
|
|
759
|
+
}
|
|
760
|
+
resumeProgressive() {
|
|
761
|
+
return !1;
|
|
762
|
+
}
|
|
763
|
+
restartProgressive() {
|
|
764
|
+
return !1;
|
|
765
|
+
}
|
|
766
|
+
findProgressiveMarks() {
|
|
767
|
+
const marks = [];
|
|
768
|
+
return this.traverseMarkTree((mark => {
|
|
769
|
+
marks.push(mark);
|
|
770
|
+
}), (mark => mark.markType !== enums_1.GrammarMarkType.group && mark.isProgressive())),
|
|
771
|
+
marks.length ? (this._progressiveMarks = marks, this.renderer && this.renderer.combineIncrementalLayers(),
|
|
772
|
+
marks) : (this._progressiveMarks = null, null);
|
|
773
|
+
}
|
|
774
|
+
doPreProgressive() {
|
|
775
|
+
if (this._progressiveMarks && this._progressiveMarks.some((mark => mark.isDoingProgressive()))) {
|
|
776
|
+
const raf = vrender_1.vglobal.getRequestAnimationFrame();
|
|
777
|
+
this._progressiveRafId = raf(this.handleProgressiveFrame);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
clearProgressive() {
|
|
781
|
+
if (this._progressiveRafId) {
|
|
782
|
+
vrender_1.vglobal.getCancelAnimationFrame()(this._progressiveRafId);
|
|
783
|
+
}
|
|
784
|
+
this._progressiveMarks && this._progressiveMarks.length && (this._progressiveMarks.forEach((entry => {
|
|
785
|
+
entry.clearProgressive();
|
|
786
|
+
})), this._progressiveMarks = null);
|
|
787
|
+
}
|
|
788
|
+
release() {
|
|
789
|
+
var _a, _b, _c;
|
|
790
|
+
this._unBindResizeEvent(), this.clearProgressive(), factory_1.Factory.unregisterRuntimeTransforms(),
|
|
791
|
+
this.animate.stop(), this.grammars.release(), this._cachedGrammars.release(), this._dataflow = null,
|
|
792
|
+
null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
793
|
+
this.renderer = null, this.removeAllListeners(), null === (_c = this._eventListeners) || void 0 === _c || _c.forEach((listener => {
|
|
794
|
+
listener.source.removeEventListener(listener.type, listener.handler);
|
|
795
|
+
})), this._eventListeners = null;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
exports.default = View;
|
|
800
|
+
//# sourceMappingURL=View.js.map
|