@visactor/vgrammar-core 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/README.zh-CN.md +11 -0
- package/cjs/component/axis.d.ts +26 -0
- package/cjs/component/axis.js +164 -0
- package/cjs/component/axis.js.map +1 -0
- package/cjs/component/crosshair.d.ts +50 -0
- package/cjs/component/crosshair.js +281 -0
- package/cjs/component/crosshair.js.map +1 -0
- package/cjs/component/datazoom.d.ts +19 -0
- package/cjs/component/datazoom.js +166 -0
- package/cjs/component/datazoom.js.map +1 -0
- package/cjs/component/grid.d.ts +27 -0
- package/cjs/component/grid.js +190 -0
- package/cjs/component/grid.js.map +1 -0
- package/cjs/component/index.d.ts +11 -0
- package/cjs/component/index.js +105 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/component/label.d.ts +19 -0
- package/cjs/component/label.js +121 -0
- package/cjs/component/label.js.map +1 -0
- package/cjs/component/legend.d.ts +26 -0
- package/cjs/component/legend.js +170 -0
- package/cjs/component/legend.js.map +1 -0
- package/cjs/component/player.d.ts +25 -0
- package/cjs/component/player.js +138 -0
- package/cjs/component/player.js.map +1 -0
- package/cjs/component/scale.d.ts +8 -0
- package/cjs/component/scale.js +25 -0
- package/cjs/component/scale.js.map +1 -0
- package/cjs/component/scrollbar.d.ts +23 -0
- package/cjs/component/scrollbar.js +187 -0
- package/cjs/component/scrollbar.js.map +1 -0
- package/cjs/component/slider.d.ts +19 -0
- package/cjs/component/slider.js +86 -0
- package/cjs/component/slider.js.map +1 -0
- package/cjs/component/title.d.ts +15 -0
- package/cjs/component/title.js +56 -0
- package/cjs/component/title.js.map +1 -0
- package/cjs/component/tooltip.d.ts +62 -0
- package/cjs/component/tooltip.js +305 -0
- package/cjs/component/tooltip.js.map +1 -0
- package/cjs/core/factory.d.ts +35 -0
- package/cjs/core/factory.js +73 -0
- package/cjs/core/factory.js.map +1 -0
- package/cjs/glyph/boxplot.d.ts +10 -0
- package/cjs/glyph/boxplot.js +418 -0
- package/cjs/glyph/boxplot.js.map +1 -0
- package/cjs/glyph/index.d.ts +7 -0
- package/cjs/glyph/index.js +64 -0
- package/cjs/glyph/index.js.map +1 -0
- package/cjs/glyph/link-path.d.ts +7 -0
- package/cjs/glyph/link-path.js +138 -0
- package/cjs/glyph/link-path.js.map +1 -0
- package/cjs/glyph/ripple.d.ts +1 -0
- package/cjs/glyph/ripple.js +44 -0
- package/cjs/glyph/ripple.js.map +1 -0
- package/cjs/glyph/tree-path.d.ts +7 -0
- package/cjs/glyph/tree-path.js +152 -0
- package/cjs/glyph/tree-path.js.map +1 -0
- package/cjs/glyph/violin.d.ts +1 -0
- package/cjs/glyph/violin.js +165 -0
- package/cjs/glyph/violin.js.map +1 -0
- package/cjs/glyph/wave.d.ts +1 -0
- package/cjs/glyph/wave.js +67 -0
- package/cjs/glyph/wave.js.map +1 -0
- package/cjs/graph/animation/animate.d.ts +48 -0
- package/cjs/graph/animation/animate.js +250 -0
- package/cjs/graph/animation/animate.js.map +1 -0
- package/cjs/graph/animation/animation/clip.d.ts +4 -0
- package/cjs/graph/animation/animation/clip.js +54 -0
- package/cjs/graph/animation/animation/clip.js.map +1 -0
- package/cjs/graph/animation/animation/fade.d.ts +4 -0
- package/cjs/graph/animation/animation/fade.js +42 -0
- package/cjs/graph/animation/animation/fade.js.map +1 -0
- package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
- package/cjs/graph/animation/animation/grow-interval.js +194 -0
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
- package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-points.js +118 -0
- package/cjs/graph/animation/animation/grow-points.js.map +1 -0
- package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
- package/cjs/graph/animation/animation/grow-polar.js +164 -0
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
- package/cjs/graph/animation/animation/index.d.ts +11 -0
- package/cjs/graph/animation/animation/index.js +191 -0
- package/cjs/graph/animation/animation/index.js.map +1 -0
- package/cjs/graph/animation/animation/move.d.ts +3 -0
- package/cjs/graph/animation/animation/move.js +90 -0
- package/cjs/graph/animation/animation/move.js.map +1 -0
- package/cjs/graph/animation/animation/rotate.d.ts +3 -0
- package/cjs/graph/animation/animation/rotate.js +42 -0
- package/cjs/graph/animation/animation/rotate.js.map +1 -0
- package/cjs/graph/animation/animation/scale.d.ts +3 -0
- package/cjs/graph/animation/animation/scale.js +84 -0
- package/cjs/graph/animation/animation/scale.js.map +1 -0
- package/cjs/graph/animation/animation/update.d.ts +6 -0
- package/cjs/graph/animation/animation/update.js +22 -0
- package/cjs/graph/animation/animation/update.js.map +1 -0
- package/cjs/graph/animation/animator.d.ts +26 -0
- package/cjs/graph/animation/animator.js +88 -0
- package/cjs/graph/animation/animator.js.map +1 -0
- package/cjs/graph/animation/arranger.d.ts +13 -0
- package/cjs/graph/animation/arranger.js +38 -0
- package/cjs/graph/animation/arranger.js.map +1 -0
- package/cjs/graph/animation/attribute.d.ts +27 -0
- package/cjs/graph/animation/attribute.js +124 -0
- package/cjs/graph/animation/attribute.js.map +1 -0
- package/cjs/graph/animation/config.d.ts +5 -0
- package/cjs/graph/animation/config.js +92 -0
- package/cjs/graph/animation/config.js.map +1 -0
- package/cjs/graph/animation/morph.d.ts +12 -0
- package/cjs/graph/animation/morph.js +174 -0
- package/cjs/graph/animation/morph.js.map +1 -0
- package/cjs/graph/attributes/common.d.ts +2 -0
- package/cjs/graph/attributes/common.js +22 -0
- package/cjs/graph/attributes/common.js.map +1 -0
- package/cjs/graph/attributes/helpers.d.ts +17 -0
- package/cjs/graph/attributes/helpers.js +86 -0
- package/cjs/graph/attributes/helpers.js.map +1 -0
- package/cjs/graph/attributes/index.d.ts +10 -0
- package/cjs/graph/attributes/index.js +257 -0
- package/cjs/graph/attributes/index.js.map +1 -0
- package/cjs/graph/canvas-renderer.d.ts +34 -0
- package/cjs/graph/canvas-renderer.js +121 -0
- package/cjs/graph/canvas-renderer.js.map +1 -0
- package/cjs/graph/constants.d.ts +23 -0
- package/cjs/graph/constants.js +21 -0
- package/cjs/graph/constants.js.map +1 -0
- package/cjs/graph/element.d.ts +66 -0
- package/cjs/graph/element.js +297 -0
- package/cjs/graph/element.js.map +1 -0
- package/cjs/graph/enums.d.ts +153 -0
- package/cjs/graph/enums.js +85 -0
- package/cjs/graph/enums.js.map +1 -0
- package/cjs/graph/glyph-element.d.ts +53 -0
- package/cjs/graph/glyph-element.js +202 -0
- package/cjs/graph/glyph-element.js.map +1 -0
- package/cjs/graph/index.d.ts +3 -0
- package/cjs/graph/index.js +44 -0
- package/cjs/graph/index.js.map +1 -0
- package/cjs/graph/layout/grid.d.ts +3 -0
- package/cjs/graph/layout/grid.js +75 -0
- package/cjs/graph/layout/grid.js.map +1 -0
- package/cjs/graph/layout/layout.d.ts +3 -0
- package/cjs/graph/layout/layout.js +33 -0
- package/cjs/graph/layout/layout.js.map +1 -0
- package/cjs/graph/layout/relative.d.ts +3 -0
- package/cjs/graph/layout/relative.js +86 -0
- package/cjs/graph/layout/relative.js.map +1 -0
- package/cjs/graph/mark/differ.d.ts +20 -0
- package/cjs/graph/mark/differ.js +110 -0
- package/cjs/graph/mark/differ.js.map +1 -0
- package/cjs/graph/mark/encode.d.ts +10 -0
- package/cjs/graph/mark/encode.js +95 -0
- package/cjs/graph/mark/encode.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +10 -0
- package/cjs/graph/mark/large-rects.js +31 -0
- package/cjs/graph/mark/large-rects.js.map +1 -0
- package/cjs/graph/mark/large-symbols.d.ts +11 -0
- package/cjs/graph/mark/large-symbols.js +33 -0
- package/cjs/graph/mark/large-symbols.js.map +1 -0
- package/cjs/graph/mark-tree.d.ts +2 -0
- package/cjs/graph/mark-tree.js +21 -0
- package/cjs/graph/mark-tree.js.map +1 -0
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/env.d.ts +2 -0
- package/cjs/graph/util/env.js +14 -0
- package/cjs/graph/util/env.js.map +1 -0
- package/cjs/graph/util/events-extend.d.ts +5 -0
- package/cjs/graph/util/events-extend.js +18 -0
- package/cjs/graph/util/events-extend.js.map +1 -0
- package/cjs/graph/util/graphic.d.ts +9 -0
- package/cjs/graph/util/graphic.js +59 -0
- package/cjs/graph/util/graphic.js.map +1 -0
- package/cjs/graph/util/point.d.ts +1 -0
- package/cjs/graph/util/point.js +75 -0
- package/cjs/graph/util/point.js.map +1 -0
- package/cjs/index.d.ts +14 -0
- package/cjs/index.js +111 -0
- package/cjs/index.js.map +1 -0
- package/cjs/parse/coordinate.d.ts +7 -0
- package/cjs/parse/coordinate.js +70 -0
- package/cjs/parse/coordinate.js.map +1 -0
- package/cjs/parse/event.d.ts +8 -0
- package/cjs/parse/event.js +33 -0
- package/cjs/parse/event.js.map +1 -0
- package/cjs/parse/mark.d.ts +4 -0
- package/cjs/parse/mark.js +25 -0
- package/cjs/parse/mark.js.map +1 -0
- package/cjs/parse/option.d.ts +3 -0
- package/cjs/parse/option.js +19 -0
- package/cjs/parse/option.js.map +1 -0
- package/cjs/parse/scale.d.ts +8 -0
- package/cjs/parse/scale.js +365 -0
- package/cjs/parse/scale.js.map +1 -0
- package/cjs/parse/transform.d.ts +5 -0
- package/cjs/parse/transform.js +103 -0
- package/cjs/parse/transform.js.map +1 -0
- package/cjs/parse/util.d.ts +13 -0
- package/cjs/parse/util.js +82 -0
- package/cjs/parse/util.js.map +1 -0
- package/cjs/parse/view.d.ts +17 -0
- package/cjs/parse/view.js +108 -0
- package/cjs/parse/view.js.map +1 -0
- package/cjs/semantic-marks/cell.d.ts +13 -0
- package/cjs/semantic-marks/cell.js +61 -0
- package/cjs/semantic-marks/cell.js.map +1 -0
- package/cjs/semantic-marks/interval.d.ts +14 -0
- package/cjs/semantic-marks/interval.js +80 -0
- package/cjs/semantic-marks/interval.js.map +1 -0
- package/cjs/semantic-marks/text.d.ts +10 -0
- package/cjs/semantic-marks/text.js +25 -0
- package/cjs/semantic-marks/text.js.map +1 -0
- package/cjs/theme/common/component.d.ts +15 -0
- package/cjs/theme/common/component.js +493 -0
- package/cjs/theme/common/component.js.map +1 -0
- package/cjs/theme/common/constants.d.ts +1 -0
- package/cjs/theme/common/constants.js +6 -0
- package/cjs/theme/common/constants.js.map +1 -0
- package/cjs/theme/common/mark.d.ts +2 -0
- package/cjs/theme/common/mark.js +15 -0
- package/cjs/theme/common/mark.js.map +1 -0
- package/cjs/theme/dark.d.ts +2 -0
- package/cjs/theme/dark.js +94 -0
- package/cjs/theme/dark.js.map +1 -0
- package/cjs/theme/default.d.ts +2 -0
- package/cjs/theme/default.js +18 -0
- package/cjs/theme/default.js.map +1 -0
- package/cjs/theme/theme-manager.d.ts +8 -0
- package/cjs/theme/theme-manager.js +26 -0
- package/cjs/theme/theme-manager.js.map +1 -0
- package/cjs/transforms/data/bin.d.ts +2 -0
- package/cjs/transforms/data/bin.js +21 -0
- package/cjs/transforms/data/bin.js.map +1 -0
- package/cjs/transforms/data/circular-relation.d.ts +2 -0
- package/cjs/transforms/data/circular-relation.js +56 -0
- package/cjs/transforms/data/circular-relation.js.map +1 -0
- package/cjs/transforms/data/contour.d.ts +2 -0
- package/cjs/transforms/data/contour.js +115 -0
- package/cjs/transforms/data/contour.js.map +1 -0
- package/cjs/transforms/data/filter.d.ts +2 -0
- package/cjs/transforms/data/filter.js +10 -0
- package/cjs/transforms/data/filter.js.map +1 -0
- package/cjs/transforms/data/fold.d.ts +2 -0
- package/cjs/transforms/data/fold.js +24 -0
- package/cjs/transforms/data/fold.js.map +1 -0
- package/cjs/transforms/data/funnel.d.ts +2 -0
- package/cjs/transforms/data/funnel.js +25 -0
- package/cjs/transforms/data/funnel.js.map +1 -0
- package/cjs/transforms/data/join.d.ts +2 -0
- package/cjs/transforms/data/join.js +33 -0
- package/cjs/transforms/data/join.js.map +1 -0
- package/cjs/transforms/data/kde.d.ts +2 -0
- package/cjs/transforms/data/kde.js +90 -0
- package/cjs/transforms/data/kde.js.map +1 -0
- package/cjs/transforms/data/map.d.ts +2 -0
- package/cjs/transforms/data/map.js +23 -0
- package/cjs/transforms/data/map.js.map +1 -0
- package/cjs/transforms/data/pick.d.ts +2 -0
- package/cjs/transforms/data/pick.js +20 -0
- package/cjs/transforms/data/pick.js.map +1 -0
- package/cjs/transforms/data/pie.d.ts +2 -0
- package/cjs/transforms/data/pie.js +24 -0
- package/cjs/transforms/data/pie.js.map +1 -0
- package/cjs/transforms/data/range.d.ts +4 -0
- package/cjs/transforms/data/range.js +15 -0
- package/cjs/transforms/data/range.js.map +1 -0
- package/cjs/transforms/data/sort.d.ts +2 -0
- package/cjs/transforms/data/sort.js +17 -0
- package/cjs/transforms/data/sort.js.map +1 -0
- package/cjs/transforms/data/stack.d.ts +2 -0
- package/cjs/transforms/data/stack.js +74 -0
- package/cjs/transforms/data/stack.js.map +1 -0
- package/cjs/transforms/data/unfold.d.ts +2 -0
- package/cjs/transforms/data/unfold.js +49 -0
- package/cjs/transforms/data/unfold.js.map +1 -0
- package/cjs/transforms/index.d.ts +23 -0
- package/cjs/transforms/index.js +213 -0
- package/cjs/transforms/index.js.map +1 -0
- package/cjs/transforms/mark/dodge.d.ts +2 -0
- package/cjs/transforms/mark/dodge.js +81 -0
- package/cjs/transforms/mark/dodge.js.map +1 -0
- package/cjs/transforms/mark/jitter.d.ts +4 -0
- package/cjs/transforms/mark/jitter.js +53 -0
- package/cjs/transforms/mark/jitter.js.map +1 -0
- package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
- package/cjs/transforms/mark/lttb-sample.js +68 -0
- package/cjs/transforms/mark/lttb-sample.js.map +1 -0
- package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
- package/cjs/transforms/mark/mark-overlap.js +79 -0
- package/cjs/transforms/mark/mark-overlap.js.map +1 -0
- package/cjs/transforms/mark/symmetry.d.ts +2 -0
- package/cjs/transforms/mark/symmetry.js +25 -0
- package/cjs/transforms/mark/symmetry.js.map +1 -0
- package/cjs/transforms/util/util.d.ts +5 -0
- package/cjs/transforms/util/util.js +41 -0
- package/cjs/transforms/util/util.js.map +1 -0
- package/cjs/transforms/view/identifier.d.ts +2 -0
- package/cjs/transforms/view/identifier.js +17 -0
- package/cjs/transforms/view/identifier.js.map +1 -0
- package/cjs/types/animate.d.ts +224 -0
- package/cjs/types/animate.js +6 -0
- package/cjs/types/animate.js.map +1 -0
- package/cjs/types/base.d.ts +36 -0
- package/cjs/types/base.js +6 -0
- package/cjs/types/base.js.map +1 -0
- package/cjs/types/component.d.ts +240 -0
- package/cjs/types/component.js +6 -0
- package/cjs/types/component.js.map +1 -0
- package/cjs/types/coordinate.d.ts +15 -0
- package/cjs/types/coordinate.js +6 -0
- package/cjs/types/coordinate.js.map +1 -0
- package/cjs/types/data.d.ts +55 -0
- package/cjs/types/data.js +5 -0
- package/cjs/types/data.js.map +1 -0
- package/cjs/types/dataflow.d.ts +13 -0
- package/cjs/types/dataflow.js +6 -0
- package/cjs/types/dataflow.js.map +1 -0
- package/cjs/types/element.d.ts +117 -0
- package/cjs/types/element.js +6 -0
- package/cjs/types/element.js.map +1 -0
- package/cjs/types/event.d.ts +58 -0
- package/cjs/types/event.js +6 -0
- package/cjs/types/event.js.map +1 -0
- package/cjs/types/glyph.d.ts +29 -0
- package/cjs/types/glyph.js +6 -0
- package/cjs/types/glyph.js.map +1 -0
- package/cjs/types/grammar.d.ts +184 -0
- package/cjs/types/grammar.js +6 -0
- package/cjs/types/grammar.js.map +1 -0
- package/cjs/types/hooks.d.ts +45 -0
- package/cjs/types/hooks.js +6 -0
- package/cjs/types/hooks.js.map +1 -0
- package/cjs/types/index.d.ts +22 -0
- package/cjs/types/index.js +31 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/layout.d.ts +5 -0
- package/cjs/types/layout.js +6 -0
- package/cjs/types/layout.js.map +1 -0
- package/cjs/types/mark.d.ts +344 -0
- package/cjs/types/mark.js +6 -0
- package/cjs/types/mark.js.map +1 -0
- package/cjs/types/morph.d.ts +29 -0
- package/cjs/types/morph.js +6 -0
- package/cjs/types/morph.js.map +1 -0
- package/cjs/types/plot.d.ts +326 -0
- package/cjs/types/plot.js +6 -0
- package/cjs/types/plot.js.map +1 -0
- package/cjs/types/projection.d.ts +61 -0
- package/cjs/types/projection.js +6 -0
- package/cjs/types/projection.js.map +1 -0
- package/cjs/types/renderer.d.ts +19 -0
- package/cjs/types/renderer.js +6 -0
- package/cjs/types/renderer.js.map +1 -0
- package/cjs/types/scale.d.ts +111 -0
- package/cjs/types/scale.js +6 -0
- package/cjs/types/scale.js.map +1 -0
- package/cjs/types/signal.d.ts +20 -0
- package/cjs/types/signal.js +6 -0
- package/cjs/types/signal.js.map +1 -0
- package/cjs/types/theme.d.ts +41 -0
- package/cjs/types/theme.js +6 -0
- package/cjs/types/theme.js.map +1 -0
- package/cjs/types/transform.d.ts +291 -0
- package/cjs/types/transform.js +6 -0
- package/cjs/types/transform.js.map +1 -0
- package/cjs/types/view.d.ts +217 -0
- package/cjs/types/view.js +6 -0
- package/cjs/types/view.js.map +1 -0
- package/cjs/util/data.d.ts +3 -0
- package/cjs/util/data.js +64 -0
- package/cjs/util/data.js.map +1 -0
- package/cjs/util/grammar-heap.d.ts +14 -0
- package/cjs/util/grammar-heap.js +66 -0
- package/cjs/util/grammar-heap.js.map +1 -0
- package/cjs/util/text.d.ts +19 -0
- package/cjs/util/text.js +32 -0
- package/cjs/util/text.js.map +1 -0
- package/cjs/util/unique-list.d.ts +12 -0
- package/cjs/util/unique-list.js +37 -0
- package/cjs/util/unique-list.js.map +1 -0
- package/cjs/view/View.d.ts +157 -0
- package/cjs/view/View.js +800 -0
- package/cjs/view/View.js.map +1 -0
- package/cjs/view/animate.d.ts +20 -0
- package/cjs/view/animate.js +106 -0
- package/cjs/view/animate.js.map +1 -0
- package/cjs/view/component.d.ts +26 -0
- package/cjs/view/component.js +64 -0
- package/cjs/view/component.js.map +1 -0
- package/cjs/view/constants.d.ts +17 -0
- package/cjs/view/constants.js +13 -0
- package/cjs/view/constants.js.map +1 -0
- package/cjs/view/coordinate.d.ts +23 -0
- package/cjs/view/coordinate.js +59 -0
- package/cjs/view/coordinate.js.map +1 -0
- package/cjs/view/data.d.ts +37 -0
- package/cjs/view/data.js +198 -0
- package/cjs/view/data.js.map +1 -0
- package/cjs/view/dataflow.d.ts +32 -0
- package/cjs/view/dataflow.js +146 -0
- package/cjs/view/dataflow.js.map +1 -0
- package/cjs/view/events.d.ts +4 -0
- package/cjs/view/events.js +34 -0
- package/cjs/view/events.js.map +1 -0
- package/cjs/view/glyph-meta.d.ts +29 -0
- package/cjs/view/glyph-meta.js +45 -0
- package/cjs/view/glyph-meta.js.map +1 -0
- package/cjs/view/glyph.d.ts +14 -0
- package/cjs/view/glyph.js +29 -0
- package/cjs/view/glyph.js.map +1 -0
- package/cjs/view/grammar-base.d.ts +46 -0
- package/cjs/view/grammar-base.js +171 -0
- package/cjs/view/grammar-base.js.map +1 -0
- package/cjs/view/grammar-record.d.ts +39 -0
- package/cjs/view/grammar-record.js +180 -0
- package/cjs/view/grammar-record.js.map +1 -0
- package/cjs/view/group.d.ts +13 -0
- package/cjs/view/group.js +39 -0
- package/cjs/view/group.js.map +1 -0
- package/cjs/view/index.d.ts +1 -0
- package/cjs/view/index.js +21 -0
- package/cjs/view/index.js.map +1 -0
- package/cjs/view/mark.d.ts +112 -0
- package/cjs/view/mark.js +600 -0
- package/cjs/view/mark.js.map +1 -0
- package/cjs/view/scale.d.ts +26 -0
- package/cjs/view/scale.js +86 -0
- package/cjs/view/scale.js.map +1 -0
- package/cjs/view/signal.d.ts +18 -0
- package/cjs/view/signal.js +56 -0
- package/cjs/view/signal.js.map +1 -0
- package/es/component/axis.d.ts +26 -0
- package/es/component/axis.js +162 -0
- package/es/component/axis.js.map +1 -0
- package/es/component/crosshair.d.ts +50 -0
- package/es/component/crosshair.js +275 -0
- package/es/component/crosshair.js.map +1 -0
- package/es/component/datazoom.d.ts +19 -0
- package/es/component/datazoom.js +161 -0
- package/es/component/datazoom.js.map +1 -0
- package/es/component/grid.d.ts +27 -0
- package/es/component/grid.js +193 -0
- package/es/component/grid.js.map +1 -0
- package/es/component/index.d.ts +11 -0
- package/es/component/index.js +22 -0
- package/es/component/index.js.map +1 -0
- package/es/component/label.d.ts +19 -0
- package/es/component/label.js +124 -0
- package/es/component/label.js.map +1 -0
- package/es/component/legend.d.ts +26 -0
- package/es/component/legend.js +169 -0
- package/es/component/legend.js.map +1 -0
- package/es/component/player.d.ts +25 -0
- package/es/component/player.js +136 -0
- package/es/component/player.js.map +1 -0
- package/es/component/scale.d.ts +8 -0
- package/es/component/scale.js +19 -0
- package/es/component/scale.js.map +1 -0
- package/es/component/scrollbar.d.ts +23 -0
- package/es/component/scrollbar.js +184 -0
- package/es/component/scrollbar.js.map +1 -0
- package/es/component/slider.d.ts +19 -0
- package/es/component/slider.js +86 -0
- package/es/component/slider.js.map +1 -0
- package/es/component/title.d.ts +15 -0
- package/es/component/title.js +58 -0
- package/es/component/title.js.map +1 -0
- package/es/component/tooltip.d.ts +62 -0
- package/es/component/tooltip.js +303 -0
- package/es/component/tooltip.js.map +1 -0
- package/es/core/factory.d.ts +35 -0
- package/es/core/factory.js +67 -0
- package/es/core/factory.js.map +1 -0
- package/es/glyph/boxplot.d.ts +10 -0
- package/es/glyph/boxplot.js +410 -0
- package/es/glyph/boxplot.js.map +1 -0
- package/es/glyph/index.d.ts +7 -0
- package/es/glyph/index.js +11 -0
- package/es/glyph/index.js.map +1 -0
- package/es/glyph/link-path.d.ts +7 -0
- package/es/glyph/link-path.js +132 -0
- package/es/glyph/link-path.js.map +1 -0
- package/es/glyph/ripple.d.ts +1 -0
- package/es/glyph/ripple.js +38 -0
- package/es/glyph/ripple.js.map +1 -0
- package/es/glyph/tree-path.d.ts +7 -0
- package/es/glyph/tree-path.js +146 -0
- package/es/glyph/tree-path.js.map +1 -0
- package/es/glyph/violin.d.ts +1 -0
- package/es/glyph/violin.js +163 -0
- package/es/glyph/violin.js.map +1 -0
- package/es/glyph/wave.d.ts +1 -0
- package/es/glyph/wave.js +61 -0
- package/es/glyph/wave.js.map +1 -0
- package/es/graph/animation/animate.d.ts +48 -0
- package/es/graph/animation/animate.js +247 -0
- package/es/graph/animation/animate.js.map +1 -0
- package/es/graph/animation/animation/clip.d.ts +4 -0
- package/es/graph/animation/animation/clip.js +44 -0
- package/es/graph/animation/animation/clip.js.map +1 -0
- package/es/graph/animation/animation/fade.d.ts +4 -0
- package/es/graph/animation/animation/fade.js +32 -0
- package/es/graph/animation/animation/fade.js.map +1 -0
- package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/es/graph/animation/animation/grow-cartesian.js +272 -0
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/es/graph/animation/animation/grow-interval.d.ts +3 -0
- package/es/graph/animation/animation/grow-interval.js +184 -0
- package/es/graph/animation/animation/grow-interval.js.map +1 -0
- package/es/graph/animation/animation/grow-points.d.ts +7 -0
- package/es/graph/animation/animation/grow-points.js +107 -0
- package/es/graph/animation/animation/grow-points.js.map +1 -0
- package/es/graph/animation/animation/grow-polar.d.ts +5 -0
- package/es/graph/animation/animation/grow-polar.js +160 -0
- package/es/graph/animation/animation/grow-polar.js.map +1 -0
- package/es/graph/animation/animation/index.d.ts +11 -0
- package/es/graph/animation/animation/index.js +22 -0
- package/es/graph/animation/animation/index.js.map +1 -0
- package/es/graph/animation/animation/move.d.ts +3 -0
- package/es/graph/animation/animation/move.js +78 -0
- package/es/graph/animation/animation/move.js.map +1 -0
- package/es/graph/animation/animation/rotate.d.ts +3 -0
- package/es/graph/animation/animation/rotate.js +32 -0
- package/es/graph/animation/animation/rotate.js.map +1 -0
- package/es/graph/animation/animation/scale.d.ts +3 -0
- package/es/graph/animation/animation/scale.js +74 -0
- package/es/graph/animation/animation/scale.js.map +1 -0
- package/es/graph/animation/animation/update.d.ts +6 -0
- package/es/graph/animation/animation/update.js +20 -0
- package/es/graph/animation/animation/update.js.map +1 -0
- package/es/graph/animation/animator.d.ts +26 -0
- package/es/graph/animation/animator.js +83 -0
- package/es/graph/animation/animator.js.map +1 -0
- package/es/graph/animation/arranger.d.ts +13 -0
- package/es/graph/animation/arranger.js +29 -0
- package/es/graph/animation/arranger.js.map +1 -0
- package/es/graph/animation/attribute.d.ts +27 -0
- package/es/graph/animation/attribute.js +114 -0
- package/es/graph/animation/attribute.js.map +1 -0
- package/es/graph/animation/config.d.ts +5 -0
- package/es/graph/animation/config.js +84 -0
- package/es/graph/animation/config.js.map +1 -0
- package/es/graph/animation/morph.d.ts +12 -0
- package/es/graph/animation/morph.js +171 -0
- package/es/graph/animation/morph.js.map +1 -0
- package/es/graph/attributes/common.d.ts +2 -0
- package/es/graph/attributes/common.js +13 -0
- package/es/graph/attributes/common.js.map +1 -0
- package/es/graph/attributes/helpers.d.ts +17 -0
- package/es/graph/attributes/helpers.js +75 -0
- package/es/graph/attributes/helpers.js.map +1 -0
- package/es/graph/attributes/index.d.ts +10 -0
- package/es/graph/attributes/index.js +231 -0
- package/es/graph/attributes/index.js.map +1 -0
- package/es/graph/canvas-renderer.d.ts +34 -0
- package/es/graph/canvas-renderer.js +115 -0
- package/es/graph/canvas-renderer.js.map +1 -0
- package/es/graph/constants.d.ts +23 -0
- package/es/graph/constants.js +47 -0
- package/es/graph/constants.js.map +1 -0
- package/es/graph/element.d.ts +66 -0
- package/es/graph/element.js +292 -0
- package/es/graph/element.js.map +1 -0
- package/es/graph/enums.d.ts +153 -0
- package/es/graph/enums.js +129 -0
- package/es/graph/enums.js.map +1 -0
- package/es/graph/glyph-element.d.ts +53 -0
- package/es/graph/glyph-element.js +206 -0
- package/es/graph/glyph-element.js.map +1 -0
- package/es/graph/index.d.ts +3 -0
- package/es/graph/index.js +6 -0
- package/es/graph/index.js.map +1 -0
- package/es/graph/layout/grid.d.ts +3 -0
- package/es/graph/layout/grid.js +66 -0
- package/es/graph/layout/grid.js.map +1 -0
- package/es/graph/layout/layout.d.ts +3 -0
- package/es/graph/layout/layout.js +33 -0
- package/es/graph/layout/layout.js.map +1 -0
- package/es/graph/layout/relative.d.ts +3 -0
- package/es/graph/layout/relative.js +85 -0
- package/es/graph/layout/relative.js.map +1 -0
- package/es/graph/mark/differ.d.ts +20 -0
- package/es/graph/mark/differ.js +104 -0
- package/es/graph/mark/differ.js.map +1 -0
- package/es/graph/mark/encode.d.ts +10 -0
- package/es/graph/mark/encode.js +92 -0
- package/es/graph/mark/encode.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +10 -0
- package/es/graph/mark/large-rects.js +23 -0
- package/es/graph/mark/large-rects.js.map +1 -0
- package/es/graph/mark/large-symbols.d.ts +11 -0
- package/es/graph/mark/large-symbols.js +27 -0
- package/es/graph/mark/large-symbols.js.map +1 -0
- package/es/graph/mark-tree.d.ts +2 -0
- package/es/graph/mark-tree.js +15 -0
- package/es/graph/mark-tree.js.map +1 -0
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/env.d.ts +2 -0
- package/es/graph/util/env.js +6 -0
- package/es/graph/util/env.js.map +1 -0
- package/es/graph/util/events-extend.d.ts +5 -0
- package/es/graph/util/events-extend.js +12 -0
- package/es/graph/util/events-extend.js.map +1 -0
- package/es/graph/util/graphic.d.ts +9 -0
- package/es/graph/util/graphic.js +59 -0
- package/es/graph/util/graphic.js.map +1 -0
- package/es/graph/util/point.d.ts +1 -0
- package/es/graph/util/point.js +67 -0
- package/es/graph/util/point.js.map +1 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +27 -0
- package/es/index.js.map +1 -0
- package/es/parse/coordinate.d.ts +7 -0
- package/es/parse/coordinate.js +65 -0
- package/es/parse/coordinate.js.map +1 -0
- package/es/parse/event.d.ts +8 -0
- package/es/parse/event.js +23 -0
- package/es/parse/event.js.map +1 -0
- package/es/parse/mark.d.ts +4 -0
- package/es/parse/mark.js +19 -0
- package/es/parse/mark.js.map +1 -0
- package/es/parse/option.d.ts +3 -0
- package/es/parse/option.js +10 -0
- package/es/parse/option.js.map +1 -0
- package/es/parse/scale.d.ts +8 -0
- package/es/parse/scale.js +347 -0
- package/es/parse/scale.js.map +1 -0
- package/es/parse/transform.d.ts +5 -0
- package/es/parse/transform.js +102 -0
- package/es/parse/transform.js.map +1 -0
- package/es/parse/util.d.ts +13 -0
- package/es/parse/util.js +65 -0
- package/es/parse/util.js.map +1 -0
- package/es/parse/view.d.ts +17 -0
- package/es/parse/view.js +98 -0
- package/es/parse/view.js.map +1 -0
- package/es/semantic-marks/cell.d.ts +13 -0
- package/es/semantic-marks/cell.js +57 -0
- package/es/semantic-marks/cell.js.map +1 -0
- package/es/semantic-marks/interval.d.ts +14 -0
- package/es/semantic-marks/interval.js +87 -0
- package/es/semantic-marks/interval.js.map +1 -0
- package/es/semantic-marks/text.d.ts +10 -0
- package/es/semantic-marks/text.js +22 -0
- package/es/semantic-marks/text.js.map +1 -0
- package/es/theme/common/component.d.ts +15 -0
- package/es/theme/common/component.js +510 -0
- package/es/theme/common/component.js.map +1 -0
- package/es/theme/common/constants.d.ts +1 -0
- package/es/theme/common/constants.js +2 -0
- package/es/theme/common/constants.js.map +1 -0
- package/es/theme/common/mark.d.ts +2 -0
- package/es/theme/common/mark.js +11 -0
- package/es/theme/common/mark.js.map +1 -0
- package/es/theme/dark.d.ts +2 -0
- package/es/theme/dark.js +96 -0
- package/es/theme/dark.js.map +1 -0
- package/es/theme/default.d.ts +2 -0
- package/es/theme/default.js +16 -0
- package/es/theme/default.js.map +1 -0
- package/es/theme/theme-manager.d.ts +8 -0
- package/es/theme/theme-manager.js +22 -0
- package/es/theme/theme-manager.js.map +1 -0
- package/es/transforms/data/bin.d.ts +2 -0
- package/es/transforms/data/bin.js +16 -0
- package/es/transforms/data/bin.js.map +1 -0
- package/es/transforms/data/circular-relation.d.ts +2 -0
- package/es/transforms/data/circular-relation.js +44 -0
- package/es/transforms/data/circular-relation.js.map +1 -0
- package/es/transforms/data/contour.d.ts +2 -0
- package/es/transforms/data/contour.js +111 -0
- package/es/transforms/data/contour.js.map +1 -0
- package/es/transforms/data/filter.d.ts +2 -0
- package/es/transforms/data/filter.js +2 -0
- package/es/transforms/data/filter.js.map +1 -0
- package/es/transforms/data/fold.d.ts +2 -0
- package/es/transforms/data/fold.js +16 -0
- package/es/transforms/data/fold.js.map +1 -0
- package/es/transforms/data/funnel.d.ts +2 -0
- package/es/transforms/data/funnel.js +17 -0
- package/es/transforms/data/funnel.js.map +1 -0
- package/es/transforms/data/join.d.ts +2 -0
- package/es/transforms/data/join.js +26 -0
- package/es/transforms/data/join.js.map +1 -0
- package/es/transforms/data/kde.d.ts +2 -0
- package/es/transforms/data/kde.js +80 -0
- package/es/transforms/data/kde.js.map +1 -0
- package/es/transforms/data/map.d.ts +2 -0
- package/es/transforms/data/map.js +16 -0
- package/es/transforms/data/map.js.map +1 -0
- package/es/transforms/data/pick.d.ts +2 -0
- package/es/transforms/data/pick.js +15 -0
- package/es/transforms/data/pick.js.map +1 -0
- package/es/transforms/data/pie.d.ts +2 -0
- package/es/transforms/data/pie.js +18 -0
- package/es/transforms/data/pie.js.map +1 -0
- package/es/transforms/data/range.d.ts +4 -0
- package/es/transforms/data/range.js +9 -0
- package/es/transforms/data/range.js.map +1 -0
- package/es/transforms/data/sort.d.ts +2 -0
- package/es/transforms/data/sort.js +13 -0
- package/es/transforms/data/sort.js.map +1 -0
- package/es/transforms/data/stack.d.ts +2 -0
- package/es/transforms/data/stack.js +72 -0
- package/es/transforms/data/stack.js.map +1 -0
- package/es/transforms/data/unfold.d.ts +2 -0
- package/es/transforms/data/unfold.js +45 -0
- package/es/transforms/data/unfold.js.map +1 -0
- package/es/transforms/index.d.ts +23 -0
- package/es/transforms/index.js +205 -0
- package/es/transforms/index.js.map +1 -0
- package/es/transforms/mark/dodge.d.ts +2 -0
- package/es/transforms/mark/dodge.js +74 -0
- package/es/transforms/mark/dodge.js.map +1 -0
- package/es/transforms/mark/jitter.d.ts +4 -0
- package/es/transforms/mark/jitter.js +48 -0
- package/es/transforms/mark/jitter.js.map +1 -0
- package/es/transforms/mark/lttb-sample.d.ts +2 -0
- package/es/transforms/mark/lttb-sample.js +60 -0
- package/es/transforms/mark/lttb-sample.js.map +1 -0
- package/es/transforms/mark/mark-overlap.d.ts +2 -0
- package/es/transforms/mark/mark-overlap.js +71 -0
- package/es/transforms/mark/mark-overlap.js.map +1 -0
- package/es/transforms/mark/symmetry.d.ts +2 -0
- package/es/transforms/mark/symmetry.js +20 -0
- package/es/transforms/mark/symmetry.js.map +1 -0
- package/es/transforms/util/util.d.ts +5 -0
- package/es/transforms/util/util.js +33 -0
- package/es/transforms/util/util.js.map +1 -0
- package/es/transforms/view/identifier.d.ts +2 -0
- package/es/transforms/view/identifier.js +13 -0
- package/es/transforms/view/identifier.js.map +1 -0
- package/es/types/animate.d.ts +224 -0
- package/es/types/animate.js +2 -0
- package/es/types/animate.js.map +1 -0
- package/es/types/base.d.ts +36 -0
- package/es/types/base.js +2 -0
- package/es/types/base.js.map +1 -0
- package/es/types/component.d.ts +240 -0
- package/es/types/component.js +2 -0
- package/es/types/component.js.map +1 -0
- package/es/types/coordinate.d.ts +15 -0
- package/es/types/coordinate.js +2 -0
- package/es/types/coordinate.js.map +1 -0
- package/es/types/data.d.ts +55 -0
- package/es/types/data.js +1 -0
- package/es/types/data.js.map +1 -0
- package/es/types/dataflow.d.ts +13 -0
- package/es/types/dataflow.js +2 -0
- package/es/types/dataflow.js.map +1 -0
- package/es/types/element.d.ts +117 -0
- package/es/types/element.js +2 -0
- package/es/types/element.js.map +1 -0
- package/es/types/event.d.ts +58 -0
- package/es/types/event.js +2 -0
- package/es/types/event.js.map +1 -0
- package/es/types/glyph.d.ts +29 -0
- package/es/types/glyph.js +2 -0
- package/es/types/glyph.js.map +1 -0
- package/es/types/grammar.d.ts +184 -0
- package/es/types/grammar.js +2 -0
- package/es/types/grammar.js.map +1 -0
- package/es/types/hooks.d.ts +45 -0
- package/es/types/hooks.js +2 -0
- package/es/types/hooks.js.map +1 -0
- package/es/types/index.d.ts +22 -0
- package/es/types/index.js +44 -0
- package/es/types/index.js.map +1 -0
- package/es/types/layout.d.ts +5 -0
- package/es/types/layout.js +2 -0
- package/es/types/layout.js.map +1 -0
- package/es/types/mark.d.ts +344 -0
- package/es/types/mark.js +2 -0
- package/es/types/mark.js.map +1 -0
- package/es/types/morph.d.ts +29 -0
- package/es/types/morph.js +2 -0
- package/es/types/morph.js.map +1 -0
- package/es/types/plot.d.ts +326 -0
- package/es/types/plot.js +2 -0
- package/es/types/plot.js.map +1 -0
- package/es/types/projection.d.ts +61 -0
- package/es/types/projection.js +2 -0
- package/es/types/projection.js.map +1 -0
- package/es/types/renderer.d.ts +19 -0
- package/es/types/renderer.js +2 -0
- package/es/types/renderer.js.map +1 -0
- package/es/types/scale.d.ts +111 -0
- package/es/types/scale.js +2 -0
- package/es/types/scale.js.map +1 -0
- package/es/types/signal.d.ts +20 -0
- package/es/types/signal.js +2 -0
- package/es/types/signal.js.map +1 -0
- package/es/types/theme.d.ts +41 -0
- package/es/types/theme.js +2 -0
- package/es/types/theme.js.map +1 -0
- package/es/types/transform.d.ts +291 -0
- package/es/types/transform.js +2 -0
- package/es/types/transform.js.map +1 -0
- package/es/types/view.d.ts +217 -0
- package/es/types/view.js +2 -0
- package/es/types/view.js.map +1 -0
- package/es/util/data.d.ts +3 -0
- package/es/util/data.js +60 -0
- package/es/util/data.js.map +1 -0
- package/es/util/grammar-heap.d.ts +14 -0
- package/es/util/grammar-heap.js +58 -0
- package/es/util/grammar-heap.js.map +1 -0
- package/es/util/text.d.ts +19 -0
- package/es/util/text.js +25 -0
- package/es/util/text.js.map +1 -0
- package/es/util/unique-list.d.ts +12 -0
- package/es/util/unique-list.js +29 -0
- package/es/util/unique-list.js.map +1 -0
- package/es/view/View.d.ts +157 -0
- package/es/view/View.js +836 -0
- package/es/view/View.js.map +1 -0
- package/es/view/animate.d.ts +20 -0
- package/es/view/animate.js +98 -0
- package/es/view/animate.js.map +1 -0
- package/es/view/component.d.ts +26 -0
- package/es/view/component.js +64 -0
- package/es/view/component.js.map +1 -0
- package/es/view/constants.d.ts +17 -0
- package/es/view/constants.js +32 -0
- package/es/view/constants.js.map +1 -0
- package/es/view/coordinate.d.ts +23 -0
- package/es/view/coordinate.js +52 -0
- package/es/view/coordinate.js.map +1 -0
- package/es/view/data.d.ts +37 -0
- package/es/view/data.js +195 -0
- package/es/view/data.js.map +1 -0
- package/es/view/dataflow.d.ts +32 -0
- package/es/view/dataflow.js +141 -0
- package/es/view/dataflow.js.map +1 -0
- package/es/view/events.d.ts +4 -0
- package/es/view/events.js +26 -0
- package/es/view/events.js.map +1 -0
- package/es/view/glyph-meta.d.ts +29 -0
- package/es/view/glyph-meta.js +37 -0
- package/es/view/glyph-meta.js.map +1 -0
- package/es/view/glyph.d.ts +14 -0
- package/es/view/glyph.js +27 -0
- package/es/view/glyph.js.map +1 -0
- package/es/view/grammar-base.d.ts +46 -0
- package/es/view/grammar-base.js +165 -0
- package/es/view/grammar-base.js.map +1 -0
- package/es/view/grammar-record.d.ts +39 -0
- package/es/view/grammar-record.js +170 -0
- package/es/view/grammar-record.js.map +1 -0
- package/es/view/group.d.ts +13 -0
- package/es/view/group.js +39 -0
- package/es/view/group.js.map +1 -0
- package/es/view/index.d.ts +1 -0
- package/es/view/index.js +2 -0
- package/es/view/index.js.map +1 -0
- package/es/view/mark.d.ts +112 -0
- package/es/view/mark.js +604 -0
- package/es/view/mark.js.map +1 -0
- package/es/view/scale.d.ts +26 -0
- package/es/view/scale.js +82 -0
- package/es/view/scale.js.map +1 -0
- package/es/view/signal.d.ts +18 -0
- package/es/view/signal.js +52 -0
- package/es/view/signal.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isNil, isString } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { accessorName } from "@visactor/vgrammar-util";
|
|
4
|
+
|
|
5
|
+
export function fieldNames(fields, as) {
|
|
6
|
+
return fields ? fields.map(((f, i) => {
|
|
7
|
+
var _a;
|
|
8
|
+
return null !== (_a = as[i]) && void 0 !== _a ? _a : isString(f) ? f : accessorName(f);
|
|
9
|
+
})) : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function partition(data, groupBy, field) {
|
|
13
|
+
if (isNil(groupBy)) return [ data.map(field) ];
|
|
14
|
+
const groups = [], map = {};
|
|
15
|
+
return data.forEach((entry => {
|
|
16
|
+
const groupKey = groupBy.map((groupFunc => groupFunc(entry))).toString();
|
|
17
|
+
if (map[groupKey]) map[groupKey].push(field(entry)); else {
|
|
18
|
+
const groupItem = [];
|
|
19
|
+
groupItem.dims = groupKey, groups.push(groupItem), map[groupKey] = groupItem;
|
|
20
|
+
}
|
|
21
|
+
})), groups;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function normalizeAngle(angle) {
|
|
25
|
+
for (;angle < 0; ) angle += 2 * Math.PI;
|
|
26
|
+
for (;angle >= 2 * Math.PI; ) angle -= 2 * Math.PI;
|
|
27
|
+
return angle;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function computeQuadrant(angle) {
|
|
31
|
+
return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transforms/util/util.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,MAAM,UAAU,UAAU,CAAC,MAAwC,EAAE,EAAa;IAChF,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;QACzB,OAAO,MAAA,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAA+B,EAAE,KAA2B;IAElG,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1B;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,MAAM,GAAG,GAAwB,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,SAA4B,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE5F,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAClB,MAAM,SAAS,GAAU,EAAE,CAAC;YAC3B,SAAiB,CAAC,IAAI,GAAG,QAAQ,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvB,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;SAC3B;aAAM;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,GAAG,CAAC,EAAE;QAChB,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QAC3B,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QACrC,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE;QAClD,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;QACxD,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC","file":"util.js","sourcesContent":["/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-transforms/src/util/util.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\n\nimport { isNil, isString } from '@visactor/vutils';\nimport type { FieldGetterFunction } from '@visactor/vgrammar-util';\nimport { accessorName } from '@visactor/vgrammar-util';\n\n// use either provided alias or accessor field name\nexport function fieldNames(fields: string[] | FieldGetterFunction[], as?: string[]) {\n if (!fields) {\n return null;\n }\n return fields.map((f, i) => {\n return as[i] ?? (isString(f) ? f : accessorName(f));\n });\n}\n\nexport function partition(data?: any[], groupBy?: FieldGetterFunction[], field?: FieldGetterFunction) {\n // partition data points into groups\n if (isNil(groupBy)) {\n return [data.map(field)];\n }\n\n const groups: any[] = [];\n const map: Record<string, any> = {};\n data.forEach((entry: any) => {\n const groupKey = groupBy.map((groupFunc: (arg: any) => any) => groupFunc(entry)).toString();\n\n if (!map[groupKey]) {\n const groupItem: any[] = [];\n (groupItem as any).dims = groupKey;\n groups.push(groupItem);\n map[groupKey] = groupItem;\n } else {\n map[groupKey].push(field(entry));\n }\n });\n\n return groups;\n}\n\nexport function normalizeAngle(angle: number): number {\n while (angle < 0) {\n angle += Math.PI * 2;\n }\n while (angle >= Math.PI * 2) {\n angle -= Math.PI * 2;\n }\n return angle;\n}\n\nexport function computeQuadrant(angle: number): 1 | 2 | 3 | 4 {\n angle = normalizeAngle(angle);\n if (angle > 0 && angle <= Math.PI / 2) {\n return 2;\n } else if (angle > Math.PI / 2 && angle <= Math.PI) {\n return 3;\n } else if (angle > Math.PI && angle <= (3 * Math.PI) / 2) {\n return 4;\n }\n return 1;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isNil } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
const COUNTER_NAME = ":vGrammar_identifier:";
|
|
4
|
+
|
|
5
|
+
export const transform = (options, upstreamData, params, view) => {
|
|
6
|
+
isNil(view[COUNTER_NAME]) && (view[COUNTER_NAME] = 0);
|
|
7
|
+
let id = view[COUNTER_NAME];
|
|
8
|
+
const as = options.as;
|
|
9
|
+
return upstreamData.forEach((entry => {
|
|
10
|
+
entry && isNil(entry[as]) && (id += 1, entry[as] = id);
|
|
11
|
+
})), view[COUNTER_NAME] = id, id;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transforms/view/identifier.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAmC,EAAE,YAAmB,EAAE,MAAW,EAAE,IAAY,EAAE,EAAE;IAC/G,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE;QAC7B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;KACxB;IAED,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IAEtB,YAAY,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;QAClC,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE;YAC7B,EAAE,IAAI,CAAC,CAAC;YACR,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;IAExB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","file":"identifier.js","sourcesContent":["/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-view-transforms/src/Identifier.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\n\nimport { isNil } from '@visactor/vutils';\nimport type { IView, IdentifierTransformOptions } from './../../types/';\n\nconst COUNTER_NAME = ':vGrammar_identifier:';\n\nexport const transform = (options: IdentifierTransformOptions, upstreamData: any[], params: any, view?: IView) => {\n if (isNil(view[COUNTER_NAME])) {\n view[COUNTER_NAME] = 0;\n }\n\n let id = view[COUNTER_NAME];\n const as = options.as;\n\n upstreamData.forEach((entry: any) => {\n if (entry && isNil(entry[as])) {\n id += 1;\n entry[as] = id;\n }\n });\n view[COUNTER_NAME] = id;\n\n return id;\n};\n"]}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender';
|
|
2
|
+
import type { IPointLike } from '@visactor/vutils';
|
|
3
|
+
import type { MarkFunctionCallback, MarkFunctionType } from './mark';
|
|
4
|
+
import type { IMark } from './grammar';
|
|
5
|
+
import type { IElement } from './element';
|
|
6
|
+
export type TypeAnimation<T extends IElement> = (element: T, options: any, animationParameters: IAnimationParameters) => {
|
|
7
|
+
from?: {
|
|
8
|
+
[channel: string]: any;
|
|
9
|
+
};
|
|
10
|
+
to?: {
|
|
11
|
+
[channel: string]: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export interface IClipAnimationOptions {
|
|
15
|
+
clipDimension?: 'x' | 'y' | 'auto' | 'default';
|
|
16
|
+
}
|
|
17
|
+
export interface IGrowCartesianAnimationOptions {
|
|
18
|
+
orient?: 'positive' | 'negative';
|
|
19
|
+
overall?: boolean | number;
|
|
20
|
+
direction?: 'x' | 'y' | 'xy';
|
|
21
|
+
}
|
|
22
|
+
export interface IGrowAngleAnimationOptions {
|
|
23
|
+
orient?: 'clockwise' | 'anticlockwise';
|
|
24
|
+
overall?: boolean | number;
|
|
25
|
+
}
|
|
26
|
+
export interface IGrowRadiusAnimationOptions {
|
|
27
|
+
orient?: 'inside' | 'outside';
|
|
28
|
+
overall?: boolean | number;
|
|
29
|
+
}
|
|
30
|
+
export interface IGrowPointsAnimationOptions {
|
|
31
|
+
orient?: 'positive' | 'negative';
|
|
32
|
+
}
|
|
33
|
+
export interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {
|
|
34
|
+
center?: IPointLike;
|
|
35
|
+
}
|
|
36
|
+
export interface IScaleAnimationOptions {
|
|
37
|
+
direction?: 'x' | 'y' | 'xy';
|
|
38
|
+
}
|
|
39
|
+
export interface IMoveAnimationOptions {
|
|
40
|
+
direction?: 'x' | 'y' | 'xy';
|
|
41
|
+
orient?: 'positive' | 'negative';
|
|
42
|
+
offset?: number;
|
|
43
|
+
point?: {
|
|
44
|
+
x?: number;
|
|
45
|
+
y?: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface IRotateAnimationOptions {
|
|
49
|
+
orient?: 'clockwise' | 'anticlockwise';
|
|
50
|
+
angle?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface TextItemAttributes {
|
|
53
|
+
fontSize?: number;
|
|
54
|
+
lineHeight?: number;
|
|
55
|
+
font?: string;
|
|
56
|
+
fontStyle?: string;
|
|
57
|
+
fontVariant?: string;
|
|
58
|
+
fontWeight?: string | number;
|
|
59
|
+
lineBreak?: string;
|
|
60
|
+
text?: string | string[];
|
|
61
|
+
limit?: number;
|
|
62
|
+
align?: string;
|
|
63
|
+
baseline?: string;
|
|
64
|
+
ellipsis?: string | boolean;
|
|
65
|
+
dir?: string;
|
|
66
|
+
}
|
|
67
|
+
export type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;
|
|
68
|
+
export type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;
|
|
69
|
+
export interface IStateAnimationConfig {
|
|
70
|
+
duration?: number;
|
|
71
|
+
easing?: EasingType;
|
|
72
|
+
}
|
|
73
|
+
export interface IAnimationTypeConfig {
|
|
74
|
+
type?: string;
|
|
75
|
+
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
76
|
+
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
77
|
+
customParameters?: MarkFunctionValueType<any>;
|
|
78
|
+
easing?: EasingType;
|
|
79
|
+
delay?: MarkFunctionValueType<number>;
|
|
80
|
+
duration?: MarkFunctionValueType<number>;
|
|
81
|
+
oneByOne?: MarkFunctionValueType<boolean | number>;
|
|
82
|
+
startTime?: MarkFunctionValueType<number>;
|
|
83
|
+
totalTime?: MarkFunctionValueType<number>;
|
|
84
|
+
loop?: boolean | number;
|
|
85
|
+
options?: MarkFunctionValueType<any>;
|
|
86
|
+
controlOptions?: IAnimationControlOptions;
|
|
87
|
+
}
|
|
88
|
+
export interface IAnimationTimeline {
|
|
89
|
+
id?: string;
|
|
90
|
+
timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];
|
|
91
|
+
startTime?: MarkFunctionValueType<number>;
|
|
92
|
+
totalTime?: MarkFunctionValueType<number>;
|
|
93
|
+
oneByOne?: MarkFunctionValueType<number | boolean>;
|
|
94
|
+
loop?: MarkFunctionValueType<number | boolean>;
|
|
95
|
+
partitioner?: MarkFunctionCallback<boolean>;
|
|
96
|
+
sort?: (datumA: any, datumB: any, elementA: IElement, elementB: IElement, parameters: any) => number;
|
|
97
|
+
controlOptions?: IAnimationControlOptions;
|
|
98
|
+
}
|
|
99
|
+
export interface IAnimationTimeSlice {
|
|
100
|
+
effects: IAnimationEffect | IAnimationEffect[];
|
|
101
|
+
duration?: MarkFunctionValueType<number>;
|
|
102
|
+
delay?: MarkFunctionValueType<number>;
|
|
103
|
+
}
|
|
104
|
+
export type IAnimationChannelFunction = (datum: any, element: IElement, parameters: IAnimationParameters) => any;
|
|
105
|
+
export type IAnimationChannelAttrs = Record<string, {
|
|
106
|
+
from?: any | IAnimationChannelFunction;
|
|
107
|
+
to?: any | IAnimationChannelFunction;
|
|
108
|
+
}>;
|
|
109
|
+
export type IAnimationChannelAttributes = string[];
|
|
110
|
+
export type IAnimationChannelInterpolator = (ratio: number, from: any, to: any, nextAttributes: any, datum: any, element: IElement, parameters: IAnimationParameters) => boolean | void;
|
|
111
|
+
export interface IAnimationCustomConstructor {
|
|
112
|
+
new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;
|
|
113
|
+
}
|
|
114
|
+
export interface IAnimationEffect {
|
|
115
|
+
type?: string;
|
|
116
|
+
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
117
|
+
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
118
|
+
customParameters?: MarkFunctionValueType<any>;
|
|
119
|
+
easing?: EasingType;
|
|
120
|
+
options?: MarkFunctionValueType<any>;
|
|
121
|
+
}
|
|
122
|
+
export interface IAnimationControlOptions {
|
|
123
|
+
stopWhenStateChange?: boolean;
|
|
124
|
+
immediatelyApply?: boolean;
|
|
125
|
+
}
|
|
126
|
+
export interface IAnimationUnit {
|
|
127
|
+
initialDelay: number;
|
|
128
|
+
loopDuration: number;
|
|
129
|
+
loopDelay: number;
|
|
130
|
+
loopDelayAfter: number;
|
|
131
|
+
loopAnimateDuration: number;
|
|
132
|
+
loopCount: number;
|
|
133
|
+
totalTime: number;
|
|
134
|
+
timeSlices: IAnimationTimeSlice[];
|
|
135
|
+
}
|
|
136
|
+
export interface IAnimationRecord {
|
|
137
|
+
start: IGraphic;
|
|
138
|
+
end: IGraphic;
|
|
139
|
+
changes: any[];
|
|
140
|
+
}
|
|
141
|
+
export interface IAnimationParameters {
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
mark: IMark;
|
|
145
|
+
group: IMark | null;
|
|
146
|
+
elementIndex: number;
|
|
147
|
+
elementCount: number;
|
|
148
|
+
view: any;
|
|
149
|
+
}
|
|
150
|
+
export interface IParsedAnimationConfig {
|
|
151
|
+
state: string;
|
|
152
|
+
timeline: IAnimationTimeline;
|
|
153
|
+
originConfig: IAnimationConfig;
|
|
154
|
+
id: string;
|
|
155
|
+
}
|
|
156
|
+
export interface IParsedAnimationAttrs {
|
|
157
|
+
from?: any;
|
|
158
|
+
to?: any;
|
|
159
|
+
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
160
|
+
customParameters?: any;
|
|
161
|
+
}
|
|
162
|
+
export interface IAnimatorOptions {
|
|
163
|
+
state: string;
|
|
164
|
+
timeline: IAnimationTimeline;
|
|
165
|
+
id: string;
|
|
166
|
+
}
|
|
167
|
+
export interface IAnimator {
|
|
168
|
+
id: number;
|
|
169
|
+
element: IElement;
|
|
170
|
+
animationOptions: IAnimatorOptions;
|
|
171
|
+
isAnimating: boolean;
|
|
172
|
+
animate: (animationParameters: IAnimationParameters, parameters: any) => this;
|
|
173
|
+
callback: (callbackFunction: (...args: any[]) => void) => this;
|
|
174
|
+
stop: (stopState?: 'start' | 'end', invokeCallback?: boolean) => this;
|
|
175
|
+
pause: () => this;
|
|
176
|
+
resume: () => this;
|
|
177
|
+
startAt: (startTime: number) => this;
|
|
178
|
+
getTotalAnimationTime: () => number;
|
|
179
|
+
getEndAttributes: () => Record<string, any>;
|
|
180
|
+
}
|
|
181
|
+
export interface IAnimateArranger {
|
|
182
|
+
parallel: (arranger: IAnimateArranger) => this;
|
|
183
|
+
after: (arranger: IAnimateArranger) => this;
|
|
184
|
+
afterArranger: IAnimateArranger;
|
|
185
|
+
parallelArrangers: IAnimateArranger[];
|
|
186
|
+
animators: IAnimator[];
|
|
187
|
+
totalTime: number;
|
|
188
|
+
startTime: number;
|
|
189
|
+
endTime: number;
|
|
190
|
+
arrangeTime: () => void;
|
|
191
|
+
}
|
|
192
|
+
export interface IBaseAnimate {
|
|
193
|
+
stop: () => this;
|
|
194
|
+
pause: () => this;
|
|
195
|
+
resume: () => this;
|
|
196
|
+
animate: () => this;
|
|
197
|
+
enable: () => this;
|
|
198
|
+
disable: () => this;
|
|
199
|
+
enableAnimationState: (state: string | string[]) => this;
|
|
200
|
+
disableAnimationState: (state: string | string[]) => this;
|
|
201
|
+
isAnimating: () => boolean;
|
|
202
|
+
release: () => void;
|
|
203
|
+
}
|
|
204
|
+
export interface IViewAnimate extends IBaseAnimate {
|
|
205
|
+
animateAddition: (mark: IMark) => this;
|
|
206
|
+
}
|
|
207
|
+
export interface IAnimate extends IBaseAnimate {
|
|
208
|
+
mark: IMark;
|
|
209
|
+
run: (config: IAnimationConfig | IAnimationConfig[]) => IAnimateArranger;
|
|
210
|
+
runAnimationByState: (animationState: string) => IAnimateArranger;
|
|
211
|
+
stopAnimationByState: (animationState: string) => this;
|
|
212
|
+
pauseAnimationByState: (animationState: string) => this;
|
|
213
|
+
resumeAnimationByState: (animationState: string) => this;
|
|
214
|
+
reverse: () => this;
|
|
215
|
+
restart: () => this;
|
|
216
|
+
record: () => this;
|
|
217
|
+
recordEnd: () => this;
|
|
218
|
+
updateConfig: (config: Record<string, IAnimationConfig | IAnimationConfig[]>) => void;
|
|
219
|
+
updateState: (state: MarkFunctionType<string> | null) => void;
|
|
220
|
+
isElementAnimating: (element: IElement) => boolean;
|
|
221
|
+
getAnimatorCount: () => number;
|
|
222
|
+
getElementAnimators: (element: IElement | IElement[], animationState?: string) => IAnimator[];
|
|
223
|
+
release: () => void;
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { MarkFunctionCallback, MarkFunctionType } from './mark';\nimport type { IMark } from './grammar';\nimport type { IElement } from './element';\n\nexport type TypeAnimation<T extends IElement> = (\n element: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IClipAnimationOptions {\n clipDimension?: 'x' | 'y' | 'auto' | 'default';\n}\n\nexport interface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number };\n}\n\nexport interface IRotateAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n angle?: number;\n}\n\n/** VGrammar 层提供的图元text上的图形属性,现在暂时会和VRender不一致 */\nexport interface TextItemAttributes {\n fontSize?: number;\n lineHeight?: number;\n font?: string;\n fontStyle?: string;\n fontVariant?: string;\n fontWeight?: string | number;\n lineBreak?: string;\n text?: string | string[];\n limit?: number;\n align?: string;\n baseline?: string;\n ellipsis?: string | boolean;\n dir?: string;\n}\n\n/** animation */\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n\n/**\n * state动画,暂时只支持简单配置\n */\nexport interface IStateAnimationConfig {\n duration?: number;\n easing?: EasingType;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n delay?: MarkFunctionValueType<number>;\n duration?: MarkFunctionValueType<number>;\n oneByOne?: MarkFunctionValueType<boolean | number>;\n startTime?: MarkFunctionValueType<number>;\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IElement, elementB: IElement, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\nexport interface IAnimationTimeSlice {\n effects: IAnimationEffect | IAnimationEffect[];\n duration?: MarkFunctionValueType<number>;\n delay?: MarkFunctionValueType<number>;\n}\n\nexport type IAnimationChannelFunction = (datum: any, element: IElement, parameters: IAnimationParameters) => any;\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IElement,\n parameters: IAnimationParameters\n) => boolean | void;\n\n// TODO: fix ACustomAnimate<any>\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n}\n\n/**\n * Animation timeline should be parsed into animation units,\n * which record all necessary configs for animator to execute animation.\n *\n * animation unit time:\n * |<--initialDelay-->| |<--loopDelay--><--Slices--><--looDelayAfter-->| |<--loopDuration-->|\n * |<-----------------loopDuration--------------->|\n */\nexport interface IAnimationUnit {\n /**\n * initial delay time before any animation loop\n */\n initialDelay: number;\n /**\n * total time for one animation loop\n */\n loopDuration: number;\n /**\n * delay time before time slices\n */\n loopDelay: number;\n /**\n * delay time after time slices\n */\n loopDelayAfter: number;\n /**\n * animating time in one animation loop\n */\n loopAnimateDuration: number;\n loopCount: number;\n totalTime: number;\n timeSlices: IAnimationTimeSlice[];\n}\n\nexport interface IAnimationRecord {\n start: IGraphic;\n end: IGraphic;\n changes: any[];\n}\n\nexport interface IAnimationParameters {\n width: number;\n height: number;\n mark: IMark;\n group: IMark | null;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\nexport interface IParsedAnimationConfig {\n state: string;\n timeline: IAnimationTimeline;\n originConfig: IAnimationConfig;\n id: string;\n}\n\nexport interface IParsedAnimationAttrs {\n from?: any;\n to?: any;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: any;\n}\n\n// animate structure\n\nexport interface IAnimatorOptions {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n}\n\nexport interface IAnimator {\n id: number;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean;\n\n /** execute animation */\n animate: (animationParameters: IAnimationParameters, parameters: any) => this;\n /** set animation callback */\n callback: (callbackFunction: (...args: any[]) => void) => this;\n\n // animation control\n stop: (stopState?: 'start' | 'end', invokeCallback?: boolean) => this;\n pause: () => this;\n resume: () => this;\n\n /** set additional initial animation delay */\n startAt: (startTime: number) => this;\n /** get total animation execution time */\n getTotalAnimationTime: () => number;\n\n getEndAttributes: () => Record<string, any>;\n}\n\nexport interface IAnimateArranger {\n // animation control api\n parallel: (arranger: IAnimateArranger) => this;\n after: (arranger: IAnimateArranger) => this;\n\n // internal properties\n afterArranger: IAnimateArranger;\n parallelArrangers: IAnimateArranger[];\n animators: IAnimator[];\n totalTime: number;\n startTime: number;\n endTime: number;\n arrangeTime: () => void;\n}\n\nexport interface IBaseAnimate {\n // animation control\n stop: () => this;\n pause: () => this;\n resume: () => this;\n\n // internal animation process api\n animate: () => this;\n enable: () => this;\n disable: () => this;\n enableAnimationState: (state: string | string[]) => this;\n disableAnimationState: (state: string | string[]) => this;\n isAnimating: () => boolean;\n\n release: () => void;\n}\n\nexport interface IViewAnimate extends IBaseAnimate {\n animateAddition: (mark: IMark) => this;\n}\n\nexport interface IAnimate extends IBaseAnimate {\n mark: IMark;\n\n // additional animation control\n run: (config: IAnimationConfig | IAnimationConfig[]) => IAnimateArranger;\n runAnimationByState: (animationState: string) => IAnimateArranger;\n stopAnimationByState: (animationState: string) => this;\n pauseAnimationByState: (animationState: string) => this;\n resumeAnimationByState: (animationState: string) => this;\n reverse: () => this;\n restart: () => this;\n record: () => this;\n recordEnd: () => this;\n\n // internal animation process api\n updateConfig: (config: Record<string, IAnimationConfig | IAnimationConfig[]>) => void;\n updateState: (state: MarkFunctionType<string> | null) => void;\n isElementAnimating: (element: IElement) => boolean;\n getAnimatorCount: () => number;\n getElementAnimators: (element: IElement | IElement[], animationState?: string) => IAnimator[];\n release: () => void;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type Nil = null | undefined;
|
|
2
|
+
export type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
|
|
3
|
+
export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;
|
|
4
|
+
export type RecursivePartial<T> = {
|
|
5
|
+
[P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> : Value<T[P]>;
|
|
6
|
+
};
|
|
7
|
+
type AllowedPrimitives = boolean | string | number | Date;
|
|
8
|
+
type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
|
|
9
|
+
export type Vector2<T> = [T, T];
|
|
10
|
+
export type Vector3<T> = [T, T, T];
|
|
11
|
+
export type Vector4<T> = [T, T, T, T];
|
|
12
|
+
export type Vector5<T> = [T, T, T, T, T];
|
|
13
|
+
export type Vector6<T> = [T, T, T, T, T, T];
|
|
14
|
+
export type Vector7<T> = [T, T, T, T, T, T, T];
|
|
15
|
+
export type Vector10<T> = [T, T, T, T, T, T, T, T, T, T];
|
|
16
|
+
export type Vector12<T> = [T, T, T, T, T, T, T, T, T, T, T, T];
|
|
17
|
+
export type CommonPaddingSpec = number | {
|
|
18
|
+
top?: number;
|
|
19
|
+
bottom?: number;
|
|
20
|
+
left?: number;
|
|
21
|
+
right?: number;
|
|
22
|
+
};
|
|
23
|
+
export type DiffResult<Prev, Next> = {
|
|
24
|
+
enter: {
|
|
25
|
+
next: Next;
|
|
26
|
+
}[];
|
|
27
|
+
update: {
|
|
28
|
+
prev: Prev;
|
|
29
|
+
next: Next;
|
|
30
|
+
}[];
|
|
31
|
+
exit: {
|
|
32
|
+
prev: Prev;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
export type ValueOf<T, K extends keyof T = keyof T> = T[K];
|
|
36
|
+
export {};
|
package/es/types/base.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/base.ts"],"names":[],"mappings":"","file":"base.js","sourcesContent":["export type Nil = null | undefined;\n\nexport type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\nexport type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> : Value<T[P]>;\n};\ntype AllowedPrimitives =\n | boolean\n | string\n | number\n | Date /* add any types than should be considered as a value, say, DateTimeOffset */;\ntype Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;\n\nexport type Vector2<T> = [T, T];\nexport type Vector3<T> = [T, T, T];\nexport type Vector4<T> = [T, T, T, T];\nexport type Vector5<T> = [T, T, T, T, T];\nexport type Vector6<T> = [T, T, T, T, T, T];\nexport type Vector7<T> = [T, T, T, T, T, T, T];\nexport type Vector10<T> = [T, T, T, T, T, T, T, T, T, T];\nexport type Vector12<T> = [T, T, T, T, T, T, T, T, T, T, T, T];\n\nexport type CommonPaddingSpec =\n | number\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\nexport type DiffResult<Prev, Next> = {\n enter: { next: Next }[];\n update: { prev: Prev; next: Next }[];\n exit: { prev: Prev }[];\n};\n\nexport type ValueOf<T, K extends keyof T = keyof T> = T[K];\n"]}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { IGraphicAttribute, ISymbolGraphicAttribute, ITextAttribute, ITextGraphicAttribute } from '@visactor/vrender';
|
|
2
|
+
import type { AxisBaseAttributes, BaseCrosshairAttrs, BaseLabelAttrs, DataLabelAttrs, DataZoomAttributes, Direction, GridBaseAttributes, LegendBaseAttributes, OrientType, PlayerAttributes, ScrollBarAttributes, SliderAttributes, TitleAttrs, TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';
|
|
3
|
+
import type { AxisEnum, ComponentEnum } from '../graph';
|
|
4
|
+
import type { Nil } from './base';
|
|
5
|
+
import type { IComponent, IData, IGroupMark, IMark, IScale } from './grammar';
|
|
6
|
+
import type { ChannelEncodeType, ComponentSpec, FieldEncodeType, GenerateBasicEncoderSpec, MarkFunctionType, ScaleEncodeType } from './mark';
|
|
7
|
+
import type { IPointLike } from '@visactor/vutils';
|
|
8
|
+
import type { IElement } from './element';
|
|
9
|
+
import type { IView } from './view';
|
|
10
|
+
export interface IScaleComponent extends IComponent {
|
|
11
|
+
scale: (scale?: IScale | string | Nil) => this;
|
|
12
|
+
}
|
|
13
|
+
export interface ScaleComponentSpec<BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>> extends ComponentSpec<BasicEncoderSpec> {
|
|
14
|
+
scale?: IScale | string;
|
|
15
|
+
}
|
|
16
|
+
export type AxisType = 'line' | 'circle';
|
|
17
|
+
export interface IAxis extends IScaleComponent {
|
|
18
|
+
axisType: (axisType: AxisType | Nil) => this;
|
|
19
|
+
tickCount: (tickCount: MarkFunctionType<number> | Nil) => this;
|
|
20
|
+
inside: (inside: MarkFunctionType<boolean> | Nil) => this;
|
|
21
|
+
baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;
|
|
22
|
+
getAxisComponentType: () => keyof typeof AxisEnum;
|
|
23
|
+
}
|
|
24
|
+
export interface AxisSpec extends ScaleComponentSpec<Partial<AxisBaseAttributes>> {
|
|
25
|
+
componentType: ComponentEnum.axis;
|
|
26
|
+
axisType?: AxisType;
|
|
27
|
+
tickCount?: MarkFunctionType<number>;
|
|
28
|
+
inside?: MarkFunctionType<boolean>;
|
|
29
|
+
baseValue?: MarkFunctionType<number>;
|
|
30
|
+
}
|
|
31
|
+
export type GridShape = 'line' | 'circle' | 'polygon';
|
|
32
|
+
export interface IGrid extends IScaleComponent {
|
|
33
|
+
gridType: (gridType: AxisType | Nil) => this;
|
|
34
|
+
gridShape: (gridShape: GridShape | Nil) => this;
|
|
35
|
+
target: (axis: IAxis | string | Nil) => this;
|
|
36
|
+
tickCount: (tickCount: MarkFunctionType<number> | Nil) => this;
|
|
37
|
+
inside: (inside: MarkFunctionType<boolean> | Nil) => this;
|
|
38
|
+
baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;
|
|
39
|
+
}
|
|
40
|
+
export interface GridSpec extends ScaleComponentSpec<Partial<GridBaseAttributes>> {
|
|
41
|
+
componentType: ComponentEnum.grid;
|
|
42
|
+
gridType?: AxisType;
|
|
43
|
+
gridShape?: GridShape;
|
|
44
|
+
target?: IAxis | string;
|
|
45
|
+
tickCount?: MarkFunctionType<number>;
|
|
46
|
+
inside?: MarkFunctionType<boolean>;
|
|
47
|
+
baseValue?: MarkFunctionType<number>;
|
|
48
|
+
}
|
|
49
|
+
export type LegendType = 'auto' | 'discrete' | 'color' | 'size';
|
|
50
|
+
export interface ILegend extends IScaleComponent {
|
|
51
|
+
legendType: (legendType: LegendType | Nil) => this;
|
|
52
|
+
target: (data: IData | string | Nil, filter: string | ((datum: any, legendValues: any) => boolean) | Nil) => this;
|
|
53
|
+
setSelected: (selectedValues: any[]) => this;
|
|
54
|
+
}
|
|
55
|
+
export interface LegendSpec extends ScaleComponentSpec<LegendBaseAttributes> {
|
|
56
|
+
componentType: ComponentEnum.legend;
|
|
57
|
+
legendType?: LegendType;
|
|
58
|
+
shapeScale?: IScale | string;
|
|
59
|
+
target?: {
|
|
60
|
+
data: IData | string;
|
|
61
|
+
filter: string | ((datum: any, legendValues: any[]) => boolean);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export type CrosshairType = 'x' | 'y' | 'angle' | 'radius' | 'radius-polygon';
|
|
65
|
+
export type CrosshairShape = 'line' | 'rect';
|
|
66
|
+
export interface ICrosshair extends IScaleComponent {
|
|
67
|
+
crosshairType: (crosshairType: CrosshairType | Nil) => this;
|
|
68
|
+
crosshairShape: (crosshairShape: CrosshairShape | Nil) => this;
|
|
69
|
+
}
|
|
70
|
+
export interface CrosshairSpec extends ScaleComponentSpec<BaseCrosshairAttrs> {
|
|
71
|
+
componentType: ComponentEnum.crosshair;
|
|
72
|
+
crosshairType?: CrosshairType;
|
|
73
|
+
crosshairShape?: CrosshairShape;
|
|
74
|
+
componentConfig?: {
|
|
75
|
+
radius?: number;
|
|
76
|
+
center?: IPointLike;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export type SliderFilterValue = {
|
|
80
|
+
start: number;
|
|
81
|
+
end: number;
|
|
82
|
+
};
|
|
83
|
+
export interface ISlider extends IComponent {
|
|
84
|
+
min: (min: MarkFunctionType<number> | Nil) => this;
|
|
85
|
+
max: (max: MarkFunctionType<number> | Nil) => this;
|
|
86
|
+
target: (data: IData | string | Nil, filter: string | ((datum: any, value: SliderFilterValue) => boolean) | Nil) => this;
|
|
87
|
+
setStartEndValue: (start?: number, end?: number) => this;
|
|
88
|
+
}
|
|
89
|
+
export interface SliderSpec extends ComponentSpec<Partial<SliderAttributes>> {
|
|
90
|
+
componentType: ComponentEnum.slider;
|
|
91
|
+
min?: MarkFunctionType<number>;
|
|
92
|
+
max?: MarkFunctionType<number>;
|
|
93
|
+
target?: {
|
|
94
|
+
data: IData | string;
|
|
95
|
+
filter: string | ((datum: any, value: SliderFilterValue) => boolean);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export type DatazoomFilterValue = {
|
|
99
|
+
start: number;
|
|
100
|
+
end: number;
|
|
101
|
+
startRatio: number;
|
|
102
|
+
endRatio: number;
|
|
103
|
+
};
|
|
104
|
+
export interface IDatazoom extends IComponent {
|
|
105
|
+
preview: (data: IData | string | Nil, x: ScaleEncodeType | Nil, y: ScaleEncodeType | Nil, x1?: ChannelEncodeType | Nil, y1?: ChannelEncodeType | Nil) => this;
|
|
106
|
+
target: (data: IData | string | Nil, filter: string | ((datum: any, value: DatazoomFilterValue) => boolean) | Nil) => this;
|
|
107
|
+
setStartEndValue: (start?: number, end?: number) => this;
|
|
108
|
+
}
|
|
109
|
+
export type DataZoomEncoderSpec = GenerateBasicEncoderSpec<Partial<DataZoomAttributes> & {
|
|
110
|
+
x1?: number;
|
|
111
|
+
y1?: number;
|
|
112
|
+
}>;
|
|
113
|
+
export interface DatazoomSpec extends ComponentSpec<DataZoomEncoderSpec> {
|
|
114
|
+
componentType: ComponentEnum.datazoom;
|
|
115
|
+
preview?: {
|
|
116
|
+
data: IData | string;
|
|
117
|
+
x?: ScaleEncodeType;
|
|
118
|
+
y?: ScaleEncodeType;
|
|
119
|
+
x1?: ChannelEncodeType;
|
|
120
|
+
y1?: ChannelEncodeType;
|
|
121
|
+
};
|
|
122
|
+
target?: {
|
|
123
|
+
data: IData | string;
|
|
124
|
+
filter: string | ((datum: any, value: DatazoomFilterValue) => boolean);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface ILabel extends IComponent {
|
|
128
|
+
labelStyle: (attributes: MarkFunctionType<Partial<BaseLabelAttrs>>) => this;
|
|
129
|
+
size: (attributes: MarkFunctionType<DataLabelAttrs['size']>) => this;
|
|
130
|
+
target: (mark: IMark | IMark[] | string | string[] | Nil) => this;
|
|
131
|
+
}
|
|
132
|
+
export type LabelEncoderSpec = GenerateBasicEncoderSpec<Partial<BaseLabelAttrs> & {
|
|
133
|
+
text?: ITextAttribute['text'];
|
|
134
|
+
}>;
|
|
135
|
+
export interface LabelSpec extends ComponentSpec<LabelEncoderSpec> {
|
|
136
|
+
componentType: ComponentEnum.label;
|
|
137
|
+
labelStyle?: MarkFunctionType<Partial<BaseLabelAttrs>>;
|
|
138
|
+
size?: MarkFunctionType<DataLabelAttrs['size']>;
|
|
139
|
+
target?: IMark | IMark[] | string | string[];
|
|
140
|
+
}
|
|
141
|
+
export type PlayerType = 'auto' | 'discrete' | 'continuous';
|
|
142
|
+
export type PlayerFilterValue = {
|
|
143
|
+
index: number;
|
|
144
|
+
value: any;
|
|
145
|
+
};
|
|
146
|
+
export interface IPlayer extends IComponent {
|
|
147
|
+
playerType: (playerType: PlayerType) => this;
|
|
148
|
+
target: (data: IData | string | Nil, source: IData | string | any[] | Nil) => this;
|
|
149
|
+
play: () => this;
|
|
150
|
+
pause: () => this;
|
|
151
|
+
backward: () => this;
|
|
152
|
+
forward: () => this;
|
|
153
|
+
}
|
|
154
|
+
export interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {
|
|
155
|
+
componentType: ComponentEnum.player;
|
|
156
|
+
playerType?: PlayerType;
|
|
157
|
+
target?: {
|
|
158
|
+
data: IData | string;
|
|
159
|
+
source: IData | string | any[];
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export type CustomTooltipCallback = (datum: any, element: IElement, parameters: any) => TooltipRowAttrs | TooltipRowAttrs[];
|
|
163
|
+
export interface ITooltipRow {
|
|
164
|
+
visible?: boolean;
|
|
165
|
+
key?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;
|
|
166
|
+
value?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;
|
|
167
|
+
symbol?: MarkFunctionType<string | Partial<ISymbolGraphicAttribute>> | FieldEncodeType;
|
|
168
|
+
}
|
|
169
|
+
export interface IBaseTooltip extends IComponent {
|
|
170
|
+
title: (title: ITooltipRow | string | CustomTooltipCallback | Nil) => this;
|
|
171
|
+
content: (content: ITooltipRow | ITooltipRow[] | CustomTooltipCallback | Nil) => this;
|
|
172
|
+
}
|
|
173
|
+
export interface ITooltip extends IBaseTooltip {
|
|
174
|
+
target: (mark: IMark | IMark[] | string | string[] | Nil) => this;
|
|
175
|
+
}
|
|
176
|
+
export interface BaseTooltipSpec extends ComponentSpec<TooltipAttributes> {
|
|
177
|
+
title?: ITooltipRow | string | CustomTooltipCallback;
|
|
178
|
+
content?: ITooltipRow | ITooltipRow[] | CustomTooltipCallback;
|
|
179
|
+
}
|
|
180
|
+
export interface TooltipSpec extends BaseTooltipSpec {
|
|
181
|
+
componentType: ComponentEnum.tooltip;
|
|
182
|
+
target?: IMark | IMark[] | string | string[];
|
|
183
|
+
}
|
|
184
|
+
export type TooltipType = 'x' | 'y' | 'angle' | 'radius';
|
|
185
|
+
export interface IDimensionTooltip extends IBaseTooltip {
|
|
186
|
+
scale: (scale?: IScale | string | Nil) => this;
|
|
187
|
+
tooltipType: (tooltipType: TooltipType | Nil) => this;
|
|
188
|
+
target: (data: IData | string | Nil, filter: string | ((datum: any, tooltipValue: any) => boolean) | Nil) => this;
|
|
189
|
+
avoidMark: (mark: IMark | IMark[] | string | string[] | Nil) => this;
|
|
190
|
+
}
|
|
191
|
+
export interface DimensionTooltipSpec extends BaseTooltipSpec {
|
|
192
|
+
componentType: ComponentEnum.dimensionTooltip;
|
|
193
|
+
scale?: IScale | string;
|
|
194
|
+
tooltipType?: TooltipType;
|
|
195
|
+
target?: {
|
|
196
|
+
data: IData | string;
|
|
197
|
+
filter: string | ((datum: any, tooltipValue: any) => boolean);
|
|
198
|
+
};
|
|
199
|
+
avoidMark?: IMark | IMark[] | string | string[];
|
|
200
|
+
componentConfig?: {
|
|
201
|
+
center?: IPointLike;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface ITitle extends IComponent {
|
|
205
|
+
title: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
|
|
206
|
+
subTitle: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
|
|
207
|
+
}
|
|
208
|
+
export interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {
|
|
209
|
+
componentType: ComponentEnum.title;
|
|
210
|
+
title?: MarkFunctionType<string | number | number[] | string[]>;
|
|
211
|
+
subTitle?: MarkFunctionType<string | number | number[] | string[]>;
|
|
212
|
+
}
|
|
213
|
+
export type ScrollbarFilterValue = {
|
|
214
|
+
start?: number;
|
|
215
|
+
end?: number;
|
|
216
|
+
startRatio: number;
|
|
217
|
+
endRatio: number;
|
|
218
|
+
};
|
|
219
|
+
export interface IScrollbar extends IScaleComponent {
|
|
220
|
+
target: (data: IData | string | Nil, filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean) | Nil) => this;
|
|
221
|
+
container: (container: IGroupMark | string | Nil) => this;
|
|
222
|
+
direction: (direction: MarkFunctionType<Direction> | Nil) => this;
|
|
223
|
+
position: (position: MarkFunctionType<OrientType> | Nil) => this;
|
|
224
|
+
setScrollStart: (start: number) => this;
|
|
225
|
+
}
|
|
226
|
+
export interface ScrollbarSpec extends ScaleComponentSpec<Partial<ScrollBarAttributes>> {
|
|
227
|
+
componentType: ComponentEnum.scrollbar;
|
|
228
|
+
target?: {
|
|
229
|
+
data: IData | string;
|
|
230
|
+
filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean);
|
|
231
|
+
};
|
|
232
|
+
container?: IGroupMark | string;
|
|
233
|
+
direction?: MarkFunctionType<Direction>;
|
|
234
|
+
position?: MarkFunctionType<OrientType>;
|
|
235
|
+
}
|
|
236
|
+
export type BuiltInComponentSpec = AxisSpec | LegendSpec | CrosshairSpec | SliderSpec | DatazoomSpec | LabelSpec | PlayerSpec | TooltipSpec | DimensionTooltipSpec | TitleSpec | ScrollbarSpec;
|
|
237
|
+
export interface IComponentConstructor {
|
|
238
|
+
readonly componentType: string;
|
|
239
|
+
new (view: IView, group?: IGroupMark, mode?: '2d' | '3d'): IComponent;
|
|
240
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/component.ts"],"names":[],"mappings":"","file":"component.js","sourcesContent":["import type {\n IGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender';\nimport type {\n AxisBaseAttributes,\n BaseCrosshairAttrs,\n BaseLabelAttrs,\n DataLabelAttrs,\n DataZoomAttributes,\n Direction,\n GridBaseAttributes,\n LegendBaseAttributes,\n OrientType,\n PlayerAttributes,\n ScrollBarAttributes,\n SliderAttributes,\n TitleAttrs,\n TooltipAttributes,\n TooltipRowAttrs\n} from '@visactor/vrender-components';\nimport type { AxisEnum, ComponentEnum } from '../graph';\nimport type { Nil } from './base';\nimport type { IComponent, IData, IGroupMark, IMark, IScale } from './grammar';\nimport type {\n ChannelEncodeType,\n ComponentSpec,\n FieldEncodeType,\n GenerateBasicEncoderSpec,\n MarkFunctionType,\n ScaleEncodeType\n} from './mark';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { IElement } from './element';\nimport type { IView } from './view';\n\n// scale component\n\nexport interface IScaleComponent extends IComponent {\n scale: (scale?: IScale | string | Nil) => this;\n}\n\nexport interface ScaleComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends ComponentSpec<BasicEncoderSpec> {\n scale?: IScale | string;\n}\n\n// axis component\n\nexport type AxisType = 'line' | 'circle';\n\nexport interface IAxis extends IScaleComponent {\n axisType: (axisType: AxisType | Nil) => this;\n tickCount: (tickCount: MarkFunctionType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n\n // internal interface\n getAxisComponentType: () => keyof typeof AxisEnum;\n}\n\nexport interface AxisSpec extends ScaleComponentSpec<Partial<AxisBaseAttributes>> {\n componentType: ComponentEnum.axis;\n axisType?: AxisType;\n tickCount?: MarkFunctionType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// grid component\n\nexport type GridShape = 'line' | 'circle' | 'polygon';\n\nexport interface IGrid extends IScaleComponent {\n gridType: (gridType: AxisType | Nil) => this;\n gridShape: (gridShape: GridShape | Nil) => this;\n target: (axis: IAxis | string | Nil) => this;\n tickCount: (tickCount: MarkFunctionType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n}\n\nexport interface GridSpec extends ScaleComponentSpec<Partial<GridBaseAttributes>> {\n componentType: ComponentEnum.grid;\n gridType?: AxisType;\n gridShape?: GridShape;\n target?: IAxis | string;\n tickCount?: MarkFunctionType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// legend component\n\nexport type LegendType = 'auto' | 'discrete' | 'color' | 'size';\n\nexport interface ILegend extends IScaleComponent {\n legendType: (legendType: LegendType | Nil) => this;\n target: (data: IData | string | Nil, filter: string | ((datum: any, legendValues: any) => boolean) | Nil) => this;\n\n // immediate functions\n setSelected: (selectedValues: any[]) => this;\n}\n\nexport interface LegendSpec extends ScaleComponentSpec<LegendBaseAttributes> {\n componentType: ComponentEnum.legend;\n legendType?: LegendType;\n shapeScale?: IScale | string;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, legendValues: any[]) => boolean);\n };\n}\n\n// crosshair component\n\nexport type CrosshairType = 'x' | 'y' | 'angle' | 'radius' | 'radius-polygon';\n\nexport type CrosshairShape = 'line' | 'rect';\n\nexport interface ICrosshair extends IScaleComponent {\n crosshairType: (crosshairType: CrosshairType | Nil) => this;\n crosshairShape: (crosshairShape: CrosshairShape | Nil) => this;\n}\n\nexport interface CrosshairSpec extends ScaleComponentSpec<BaseCrosshairAttrs> {\n componentType: ComponentEnum.crosshair;\n crosshairType?: CrosshairType;\n crosshairShape?: CrosshairShape;\n componentConfig?: { radius?: number; center?: IPointLike };\n}\n\n// slider component\n\nexport type SliderFilterValue = { start: number; end: number };\n\nexport interface ISlider extends IComponent {\n min: (min: MarkFunctionType<number> | Nil) => this;\n max: (max: MarkFunctionType<number> | Nil) => this;\n target: (\n data: IData | string | Nil,\n filter: string | ((datum: any, value: SliderFilterValue) => boolean) | Nil\n ) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n}\n\nexport interface SliderSpec extends ComponentSpec<Partial<SliderAttributes>> {\n componentType: ComponentEnum.slider;\n min?: MarkFunctionType<number>;\n max?: MarkFunctionType<number>;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, value: SliderFilterValue) => boolean);\n };\n}\n\n// datazoom component\n\nexport type DatazoomFilterValue = { start: number; end: number; startRatio: number; endRatio: number };\n\nexport interface IDatazoom extends IComponent {\n preview: (\n data: IData | string | Nil,\n x: ScaleEncodeType | Nil,\n y: ScaleEncodeType | Nil,\n x1?: ChannelEncodeType | Nil,\n y1?: ChannelEncodeType | Nil\n ) => this;\n target: (\n data: IData | string | Nil,\n filter: string | ((datum: any, value: DatazoomFilterValue) => boolean) | Nil\n ) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n}\n\nexport type DataZoomEncoderSpec = GenerateBasicEncoderSpec<Partial<DataZoomAttributes> & { x1?: number; y1?: number }>;\nexport interface DatazoomSpec extends ComponentSpec<DataZoomEncoderSpec> {\n componentType: ComponentEnum.datazoom;\n preview?: {\n data: IData | string;\n x?: ScaleEncodeType;\n y?: ScaleEncodeType;\n x1?: ChannelEncodeType;\n y1?: ChannelEncodeType;\n };\n target?: {\n data: IData | string;\n filter: string | ((datum: any, value: DatazoomFilterValue) => boolean);\n };\n}\n\n// label component\n\nexport interface ILabel extends IComponent {\n labelStyle: (attributes: MarkFunctionType<Partial<BaseLabelAttrs>>) => this;\n size: (attributes: MarkFunctionType<DataLabelAttrs['size']>) => this;\n target: (mark: IMark | IMark[] | string | string[] | Nil) => this;\n}\n\nexport type LabelEncoderSpec = GenerateBasicEncoderSpec<Partial<BaseLabelAttrs> & { text?: ITextAttribute['text'] }>;\nexport interface LabelSpec extends ComponentSpec<LabelEncoderSpec> {\n componentType: ComponentEnum.label;\n labelStyle?: MarkFunctionType<Partial<BaseLabelAttrs>>;\n size?: MarkFunctionType<DataLabelAttrs['size']>;\n target?: IMark | IMark[] | string | string[];\n}\n\n// player component\n\nexport type PlayerType = 'auto' | 'discrete' | 'continuous';\n\nexport type PlayerFilterValue = { index: number; value: any };\n\nexport interface IPlayer extends IComponent {\n playerType: (playerType: PlayerType) => this;\n target: (data: IData | string | Nil, source: IData | string | any[] | Nil) => this;\n\n // immediate functions\n play: () => this;\n pause: () => this;\n backward: () => this;\n forward: () => this;\n}\n\nexport interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {\n componentType: ComponentEnum.player;\n playerType?: PlayerType;\n target?: {\n data: IData | string;\n source: IData | string | any[];\n };\n}\n\n// tooltip component\n\nexport type CustomTooltipCallback = (\n datum: any,\n element: IElement,\n parameters: any\n) => TooltipRowAttrs | TooltipRowAttrs[];\n\nexport interface ITooltipRow {\n visible?: boolean;\n key?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n value?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n symbol?: MarkFunctionType<string | Partial<ISymbolGraphicAttribute>> | FieldEncodeType;\n}\n\nexport interface IBaseTooltip extends IComponent {\n title: (title: ITooltipRow | string | CustomTooltipCallback | Nil) => this;\n content: (content: ITooltipRow | ITooltipRow[] | CustomTooltipCallback | Nil) => this;\n}\n\nexport interface ITooltip extends IBaseTooltip {\n target: (mark: IMark | IMark[] | string | string[] | Nil) => this;\n}\n\nexport interface BaseTooltipSpec extends ComponentSpec<TooltipAttributes> {\n title?: ITooltipRow | string | CustomTooltipCallback;\n content?: ITooltipRow | ITooltipRow[] | CustomTooltipCallback;\n}\n\nexport interface TooltipSpec extends BaseTooltipSpec {\n componentType: ComponentEnum.tooltip;\n target?: IMark | IMark[] | string | string[];\n}\n\nexport type TooltipType = 'x' | 'y' | 'angle' | 'radius';\n\nexport interface IDimensionTooltip extends IBaseTooltip {\n scale: (scale?: IScale | string | Nil) => this;\n tooltipType: (tooltipType: TooltipType | Nil) => this;\n target: (data: IData | string | Nil, filter: string | ((datum: any, tooltipValue: any) => boolean) | Nil) => this;\n avoidMark: (mark: IMark | IMark[] | string | string[] | Nil) => this;\n}\n\nexport interface DimensionTooltipSpec extends BaseTooltipSpec {\n componentType: ComponentEnum.dimensionTooltip;\n scale?: IScale | string;\n tooltipType?: TooltipType;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, tooltipValue: any) => boolean);\n };\n avoidMark?: IMark | IMark[] | string | string[];\n componentConfig?: { center?: IPointLike };\n}\n\n// title component\n\nexport interface ITitle extends IComponent {\n title: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;\n subTitle: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;\n}\n\nexport interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {\n componentType: ComponentEnum.title;\n title?: MarkFunctionType<string | number | number[] | string[]>;\n subTitle?: MarkFunctionType<string | number | number[] | string[]>;\n}\n\n// scrollbar component\n\nexport type ScrollbarFilterValue = { start?: number; end?: number; startRatio: number; endRatio: number };\n\nexport interface IScrollbar extends IScaleComponent {\n target: (\n data: IData | string | Nil,\n filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean) | Nil\n ) => this;\n container: (container: IGroupMark | string | Nil) => this;\n direction: (direction: MarkFunctionType<Direction> | Nil) => this;\n position: (position: MarkFunctionType<OrientType> | Nil) => this;\n\n // immediate functions\n setScrollStart: (start: number) => this;\n}\n\nexport interface ScrollbarSpec extends ScaleComponentSpec<Partial<ScrollBarAttributes>> {\n componentType: ComponentEnum.scrollbar;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean);\n };\n container?: IGroupMark | string;\n direction?: MarkFunctionType<Direction>;\n position?: MarkFunctionType<OrientType>;\n}\n\n// built-in components\n\nexport type BuiltInComponentSpec =\n | AxisSpec\n | LegendSpec\n | CrosshairSpec\n | SliderSpec\n | DatazoomSpec\n | LabelSpec\n | PlayerSpec\n | TooltipSpec\n | DimensionTooltipSpec\n | TitleSpec\n | ScrollbarSpec;\n\nexport interface IComponentConstructor {\n readonly componentType: string;\n\n new (view: IView, group?: IGroupMark, mode?: '2d' | '3d'): IComponent;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IBaseCoordinate, CoordinateType } from '@visactor/vgrammar-coordinate';
|
|
2
|
+
import type { GrammarSpec } from './grammar';
|
|
3
|
+
import type { GenericFunctionType } from './signal';
|
|
4
|
+
export type CoordinateFunctionCallback<T> = (scale: IBaseCoordinate, parameters: any) => T;
|
|
5
|
+
export type CoordinateFunctionType<T> = GenericFunctionType<CoordinateFunctionCallback<T>, T>;
|
|
6
|
+
export interface CoordinateSpec extends GrammarSpec {
|
|
7
|
+
type: CoordinateType;
|
|
8
|
+
start?: CoordinateFunctionType<[number, number]>;
|
|
9
|
+
end?: CoordinateFunctionType<[number, number]>;
|
|
10
|
+
origin?: CoordinateFunctionType<[number, number]>;
|
|
11
|
+
translate?: CoordinateFunctionType<[number, number]>;
|
|
12
|
+
rotate?: CoordinateFunctionType<number>;
|
|
13
|
+
scale?: CoordinateFunctionType<[number, number]>;
|
|
14
|
+
transpose?: CoordinateFunctionType<boolean>;
|
|
15
|
+
}
|