@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IGroupGraphicAttribute } from '@visactor/vrender';
|
|
2
|
-
import { Group } from '@visactor/vrender';
|
|
1
|
+
import type { IGroupGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import { Group } from '@visactor/vrender-core';
|
|
3
3
|
interface LargeRectsAttribute extends IGroupGraphicAttribute {
|
|
4
4
|
points: Float32Array | number[];
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/large-rects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/large-rects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM7D,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,UAA+B;QACzC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,CAAU,CAAC;QAC7E,MAAM,MAAM,GAAI,IAAI,CAAC,SAAiC,CAAC,MAAM,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAC,QAAQ,CAAC,SAAS,CAAC,IAAsB,mCAAI,IAAI,YAAY,EAAE,CAAC;QAChF,IAAI,CAAC,CAAC;QACN,IAAI,CAAC,CAAC;QACN,IAAI,KAAK,CAAC;QACV,IAAI,MAAM,CAAC;QAEX,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;YACpD,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACd,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,KAAK,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACtB,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;SAClC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACnB,QAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF","file":"large-rects.js","sourcesContent":["/**\n * use when mark render in large mode or progressive mode\n */\nimport type { IGroupGraphicAttribute, IPath, ICustomPath2D } from '@visactor/vrender-core';\nimport { Group, CustomPath2D } from '@visactor/vrender-core';\n\ninterface LargeRectsAttribute extends IGroupGraphicAttribute {\n points: Float32Array | number[];\n}\n\nexport class LargeRects extends Group {\n constructor(attributes: LargeRectsAttribute) {\n super(attributes);\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n });\n }\n\n render() {\n const pathNode = this.createOrUpdateChild('large-path', {}, 'path') as IPath;\n const points = (this.attribute as LargeRectsAttribute).points;\n const path2d = (pathNode.attribute.path as ICustomPath2D) ?? new CustomPath2D();\n let x;\n let y;\n let width;\n let height;\n\n path2d.clear();\n for (let i = 0, len = points.length; i < len; i += 4) {\n x = points[i];\n y = points[i + 1];\n width = points[i + 2];\n height = points[i + 3];\n path2d.rect(x, y, width, height);\n }\n\n const pathAttrs = Object.assign({}, this.attribute, { path: path2d, points: null });\n this.attribute = {};\n (pathNode as IPath).setAttributes(pathAttrs);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IGroupGraphicAttribute } from '@visactor/vrender';
|
|
2
|
-
import { Group } from '@visactor/vrender';
|
|
1
|
+
import type { IGroupGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import { Group } from '@visactor/vrender-core';
|
|
3
3
|
interface LargeSymbolsAttribute extends IGroupGraphicAttribute {
|
|
4
4
|
size: number;
|
|
5
5
|
points: Float32Array | number[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumber, max } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
import { CustomPath2D, Group, DefaultSymbolAttribute } from "@visactor/vrender";
|
|
3
|
+
import { CustomPath2D, Group, DefaultSymbolAttribute } from "@visactor/vrender-core";
|
|
4
4
|
|
|
5
5
|
export class LargeSymbols extends Group {
|
|
6
6
|
constructor(attributes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/large-symbols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAOrF,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,UAAiC;QAC3C,KAAK,CAAC,UAAU,CAAC,CAAC;Q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,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACnB,QAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF","file":"large-symbols.js","sourcesContent":["import type { ICustomPath2D, IGroupGraphicAttribute, IPath } from '@visactor/vrender-core';\nimport { isNumber, max } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { CustomPath2D, Group, DefaultSymbolAttribute } from '@visactor/vrender-core';\n\ninterface LargeSymbolsAttribute extends IGroupGraphicAttribute {\n size: number;\n points: Float32Array | number[];\n}\n\nexport class LargeSymbols extends Group {\n constructor(attributes: LargeSymbolsAttribute) {\n super(attributes);\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n });\n }\n\n render() {\n const pathNode = this.createOrUpdateChild('large-path', {}, 'path') as IPath;\n const points = (this.attribute as LargeSymbolsAttribute).points;\n const size = (this.attribute as LargeSymbolsAttribute).size ?? (DefaultSymbolAttribute.size as number);\n const path2d = (pathNode.attribute.path as ICustomPath2D) ?? new CustomPath2D();\n let x;\n let y;\n\n path2d.clear();\n const maxSize = isNumber(size) ? size : max(size[0], size[1]);\n for (let i = 0, len = points.length; i < len; i += 4) {\n x = points[i];\n y = points[i + 1];\n path2d.arc(x, y, maxSize / 2, 0, Math.PI * 2);\n path2d.closePath();\n }\n\n const pathAttrs = Object.assign({}, this.attribute, { path: path2d, points: null, size: null });\n this.attribute = {};\n (pathNode as IPath).setAttributes(pathAttrs);\n }\n}\n"]}
|
package/es/graph/util/env.js
CHANGED
package/es/graph/util/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAC/D,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;KACxD;AACH,CAAC","file":"env.js","sourcesContent":["import { vglobal } from '@visactor/vrender-core';\nimport type { IEnvironmentOptions } from '../../types';\n\nexport function configureEnvironment(options: IEnvironmentOptions) {\n if (options.mode) {\n vglobal.setEnv(options.mode, options.modeParams || {});\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FederatedEvent } from '@visactor/vrender';
|
|
1
|
+
import type { FederatedEvent } from '@visactor/vrender-core';
|
|
2
2
|
import type { IElement } from './../../types/element';
|
|
3
3
|
import type { IView } from './../../types/view';
|
|
4
4
|
import type { EventSourceType } from '../../types';
|
|
@@ -7,6 +7,6 @@ export default function getExtendedEvents(view, event, item, type, source) {
|
|
|
7
7
|
const e = event.changedTouches ? event.changedTouches[0] : event;
|
|
8
8
|
point(e);
|
|
9
9
|
}
|
|
10
|
-
return event.element = item, event
|
|
10
|
+
return event.element = item, event;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=events-extend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/events-extend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,mBAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,KAAK,CAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/events-extend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAW,EACX,KAAqB,EACrB,IAAc,EACd,IAAY,EACZ,MAAuB;IAEvB,IAAI,MAAM,KAAK,mBAAmB,EAAE;QAClC,MAAM,CAAC,GAAI,KAAa,CAAC,cAAc,CAAC,CAAC,CAAE,KAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,KAAK,CAAC,CAAC,CAAC,CAAC;KACV;IAEA,KAAa,CAAC,OAAO,GAAG,IAAI,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC","file":"events-extend.js","sourcesContent":["import type { FederatedEvent } from '@visactor/vrender-core';\nimport type { IElement } from './../../types/element';\nimport type { IView } from './../../types/view';\nimport { point } from './point';\nimport { EVENT_SOURCE_WINDOW } from '../../view/constants';\nimport type { EventSourceType } from '../../types';\n\nexport default function getExtendedEvents(\n view: IView,\n event: FederatedEvent,\n item: IElement,\n type: string,\n source: EventSourceType\n) {\n if (source === EVENT_SOURCE_WINDOW) {\n const e = (event as any).changedTouches ? (event as any).changedTouches[0] : event;\n point(e);\n }\n\n (event as any).element = item;\n\n return event;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IGlyphMeta, IMark } from '../../types';
|
|
2
|
-
import type { IGraphic } from '@visactor/vrender';
|
|
2
|
+
import type { IGraphic } from '@visactor/vrender-core';
|
|
3
3
|
import { LargeRects } from '../mark/large-rects';
|
|
4
4
|
import { LargeSymbols } from '../mark/large-symbols';
|
|
5
5
|
export declare const isMarkType: (type: string) => boolean;
|
|
6
|
-
export declare function createGraphicItem(mark: IMark, markType: string, attrs?: any): IGraphic<Partial<import("@visactor/vrender").IGraphicAttribute>> | LargeRects | LargeSymbols;
|
|
7
|
-
export declare function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs?: any): import("@visactor/vrender").IGlyph<Partial<import("@visactor/vrender").IGraphicAttribute>>;
|
|
6
|
+
export declare function createGraphicItem(mark: IMark, markType: string, attrs?: any): IGraphic<Partial<import("@visactor/vrender-core").IGraphicAttribute>> | LargeRects | LargeSymbols;
|
|
7
|
+
export declare function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs?: any): import("@visactor/vrender-core").IGlyph<Partial<import("@visactor/vrender-core").IGraphicAttribute>>;
|
|
8
8
|
export declare const removeGraphicItem: (graphicItem: IGraphic) => void;
|
|
9
9
|
export declare const getMarkTypeOfLarge: (markType: string) => string;
|
package/es/graph/util/graphic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createArc, createArea, createGroup, createImage, createRect3d, createLine, createPath, createRect, createSymbol, createRichText, createText, createPolygon, createGlyph, createArc3d, createPyramid3d, createCircle } from "@visactor/vrender";
|
|
1
|
+
import { createArc, createArea, createGroup, createImage, createRect3d, createLine, createPath, createRect, createSymbol, createRichText, createText, createPolygon, createGlyph, createArc3d, createPyramid3d, createCircle } from "@visactor/vrender-core";
|
|
2
2
|
|
|
3
3
|
import { HOOK_EVENT, GrammarMarkType } from "../enums";
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/graphic.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YA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,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAChD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAqB,EAAE,EAAE;IACzD,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;QACrC,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,WAAW,CAAC,MAAM,EAAE;YACtB,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;SAC7C;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,eAAe,CAAC,IAAI,EAAE;QACrC,OAAO,eAAe,CAAC,UAAU,CAAC;KACnC;IAED,IAAI,QAAQ,KAAK,eAAe,CAAC,MAAM,EAAE;QACvC,OAAO,eAAe,CAAC,YAAY,CAAC;KACrC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC","file":"graphic.js","sourcesContent":["import type { IGlyphMeta, IMark } from '../../types';\nimport type { IGraphic } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n createArc,\n createArea,\n createGroup,\n createImage,\n createRect3d,\n createLine,\n createPath,\n createRect,\n createSymbol,\n createRichText,\n createText,\n createPolygon,\n createGlyph,\n createArc3d,\n createPyramid3d,\n createCircle\n} from '@visactor/vrender-core';\nimport { HOOK_EVENT, GrammarMarkType } from '../enums';\nimport { BridgeElementKey } from '../constants';\nimport { LargeRects } from '../mark/large-rects';\nimport { LargeSymbols } from '../mark/large-symbols';\nimport { Factory } from '../../core/factory';\n\nconst itemCreator = {\n circle: createCircle,\n arc: createArc,\n arc3d: createArc3d,\n pyramid3d: createPyramid3d,\n area: createArea,\n group: createGroup,\n image: createImage,\n rect3d: createRect3d,\n line: createLine,\n path: createPath,\n rect: createRect,\n rule: createLine,\n shape: createPath,\n symbol: createSymbol,\n text: createText,\n richtext: createRichText,\n polygon: createPolygon,\n cell: createSymbol,\n interval: createRect\n};\n\nexport const isMarkType = (type: string) => {\n return !!itemCreator[type];\n};\n\nexport function createGraphicItem(mark: IMark, markType: string, attrs: any = {}) {\n mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);\n\n if (markType === GrammarMarkType.largeRects) {\n return new LargeRects(attrs);\n } else if (markType === GrammarMarkType.largeSymbols) {\n return new LargeSymbols(attrs);\n }\n\n const graphicItem: IGraphic = itemCreator[markType]\n ? itemCreator[markType](attrs)\n : Factory.createGraphicComponent(markType, attrs);\n\n mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK);\n return graphicItem;\n}\n\nexport function createGlyphGraphicItem(mark: IMark, glyphMeta: IGlyphMeta, attrs: any = {}) {\n mark.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_MARK);\n\n const graphicItem = createGlyph(attrs);\n const glyphMarks = glyphMeta.getMarks();\n const subGraphics: IGraphic[] = Object.keys(glyphMarks).map(name => {\n const graphic = itemCreator[glyphMarks[name]]();\n graphic.name = name;\n return graphic;\n });\n graphicItem.setSubGraphic(subGraphics);\n\n mark.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_MARK);\n return graphicItem;\n}\n\nexport const removeGraphicItem = (graphicItem: IGraphic) => {\n if (graphicItem) {\n graphicItem[BridgeElementKey] = null;\n graphicItem.release();\n if (graphicItem.parent) {\n graphicItem.parent.removeChild(graphicItem);\n }\n }\n};\n\nexport const getMarkTypeOfLarge = (markType: string) => {\n if (markType === GrammarMarkType.rect) {\n return GrammarMarkType.largeRects;\n }\n\n if (markType === GrammarMarkType.symbol) {\n return GrammarMarkType.largeSymbols;\n }\n\n return markType;\n};\n"]}
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.8.0";
|
|
2
2
|
export * from './graph';
|
|
3
|
+
export * from './interactions';
|
|
3
4
|
export { View } from './view';
|
|
4
5
|
export { parseFunctionType, invokeFunctionType } from './parse/util';
|
|
5
6
|
export { GrammarBase } from './view/grammar-base';
|
|
@@ -12,3 +13,6 @@ export * from './glyph';
|
|
|
12
13
|
export * from './component';
|
|
13
14
|
export * from './transforms';
|
|
14
15
|
export * from './graph/animation/animation';
|
|
16
|
+
export { vglobal } from '@visactor/vrender-core';
|
|
17
|
+
export * from './env';
|
|
18
|
+
export * from './interactions';
|
package/es/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export const version = "0.
|
|
1
|
+
export const version = "0.8.0";
|
|
2
2
|
|
|
3
3
|
export * from "./graph";
|
|
4
4
|
|
|
5
|
+
export * from "./interactions";
|
|
6
|
+
|
|
5
7
|
export { View } from "./view";
|
|
6
8
|
|
|
7
9
|
export { parseFunctionType, invokeFunctionType } from "./parse/util";
|
|
@@ -24,4 +26,11 @@ export * from "./component";
|
|
|
24
26
|
|
|
25
27
|
export * from "./transforms";
|
|
26
28
|
|
|
27
|
-
export * from "./graph/animation/animation";
|
|
29
|
+
export * from "./graph/animation/animation";
|
|
30
|
+
|
|
31
|
+
export { vglobal } from "@visactor/vrender-core";
|
|
32
|
+
|
|
33
|
+
export * from "./env";
|
|
34
|
+
|
|
35
|
+
export * from "./interactions";
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.8.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';
|
|
2
|
+
import { Tooltip as TooltipComponent } from '@visactor/vrender-components';
|
|
3
|
+
import type { IBounds, IPointLike } from '@visactor/vutils';
|
|
4
|
+
import { BaseInteraction } from './base';
|
|
5
|
+
import type { IMark, ITheme, ITooltipRow, IView, RecursivePartial, TooltipOptions } from '../types';
|
|
6
|
+
export declare const generateTooltipAttributes: (point: IPointLike, title: TooltipRowAttrs, content: TooltipRowAttrs[], bounds: IBounds, theme?: ITheme, addition?: RecursivePartial<TooltipAttributes>) => TooltipAttributes;
|
|
7
|
+
export declare abstract class BaseTooltip<T extends TooltipOptions> extends BaseInteraction<T> {
|
|
8
|
+
options: T;
|
|
9
|
+
protected _tooltipComponent?: TooltipComponent;
|
|
10
|
+
protected _marks?: IMark[];
|
|
11
|
+
constructor(view: IView, options?: T);
|
|
12
|
+
bind(): void;
|
|
13
|
+
unbind(): void;
|
|
14
|
+
protected _computeTooltipRow(row: ITooltipRow, datum: any): {
|
|
15
|
+
visible: boolean;
|
|
16
|
+
key: object;
|
|
17
|
+
value: object;
|
|
18
|
+
shape: object;
|
|
19
|
+
};
|
|
20
|
+
protected _computeTitleContent(datum: any): {
|
|
21
|
+
title: TooltipRowAttrs | {
|
|
22
|
+
visible: boolean;
|
|
23
|
+
key: object;
|
|
24
|
+
value: object;
|
|
25
|
+
shape: object;
|
|
26
|
+
};
|
|
27
|
+
content: any;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Tooltip as TooltipComponent } from "@visactor/vrender-components";
|
|
2
|
+
|
|
3
|
+
import { array, isArray, isFunction, isNil, isObjectLike, isString, isValid, merge } from "@visactor/vutils";
|
|
4
|
+
|
|
5
|
+
import { field as getFieldAccessor } from "@visactor/vgrammar-util";
|
|
6
|
+
|
|
7
|
+
import { BaseInteraction } from "./base";
|
|
8
|
+
|
|
9
|
+
import { isFieldEncode } from "../parse/mark";
|
|
10
|
+
|
|
11
|
+
import { invokeFunctionType } from "../parse/util";
|
|
12
|
+
|
|
13
|
+
export const generateTooltipAttributes = (point, title, content, bounds, theme, addition) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const tooltipTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.tooltip;
|
|
16
|
+
return merge({}, tooltipTheme, {
|
|
17
|
+
visible: !0,
|
|
18
|
+
pointerX: point.x,
|
|
19
|
+
pointerY: point.y,
|
|
20
|
+
title: title,
|
|
21
|
+
content: content,
|
|
22
|
+
parentBounds: bounds
|
|
23
|
+
}, null != addition ? addition : {});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export class BaseTooltip extends BaseInteraction {
|
|
27
|
+
constructor(view, options) {
|
|
28
|
+
super(view, options), this._marks = view.getMarksBySelector(options.selector);
|
|
29
|
+
}
|
|
30
|
+
bind() {
|
|
31
|
+
super.bind();
|
|
32
|
+
const stage = this.view.renderer.stage();
|
|
33
|
+
!this._tooltipComponent && stage && (this._tooltipComponent = new TooltipComponent({}),
|
|
34
|
+
stage.defaultLayer.appendChild(this._tooltipComponent));
|
|
35
|
+
}
|
|
36
|
+
unbind() {
|
|
37
|
+
super.unbind(), this._tooltipComponent && (this._tooltipComponent.release(), this._tooltipComponent = null);
|
|
38
|
+
}
|
|
39
|
+
_computeTooltipRow(row, datum) {
|
|
40
|
+
let key, value, symbol, visible = invokeFunctionType(row.visible, this.parameters(), datum);
|
|
41
|
+
if (visible = !!isNil(visible) || !!visible, isFieldEncode(row.key)) {
|
|
42
|
+
key = getFieldAccessor(row.key.field)(datum);
|
|
43
|
+
} else key = invokeFunctionType(row.key, this.parameters(), datum);
|
|
44
|
+
if (key = isNil(key) ? void 0 : isObjectLike(key) ? key : {
|
|
45
|
+
text: key
|
|
46
|
+
}, isFieldEncode(row.value)) {
|
|
47
|
+
value = getFieldAccessor(row.value.field)(datum);
|
|
48
|
+
} else value = invokeFunctionType(row.value, this.parameters(), datum);
|
|
49
|
+
if (value = isNil(value) ? void 0 : isObjectLike(value) ? value : {
|
|
50
|
+
text: value
|
|
51
|
+
}, isFieldEncode(row.symbol)) {
|
|
52
|
+
symbol = getFieldAccessor(row.symbol.field)(datum);
|
|
53
|
+
} else symbol = invokeFunctionType(row.symbol, this.parameters(), datum);
|
|
54
|
+
return symbol = isNil(symbol) ? void 0 : isObjectLike(symbol) ? symbol : {
|
|
55
|
+
symbolType: symbol
|
|
56
|
+
}, {
|
|
57
|
+
visible: visible,
|
|
58
|
+
key: key,
|
|
59
|
+
value: value,
|
|
60
|
+
shape: symbol
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
_computeTitleContent(datum) {
|
|
64
|
+
const title = isValid(this.options.title) ? isFunction(this.options.title) ? this.options.title.call(null, datum, null, {}) : this._computeTooltipRow(isString(this.options.title) ? {
|
|
65
|
+
value: this.options.title
|
|
66
|
+
} : this.options.title, datum) : void 0, content = isValid(this.options.content) ? isFunction(this.options.content) ? array(this.options.content.call(null, datum, null, {})) : array(datum).reduce(((content, datumRow) => content.concat(array(this.options.content).map((row => this._computeTooltipRow(row, datumRow))))), []) : void 0;
|
|
67
|
+
return {
|
|
68
|
+
title: isArray(title) ? title[0] : title,
|
|
69
|
+
content: content
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=base-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interactions/base-tooltip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAiB,EACjB,KAAsB,EACtB,OAA0B,EAC1B,MAAe,EACf,KAAc,EACd,QAA8C,EAC3B,EAAE;;IACrB,MAAM,YAAY,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,OAAO,CAAC;IAEhD,OAAO,KAAK,CACV,EAAE,EACF,YAAY,EACZ;QACE,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjB,KAAK;QACL,OAAO;QACP,YAAY,EAAE,MAAM;KACrB,EACD,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAgB,WAAsC,SAAQ,eAAkB;IAKpF,YAAY,IAAW,EAAE,OAAW;QAClC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACr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,CAAC;YACV,CAAC,CAAC,SAAS,CAAC;QAGd,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;IAC/D,CAAC;CACF","file":"base-tooltip.js","sourcesContent":["import type { TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tooltip as TooltipComponent } from '@visactor/vrender-components';\nimport type { IBounds, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { array, isArray, isFunction, isNil, isObjectLike, isString, isValid, merge } from '@visactor/vutils';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport { BaseInteraction } from './base';\nimport type { IMark, ITheme, ITooltipRow, IView, RecursivePartial, TooltipOptions } from '../types';\nimport { isFieldEncode } from '../parse/mark';\nimport { invokeFunctionType } from '../parse/util';\n\nexport const generateTooltipAttributes = (\n point: IPointLike,\n title: TooltipRowAttrs,\n content: TooltipRowAttrs[],\n bounds: IBounds,\n theme?: ITheme,\n addition?: RecursivePartial<TooltipAttributes>\n): TooltipAttributes => {\n const tooltipTheme = theme?.components?.tooltip;\n\n return merge(\n {},\n tooltipTheme,\n {\n visible: true,\n pointerX: point.x,\n pointerY: point.y,\n title,\n content,\n parentBounds: bounds\n },\n addition ?? {}\n );\n};\n\nexport abstract class BaseTooltip<T extends TooltipOptions> extends BaseInteraction<T> {\n options: T;\n protected _tooltipComponent?: TooltipComponent;\n protected _marks?: IMark[];\n\n constructor(view: IView, options?: T) {\n super(view, options);\n this._marks = view.getMarksBySelector(options.selector);\n }\n\n bind(): void {\n super.bind();\n\n const stage = this.view.renderer.stage();\n if (this._tooltipComponent || !stage) {\n return;\n }\n this._tooltipComponent = new TooltipComponent({});\n\n (stage.defaultLayer as any).appendChild(this._tooltipComponent);\n }\n\n unbind(): void {\n super.unbind();\n\n if (this._tooltipComponent) {\n this._tooltipComponent.release();\n this._tooltipComponent = null;\n }\n }\n\n protected _computeTooltipRow(row: ITooltipRow, datum: any) {\n // compute visible\n let visible = invokeFunctionType(row.visible, this.parameters(), datum);\n visible = isNil(visible) ? true : !!visible;\n\n // compute key\n let key;\n if (isFieldEncode(row.key)) {\n const fieldAccessor = getFieldAccessor(row.key.field);\n key = fieldAccessor(datum);\n } else {\n key = invokeFunctionType(row.key, this.parameters(), datum);\n }\n key = isNil(key) ? undefined : isObjectLike(key) ? key : { text: key };\n\n // compute value\n let value;\n if (isFieldEncode(row.value)) {\n const fieldAccessor = getFieldAccessor(row.value.field);\n value = fieldAccessor(datum);\n } else {\n value = invokeFunctionType(row.value, this.parameters(), datum);\n }\n value = isNil(value) ? undefined : isObjectLike(value) ? value : { text: value };\n\n // compute symbol\n let symbol;\n if (isFieldEncode(row.symbol)) {\n const fieldAccessor = getFieldAccessor(row.symbol.field);\n symbol = fieldAccessor(datum);\n } else {\n symbol = invokeFunctionType(row.symbol, this.parameters(), datum);\n }\n symbol = isNil(symbol) ? undefined : isObjectLike(symbol) ? symbol : { symbolType: symbol };\n\n return { visible, key, value, shape: symbol };\n }\n\n protected _computeTitleContent(datum: any) {\n const title = isValid(this.options.title)\n ? isFunction(this.options.title)\n ? this.options.title.call(null, datum, null, {})\n : this._computeTooltipRow(\n isString(this.options.title) ? { value: this.options.title } : this.options.title,\n datum\n )\n : undefined;\n const content = isValid(this.options.content)\n ? isFunction(this.options.content)\n ? array(this.options.content.call(null, datum, null, {}))\n : array(datum).reduce((content, datumRow) => {\n return content.concat(\n array(this.options.content).map(row => this._computeTooltipRow(row as ITooltipRow, datumRow))\n );\n }, [])\n : undefined;\n\n // only display one single row in title\n return { title: isArray(title) ? title[0] : title, content };\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IBaseInteractionOptions, IGrammarBase, IView, InteractionEventHandler } from '../types';
|
|
2
|
+
export declare abstract class BaseInteraction<T extends IBaseInteractionOptions> {
|
|
3
|
+
readonly view: IView;
|
|
4
|
+
constructor(view: IView, options: T);
|
|
5
|
+
references: Map<IGrammarBase, number>;
|
|
6
|
+
protected abstract getEvents(): Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
handler: InteractionEventHandler;
|
|
9
|
+
}>;
|
|
10
|
+
depend(grammar: IGrammarBase[] | IGrammarBase | string[] | string): void;
|
|
11
|
+
parameters(): any;
|
|
12
|
+
bind(): void;
|
|
13
|
+
unbind(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { array, isNil, isString, isValid } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export class BaseInteraction {
|
|
4
|
+
constructor(view, options) {
|
|
5
|
+
this.references = new Map, this.view = view, this.depend(null == options ? void 0 : options.dependencies);
|
|
6
|
+
}
|
|
7
|
+
depend(grammar) {
|
|
8
|
+
this.references.clear(), array(grammar).map((grammar => isString(grammar) ? this.view.getGrammarById(grammar) : grammar)).filter((ref => !isNil(ref))).forEach((ref => {
|
|
9
|
+
var _a;
|
|
10
|
+
this.references.set(ref, (null !== (_a = this.references.get(ref)) && void 0 !== _a ? _a : 0) + 1);
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
parameters() {
|
|
14
|
+
const params = {};
|
|
15
|
+
return this.references.forEach(((count, ref) => {
|
|
16
|
+
isValid(ref.id()) && (params[ref.id()] = ref.output());
|
|
17
|
+
})), params;
|
|
18
|
+
}
|
|
19
|
+
bind() {
|
|
20
|
+
const events = this.getEvents();
|
|
21
|
+
(null != events ? events : []).forEach((evt => {
|
|
22
|
+
evt.type && evt.handler && this.view.addEventListener(evt.type, evt.handler);
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
unbind() {
|
|
26
|
+
const events = this.getEvents();
|
|
27
|
+
(null != events ? events : []).forEach((evt => {
|
|
28
|
+
evt.type && evt.handler && this.view.removeEventListener(evt.type, evt.handler);
|
|
29
|
+
}));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CAAC,EAAE;gBACrB,MAAM,CAAC,GAAG,CAAC,EAAE,EAAY,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;aAC3C;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC3B,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;aACnD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QAEJ,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC3B,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;aACtD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"base.js","sourcesContent":["import { array, isArray, isNil, isString, isValid } from '@visactor/vutils';\nimport type { IBaseInteractionOptions, IGrammarBase, IView, InteractionEventHandler } from '../types';\n\nexport abstract class BaseInteraction<T extends IBaseInteractionOptions> {\n readonly view: IView;\n\n constructor(view: IView, options: T) {\n this.view = view;\n this.depend(options?.dependencies);\n }\n\n references: Map<IGrammarBase, number> = new Map();\n\n protected abstract getEvents(): Array<{ type: string; handler: InteractionEventHandler }>;\n\n depend(grammar: IGrammarBase[] | IGrammarBase | string[] | string) {\n this.references.clear();\n array(grammar)\n .map(grammar => (isString(grammar) ? this.view.getGrammarById(grammar) : grammar))\n .filter(ref => !isNil(ref))\n .forEach(ref => {\n this.references.set(ref, (this.references.get(ref) ?? 0) + 1);\n });\n }\n\n parameters() {\n const params: any = {};\n this.references.forEach((count, ref) => {\n // upstream reference with no valid id will not be recorded in parameters\n if (isValid(ref.id())) {\n params[ref.id() as string] = ref.output();\n }\n });\n return params;\n }\n\n bind() {\n const events = this.getEvents();\n\n (events ?? []).forEach(evt => {\n if (evt.type && evt.handler) {\n this.view.addEventListener(evt.type, evt.handler);\n }\n });\n }\n\n unbind() {\n // unbind events\n const events = this.getEvents();\n\n (events ?? []).forEach(evt => {\n if (evt.type && evt.handler) {\n this.view.removeEventListener(evt.type, evt.handler);\n }\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IPolygon } from '@visactor/vrender-core';
|
|
2
|
+
import type { BrushActiveOptions, IView } from '../types';
|
|
3
|
+
import { BrushBase } from './brush-base';
|
|
4
|
+
import { type IBounds } from '@visactor/vutils';
|
|
5
|
+
export declare class BrushActive extends BrushBase<BrushActiveOptions> {
|
|
6
|
+
static type: string;
|
|
7
|
+
type: string;
|
|
8
|
+
static defaultOptions: BrushActiveOptions;
|
|
9
|
+
constructor(view: IView, option?: BrushActiveOptions);
|
|
10
|
+
handleBrushUpdate: (options: {
|
|
11
|
+
operateType: string;
|
|
12
|
+
operateMask: IPolygon;
|
|
13
|
+
operatedMaskAABBBounds: {
|
|
14
|
+
[name: string]: IBounds;
|
|
15
|
+
};
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InteractionStateEnum } from "../graph/enums";
|
|
2
|
+
|
|
3
|
+
import { BrushBase } from "./brush-base";
|
|
4
|
+
|
|
5
|
+
export class BrushActive extends BrushBase {
|
|
6
|
+
constructor(view, option) {
|
|
7
|
+
super(view, Object.assign({}, BrushActive.defaultOptions, option)), this.type = BrushActive.type,
|
|
8
|
+
this.handleBrushUpdate = options => {
|
|
9
|
+
const elements = [];
|
|
10
|
+
this._marks.forEach((mark => {
|
|
11
|
+
mark.elements.forEach((el => {
|
|
12
|
+
this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem()) ? (elements.push(el),
|
|
13
|
+
el.addState(this.options.state)) : el.removeState(this.options.state);
|
|
14
|
+
}));
|
|
15
|
+
})), this.dispatchEvent(options, elements);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
BrushActive.type = "brush-active", BrushActive.defaultOptions = {
|
|
21
|
+
state: InteractionStateEnum.active
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=brush-active.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interactions/brush-active.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,WAAY,SAAQ,SAA6B;IAQ5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QAPrE,SAAI,GAAW,WAAW,CAAC,IAAI,CAAC;QAUhC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;oBAE1F,IAAI,QAAQ,EAAE;wBACZ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBAClB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACjC;yBAAM;wBACL,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACpC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;IAvBF,CAAC;;AATM,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,oBAAoB,CAAC,MAAM;CACnC,CAAC","file":"brush-active.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender-core';\nimport { InteractionStateEnum } from '../graph/enums';\nimport type { BrushActiveOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { type IBounds } from '@visactor/vutils';\n\nexport class BrushActive extends BrushBase<BrushActiveOptions> {\n static type: string = 'brush-active';\n type: string = BrushActive.type;\n\n static defaultOptions: BrushActiveOptions = {\n state: InteractionStateEnum.active\n };\n\n constructor(view: IView, option?: BrushActiveOptions) {\n super(view, Object.assign({}, BrushActive.defaultOptions, option));\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isActive = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isActive) {\n elements.push(el);\n el.addState(this.options.state);\n } else {\n el.removeState(this.options.state);\n }\n });\n });\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Brush } from '@visactor/vrender-components';
|
|
2
|
+
import type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';
|
|
3
|
+
import { BaseInteraction } from './base';
|
|
4
|
+
import type { IGraphic, IPolygon } from '@visactor/vrender-core';
|
|
5
|
+
import { type IBounds } from '@visactor/vutils';
|
|
6
|
+
export declare abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {
|
|
7
|
+
options: T;
|
|
8
|
+
protected _brushComp?: Brush;
|
|
9
|
+
protected _marks?: IMark[];
|
|
10
|
+
constructor(view: IView, options?: T);
|
|
11
|
+
protected getEvents(): Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
handler: InteractionEventHandler;
|
|
14
|
+
}>;
|
|
15
|
+
protected isPolygonBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}): boolean;
|
|
19
|
+
protected isRectBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}): boolean;
|
|
23
|
+
protected isBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}): boolean;
|
|
27
|
+
handleAfterDraw: () => void;
|
|
28
|
+
abstract handleBrushUpdate: (options: {
|
|
29
|
+
operateType: string;
|
|
30
|
+
operateMask: IPolygon;
|
|
31
|
+
operatedMaskAABBBounds: {
|
|
32
|
+
[name: string]: IBounds;
|
|
33
|
+
};
|
|
34
|
+
}) => void;
|
|
35
|
+
unbind(): void;
|
|
36
|
+
protected dispatchEvent(options: {
|
|
37
|
+
operateType: string;
|
|
38
|
+
operateMask: IPolygon;
|
|
39
|
+
operatedMaskAABBBounds: {
|
|
40
|
+
[name: string]: IBounds;
|
|
41
|
+
};
|
|
42
|
+
}, activeElements: (IElement | IGlyphElement)[]): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Brush, IOperateType } from "@visactor/vrender-components";
|
|
2
|
+
|
|
3
|
+
import { BaseInteraction } from "./base";
|
|
4
|
+
|
|
5
|
+
import { polygonContainPoint, polygonIntersectPolygon, isRectIntersect } from "@visactor/vutils";
|
|
6
|
+
|
|
7
|
+
import { HOOK_EVENT } from "../graph";
|
|
8
|
+
|
|
9
|
+
export class BrushBase extends BaseInteraction {
|
|
10
|
+
constructor(view, options) {
|
|
11
|
+
super(view, options), this.handleAfterDraw = () => {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const stage = this.view.renderer.stage();
|
|
14
|
+
if (this._brushComp || !stage) return;
|
|
15
|
+
const viewBox = this.view.getViewBox();
|
|
16
|
+
this._brushComp = new Brush({
|
|
17
|
+
interactiveRange: null !== (_a = this.options.interactiveRange) && void 0 !== _a ? _a : {
|
|
18
|
+
minX: viewBox.x1,
|
|
19
|
+
maxX: viewBox.x2,
|
|
20
|
+
minY: viewBox.y1,
|
|
21
|
+
maxY: viewBox.y2
|
|
22
|
+
},
|
|
23
|
+
xRange: null !== (_b = this.options.xRange) && void 0 !== _b ? _b : [ viewBox.x1, viewBox.x2 ],
|
|
24
|
+
yRange: null !== (_c = this.options.yRange) && void 0 !== _c ? _c : [ viewBox.y1, viewBox.y2 ],
|
|
25
|
+
brushMode: null !== (_d = this.options.brushMode) && void 0 !== _d ? _d : "single",
|
|
26
|
+
brushType: this.options.brushType,
|
|
27
|
+
brushStyle: this.options.brushStyle,
|
|
28
|
+
brushMoved: this.options.brushMoved,
|
|
29
|
+
removeOnClick: this.options.removeOnClick,
|
|
30
|
+
sizeThreshold: this.options.sizeThreshold,
|
|
31
|
+
delayType: this.options.delayType,
|
|
32
|
+
delayTime: this.options.delayTime
|
|
33
|
+
}), this._brushComp.setUpdateDragMaskCallback(this.handleBrushUpdate), stage.defaultLayer.appendChild(this._brushComp);
|
|
34
|
+
}, this.options = options, this._marks = view.getMarksBySelector(this.options.selector);
|
|
35
|
+
}
|
|
36
|
+
getEvents() {
|
|
37
|
+
return [ {
|
|
38
|
+
type: HOOK_EVENT.BEFORE_DO_RENDER,
|
|
39
|
+
handler: this.handleAfterDraw
|
|
40
|
+
} ];
|
|
41
|
+
}
|
|
42
|
+
isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const points = brushMask.attribute.points, {a: a, b: b, c: c, d: d, e: e, f: f} = brushMask.globalTransMatrix, dx = null !== (_a = null == offset ? void 0 : offset.x) && void 0 !== _a ? _a : 0, dy = null !== (_b = null == offset ? void 0 : offset.y) && void 0 !== _b ? _b : 0, pointsCoord = points.map((p => ({
|
|
45
|
+
x: a * p.x + c * p.y + e + dx,
|
|
46
|
+
y: b * p.x + d * p.y + f + dy
|
|
47
|
+
}))), globalAABBBoundsOffset = brushMask.globalAABBBounds.clone().set(brushMask.globalAABBBounds.x1 + dx, brushMask.globalAABBBounds.y1 + dy, brushMask.globalAABBBounds.x2 + dx, brushMask.globalAABBBounds.y2 + dy), x = graphicItem.globalTransMatrix.e, y = graphicItem.globalTransMatrix.f;
|
|
48
|
+
if ("symbol" === graphicItem.type || "circle" === graphicItem.type) return globalAABBBoundsOffset.contains(x, y) && polygonContainPoint(pointsCoord, x, y);
|
|
49
|
+
if ("rect" === graphicItem.type) {
|
|
50
|
+
const {width: width = 0, height: height = 0} = null == graphicItem ? void 0 : graphicItem.attribute;
|
|
51
|
+
return polygonIntersectPolygon(pointsCoord, [ {
|
|
52
|
+
x: x,
|
|
53
|
+
y: y
|
|
54
|
+
}, {
|
|
55
|
+
x: x + width,
|
|
56
|
+
y: y
|
|
57
|
+
}, {
|
|
58
|
+
x: x + width,
|
|
59
|
+
y: y + height
|
|
60
|
+
}, {
|
|
61
|
+
x: x,
|
|
62
|
+
y: y + height
|
|
63
|
+
} ]);
|
|
64
|
+
}
|
|
65
|
+
return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);
|
|
66
|
+
}
|
|
67
|
+
isRectBrushContainGraphicItem(brushMask, graphicItem, offset) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const dx = null !== (_a = null == offset ? void 0 : offset.x) && void 0 !== _a ? _a : 0, dy = null !== (_b = null == offset ? void 0 : offset.y) && void 0 !== _b ? _b : 0, globalAABBBoundsOffset = brushMask.globalAABBBounds.clone().set(brushMask.globalAABBBounds.x1 + dx, brushMask.globalAABBBounds.y1 + dy, brushMask.globalAABBBounds.x2 + dx, brushMask.globalAABBBounds.y2 + dy), x = graphicItem.globalTransMatrix.e, y = graphicItem.globalTransMatrix.f;
|
|
70
|
+
if ("symbol" === graphicItem.type || "circle" === graphicItem.type) return globalAABBBoundsOffset.contains(x, y);
|
|
71
|
+
if ("rect" === graphicItem.type) {
|
|
72
|
+
const {width: width = 0, height: height = 0} = null == graphicItem ? void 0 : graphicItem.attribute;
|
|
73
|
+
return isRectIntersect(globalAABBBoundsOffset, {
|
|
74
|
+
x1: x,
|
|
75
|
+
y1: y,
|
|
76
|
+
x2: x + width,
|
|
77
|
+
y2: y + height
|
|
78
|
+
}, !1);
|
|
79
|
+
}
|
|
80
|
+
return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);
|
|
81
|
+
}
|
|
82
|
+
isBrushContainGraphicItem(brushMask, graphicItem, offset) {
|
|
83
|
+
var _a;
|
|
84
|
+
return !(!((null == brushMask ? void 0 : brushMask.globalTransMatrix) && brushMask.globalAABBBounds && !brushMask.globalAABBBounds.empty() && graphicItem && (null === (_a = null == brushMask ? void 0 : brushMask.attribute) || void 0 === _a ? void 0 : _a.points)) || brushMask.attribute.points.length <= 1) && ("polygon" === this.options.brushType ? this.isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset) : this.isRectBrushContainGraphicItem(brushMask, graphicItem, offset));
|
|
85
|
+
}
|
|
86
|
+
unbind() {
|
|
87
|
+
super.unbind(), this._brushComp && (this._brushComp.releaseBrushEvents(), this._brushComp.release(),
|
|
88
|
+
this._brushComp = null);
|
|
89
|
+
}
|
|
90
|
+
dispatchEvent(options, activeElements) {
|
|
91
|
+
const params = {
|
|
92
|
+
operateType: options.operateType,
|
|
93
|
+
operateMask: options.operateMask,
|
|
94
|
+
activeElements: activeElements
|
|
95
|
+
};
|
|
96
|
+
options.operateType === IOperateType.drawStart || options.operateType === IOperateType.moveStart ? (this.view.emit("brushStart", params),
|
|
97
|
+
this.options.onStart && this.options.onStart(params)) : options.operateType === IOperateType.drawing || options.operateType === IOperateType.moving ? (this.view.emit("brushUpdate", params),
|
|
98
|
+
this.options.onUpdate && this.options.onEnd(params)) : options.operateType === IOperateType.drawEnd || options.operateType === IOperateType.moveEnd ? (this.view.emit("brushEnd", params),
|
|
99
|
+
this.options.onEnd && this.options.onEnd(params)) : (this.view.emit("brushReset", params),
|
|
100
|
+
this.options.onReset && this.options.onReset(params));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=brush-base.js.map
|