@visactor/vgrammar-core 0.7.7-alpha.2 → 0.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/component/datazoom.d.ts +7 -4
- package/cjs/component/datazoom.js +21 -43
- package/cjs/component/datazoom.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/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/core/factory.d.ts +4 -1
- package/cjs/core/factory.js +9 -2
- package/cjs/core/factory.js.map +1 -1
- package/cjs/glyph/link-path.js +1 -2
- package/cjs/glyph/ripple.js +2 -2
- package/cjs/glyph/ripple.js.map +1 -1
- package/cjs/graph/animation/animate.js +25 -19
- package/cjs/graph/animation/animate.js.map +1 -1
- package/cjs/graph/animation/attribute.js +6 -6
- package/cjs/graph/animation/attribute.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.js +2 -1
- package/cjs/graph/element.js +2 -2
- 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/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/util/events-extend.js +1 -1
- package/cjs/graph/util/events-extend.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +2 -2
- 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 +2 -1
- package/cjs/parse/option.js +1 -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.js +4 -4
- package/cjs/semantic-marks/cell.js.map +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.js +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 +2 -1
- package/cjs/types/data.js +1 -1
- package/cjs/types/dataflow.js +1 -1
- package/cjs/types/element.js +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 +5 -1
- 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 +2 -1
- 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 +1 -2
- package/cjs/types/mark.js.map +1 -1
- package/cjs/types/view.d.ts +12 -13
- 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/view/View.d.ts +8 -12
- package/cjs/view/View.js +43 -68
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/component.d.ts +1 -5
- 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.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/datazoom.d.ts +7 -4
- package/es/component/datazoom.js +26 -42
- package/es/component/datazoom.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/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/core/factory.d.ts +4 -1
- package/es/core/factory.js +9 -2
- package/es/core/factory.js.map +1 -1
- package/es/glyph/boxplot.js +2 -1
- package/es/glyph/link-path.js +1 -2
- package/es/glyph/ripple.js +2 -2
- package/es/glyph/ripple.js.map +1 -1
- package/es/graph/animation/animate.js +24 -19
- package/es/graph/animation/animate.js.map +1 -1
- package/es/graph/animation/attribute.js +6 -6
- package/es/graph/animation/attribute.js.map +1 -1
- package/es/graph/attributes/index.js +1 -1
- package/es/graph/attributes/index.js.map +1 -1
- package/es/graph/element.js +2 -2
- 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/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/util/events-extend.js +1 -1
- package/es/graph/util/events-extend.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- 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 +32 -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 +50 -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 +148 -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/coordinate.js +1 -1
- package/es/parse/event.d.ts +2 -0
- package/es/parse/event.js +6 -2
- package/es/parse/event.js.map +1 -1
- package/es/parse/mark.js +2 -1
- package/es/parse/option.js +1 -1
- package/es/parse/scale.js +1 -1
- package/es/parse/transform.js +1 -1
- package/es/parse/util.js +1 -1
- package/es/parse/view.js +1 -1
- package/es/semantic-marks/cell.js +4 -2
- package/es/semantic-marks/cell.js.map +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.js +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 +2 -1
- package/es/types/data.js +1 -1
- package/es/types/dataflow.js +1 -1
- package/es/types/element.js +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 +5 -1
- 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 +2 -0
- 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 +1 -2
- package/es/types/mark.js.map +1 -1
- package/es/types/view.d.ts +12 -13
- 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/view/View.d.ts +8 -12
- package/es/view/View.js +48 -68
- package/es/view/View.js.map +1 -1
- package/es/view/component.d.ts +1 -5
- 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.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 +10 -10
- 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/es/types/view.d.ts
CHANGED
|
@@ -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/es/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;
|
package/es/util/scale.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScaleEnum } from "@visactor/vscale";
|
|
2
|
+
|
|
3
|
+
export function isBandLikeScale(scale) {
|
|
4
|
+
return scale && (scale.type === ScaleEnum.Band || scale.type === ScaleEnum.Point);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getBandWidthOfScale(scale) {
|
|
8
|
+
if (scale) return scale.type === ScaleEnum.Band ? scale.bandwidth() : scale.type === ScaleEnum.Point ? scale.step() : void 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getScaleRangeRatio(scale, input) {
|
|
12
|
+
const range = scale.range();
|
|
13
|
+
return (scale.scale(input) - range[0]) / (range[range.length - 1] - range[0]);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/util/scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;QAClC,CAAC,CAAE,KAAwB,CAAC,SAAS,EAAE;QACvC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,KAAK;YAChC,CAAC,CAAE,KAAwB,CAAC,IAAI,EAAE;YAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,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","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/es/view/View.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { IBounds, ILogger } from '@visactor/vutils';
|
|
|
2
2
|
import { EventEmitter } from '@visactor/vutils';
|
|
3
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/es/view/View.js
CHANGED
|
@@ -24,7 +24,7 @@ var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, gener
|
|
|
24
24
|
}));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
import { EventEmitter, debounce,
|
|
27
|
+
import { EventEmitter, debounce, isObject, isString, getContainerSize, Logger, array } from "@visactor/vutils";
|
|
28
28
|
|
|
29
29
|
import { vglobal } from "@visactor/vrender-core";
|
|
30
30
|
|
|
@@ -42,7 +42,7 @@ import CanvasRenderer from "../graph/canvas-renderer";
|
|
|
42
42
|
|
|
43
43
|
import getExtendedEvents from "../graph/util/events-extend";
|
|
44
44
|
|
|
45
|
-
import { BROWSER, NO_TRAP, SIGNAL_WIDTH, SIGNAL_HEIGHT, SIGNAL_PADDING, SIGNAL_AUTOFIT,
|
|
45
|
+
import { BROWSER, NO_TRAP, SIGNAL_WIDTH, SIGNAL_HEIGHT, SIGNAL_PADDING, SIGNAL_AUTOFIT, SIGNAL_VIEW_WIDTH, SIGNAL_VIEW_HEIGHT, EVENT_SOURCE_VIEW, EVENT_SOURCE_WINDOW, SIGNAL_VIEW_BOX } from "./constants";
|
|
46
46
|
|
|
47
47
|
import { Signal } from "./signal";
|
|
48
48
|
|
|
@@ -50,9 +50,9 @@ import { Scale } from "./scale";
|
|
|
50
50
|
|
|
51
51
|
import { BuiltInSignalID, builtInSignals, normalizeMarkTree, normalizeRunningConfig, normalizePadding } from "../parse/view";
|
|
52
52
|
|
|
53
|
-
import { parseHandler, parseEventSelector, generateFilterByMark } from "../parse/event";
|
|
53
|
+
import { parseHandler, parseEventSelector, generateFilterByMark, ID_PREFIX, NAME_PREFIX } from "../parse/event";
|
|
54
54
|
|
|
55
|
-
import { parseReference } from "../parse/util";
|
|
55
|
+
import { isGrammar, parseReference } from "../parse/util";
|
|
56
56
|
|
|
57
57
|
import { configureEnvironment } from "../graph/util/env";
|
|
58
58
|
|
|
@@ -86,6 +86,8 @@ import { Factory } from "../core/factory";
|
|
|
86
86
|
|
|
87
87
|
import { Component } from "./component";
|
|
88
88
|
|
|
89
|
+
import { isMarkType } from "../graph/util/graphic";
|
|
90
|
+
|
|
89
91
|
export default class View extends EventEmitter {
|
|
90
92
|
static useRegisters(comps) {
|
|
91
93
|
comps.forEach((fn => {
|
|
@@ -105,8 +107,7 @@ export default class View extends EventEmitter {
|
|
|
105
107
|
mark.isDoingProgressive() && mark.evaluateProgressive();
|
|
106
108
|
})), this.doPreProgressive();
|
|
107
109
|
}, this._config = config, this._options = Object.assign({
|
|
108
|
-
mode: BROWSER
|
|
109
|
-
cursor: !0
|
|
110
|
+
mode: BROWSER
|
|
110
111
|
}, options), this.initialize();
|
|
111
112
|
}
|
|
112
113
|
getGrammarById(id) {
|
|
@@ -139,6 +140,19 @@ export default class View extends EventEmitter {
|
|
|
139
140
|
getMarksByType(markType) {
|
|
140
141
|
return this.grammars.getAllMarks().filter((mark => mark.markType === markType));
|
|
141
142
|
}
|
|
143
|
+
getMarksByName(name) {
|
|
144
|
+
return this.grammars.getAllMarks().filter((mark => mark.name() === name));
|
|
145
|
+
}
|
|
146
|
+
getMarksBySelector(selector) {
|
|
147
|
+
if (!selector) return null;
|
|
148
|
+
const selectors = array(selector);
|
|
149
|
+
let res = [];
|
|
150
|
+
return selectors.forEach((selectorStr => {
|
|
151
|
+
isGrammar(selectorStr) ? res = res.concat(selectorStr) : (selectorStr[0] === ID_PREFIX && (res = res.concat(this.getMarkById(selectorStr.slice(1)))),
|
|
152
|
+
selectorStr[0] === NAME_PREFIX && (res = res.concat(this.getMarksByName(selectorStr.slice(1)))),
|
|
153
|
+
isMarkType(selectorStr) && (res = res.concat(this.getMarksByType(selectorStr))));
|
|
154
|
+
})), res;
|
|
155
|
+
}
|
|
142
156
|
updateSignal(signal, value) {
|
|
143
157
|
isString(signal) && (signal = this.getSignalById(signal)), signal.set(value), this.commit(signal);
|
|
144
158
|
}
|
|
@@ -223,11 +237,6 @@ export default class View extends EventEmitter {
|
|
|
223
237
|
componentType: ComponentEnum.legend
|
|
224
238
|
});
|
|
225
239
|
}
|
|
226
|
-
crosshair(group) {
|
|
227
|
-
return this.mark(GrammarMarkType.component, group, {
|
|
228
|
-
componentType: ComponentEnum.crosshair
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
240
|
slider(group) {
|
|
232
241
|
return this.mark(GrammarMarkType.component, group, {
|
|
233
242
|
componentType: ComponentEnum.slider
|
|
@@ -248,16 +257,6 @@ export default class View extends EventEmitter {
|
|
|
248
257
|
componentType: ComponentEnum.player
|
|
249
258
|
});
|
|
250
259
|
}
|
|
251
|
-
tooltip(group) {
|
|
252
|
-
return this.mark(GrammarMarkType.component, group, {
|
|
253
|
-
componentType: ComponentEnum.tooltip
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
dimensionTooltip(group) {
|
|
257
|
-
return this.mark(GrammarMarkType.component, group, {
|
|
258
|
-
componentType: ComponentEnum.dimensionTooltip
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
260
|
title(group) {
|
|
262
261
|
return this.mark(GrammarMarkType.component, group, {
|
|
263
262
|
componentType: ComponentEnum.title
|
|
@@ -290,7 +289,7 @@ export default class View extends EventEmitter {
|
|
|
290
289
|
})), this;
|
|
291
290
|
}
|
|
292
291
|
parseSpec(spec) {
|
|
293
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
294
293
|
if (this.emit(HOOK_EVENT.BEFORE_PARSE_VIEW), this._spec = spec, normalizeMarkTree(spec),
|
|
295
294
|
spec.theme ? this.theme(spec.theme) : this.theme(ThemeManager.getDefaultTheme()),
|
|
296
295
|
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),
|
|
@@ -318,11 +317,13 @@ export default class View extends EventEmitter {
|
|
|
318
317
|
this.parseMarkSpec(mark);
|
|
319
318
|
})), (null === (_h = spec.events) || void 0 === _h ? void 0 : _h.length) && spec.events.forEach((eventConfig => {
|
|
320
319
|
this.event(eventConfig);
|
|
320
|
+
})), (null === (_j = spec.interactions) || void 0 === _j ? void 0 : _j.length) && spec.interactions.forEach((interaction => {
|
|
321
|
+
this.interaction(interaction.type, interaction);
|
|
321
322
|
})), this.emit(HOOK_EVENT.AFTER_PARSE_VIEW), this._needBuildLayoutTree = !0, this._layoutState = LayoutState.before,
|
|
322
323
|
this;
|
|
323
324
|
}
|
|
324
325
|
updateSpec(spec) {
|
|
325
|
-
return this.removeAllGrammars(), this.parseSpec(spec);
|
|
326
|
+
return this.removeAllInteractions(), this.removeAllGrammars(), this.parseSpec(spec);
|
|
326
327
|
}
|
|
327
328
|
parseBuiltIn() {
|
|
328
329
|
builtInSignals(this._options, this._config, this.getCurrentTheme()).map((signalSpec => {
|
|
@@ -713,28 +714,24 @@ export default class View extends EventEmitter {
|
|
|
713
714
|
singleEvent.debounce = 50, this.bindEvents(singleEvent);
|
|
714
715
|
})) : this.bindEvents(eventSpec);
|
|
715
716
|
}
|
|
716
|
-
|
|
717
|
-
const
|
|
718
|
-
return
|
|
719
|
-
|
|
720
|
-
evt.element.addState(state);
|
|
721
|
-
})), this.addEventListener("pointerout", (evt => {
|
|
722
|
-
if (!evt.element) return;
|
|
723
|
-
evt.element.removeState(state);
|
|
724
|
-
})), this;
|
|
717
|
+
interaction(type, spec) {
|
|
718
|
+
const interaction = Factory.createInteraction(type, this, spec);
|
|
719
|
+
return interaction && (interaction.bind(), this._boundInteractions || (this._boundInteractions = []),
|
|
720
|
+
this._boundInteractions.push(interaction)), interaction;
|
|
725
721
|
}
|
|
726
|
-
|
|
727
|
-
this.
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
722
|
+
removeInteraction(type) {
|
|
723
|
+
if (this._boundInteractions) {
|
|
724
|
+
const instances = this._boundInteractions.filter((interaction => isString(type) && interaction.type === type || interaction === type));
|
|
725
|
+
instances.length && instances.forEach((instance => {
|
|
726
|
+
instance.unbind();
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
return this;
|
|
730
|
+
}
|
|
731
|
+
removeAllInteractions() {
|
|
732
|
+
return this._boundInteractions && (this._boundInteractions.forEach((instance => {
|
|
733
|
+
instance.unbind();
|
|
734
|
+
})), this._boundInteractions = null), this;
|
|
738
735
|
}
|
|
739
736
|
initEvent() {
|
|
740
737
|
const stage = this.renderer.stage();
|
|
@@ -749,28 +746,10 @@ export default class View extends EventEmitter {
|
|
|
749
746
|
removeEventListener(type, handler) {
|
|
750
747
|
return handler ? this.off(type, handler) : this.off(type), this;
|
|
751
748
|
}
|
|
752
|
-
setCursor(cursor) {
|
|
753
|
-
if (this._options.domBridge && this._options.domBridge.setCursor) return void this._options.domBridge.setCursor(cursor);
|
|
754
|
-
const el = this.globalCursor() ? !isNil(document) && document.body : this.container;
|
|
755
|
-
return el ? isNil(cursor) ? el.style.removeProperty("cursor") : el.style.cursor = cursor : void 0;
|
|
756
|
-
}
|
|
757
|
-
globalCursor(_) {
|
|
758
|
-
if (arguments.length) {
|
|
759
|
-
if (this._globalCursor !== !!_) {
|
|
760
|
-
const prev = this.setCursor(null);
|
|
761
|
-
this._globalCursor = !!_, prev && this.setCursor(prev);
|
|
762
|
-
}
|
|
763
|
-
return this;
|
|
764
|
-
}
|
|
765
|
-
return this._globalCursor;
|
|
766
|
-
}
|
|
767
749
|
initializeRenderer() {
|
|
768
750
|
const width = this._options.width, height = this._options.height;
|
|
769
751
|
this.renderer = new CanvasRenderer(this), this.renderer.initialize(width, height, this._options, this._eventConfig).background(this._background);
|
|
770
752
|
}
|
|
771
|
-
initializeBuiltEvents() {
|
|
772
|
-
this._options.cursor && this.cursor(), this._options.hover && this.hover(), this._bindResizeEvent();
|
|
773
|
-
}
|
|
774
753
|
initialize() {
|
|
775
754
|
var _a;
|
|
776
755
|
this.grammars = new RecordedGrammars((grammar => grammar.id()), ((key, grammar) => this.logger.warn(`Grammar id '${key}' has been occupied`, grammar))),
|
|
@@ -780,11 +759,11 @@ export default class View extends EventEmitter {
|
|
|
780
759
|
this._theme = ThemeManager.getDefaultTheme(), this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
|
|
781
760
|
this.on(key, this._options.hooks[key]);
|
|
782
761
|
})), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
|
|
783
|
-
this.
|
|
784
|
-
this.
|
|
785
|
-
this.
|
|
786
|
-
this.
|
|
787
|
-
this.
|
|
762
|
+
this._eventListeners = [], this._eventConfig = initializeEventConfig(this._options.eventConfig),
|
|
763
|
+
this._theme = ThemeManager.getDefaultTheme(), this.parseBuiltIn(), configureEnvironment(this._options),
|
|
764
|
+
this.initializeRenderer(), this._eventConfig.disable || this.initEvent(), this._bindResizeEvent(),
|
|
765
|
+
this._currentDataflow = null, this._needBuildLayoutTree = !0, this._layoutState = LayoutState.before,
|
|
766
|
+
this.theme(this._theme);
|
|
788
767
|
}
|
|
789
768
|
normalBrowserEnv() {
|
|
790
769
|
return "browser" === this._options.mode;
|
|
@@ -825,7 +804,8 @@ export default class View extends EventEmitter {
|
|
|
825
804
|
this._unBindResizeEvent(), this.clearProgressive(), Factory.unregisterRuntimeTransforms(),
|
|
826
805
|
this.animate.stop(), this.grammars.release(), this._cachedGrammars.release(), this._dataflow = null,
|
|
827
806
|
null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
828
|
-
this.renderer = null, this.
|
|
807
|
+
this.renderer = null, this._boundInteractions = null, this.removeAllListeners(),
|
|
808
|
+
null === (_c = this._eventListeners) || void 0 === _c || _c.forEach((listener => {
|
|
829
809
|
listener.source.removeEventListener(listener.type, listener.handler);
|
|
830
810
|
})), this._eventListeners = null;
|
|
831
811
|
}
|