@visactor/vgrammar-core 0.7.7 → 0.8.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.js.map +1 -1
- package/cjs/component/datazoom.d.ts +7 -4
- package/cjs/component/datazoom.js +21 -43
- package/cjs/component/datazoom.js.map +1 -1
- package/cjs/component/grid.js.map +1 -1
- package/cjs/component/index.d.ts +0 -2
- package/cjs/component/index.js +1 -19
- package/cjs/component/index.js.map +1 -1
- package/cjs/component/label.js.map +1 -1
- package/cjs/component/legend.d.ts +1 -3
- package/cjs/component/legend.js +5 -26
- package/cjs/component/legend.js.map +1 -1
- package/cjs/component/player.d.ts +1 -2
- package/cjs/component/player.js +15 -31
- package/cjs/component/player.js.map +1 -1
- package/cjs/component/scale.d.ts +1 -0
- package/cjs/component/scale.js +3 -0
- package/cjs/component/scale.js.map +1 -1
- package/cjs/component/scrollbar.d.ts +3 -4
- package/cjs/component/scrollbar.js +12 -54
- package/cjs/component/scrollbar.js.map +1 -1
- package/cjs/component/slider.d.ts +2 -5
- package/cjs/component/slider.js +4 -26
- package/cjs/component/slider.js.map +1 -1
- package/cjs/component/title.js.map +1 -1
- package/cjs/core/factory.d.ts +6 -3
- package/cjs/core/factory.js +9 -2
- package/cjs/core/factory.js.map +1 -1
- package/cjs/env.d.ts +1 -0
- package/cjs/env.js +20 -0
- package/cjs/env.js.map +1 -0
- package/cjs/glyph/index.js +2 -1
- package/cjs/glyph/link-path.js +1 -2
- package/cjs/graph/animation/animate.js +25 -19
- package/cjs/graph/animation/animate.js.map +1 -1
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/cjs/graph/animation/animator.js +4 -4
- package/cjs/graph/animation/animator.js.map +1 -1
- package/cjs/graph/animation/attribute.d.ts +2 -2
- package/cjs/graph/animation/attribute.js +12 -12
- package/cjs/graph/animation/attribute.js.map +1 -1
- package/cjs/graph/animation/morph.js +4 -4
- package/cjs/graph/animation/morph.js.map +1 -1
- package/cjs/graph/attributes/index.js +1 -1
- package/cjs/graph/attributes/index.js.map +1 -1
- package/cjs/graph/canvas-renderer.d.ts +1 -1
- package/cjs/graph/canvas-renderer.js +5 -5
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/element.d.ts +1 -1
- package/cjs/graph/element.js +4 -4
- package/cjs/graph/element.js.map +1 -1
- package/cjs/graph/enums.d.ts +25 -8
- package/cjs/graph/enums.js +23 -14
- package/cjs/graph/enums.js.map +1 -1
- package/cjs/graph/glyph-element.d.ts +1 -1
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/graph/mark/encode.d.ts +0 -3
- package/cjs/graph/mark/encode.js +3 -12
- package/cjs/graph/mark/encode.js.map +1 -1
- package/cjs/graph/mark/large-rects.d.ts +2 -2
- package/cjs/graph/mark/large-rects.js +3 -3
- package/cjs/graph/mark/large-rects.js.map +1 -1
- package/cjs/graph/mark/large-symbols.d.ts +2 -2
- package/cjs/graph/mark/large-symbols.js +3 -3
- package/cjs/graph/mark/large-symbols.js.map +1 -1
- package/cjs/graph/util/env.js +2 -2
- package/cjs/graph/util/env.js.map +1 -1
- package/cjs/graph/util/events-extend.d.ts +1 -1
- package/cjs/graph/util/events-extend.js +1 -1
- package/cjs/graph/util/events-extend.js.map +1 -1
- package/cjs/graph/util/graphic.d.ts +3 -3
- package/cjs/graph/util/graphic.js +21 -21
- package/cjs/graph/util/graphic.js.map +1 -1
- package/cjs/index.d.ts +5 -1
- package/cjs/index.js +13 -3
- package/cjs/index.js.map +1 -1
- package/cjs/interactions/base-tooltip.d.ts +29 -0
- package/cjs/interactions/base-tooltip.js +74 -0
- package/cjs/interactions/base-tooltip.js.map +1 -0
- package/cjs/interactions/base.d.ts +14 -0
- package/cjs/interactions/base.js +41 -0
- package/cjs/interactions/base.js.map +1 -0
- package/cjs/interactions/brush-active.d.ts +17 -0
- package/cjs/interactions/brush-active.js +27 -0
- package/cjs/interactions/brush-active.js.map +1 -0
- package/cjs/interactions/brush-base.d.ts +43 -0
- package/cjs/interactions/brush-base.js +106 -0
- package/cjs/interactions/brush-base.js.map +1 -0
- package/cjs/interactions/brush-filter.d.ts +24 -0
- package/cjs/interactions/brush-filter.js +34 -0
- package/cjs/interactions/brush-filter.js.map +1 -0
- package/cjs/interactions/brush-highlight.d.ts +17 -0
- package/cjs/interactions/brush-highlight.js +34 -0
- package/cjs/interactions/brush-highlight.js.map +1 -0
- package/cjs/interactions/crosshair.d.ts +53 -0
- package/cjs/{component → interactions}/crosshair.js +80 -79
- package/cjs/interactions/crosshair.js.map +1 -0
- package/cjs/interactions/datazoom-filter.d.ts +13 -0
- package/cjs/interactions/datazoom-filter.js +42 -0
- package/cjs/interactions/datazoom-filter.js.map +1 -0
- package/cjs/interactions/dimension-tooltip.d.ts +18 -0
- package/cjs/interactions/dimension-tooltip.js +99 -0
- package/cjs/interactions/dimension-tooltip.js.map +1 -0
- package/cjs/interactions/drill-down.d.ts +25 -0
- package/cjs/interactions/drill-down.js +48 -0
- package/cjs/interactions/drill-down.js.map +1 -0
- package/cjs/interactions/element-active-by-legend.d.ts +17 -0
- package/cjs/interactions/element-active-by-legend.js +44 -0
- package/cjs/interactions/element-active-by-legend.js.map +1 -0
- package/cjs/interactions/element-active.d.ts +16 -0
- package/cjs/interactions/element-active.js +33 -0
- package/cjs/interactions/element-active.js.map +1 -0
- package/cjs/interactions/element-highlight-by-group.d.ts +17 -0
- package/cjs/interactions/element-highlight-by-group.js +53 -0
- package/cjs/interactions/element-highlight-by-group.js.map +1 -0
- package/cjs/interactions/element-highlight-by-key.d.ts +17 -0
- package/cjs/interactions/element-highlight-by-key.js +53 -0
- package/cjs/interactions/element-highlight-by-key.js.map +1 -0
- package/cjs/interactions/element-highlight-by-legend.d.ts +17 -0
- package/cjs/interactions/element-highlight-by-legend.js +47 -0
- package/cjs/interactions/element-highlight-by-legend.js.map +1 -0
- package/cjs/interactions/element-highlight-by-name.d.ts +18 -0
- package/cjs/interactions/element-highlight-by-name.js +59 -0
- package/cjs/interactions/element-highlight-by-name.js.map +1 -0
- package/cjs/interactions/element-highlight.d.ts +17 -0
- package/cjs/interactions/element-highlight.js +48 -0
- package/cjs/interactions/element-highlight.js.map +1 -0
- package/cjs/interactions/element-select.d.ts +18 -0
- package/cjs/interactions/element-select.js +42 -0
- package/cjs/interactions/element-select.js.map +1 -0
- package/cjs/interactions/filter.d.ts +20 -0
- package/cjs/interactions/filter.js +37 -0
- package/cjs/interactions/filter.js.map +1 -0
- package/cjs/interactions/fish-eye.d.ts +38 -0
- package/cjs/interactions/fish-eye.js +109 -0
- package/cjs/interactions/fish-eye.js.map +1 -0
- package/cjs/interactions/index.d.ts +50 -0
- package/cjs/interactions/index.js +386 -0
- package/cjs/interactions/index.js.map +1 -0
- package/cjs/interactions/legend-filter.d.ts +13 -0
- package/cjs/interactions/legend-filter.js +33 -0
- package/cjs/interactions/legend-filter.js.map +1 -0
- package/cjs/interactions/player-filter.d.ts +14 -0
- package/cjs/interactions/player-filter.js +32 -0
- package/cjs/interactions/player-filter.js.map +1 -0
- package/cjs/interactions/roll-up.d.ts +16 -0
- package/cjs/interactions/roll-up.js +47 -0
- package/cjs/interactions/roll-up.js.map +1 -0
- package/cjs/interactions/scrollbar-filter.d.ts +13 -0
- package/cjs/interactions/scrollbar-filter.js +54 -0
- package/cjs/interactions/scrollbar-filter.js.map +1 -0
- package/cjs/interactions/slider-filter.d.ts +13 -0
- package/cjs/interactions/slider-filter.js +32 -0
- package/cjs/interactions/slider-filter.js.map +1 -0
- package/cjs/interactions/tooltip.d.ts +15 -0
- package/cjs/interactions/tooltip.js +62 -0
- package/cjs/interactions/tooltip.js.map +1 -0
- package/cjs/interactions/view-drag-mixin.d.ts +22 -0
- package/cjs/interactions/view-drag-mixin.js +52 -0
- package/cjs/interactions/view-drag-mixin.js.map +1 -0
- package/cjs/interactions/view-drag.d.ts +19 -0
- package/cjs/interactions/view-drag.js +49 -0
- package/cjs/interactions/view-drag.js.map +1 -0
- package/cjs/interactions/view-navigation-base.d.ts +17 -0
- package/cjs/interactions/view-navigation-base.js +81 -0
- package/cjs/interactions/view-navigation-base.js.map +1 -0
- package/cjs/interactions/view-roam.d.ts +30 -0
- package/cjs/interactions/view-roam.js +93 -0
- package/cjs/interactions/view-roam.js.map +1 -0
- package/cjs/interactions/view-scroll-mixin.d.ts +10 -0
- package/cjs/interactions/view-scroll-mixin.js +45 -0
- package/cjs/interactions/view-scroll-mixin.js.map +1 -0
- package/cjs/interactions/view-scroll.d.ts +17 -0
- package/cjs/interactions/view-scroll.js +37 -0
- package/cjs/interactions/view-scroll.js.map +1 -0
- package/cjs/interactions/view-utils.d.ts +14 -0
- package/cjs/interactions/view-utils.js +73 -0
- package/cjs/interactions/view-utils.js.map +1 -0
- package/cjs/interactions/view-zoom-mixin.d.ts +29 -0
- package/cjs/interactions/view-zoom-mixin.js +77 -0
- package/cjs/interactions/view-zoom-mixin.js.map +1 -0
- package/cjs/interactions/view-zoom.d.ts +23 -0
- package/cjs/interactions/view-zoom.js +53 -0
- package/cjs/interactions/view-zoom.js.map +1 -0
- package/cjs/parse/coordinate.js +1 -1
- package/cjs/parse/event.d.ts +2 -0
- package/cjs/parse/event.js +8 -4
- package/cjs/parse/event.js.map +1 -1
- package/cjs/parse/mark.js +1 -1
- package/cjs/parse/option.js +2 -1
- package/cjs/parse/scale.js +1 -1
- package/cjs/parse/transform.js +1 -1
- package/cjs/parse/util.js +1 -1
- package/cjs/parse/view.js +1 -1
- package/cjs/semantic-marks/cell.d.ts +1 -1
- package/cjs/semantic-marks/cell.js +4 -4
- package/cjs/semantic-marks/cell.js.map +1 -1
- package/cjs/semantic-marks/interval.d.ts +1 -1
- package/cjs/semantic-marks/interval.js +1 -1
- package/cjs/semantic-marks/text.js +1 -1
- package/cjs/theme/dark.js +1 -1
- package/cjs/theme/default.js +1 -1
- package/cjs/theme/theme-manager.js +1 -1
- package/cjs/transforms/index.js +1 -1
- package/cjs/transforms/mark/dodge.js +4 -4
- package/cjs/transforms/mark/dodge.js.map +1 -1
- package/cjs/transforms/mark/jitter.js +2 -2
- package/cjs/transforms/mark/jitter.js.map +1 -1
- package/cjs/types/animate.d.ts +1 -1
- package/cjs/types/animate.js +1 -1
- package/cjs/types/animate.js.map +1 -1
- package/cjs/types/base.js +1 -1
- package/cjs/types/component.d.ts +16 -88
- package/cjs/types/component.js +1 -1
- package/cjs/types/component.js.map +1 -1
- package/cjs/types/coordinate.js +1 -1
- package/cjs/types/data.js +2 -1
- package/cjs/types/dataflow.js +1 -1
- package/cjs/types/element.d.ts +1 -1
- package/cjs/types/element.js +1 -1
- package/cjs/types/element.js.map +1 -1
- package/cjs/types/event.d.ts +11 -4
- package/cjs/types/event.js +1 -1
- package/cjs/types/event.js.map +1 -1
- package/cjs/types/glyph.js +1 -1
- package/cjs/types/grammar.d.ts +6 -2
- package/cjs/types/grammar.js +1 -1
- package/cjs/types/grammar.js.map +1 -1
- package/cjs/types/hooks.js +1 -1
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +3 -2
- package/cjs/types/index.js.map +1 -1
- package/cjs/types/interaction.d.ts +353 -0
- package/cjs/types/interaction.js +6 -0
- package/cjs/types/interaction.js.map +1 -0
- package/cjs/types/mark.d.ts +2 -3
- package/cjs/types/mark.js.map +1 -1
- package/cjs/types/morph.d.ts +1 -1
- package/cjs/types/morph.js.map +1 -1
- package/cjs/types/plot.d.ts +1 -1
- package/cjs/types/plot.js.map +1 -1
- package/cjs/types/renderer.d.ts +1 -1
- package/cjs/types/renderer.js.map +1 -1
- package/cjs/types/theme.d.ts +1 -1
- package/cjs/types/theme.js.map +1 -1
- package/cjs/types/view.d.ts +13 -14
- package/cjs/types/view.js.map +1 -1
- package/cjs/util/scale.d.ts +4 -0
- package/cjs/util/scale.js +24 -0
- package/cjs/util/scale.js.map +1 -0
- package/cjs/util/text.d.ts +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/cjs/view/View.d.ts +9 -13
- package/cjs/view/View.js +49 -74
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/component.d.ts +2 -6
- package/cjs/view/component.js +1 -19
- package/cjs/view/component.js.map +1 -1
- package/cjs/view/dataflow.js +1 -1
- package/cjs/view/dataflow.js.map +1 -1
- package/cjs/view/events.d.ts +1 -1
- package/cjs/view/mark.d.ts +2 -2
- package/cjs/view/mark.js +12 -10
- package/cjs/view/mark.js.map +1 -1
- package/cjs/view/scale.d.ts +7 -1
- package/cjs/view/scale.js +17 -3
- package/cjs/view/scale.js.map +1 -1
- package/es/component/axis.js.map +1 -1
- package/es/component/datazoom.d.ts +7 -4
- package/es/component/datazoom.js +26 -42
- package/es/component/datazoom.js.map +1 -1
- package/es/component/grid.js.map +1 -1
- package/es/component/index.d.ts +0 -2
- package/es/component/index.js +0 -4
- package/es/component/index.js.map +1 -1
- package/es/component/label.js.map +1 -1
- package/es/component/legend.d.ts +1 -3
- package/es/component/legend.js +11 -26
- package/es/component/legend.js.map +1 -1
- package/es/component/player.d.ts +1 -2
- package/es/component/player.js +17 -30
- package/es/component/player.js.map +1 -1
- package/es/component/scale.d.ts +1 -0
- package/es/component/scale.js +3 -0
- package/es/component/scale.js.map +1 -1
- package/es/component/scrollbar.d.ts +3 -4
- package/es/component/scrollbar.js +17 -53
- package/es/component/scrollbar.js.map +1 -1
- package/es/component/slider.d.ts +2 -5
- package/es/component/slider.js +9 -25
- package/es/component/slider.js.map +1 -1
- package/es/component/title.js.map +1 -1
- package/es/core/factory.d.ts +6 -3
- package/es/core/factory.js +9 -2
- package/es/core/factory.js.map +1 -1
- package/es/env.d.ts +1 -0
- package/es/env.js +1 -0
- package/es/env.js.map +1 -0
- package/es/glyph/index.js +2 -1
- package/es/glyph/link-path.js +1 -2
- package/es/graph/animation/animate.js +24 -19
- package/es/graph/animation/animate.js.map +1 -1
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/es/graph/animation/animator.js +1 -1
- package/es/graph/animation/animator.js.map +1 -1
- package/es/graph/animation/attribute.d.ts +2 -2
- package/es/graph/animation/attribute.js +7 -7
- package/es/graph/animation/attribute.js.map +1 -1
- package/es/graph/animation/morph.js +1 -1
- package/es/graph/animation/morph.js.map +1 -1
- package/es/graph/attributes/index.js +1 -1
- package/es/graph/attributes/index.js.map +1 -1
- package/es/graph/canvas-renderer.d.ts +1 -1
- package/es/graph/canvas-renderer.js +3 -1
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/element.d.ts +1 -1
- package/es/graph/element.js +3 -3
- package/es/graph/element.js.map +1 -1
- package/es/graph/enums.d.ts +25 -8
- package/es/graph/enums.js +27 -11
- package/es/graph/enums.js.map +1 -1
- package/es/graph/glyph-element.d.ts +1 -1
- package/es/graph/glyph-element.js.map +1 -1
- package/es/graph/mark/encode.d.ts +0 -3
- package/es/graph/mark/encode.js +0 -10
- package/es/graph/mark/encode.js.map +1 -1
- package/es/graph/mark/large-rects.d.ts +2 -2
- package/es/graph/mark/large-rects.js +1 -1
- package/es/graph/mark/large-rects.js.map +1 -1
- package/es/graph/mark/large-symbols.d.ts +2 -2
- package/es/graph/mark/large-symbols.js +1 -1
- package/es/graph/mark/large-symbols.js.map +1 -1
- package/es/graph/util/env.js +1 -1
- package/es/graph/util/env.js.map +1 -1
- package/es/graph/util/events-extend.d.ts +1 -1
- package/es/graph/util/events-extend.js +1 -1
- package/es/graph/util/events-extend.js.map +1 -1
- package/es/graph/util/graphic.d.ts +3 -3
- package/es/graph/util/graphic.js +1 -1
- package/es/graph/util/graphic.js.map +1 -1
- package/es/index.d.ts +5 -1
- package/es/index.js +11 -2
- package/es/index.js.map +1 -1
- package/es/interactions/base-tooltip.d.ts +29 -0
- package/es/interactions/base-tooltip.js +73 -0
- package/es/interactions/base-tooltip.js.map +1 -0
- package/es/interactions/base.d.ts +14 -0
- package/es/interactions/base.js +32 -0
- package/es/interactions/base.js.map +1 -0
- package/es/interactions/brush-active.d.ts +17 -0
- package/es/interactions/brush-active.js +23 -0
- package/es/interactions/brush-active.js.map +1 -0
- package/es/interactions/brush-base.d.ts +43 -0
- package/es/interactions/brush-base.js +103 -0
- package/es/interactions/brush-base.js.map +1 -0
- package/es/interactions/brush-filter.d.ts +24 -0
- package/es/interactions/brush-filter.js +33 -0
- package/es/interactions/brush-filter.js.map +1 -0
- package/es/interactions/brush-highlight.d.ts +17 -0
- package/es/interactions/brush-highlight.js +31 -0
- package/es/interactions/brush-highlight.js.map +1 -0
- package/es/interactions/crosshair.d.ts +53 -0
- package/es/{component → interactions}/crosshair.js +82 -81
- package/es/interactions/crosshair.js.map +1 -0
- package/es/interactions/datazoom-filter.d.ts +13 -0
- package/es/interactions/datazoom-filter.js +40 -0
- package/es/interactions/datazoom-filter.js.map +1 -0
- package/es/interactions/dimension-tooltip.d.ts +18 -0
- package/es/interactions/dimension-tooltip.js +99 -0
- package/es/interactions/dimension-tooltip.js.map +1 -0
- package/es/interactions/drill-down.d.ts +25 -0
- package/es/interactions/drill-down.js +46 -0
- package/es/interactions/drill-down.js.map +1 -0
- package/es/interactions/element-active-by-legend.d.ts +17 -0
- package/es/interactions/element-active-by-legend.js +43 -0
- package/es/interactions/element-active-by-legend.js.map +1 -0
- package/es/interactions/element-active.d.ts +16 -0
- package/es/interactions/element-active.js +29 -0
- package/es/interactions/element-active.js.map +1 -0
- package/es/interactions/element-highlight-by-group.d.ts +17 -0
- package/es/interactions/element-highlight-by-group.js +49 -0
- package/es/interactions/element-highlight-by-group.js.map +1 -0
- package/es/interactions/element-highlight-by-key.d.ts +17 -0
- package/es/interactions/element-highlight-by-key.js +50 -0
- package/es/interactions/element-highlight-by-key.js.map +1 -0
- package/es/interactions/element-highlight-by-legend.d.ts +17 -0
- package/es/interactions/element-highlight-by-legend.js +46 -0
- package/es/interactions/element-highlight-by-legend.js.map +1 -0
- package/es/interactions/element-highlight-by-name.d.ts +18 -0
- package/es/interactions/element-highlight-by-name.js +56 -0
- package/es/interactions/element-highlight-by-name.js.map +1 -0
- package/es/interactions/element-highlight.d.ts +17 -0
- package/es/interactions/element-highlight.js +43 -0
- package/es/interactions/element-highlight.js.map +1 -0
- package/es/interactions/element-select.d.ts +18 -0
- package/es/interactions/element-select.js +38 -0
- package/es/interactions/element-select.js.map +1 -0
- package/es/interactions/filter.d.ts +20 -0
- package/es/interactions/filter.js +31 -0
- package/es/interactions/filter.js.map +1 -0
- package/es/interactions/fish-eye.d.ts +38 -0
- package/es/interactions/fish-eye.js +105 -0
- package/es/interactions/fish-eye.js.map +1 -0
- package/es/interactions/index.d.ts +50 -0
- package/es/interactions/index.js +149 -0
- package/es/interactions/index.js.map +1 -0
- package/es/interactions/legend-filter.d.ts +13 -0
- package/es/interactions/legend-filter.js +32 -0
- package/es/interactions/legend-filter.js.map +1 -0
- package/es/interactions/player-filter.d.ts +14 -0
- package/es/interactions/player-filter.js +32 -0
- package/es/interactions/player-filter.js.map +1 -0
- package/es/interactions/roll-up.d.ts +16 -0
- package/es/interactions/roll-up.js +45 -0
- package/es/interactions/roll-up.js.map +1 -0
- package/es/interactions/scrollbar-filter.d.ts +13 -0
- package/es/interactions/scrollbar-filter.js +50 -0
- package/es/interactions/scrollbar-filter.js.map +1 -0
- package/es/interactions/slider-filter.d.ts +13 -0
- package/es/interactions/slider-filter.js +29 -0
- package/es/interactions/slider-filter.js.map +1 -0
- package/es/interactions/tooltip.d.ts +15 -0
- package/es/interactions/tooltip.js +58 -0
- package/es/interactions/tooltip.js.map +1 -0
- package/es/interactions/view-drag-mixin.d.ts +22 -0
- package/es/interactions/view-drag-mixin.js +46 -0
- package/es/interactions/view-drag-mixin.js.map +1 -0
- package/es/interactions/view-drag.d.ts +19 -0
- package/es/interactions/view-drag.js +47 -0
- package/es/interactions/view-drag.js.map +1 -0
- package/es/interactions/view-navigation-base.d.ts +17 -0
- package/es/interactions/view-navigation-base.js +78 -0
- package/es/interactions/view-navigation-base.js.map +1 -0
- package/es/interactions/view-roam.d.ts +30 -0
- package/es/interactions/view-roam.js +91 -0
- package/es/interactions/view-roam.js.map +1 -0
- package/es/interactions/view-scroll-mixin.d.ts +10 -0
- package/es/interactions/view-scroll-mixin.js +37 -0
- package/es/interactions/view-scroll-mixin.js.map +1 -0
- package/es/interactions/view-scroll.d.ts +17 -0
- package/es/interactions/view-scroll.js +35 -0
- package/es/interactions/view-scroll.js.map +1 -0
- package/es/interactions/view-utils.d.ts +14 -0
- package/es/interactions/view-utils.js +60 -0
- package/es/interactions/view-utils.js.map +1 -0
- package/es/interactions/view-zoom-mixin.d.ts +29 -0
- package/es/interactions/view-zoom-mixin.js +68 -0
- package/es/interactions/view-zoom-mixin.js.map +1 -0
- package/es/interactions/view-zoom.d.ts +23 -0
- package/es/interactions/view-zoom.js +51 -0
- package/es/interactions/view-zoom.js.map +1 -0
- package/es/parse/event.d.ts +2 -0
- package/es/parse/event.js +5 -1
- package/es/parse/event.js.map +1 -1
- package/es/parse/option.js +2 -1
- package/es/parse/scale.js +1 -2
- package/es/semantic-marks/cell.d.ts +1 -1
- package/es/semantic-marks/cell.js +4 -2
- package/es/semantic-marks/cell.js.map +1 -1
- package/es/semantic-marks/interval.d.ts +1 -1
- package/es/semantic-marks/interval.js +1 -1
- package/es/semantic-marks/text.js +1 -1
- package/es/theme/dark.js +1 -1
- package/es/theme/default.js +1 -1
- package/es/theme/theme-manager.js +1 -1
- package/es/transforms/index.js +1 -1
- package/es/transforms/mark/dodge.js +2 -2
- package/es/transforms/mark/dodge.js.map +1 -1
- package/es/transforms/mark/jitter.js +2 -2
- package/es/transforms/mark/jitter.js.map +1 -1
- package/es/types/animate.d.ts +1 -1
- package/es/types/animate.js +1 -1
- package/es/types/animate.js.map +1 -1
- package/es/types/base.js +1 -1
- package/es/types/component.d.ts +16 -88
- package/es/types/component.js +1 -1
- package/es/types/component.js.map +1 -1
- package/es/types/coordinate.js +1 -1
- package/es/types/data.js +2 -1
- package/es/types/dataflow.js +1 -1
- package/es/types/element.d.ts +1 -1
- package/es/types/element.js +1 -1
- package/es/types/element.js.map +1 -1
- package/es/types/event.d.ts +11 -4
- package/es/types/event.js +1 -1
- package/es/types/event.js.map +1 -1
- package/es/types/glyph.js +1 -1
- package/es/types/grammar.d.ts +6 -2
- package/es/types/grammar.js +1 -1
- package/es/types/grammar.js.map +1 -1
- package/es/types/hooks.js +1 -1
- package/es/types/index.d.ts +1 -0
- package/es/types/index.js +3 -1
- package/es/types/index.js.map +1 -1
- package/es/types/interaction.d.ts +353 -0
- package/es/types/interaction.js +2 -0
- package/es/types/interaction.js.map +1 -0
- package/es/types/mark.d.ts +2 -3
- package/es/types/mark.js.map +1 -1
- package/es/types/morph.d.ts +1 -1
- package/es/types/morph.js.map +1 -1
- package/es/types/plot.d.ts +1 -1
- package/es/types/plot.js.map +1 -1
- package/es/types/renderer.d.ts +1 -1
- package/es/types/renderer.js.map +1 -1
- package/es/types/theme.d.ts +1 -1
- package/es/types/theme.js.map +1 -1
- package/es/types/view.d.ts +13 -14
- package/es/types/view.js.map +1 -1
- package/es/util/scale.d.ts +4 -0
- package/es/util/scale.js +15 -0
- package/es/util/scale.js.map +1 -0
- package/es/util/text.d.ts +1 -1
- package/es/util/text.js +1 -1
- package/es/util/text.js.map +1 -1
- package/es/view/View.d.ts +9 -13
- package/es/view/View.js +49 -69
- package/es/view/View.js.map +1 -1
- package/es/view/component.d.ts +2 -6
- package/es/view/component.js +0 -20
- package/es/view/component.js.map +1 -1
- package/es/view/dataflow.js +1 -1
- package/es/view/dataflow.js.map +1 -1
- package/es/view/events.d.ts +1 -1
- package/es/view/mark.d.ts +2 -2
- package/es/view/mark.js +12 -10
- package/es/view/mark.js.map +1 -1
- package/es/view/scale.d.ts +7 -1
- package/es/view/scale.js +17 -2
- package/es/view/scale.js.map +1 -1
- package/package.json +9 -8
- package/cjs/component/crosshair.d.ts +0 -50
- package/cjs/component/crosshair.js.map +0 -1
- package/cjs/component/tooltip.d.ts +0 -62
- package/cjs/component/tooltip.js +0 -305
- package/cjs/component/tooltip.js.map +0 -1
- package/es/component/crosshair.d.ts +0 -50
- package/es/component/crosshair.js.map +0 -1
- package/es/component/tooltip.d.ts +0 -62
- package/es/component/tooltip.js +0 -303
- package/es/component/tooltip.js.map +0 -1
package/cjs/types/renderer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
-
import type { IColor, Stage } from '@visactor/vrender';
|
|
2
|
+
import type { IColor, Stage } from '@visactor/vrender-core';
|
|
3
3
|
import type { IViewEventConfig, IViewOptions } from './view';
|
|
4
4
|
export interface IRenderer {
|
|
5
5
|
initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/renderer.ts"],"names":[],"mappings":"","file":"renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IColor, Stage } from '@visactor/vrender';\nimport type { IViewEventConfig, IViewOptions } from './view';\n\nexport interface IRenderer {\n initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;\n\n render: (immediately?: boolean) => this;\n renderNextFrame: () => this;\n resize: (width: number, height: number) => this;\n shouldResize: (width: number, height: number) => boolean;\n combineIncrementalLayers: () => this;\n\n setDpr: (resolution: number, redraw: boolean) => this;\n background: (color: IColor) => this;\n setViewBox: (viewBox: IBoundsLike, rerender: boolean) => this;\n\n stage: () => Stage;\n canvas: () => HTMLCanvasElement;\n context: () => CanvasRenderingContext2D;\n\n toCanvas: () => HTMLCanvasElement;\n // toImageData: () => Promise<ImageData | undefined>;\n\n release: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/renderer.ts"],"names":[],"mappings":"","file":"renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IColor, Stage } from '@visactor/vrender-core';\nimport type { IViewEventConfig, IViewOptions } from './view';\n\nexport interface IRenderer {\n initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;\n\n render: (immediately?: boolean) => this;\n renderNextFrame: () => this;\n resize: (width: number, height: number) => this;\n shouldResize: (width: number, height: number) => boolean;\n combineIncrementalLayers: () => this;\n\n setDpr: (resolution: number, redraw: boolean) => this;\n background: (color: IColor) => this;\n setViewBox: (viewBox: IBoundsLike, rerender: boolean) => this;\n\n stage: () => Stage;\n canvas: () => HTMLCanvasElement;\n context: () => CanvasRenderingContext2D;\n\n toCanvas: () => HTMLCanvasElement;\n // toImageData: () => Promise<ImageData | undefined>;\n\n release: () => void;\n}\n"]}
|
package/cjs/types/theme.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IColor } from '@visactor/vrender';
|
|
1
|
+
import type { IColor } from '@visactor/vrender-core';
|
|
2
2
|
import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes } from '@visactor/vrender-components';
|
|
3
3
|
import type { IPadding } from '@visactor/vutils';
|
|
4
4
|
import type { RecursivePartial } from './base';
|
package/cjs/types/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
|
package/cjs/types/view.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';
|
|
3
|
-
import type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender';
|
|
3
|
+
import type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';
|
|
4
4
|
import type { CoordinateType } from '@visactor/vgrammar-coordinate';
|
|
5
5
|
import type { DataSpec } from './data';
|
|
6
6
|
import type { SignalFunctionType, SignalSpec } from './signal';
|
|
@@ -14,9 +14,10 @@ import type { CommonPaddingSpec } from './base';
|
|
|
14
14
|
import type { IMorphAnimationConfig } from './morph';
|
|
15
15
|
import type { IBaseAnimate } from './animate';
|
|
16
16
|
import type { IRenderer } from './renderer';
|
|
17
|
-
import type { IAxis,
|
|
17
|
+
import type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';
|
|
18
18
|
import type { CoordinateSpec } from './coordinate';
|
|
19
19
|
import type { ITheme } from './theme';
|
|
20
|
+
import type { IInteraction, InteractionSpec } from './interaction';
|
|
20
21
|
export interface IViewThemeConfig {
|
|
21
22
|
labelMonospace?: boolean;
|
|
22
23
|
}
|
|
@@ -41,15 +42,13 @@ export interface ILayoutOptions {
|
|
|
41
42
|
}
|
|
42
43
|
export interface IViewEventConfig {
|
|
43
44
|
defaults?: {
|
|
44
|
-
prevent?: boolean | Record<string, boolean
|
|
45
|
-
allow?: boolean | Record<string, boolean
|
|
45
|
+
prevent?: boolean | Record<string, boolean>;
|
|
46
|
+
allow?: boolean | Record<string, boolean>;
|
|
46
47
|
};
|
|
47
|
-
view?: boolean | Record<string, boolean
|
|
48
|
-
window?: boolean | Record<string, boolean> | string[];
|
|
48
|
+
view?: boolean | Record<string, boolean>;
|
|
49
49
|
disable?: boolean;
|
|
50
50
|
gesture?: boolean;
|
|
51
51
|
drag?: boolean;
|
|
52
|
-
globalCursor?: boolean;
|
|
53
52
|
}
|
|
54
53
|
export interface srIOption3DType extends IOption3D {
|
|
55
54
|
enable?: boolean;
|
|
@@ -61,14 +60,11 @@ export interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILa
|
|
|
61
60
|
padding?: CommonPaddingSpec;
|
|
62
61
|
autoFit?: boolean;
|
|
63
62
|
options3d?: srIOption3DType;
|
|
64
|
-
hover?: boolean;
|
|
65
|
-
select?: boolean;
|
|
66
|
-
cursor?: boolean;
|
|
67
63
|
logger?: ILogger;
|
|
68
64
|
logLevel?: number;
|
|
69
|
-
domBridge?: any;
|
|
70
65
|
hooks?: Hooks;
|
|
71
66
|
eventConfig?: IViewEventConfig;
|
|
67
|
+
background?: IColor;
|
|
72
68
|
}
|
|
73
69
|
export interface IRunningConfig {
|
|
74
70
|
reuse?: boolean;
|
|
@@ -98,15 +94,15 @@ export interface IView {
|
|
|
98
94
|
axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;
|
|
99
95
|
grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;
|
|
100
96
|
legend: (group: IGroupMark | string) => ILegend;
|
|
101
|
-
crosshair: (group: IGroupMark | string) => ICrosshair;
|
|
102
97
|
slider: (group: IGroupMark | string) => ISlider;
|
|
103
98
|
label: (group: IGroupMark | string) => ILabel;
|
|
104
99
|
datazoom: (group: IGroupMark | string) => IDatazoom;
|
|
105
100
|
player: (group: IGroupMark | string) => IPlayer;
|
|
106
|
-
tooltip: (group: IGroupMark | string) => ITooltip;
|
|
107
|
-
dimensionTooltip: (group: IGroupMark | string) => IDimensionTooltip;
|
|
108
101
|
title: (group: IGroupMark | string) => ITitle;
|
|
109
102
|
scrollbar: (group: IGroupMark | string) => IScrollbar;
|
|
103
|
+
interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;
|
|
104
|
+
removeInteraction: (type: string) => this;
|
|
105
|
+
removeAllInteractions: () => this;
|
|
110
106
|
addGrammar: (grammar: IGrammarBase) => this;
|
|
111
107
|
removeGrammar: (grammar: string | IGrammarBase) => this;
|
|
112
108
|
removeAllGrammars: () => this;
|
|
@@ -120,6 +116,8 @@ export interface IView {
|
|
|
120
116
|
getGrammarsByName: (name: string) => IGrammarBase[];
|
|
121
117
|
getGrammarsByType: (grammarType: string) => IGrammarBase[];
|
|
122
118
|
getMarksByType: (markType: string) => IMark[];
|
|
119
|
+
getMarksByName: (name: string) => IMark[] | null;
|
|
120
|
+
getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;
|
|
123
121
|
commit: (grammar: IGrammarBase) => this;
|
|
124
122
|
parseSpec: (spec: ViewSpec) => this;
|
|
125
123
|
updateSpec: (spec: ViewSpec) => this;
|
|
@@ -183,6 +181,7 @@ export interface ViewSpec {
|
|
|
183
181
|
coordinates?: CoordinateSpec[];
|
|
184
182
|
marks?: MarkSpec[];
|
|
185
183
|
events?: EventSpec[];
|
|
184
|
+
interactions?: InteractionSpec[];
|
|
186
185
|
}
|
|
187
186
|
export interface IRecordedGrammars {
|
|
188
187
|
record: (grammar: IGrammarBase) => this;
|
package/cjs/types/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds,
|
|
1
|
+
{"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';\nimport type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { DataSpec } from './data';\nimport type { SignalFunctionType, SignalSpec } from './signal';\nimport type {\n IData,\n ISignal,\n IScale,\n IMark,\n IGrammarBase,\n ICoordinate,\n IGlyphMark,\n IGroupMark,\n IComponent\n} from './grammar';\nimport type { ScaleSpec, GrammarScaleType } from './scale';\nimport type { MarkSpec, MarkType } from './mark';\nimport type { Hooks } from './hooks';\nimport type { ProjectionSpec } from './projection';\nimport type { BaseEventHandler, EventSpec } from './event';\nimport type { CommonPaddingSpec } from './base';\nimport type { IMorphAnimationConfig } from './morph';\nimport type { IBaseAnimate } from './animate';\nimport type { IRenderer } from './renderer';\nimport type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';\nimport type { CoordinateSpec } from './coordinate';\nimport type { ITheme } from './theme';\nimport type { IInteraction, InteractionSpec } from './interaction';\n\nexport interface IViewThemeConfig {\n labelMonospace?: boolean;\n}\n\n/**\n * 获取state相关配置\n */\nexport interface IViewStateOptions {\n signals?: (name?: string, operator?: any) => boolean;\n data?: (name?: string, object?: any) => boolean;\n recurse?: boolean;\n}\n\nexport interface IEnvironmentOptions {\n /** 环境参数 */\n mode?: EnvType;\n /**\n * 环境带的配置\n */\n modeParams?: any;\n}\n\nexport interface IRendererOptions extends Partial<IStageParams> {\n /** 非浏览器环境下,如小程序,需要传入经过包装的伪 canvas 实例 */\n renderCanvas?: string | HTMLCanvasElement;\n /** vRender stage */\n stage?: IStage;\n rendererTitle?: string;\n /** vRender layer */\n layer?: ILayer;\n}\n\nexport interface ILayoutOptions {\n parseMarkBounds?: (bounds: IBounds, mark: IMark) => IBounds;\n doLayout?: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n}\n\n/** 事件配置 */\nexport interface IViewEventConfig {\n /**\n * preventDefaults相关配置\n */\n defaults?: {\n prevent?: boolean | Record<string, boolean>;\n allow?: boolean | Record<string, boolean>;\n };\n /**\n * whether permit events of view\n */\n view?: boolean | Record<string, boolean>;\n /** disable all the events */\n disable?: boolean;\n /** use gesture events or not */\n gesture?: boolean;\n /** use drag events or not */\n drag?: boolean;\n}\n\nexport interface srIOption3DType extends IOption3D {\n enable?: boolean;\n /* 是否支持3d视角变换 */\n enableView3dTranform?: boolean;\n}\nexport interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILayoutOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n\n options3d?: srIOption3DType;\n /** 外部传入的logger方法 */\n logger?: ILogger;\n /**\n * 0 - None\n * 1 - Error\n * 2 - Warn\n * 3 - Info\n * 4 - Debug\n */\n logLevel?: number;\n\n /** 生命周期等事件钩子 */\n hooks?: Hooks;\n\n /**\n * 事件相关配置\n * {\n * defaults: {\n * prevent: ['mousemove', 'mouseenter']\n * }\n * }\n */\n eventConfig?: IViewEventConfig;\n background?: IColor;\n}\n\nexport interface IRunningConfig {\n /** whether enable reusing of grammar */\n reuse?: boolean;\n /** whether enable morph */\n morph?: boolean;\n /** force all marks to participate in morphing */\n morphAll?: boolean;\n /** morphing animation config */\n animation?: IMorphAnimationConfig;\n /** whether apply exit animations for released marks */\n enableExitAnimation?: boolean;\n}\n\nexport interface IView {\n readonly renderer: IRenderer;\n readonly rootMark: IGroupMark;\n readonly animate: IBaseAnimate;\n readonly grammars: IRecordedGrammars;\n readonly logger: ILogger;\n\n // --- Grammar API ---\n signal: <T>(value?: T, update?: SignalFunctionType<T>) => ISignal<T>;\n data: (values?: any[]) => IData;\n scale: (type: GrammarScaleType) => IScale;\n coordinate: (type: CoordinateType) => ICoordinate;\n mark: (\n type: MarkType,\n group: IGroupMark | string,\n markOptions?: { glyphType?: string; componentType?: string; mode?: '2d' | '3d' }\n ) => IMark;\n group: (group: IGroupMark | string) => IGroupMark;\n glyph: (glyphType: string, group: IGroupMark | string) => IGlyphMark;\n component: (componentType: string, group: IGroupMark | string, mode?: '2d' | '3d') => IComponent;\n axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;\n grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;\n legend: (group: IGroupMark | string) => ILegend;\n slider: (group: IGroupMark | string) => ISlider;\n label: (group: IGroupMark | string) => ILabel;\n datazoom: (group: IGroupMark | string) => IDatazoom;\n player: (group: IGroupMark | string) => IPlayer;\n title: (group: IGroupMark | string) => ITitle;\n scrollbar: (group: IGroupMark | string) => IScrollbar;\n\n interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;\n removeInteraction: (type: string) => this;\n removeAllInteractions: () => this;\n\n addGrammar: (grammar: IGrammarBase) => this;\n removeGrammar: (grammar: string | IGrammarBase) => this;\n removeAllGrammars: () => this;\n\n getGrammarById: (id: string) => IGrammarBase | null;\n getCustomizedById: (id: string) => IGrammarBase | null;\n getSignalById: <T>(id: string) => ISignal<T> | null;\n getDataById: (id: string) => IData | null;\n getScaleById: (id: string) => IScale | null;\n getCoordinateById: (id: string) => ICoordinate | null;\n getMarkById: (id: string) => IMark | null;\n getGrammarsByName: (name: string) => IGrammarBase[];\n getGrammarsByType: (grammarType: string) => IGrammarBase[];\n getMarksByType: (markType: string) => IMark[];\n getMarksByName: (name: string) => IMark[] | null;\n getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;\n\n commit: (grammar: IGrammarBase) => this;\n\n // --- Spec API ---\n parseSpec: (spec: ViewSpec) => this;\n updateSpec: (spec: ViewSpec) => this;\n\n // --- Evaluate API ---\n run: (runningConfig?: IRunningConfig) => this;\n runNextTick: (runningConfig?: IRunningConfig) => Promise<this>;\n runAsync: (runningConfig?: IRunningConfig) => Promise<this>;\n runSync: (runningConfig?: IRunningConfig) => this;\n runBefore: (callback: (view: IView) => void) => this;\n runAfter: (callback: (view: IView) => void) => this;\n\n // --- Theme API ---\n theme: (theme: ITheme | string) => this;\n getCurrentTheme: () => ITheme;\n setCurrentTheme: (theme: ITheme | string, render?: boolean) => Promise<this>;\n\n // --- Global Config API ---\n background: (value?: IColor) => IColor;\n width: (value?: number) => number;\n height: (value?: number) => number;\n viewWidth: (value?: number) => number;\n viewHeight: (value?: number) => number;\n padding: (p?: number | { left?: number; right?: number; top?: number; bottom?: number }) => {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n getViewBox: () => IBounds;\n\n // --- Event API ---\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // --- Other API ---\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n resize: (width: number, height: number, render?: boolean) => Promise<this>;\n traverseMarkTree: (apply: (mark: IMark) => any, filter?: (mark: IMark) => boolean, leafFirst?: boolean) => this;\n\n getLayoutState: () => string;\n updateLayoutTag: () => this;\n\n pauseProgressive: () => boolean;\n resumeProgressive: () => boolean;\n restartProgressive: () => boolean;\n\n release: () => void;\n getImageBuffer: () => Buffer;\n}\n\nexport interface IViewConstructor {\n new (options?: IViewOptions, config?: IViewThemeConfig): IView;\n}\n\nexport interface ViewSpec {\n /** 梳理详细配置 */\n theme?: string;\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number };\n signals?: SignalSpec<any>[];\n projections?: ProjectionSpec[];\n data?: DataSpec[];\n scales?: ScaleSpec[];\n coordinates?: CoordinateSpec[];\n marks?: MarkSpec[];\n events?: EventSpec[];\n interactions?: InteractionSpec[];\n}\n\nexport interface IRecordedGrammars {\n record: (grammar: IGrammarBase) => this;\n unrecord: (grammar: IGrammarBase) => this;\n\n size: () => number;\n\n getSignal: <T>(key: string) => ISignal<T> | null;\n getData: (key: string) => IData | null;\n getScale: (key: string) => IScale | null;\n getCoordinate: (key: string) => ICoordinate | null;\n getMark: (key: string) => IMark | null;\n getCustomized: (key: string) => IGrammarBase | null;\n getGrammar: (key: string) => IGrammarBase | null;\n\n getAllSignals: () => ISignal<any>[];\n getAllData: () => IData[];\n getAllScales: () => IScale[];\n getAllCoordinates: () => ICoordinate[];\n getAllMarks: () => IMark[];\n getAllCustomized: () => IGrammarBase[];\n\n clear: () => void;\n\n traverse: (func: (grammar: IGrammarBase) => boolean | void) => void;\n find: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase | null;\n filter: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase[];\n\n release: () => void;\n}\n\nexport interface IMarkTreeNode {\n mark: IMark;\n parent: IMarkTreeNode;\n children: IMarkTreeNode[];\n}\n\nexport interface IRecordedTreeGrammars extends IRecordedGrammars {\n getAllMarkNodes: () => IMarkTreeNode[];\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IBaseScale } from '@visactor/vscale';
|
|
2
|
+
export declare function isBandLikeScale(scale: IBaseScale): boolean;
|
|
3
|
+
export declare function getBandWidthOfScale(scale: IBaseScale): number;
|
|
4
|
+
export declare function getScaleRangeRatio(scale: IBaseScale, input: any): number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.getScaleRangeRatio = exports.getBandWidthOfScale = exports.isBandLikeScale = void 0;
|
|
6
|
+
|
|
7
|
+
const vscale_1 = require("@visactor/vscale");
|
|
8
|
+
|
|
9
|
+
function isBandLikeScale(scale) {
|
|
10
|
+
return scale && (scale.type === vscale_1.ScaleEnum.Band || scale.type === vscale_1.ScaleEnum.Point);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getBandWidthOfScale(scale) {
|
|
14
|
+
if (scale) return scale.type === vscale_1.ScaleEnum.Band ? scale.bandwidth() : scale.type === vscale_1.ScaleEnum.Point ? scale.step() : void 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getScaleRangeRatio(scale, input) {
|
|
18
|
+
const range = scale.range();
|
|
19
|
+
return (scale.scale(input) - range[0]) / (range[range.length - 1] - range[0]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.isBandLikeScale = isBandLikeScale, exports.getBandWidthOfScale = getBandWidthOfScale,
|
|
23
|
+
exports.getScaleRangeRatio = getScaleRangeRatio;
|
|
24
|
+
//# sourceMappingURL=scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/util/scale.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAI7C,SAAgB,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC;AAFD,0CAEC;AAED,SAAgB,mBAAmB,CAAC,KAAiB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,IAAI;QAClC,CAAC,CAAE,KAAwB,CAAC,SAAS,EAAE;QACvC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,KAAK;YAChC,CAAC,CAAE,KAAwB,CAAC,IAAI,EAAE;YAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAVD,kDAUC;AAED,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,KAAU;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAHD,gDAGC","file":"scale.js","sourcesContent":["import { ScaleEnum } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n\nexport function isBandLikeScale(scale: IBaseScale) {\n return scale && (scale.type === ScaleEnum.Band || scale.type === ScaleEnum.Point);\n}\n\nexport function getBandWidthOfScale(scale: IBaseScale) {\n if (!scale) {\n return undefined;\n }\n\n return scale.type === ScaleEnum.Band\n ? (scale as IBandLikeScale).bandwidth()\n : scale.type === ScaleEnum.Point\n ? (scale as IBandLikeScale).step()\n : undefined;\n}\n\nexport function getScaleRangeRatio(scale: IBaseScale, input: any) {\n const range = scale.range();\n return (scale.scale(input) - range[0]) / (range[range.length - 1] - range[0]);\n}\n"]}
|
package/cjs/util/text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IRichText, IRichTextCharacter } from '@visactor/vrender';
|
|
1
|
+
import type { IRichText, IRichTextCharacter } from '@visactor/vrender-core';
|
|
2
2
|
export declare function richXul(strings: TemplateStringsArray, ...insertVars: (string | number)[]): {
|
|
3
3
|
type: string;
|
|
4
4
|
text: IRichTextCharacter[];
|
package/cjs/util/text.js
CHANGED
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.textHtml = exports.richJsx = exports.richXul = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
|
|
8
8
|
|
|
9
9
|
function richXul(strings, ...insertVars) {
|
|
10
10
|
return {
|
|
11
11
|
type: "rich",
|
|
12
|
-
text: (0,
|
|
12
|
+
text: (0, vrender_core_1.xul)(strings.reduce(((res, temp, i) => res + temp + (i >= insertVars.length ? "" : insertVars[i])), ""))
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function richJsx(richText) {
|
|
17
17
|
return {
|
|
18
18
|
type: "rich",
|
|
19
|
-
text: richText instanceof
|
|
19
|
+
text: richText instanceof vrender_core_1.RichText ? richText.attribute.textConfig : (0,
|
|
20
20
|
vutils_1.isArray)(richText) ? richText.map((entry => entry.type ? entry.attribute : entry)) : []
|
|
21
21
|
};
|
|
22
22
|
}
|
package/cjs/util/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AACA,yDAAqE;AACrE,6CAA2C;AAE3C,SAAgB,OAAO,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACvF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAA,kBAAU,EACd,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC,CACP;KACF,CAAC;AACJ,CAAC;AATD,0BASC;AAED,SAAgB,OAAO,CACrB,QAA8F;IAE9F,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EACF,QAAQ,YAAY,uBAAQ;YAC1B,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU;YAC/B,CAAC,CAAC,IAAA,gBAAO,EAAC,QAAQ,CAAC;gBACnB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBACnB,OAAQ,KAAyD,CAAC,IAAI;wBACpE,CAAC,CAAE,KAAyD,CAAC,SAAS;wBACtE,CAAC,CAAC,KAAK,CAAC;gBACZ,CAAC,CAAC;gBACJ,CAAC,CAAC,EAAE;KACT,CAAC;AACJ,CAAC;AAhBD,0BAgBC;AAED,SAAgB,QAAQ,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACxF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACpC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC;KACP,CAAC;AACJ,CAAC;AAPD,4BAOC","file":"text.js","sourcesContent":["import type { IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { xul as vRenderXul, RichText } from '@visactor/vrender-core';\nimport { isArray } from '@visactor/vutils';\n\nexport function richXul(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'rich',\n text: vRenderXul(\n strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n )\n };\n}\n\nexport function richJsx(\n richText: IRichText | { attribute: IRichTextCharacter; type: string }[] | IRichTextCharacter[]\n) {\n return {\n type: 'rich',\n text:\n richText instanceof RichText\n ? richText.attribute.textConfig\n : isArray(richText)\n ? richText.map(entry => {\n return (entry as { attribute: IRichTextCharacter; type: string }).type\n ? (entry as { attribute: IRichTextCharacter; type: string }).attribute\n : entry;\n })\n : []\n };\n}\n\nexport function textHtml(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'html',\n text: strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n };\n}\n"]}
|
package/cjs/view/View.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IBounds, ILogger } from '@visactor/vutils';
|
|
2
2
|
import { EventEmitter } from '@visactor/vutils';
|
|
3
|
-
import type { IColor } from '@visactor/vrender';
|
|
3
|
+
import type { IColor } from '@visactor/vrender-core';
|
|
4
4
|
import type { CoordinateType } from '@visactor/vgrammar-coordinate';
|
|
5
|
-
import type { IData, ISignal, ViewSpec, IView, IViewOptions, IViewThemeConfig, Hooks, IMark, EventSpec, MarkType, GrammarScaleType, SignalFunctionType, IScale, IGrammarBase, IGroupMark, IGlyphMark, ICoordinate, BaseEventHandler, IRecordedGrammars, IComponent, IRunningConfig, IViewAnimate, ITheme } from '../types/';
|
|
5
|
+
import type { IData, ISignal, ViewSpec, IView, IViewOptions, IViewThemeConfig, Hooks, IMark, EventSpec, MarkType, GrammarScaleType, SignalFunctionType, IScale, IGrammarBase, IGroupMark, IGlyphMark, ICoordinate, BaseEventHandler, IRecordedGrammars, IComponent, IRunningConfig, IViewAnimate, ITheme, InteractionSpec, IInteraction } from '../types/';
|
|
6
6
|
import type { IRenderer } from '../types/renderer';
|
|
7
7
|
import { LayoutState } from '../graph/enums';
|
|
8
|
-
import type { IAxis,
|
|
8
|
+
import type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from '../types/component';
|
|
9
9
|
export default class View extends EventEmitter implements IView {
|
|
10
10
|
container: HTMLElement;
|
|
11
11
|
renderer: IRenderer;
|
|
@@ -21,7 +21,6 @@ export default class View extends EventEmitter implements IView {
|
|
|
21
21
|
private _willMorphMarks;
|
|
22
22
|
private _morph;
|
|
23
23
|
private _eventConfig;
|
|
24
|
-
private _globalCursor;
|
|
25
24
|
private _eventListeners;
|
|
26
25
|
private _theme;
|
|
27
26
|
private _dataflow;
|
|
@@ -34,8 +33,8 @@ export default class View extends EventEmitter implements IView {
|
|
|
34
33
|
private _eventCache;
|
|
35
34
|
private _progressiveMarks?;
|
|
36
35
|
private _progressiveRafId?;
|
|
37
|
-
private _cursorValue?;
|
|
38
36
|
private _observer;
|
|
37
|
+
private _boundInteractions?;
|
|
39
38
|
static useRegisters(comps: (() => void)[]): void;
|
|
40
39
|
constructor(options?: IViewOptions, config?: IViewThemeConfig);
|
|
41
40
|
getGrammarById(id: string): IGrammarBase;
|
|
@@ -48,6 +47,8 @@ export default class View extends EventEmitter implements IView {
|
|
|
48
47
|
getGrammarsByName(name: string): IGrammarBase[];
|
|
49
48
|
getGrammarsByType(grammarType: string): IGrammarBase[];
|
|
50
49
|
getMarksByType(markType: string): IMark[];
|
|
50
|
+
getMarksByName(name: string): IMark[] | null;
|
|
51
|
+
getMarksBySelector(selector: string | string[] | IMark | IMark[]): IMark[] | null;
|
|
51
52
|
private updateSignal;
|
|
52
53
|
signal<T>(value?: T, update?: SignalFunctionType<T>): ISignal<T>;
|
|
53
54
|
data(values?: any[]): IData;
|
|
@@ -64,13 +65,10 @@ export default class View extends EventEmitter implements IView {
|
|
|
64
65
|
axis(group: IGroupMark | string, mode?: '2d' | '3d'): IAxis;
|
|
65
66
|
grid(group: IGroupMark | string, mode?: '2d' | '3d'): IGrid;
|
|
66
67
|
legend(group: IGroupMark | string): ILegend;
|
|
67
|
-
crosshair(group: IGroupMark | string): ICrosshair;
|
|
68
68
|
slider(group: IGroupMark | string): ISlider;
|
|
69
69
|
label(group: IGroupMark | string): ILabel;
|
|
70
70
|
datazoom(group: IGroupMark | string): IDatazoom;
|
|
71
71
|
player(group: IGroupMark | string): IPlayer;
|
|
72
|
-
tooltip(group: IGroupMark | string): ITooltip;
|
|
73
|
-
dimensionTooltip(group: IGroupMark | string): IDimensionTooltip;
|
|
74
72
|
title(group: IGroupMark | string): ITitle;
|
|
75
73
|
scrollbar(group: IGroupMark | string): IScrollbar;
|
|
76
74
|
customized(type: string, spec: any): IGrammarBase;
|
|
@@ -132,16 +130,14 @@ export default class View extends EventEmitter implements IView {
|
|
|
132
130
|
private _resizeRenderer;
|
|
133
131
|
private bindEvents;
|
|
134
132
|
event(eventSpec: EventSpec): void;
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
interaction(type: string, spec: Partial<InteractionSpec>): IInteraction;
|
|
134
|
+
removeInteraction(type: string | IInteraction): this;
|
|
135
|
+
removeAllInteractions(): this;
|
|
137
136
|
private initEvent;
|
|
138
137
|
private delegateEvent;
|
|
139
138
|
addEventListener(type: string, handler: BaseEventHandler, options?: any): this;
|
|
140
139
|
removeEventListener(type: string, handler?: BaseEventHandler): this;
|
|
141
|
-
private setCursor;
|
|
142
|
-
globalCursor(_?: boolean): string | boolean | this;
|
|
143
140
|
private initializeRenderer;
|
|
144
|
-
private initializeBuiltEvents;
|
|
145
141
|
private initialize;
|
|
146
142
|
normalBrowserEnv(): boolean;
|
|
147
143
|
pauseProgressive(): boolean;
|
package/cjs/view/View.js
CHANGED
|
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
34
34
|
value: !0
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
const vutils_1 = require("@visactor/vutils"),
|
|
37
|
+
const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), 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"), component_1 = require("./component"), graphic_1 = require("../graph/util/graphic");
|
|
38
38
|
|
|
39
39
|
class View extends vutils_1.EventEmitter {
|
|
40
40
|
static useRegisters(comps) {
|
|
@@ -56,8 +56,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
56
56
|
mark.isDoingProgressive() && mark.evaluateProgressive();
|
|
57
57
|
})), this.doPreProgressive();
|
|
58
58
|
}, this._config = config, this._options = Object.assign({
|
|
59
|
-
mode: constants_2.BROWSER
|
|
60
|
-
cursor: !0
|
|
59
|
+
mode: constants_2.BROWSER
|
|
61
60
|
}, options), this.initialize();
|
|
62
61
|
}
|
|
63
62
|
getGrammarById(id) {
|
|
@@ -90,6 +89,19 @@ class View extends vutils_1.EventEmitter {
|
|
|
90
89
|
getMarksByType(markType) {
|
|
91
90
|
return this.grammars.getAllMarks().filter((mark => mark.markType === markType));
|
|
92
91
|
}
|
|
92
|
+
getMarksByName(name) {
|
|
93
|
+
return this.grammars.getAllMarks().filter((mark => mark.name() === name));
|
|
94
|
+
}
|
|
95
|
+
getMarksBySelector(selector) {
|
|
96
|
+
if (!selector) return null;
|
|
97
|
+
const selectors = (0, vutils_1.array)(selector);
|
|
98
|
+
let res = [];
|
|
99
|
+
return selectors.forEach((selectorStr => {
|
|
100
|
+
(0, util_1.isGrammar)(selectorStr) ? res = res.concat(selectorStr) : (selectorStr[0] === event_1.ID_PREFIX && (res = res.concat(this.getMarkById(selectorStr.slice(1)))),
|
|
101
|
+
selectorStr[0] === event_1.NAME_PREFIX && (res = res.concat(this.getMarksByName(selectorStr.slice(1)))),
|
|
102
|
+
(0, graphic_1.isMarkType)(selectorStr) && (res = res.concat(this.getMarksByType(selectorStr))));
|
|
103
|
+
})), res;
|
|
104
|
+
}
|
|
93
105
|
updateSignal(signal, value) {
|
|
94
106
|
(0, vutils_1.isString)(signal) && (signal = this.getSignalById(signal)), signal.set(value),
|
|
95
107
|
this.commit(signal);
|
|
@@ -175,11 +187,6 @@ class View extends vutils_1.EventEmitter {
|
|
|
175
187
|
componentType: enums_1.ComponentEnum.legend
|
|
176
188
|
});
|
|
177
189
|
}
|
|
178
|
-
crosshair(group) {
|
|
179
|
-
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
180
|
-
componentType: enums_1.ComponentEnum.crosshair
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
190
|
slider(group) {
|
|
184
191
|
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
185
192
|
componentType: enums_1.ComponentEnum.slider
|
|
@@ -200,16 +207,6 @@ class View extends vutils_1.EventEmitter {
|
|
|
200
207
|
componentType: enums_1.ComponentEnum.player
|
|
201
208
|
});
|
|
202
209
|
}
|
|
203
|
-
tooltip(group) {
|
|
204
|
-
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
205
|
-
componentType: enums_1.ComponentEnum.tooltip
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
dimensionTooltip(group) {
|
|
209
|
-
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
210
|
-
componentType: enums_1.ComponentEnum.dimensionTooltip
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
210
|
title(group) {
|
|
214
211
|
return this.mark(enums_1.GrammarMarkType.component, group, {
|
|
215
212
|
componentType: enums_1.ComponentEnum.title
|
|
@@ -242,7 +239,7 @@ class View extends vutils_1.EventEmitter {
|
|
|
242
239
|
})), this;
|
|
243
240
|
}
|
|
244
241
|
parseSpec(spec) {
|
|
245
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
242
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
246
243
|
if (this.emit(enums_1.HOOK_EVENT.BEFORE_PARSE_VIEW), this._spec = spec, (0, view_1.normalizeMarkTree)(spec),
|
|
247
244
|
spec.theme ? this.theme(spec.theme) : this.theme(theme_manager_1.ThemeManager.getDefaultTheme()),
|
|
248
245
|
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),
|
|
@@ -270,11 +267,13 @@ class View extends vutils_1.EventEmitter {
|
|
|
270
267
|
this.parseMarkSpec(mark);
|
|
271
268
|
})), (null === (_h = spec.events) || void 0 === _h ? void 0 : _h.length) && spec.events.forEach((eventConfig => {
|
|
272
269
|
this.event(eventConfig);
|
|
270
|
+
})), (null === (_j = spec.interactions) || void 0 === _j ? void 0 : _j.length) && spec.interactions.forEach((interaction => {
|
|
271
|
+
this.interaction(interaction.type, interaction);
|
|
273
272
|
})), this.emit(enums_1.HOOK_EVENT.AFTER_PARSE_VIEW), this._needBuildLayoutTree = !0,
|
|
274
273
|
this._layoutState = enums_1.LayoutState.before, this;
|
|
275
274
|
}
|
|
276
275
|
updateSpec(spec) {
|
|
277
|
-
return this.removeAllGrammars(), this.parseSpec(spec);
|
|
276
|
+
return this.removeAllInteractions(), this.removeAllGrammars(), this.parseSpec(spec);
|
|
278
277
|
}
|
|
279
278
|
parseBuiltIn() {
|
|
280
279
|
(0, view_1.builtInSignals)(this._options, this._config, this.getCurrentTheme()).map((signalSpec => {
|
|
@@ -635,14 +634,14 @@ class View extends vutils_1.EventEmitter {
|
|
|
635
634
|
() => {
|
|
636
635
|
this.removeEventListener(type, send);
|
|
637
636
|
};
|
|
638
|
-
} else if (source === constants_2.EVENT_SOURCE_WINDOW) return
|
|
637
|
+
} else if (source === constants_2.EVENT_SOURCE_WINDOW) return vrender_core_1.vglobal.addEventListener(type, send),
|
|
639
638
|
this._eventListeners.push({
|
|
640
639
|
type: type,
|
|
641
|
-
source:
|
|
640
|
+
source: vrender_core_1.vglobal,
|
|
642
641
|
handler: send
|
|
643
642
|
}), () => {
|
|
644
|
-
|
|
645
|
-
const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source ===
|
|
643
|
+
vrender_core_1.vglobal.removeEventListener(type, send);
|
|
644
|
+
const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source === vrender_core_1.vglobal && entry.handler === send));
|
|
646
645
|
index >= 0 && this._eventListeners.splice(index, 1);
|
|
647
646
|
};
|
|
648
647
|
}
|
|
@@ -669,30 +668,24 @@ class View extends vutils_1.EventEmitter {
|
|
|
669
668
|
singleEvent.debounce = 50, this.bindEvents(singleEvent);
|
|
670
669
|
})) : this.bindEvents(eventSpec);
|
|
671
670
|
}
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
return
|
|
675
|
-
|
|
676
|
-
evt.element.addState(state);
|
|
677
|
-
})), this.addEventListener("pointerout", (evt => {
|
|
678
|
-
if (!evt.element) return;
|
|
679
|
-
evt.element.removeState(state);
|
|
680
|
-
})), this;
|
|
671
|
+
interaction(type, spec) {
|
|
672
|
+
const interaction = factory_1.Factory.createInteraction(type, this, spec);
|
|
673
|
+
return interaction && (interaction.bind(), this._boundInteractions || (this._boundInteractions = []),
|
|
674
|
+
this._boundInteractions.push(interaction)), interaction;
|
|
681
675
|
}
|
|
682
|
-
|
|
683
|
-
this.
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}));
|
|
676
|
+
removeInteraction(type) {
|
|
677
|
+
if (this._boundInteractions) {
|
|
678
|
+
const instances = this._boundInteractions.filter((interaction => (0, vutils_1.isString)(type) && interaction.type === type || interaction === type));
|
|
679
|
+
instances.length && instances.forEach((instance => {
|
|
680
|
+
instance.unbind();
|
|
681
|
+
}));
|
|
682
|
+
}
|
|
683
|
+
return this;
|
|
684
|
+
}
|
|
685
|
+
removeAllInteractions() {
|
|
686
|
+
return this._boundInteractions && (this._boundInteractions.forEach((instance => {
|
|
687
|
+
instance.unbind();
|
|
688
|
+
})), this._boundInteractions = null), this;
|
|
696
689
|
}
|
|
697
690
|
initEvent() {
|
|
698
691
|
const stage = this.renderer.stage();
|
|
@@ -707,28 +700,10 @@ class View extends vutils_1.EventEmitter {
|
|
|
707
700
|
removeEventListener(type, handler) {
|
|
708
701
|
return handler ? this.off(type, handler) : this.off(type), this;
|
|
709
702
|
}
|
|
710
|
-
setCursor(cursor) {
|
|
711
|
-
if (this._options.domBridge && this._options.domBridge.setCursor) return void this._options.domBridge.setCursor(cursor);
|
|
712
|
-
const el = this.globalCursor() ? !(0, vutils_1.isNil)(document) && document.body : this.container;
|
|
713
|
-
return el ? (0, vutils_1.isNil)(cursor) ? el.style.removeProperty("cursor") : el.style.cursor = cursor : void 0;
|
|
714
|
-
}
|
|
715
|
-
globalCursor(_) {
|
|
716
|
-
if (arguments.length) {
|
|
717
|
-
if (this._globalCursor !== !!_) {
|
|
718
|
-
const prev = this.setCursor(null);
|
|
719
|
-
this._globalCursor = !!_, prev && this.setCursor(prev);
|
|
720
|
-
}
|
|
721
|
-
return this;
|
|
722
|
-
}
|
|
723
|
-
return this._globalCursor;
|
|
724
|
-
}
|
|
725
703
|
initializeRenderer() {
|
|
726
704
|
const width = this._options.width, height = this._options.height;
|
|
727
705
|
this.renderer = new canvas_renderer_1.default(this), this.renderer.initialize(width, height, this._options, this._eventConfig).background(this._background);
|
|
728
706
|
}
|
|
729
|
-
initializeBuiltEvents() {
|
|
730
|
-
this._options.cursor && this.cursor(), this._options.hover && this.hover(), this._bindResizeEvent();
|
|
731
|
-
}
|
|
732
707
|
initialize() {
|
|
733
708
|
var _a;
|
|
734
709
|
this.grammars = new grammar_record_1.RecordedGrammars((grammar => grammar.id()), ((key, grammar) => this.logger.warn(`Grammar id '${key}' has been occupied`, grammar))),
|
|
@@ -739,12 +714,11 @@ class View extends vutils_1.EventEmitter {
|
|
|
739
714
|
this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
|
|
740
715
|
this.on(key, this._options.hooks[key]);
|
|
741
716
|
})), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
|
|
742
|
-
this.
|
|
743
|
-
this.
|
|
744
|
-
|
|
745
|
-
this.
|
|
746
|
-
this.
|
|
747
|
-
this.theme(this._theme);
|
|
717
|
+
this._eventListeners = [], this._eventConfig = (0, events_1.initializeEventConfig)(this._options.eventConfig),
|
|
718
|
+
this._theme = theme_manager_1.ThemeManager.getDefaultTheme(), this.parseBuiltIn(),
|
|
719
|
+
(0, env_1.configureEnvironment)(this._options), this.initializeRenderer(), this._eventConfig.disable || this.initEvent(),
|
|
720
|
+
this._bindResizeEvent(), this._currentDataflow = null, this._needBuildLayoutTree = !0,
|
|
721
|
+
this._layoutState = enums_1.LayoutState.before, this.theme(this._theme);
|
|
748
722
|
}
|
|
749
723
|
normalBrowserEnv() {
|
|
750
724
|
return "browser" === this._options.mode;
|
|
@@ -768,13 +742,13 @@ class View extends vutils_1.EventEmitter {
|
|
|
768
742
|
}
|
|
769
743
|
doPreProgressive() {
|
|
770
744
|
if (this._progressiveMarks && this._progressiveMarks.some((mark => mark.isDoingProgressive()))) {
|
|
771
|
-
const raf =
|
|
745
|
+
const raf = vrender_core_1.vglobal.getRequestAnimationFrame();
|
|
772
746
|
this._progressiveRafId = raf(this.handleProgressiveFrame);
|
|
773
747
|
}
|
|
774
748
|
}
|
|
775
749
|
clearProgressive() {
|
|
776
750
|
if (this._progressiveRafId) {
|
|
777
|
-
|
|
751
|
+
vrender_core_1.vglobal.getCancelAnimationFrame()(this._progressiveRafId);
|
|
778
752
|
}
|
|
779
753
|
this._progressiveMarks && this._progressiveMarks.length && (this._progressiveMarks.forEach((entry => {
|
|
780
754
|
entry.clearProgressive();
|
|
@@ -785,7 +759,8 @@ class View extends vutils_1.EventEmitter {
|
|
|
785
759
|
this._unBindResizeEvent(), this.clearProgressive(), factory_1.Factory.unregisterRuntimeTransforms(),
|
|
786
760
|
this.animate.stop(), this.grammars.release(), this._cachedGrammars.release(), this._dataflow = null,
|
|
787
761
|
null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
788
|
-
this.renderer = null, this.
|
|
762
|
+
this.renderer = null, this._boundInteractions = null, this.removeAllListeners(),
|
|
763
|
+
null === (_c = this._eventListeners) || void 0 === _c || _c.forEach((listener => {
|
|
789
764
|
listener.source.removeEventListener(listener.type, listener.handler);
|
|
790
765
|
})), this._eventListeners = null;
|
|
791
766
|
}
|