@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,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.parseColor = exports.parseField = exports.isGrammar = exports.isSignal = exports.getGrammarOutput = exports.invokeParameterFunctionType = exports.invokeFunctionType = exports.isFunctionType = exports.parseFunctionType = exports.parseReference = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
function parseReference(dependency, view) {
|
|
10
|
+
return (0, vutils_1.array)(dependency).reduce(((refs, dep) => {
|
|
11
|
+
const ref = (0, vutils_1.isString)(dep) ? view.getGrammarById(dep) : dep;
|
|
12
|
+
return ref && refs.push(ref), refs;
|
|
13
|
+
}), []);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isSignalReferenceType(signal) {
|
|
17
|
+
return !(0, vutils_1.isFunction)(signal) && !!(null == signal ? void 0 : signal.signal);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isSignalFunctionType(signal) {
|
|
21
|
+
return !(0, vutils_1.isFunction)(signal) && !!(null == signal ? void 0 : signal.callback);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parseFunctionType(spec, view) {
|
|
25
|
+
if ((0, vutils_1.isNil)(spec)) return [];
|
|
26
|
+
if (isSignalReferenceType(spec)) {
|
|
27
|
+
const signal = spec.signal;
|
|
28
|
+
if ((0, vutils_1.isString)(signal)) return (0, vutils_1.array)(view.getGrammarById(signal));
|
|
29
|
+
if ("signal" === (null == signal ? void 0 : signal.grammarType)) return [ signal ];
|
|
30
|
+
} else if (isSignalFunctionType(spec)) return parseReference(spec.dependency, view);
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isFunctionType(spec) {
|
|
35
|
+
return (0, vutils_1.isFunction)(spec) || (null == spec ? void 0 : spec.signal) || !!(null == spec ? void 0 : spec.callback);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function invokeFunctionType(spec, parameters, datumOrGrammarInstance, element) {
|
|
39
|
+
if ((0, vutils_1.isNil)(spec)) return spec;
|
|
40
|
+
if ((0, vutils_1.isFunction)(spec)) return element ? spec.call(null, datumOrGrammarInstance, element, parameters) : spec.call(null, datumOrGrammarInstance, parameters);
|
|
41
|
+
if (spec.signal) {
|
|
42
|
+
const signal = spec.signal;
|
|
43
|
+
return (0, vutils_1.isString)(signal) ? null == parameters ? void 0 : parameters[signal] : signal.output();
|
|
44
|
+
}
|
|
45
|
+
return spec.callback ? element ? spec.callback.call(null, datumOrGrammarInstance, element, parameters) : spec.callback.call(null, datumOrGrammarInstance, parameters) : spec;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function invokeParameterFunctionType(spec, parameters) {
|
|
49
|
+
if ((0, vutils_1.isNil)(spec)) return spec;
|
|
50
|
+
if ((0, vutils_1.isFunction)(spec)) return spec.call(null, parameters);
|
|
51
|
+
if (spec.signal) {
|
|
52
|
+
const signal = spec.signal;
|
|
53
|
+
return (0, vutils_1.isString)(signal) ? null == parameters ? void 0 : parameters[signal] : signal.output();
|
|
54
|
+
}
|
|
55
|
+
return spec.callback ? spec.callback.call(null, parameters) : spec;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getGrammarOutput(grammar, parameters) {
|
|
59
|
+
return (0, exports.isGrammar)(grammar) ? grammar.output() : parameters[grammar];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function isSignal(obj) {
|
|
63
|
+
return obj && (obj.signal || obj.callback);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.parseReference = parseReference, exports.parseFunctionType = parseFunctionType,
|
|
67
|
+
exports.isFunctionType = isFunctionType, exports.invokeFunctionType = invokeFunctionType,
|
|
68
|
+
exports.invokeParameterFunctionType = invokeParameterFunctionType, exports.getGrammarOutput = getGrammarOutput,
|
|
69
|
+
exports.isSignal = isSignal;
|
|
70
|
+
|
|
71
|
+
const isGrammar = el => el && !(0, vutils_1.isNil)(el.grammarType);
|
|
72
|
+
|
|
73
|
+
exports.isGrammar = isGrammar;
|
|
74
|
+
|
|
75
|
+
const parseField = field => (0, vutils_1.isFunction)(field) ? field : datum => datum[field];
|
|
76
|
+
|
|
77
|
+
exports.parseField = parseField;
|
|
78
|
+
|
|
79
|
+
const parseColor = color => (0, vutils_1.isString)(color) && vutils_1.Color.parseColorString(color) ? color : null;
|
|
80
|
+
|
|
81
|
+
exports.parseColor = parseColor;
|
|
82
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/parse/util.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAe7E,SAAgB,cAAc,CAAC,UAAiD,EAAE,IAAW;IAC3F,MAAM,YAAY,GAAuB,IAAA,cAAK,EAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,IAAoB,EAAE,GAA0B,EAAE,EAAE;QAC9E,MAAM,GAAG,GAAG,CAAC,IAAA,iBAAQ,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAiB,CAAC;QAEvF,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAVD,wCAUC;AAED,SAAS,qBAAqB,CAAC,MAAW;IACxC,OAAO,CAAC,IAAA,mBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAA0B,aAA1B,MAAM,uBAAN,MAAM,CAAsB,MAAM,CAAA,CAAC;AACtE,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAW;IAEX,OAAO,CAAC,IAAA,mBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAsC,aAAtC,MAA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vutils';\nimport type { IElement } from '../types/element';\nimport type {\n FunctionCallback,\n SignalDependency,\n SignalReference,\n IView,\n GenericFunctionType,\n SignalFunction,\n ParameterFunctionType,\n ParameterCallback,\n Nil\n} from '../types';\nimport type { IGrammarBase } from '../types/grammar';\n\nexport function parseReference(dependency: SignalDependency | SignalDependency[], view: IView): IGrammarBase[] {\n const dependencies: SignalDependency[] = array(dependency);\n return dependencies.reduce((refs: IGrammarBase[], dep: string | IGrammarBase) => {\n const ref = (isString(dep) ? view.getGrammarById(dep as string) : dep) as IGrammarBase;\n\n if (ref) {\n refs.push(ref);\n }\n return refs;\n }, []);\n}\n\nfunction isSignalReferenceType(signal: any): signal is SignalReference {\n return !isFunction(signal) && !!(signal as SignalReference)?.signal;\n}\n\nfunction isSignalFunctionType<Callback extends FunctionCallback<T>, T>(\n signal: any\n): signal is SignalFunction<Callback, T> {\n return !isFunction(signal) && !!(signal as SignalFunction<Callback, T>)?.callback;\n}\n\nexport function parseFunctionType<Callback extends FunctionCallback<T>, T>(\n spec: GenericFunctionType<Callback, T> | Nil,\n view: IView\n): IGrammarBase[] {\n if (isNil(spec)) {\n return [];\n }\n if (isSignalReferenceType(spec)) {\n const signal = spec.signal;\n if (isString(signal)) {\n return array<IGrammarBase>(view.getGrammarById(signal as string) as IGrammarBase);\n } else if ((signal as IGrammarBase)?.grammarType === 'signal') {\n return [signal as IGrammarBase];\n }\n } else if (isSignalFunctionType(spec)) {\n return parseReference((spec as SignalFunction<Callback, T>).dependency, view);\n }\n return [];\n}\n\nexport function isFunctionType<Callback extends FunctionCallback<T>, T>(\n spec: any\n): spec is Callback | SignalReference | SignalFunction<Callback, T> {\n return isFunction(spec) || spec?.signal || !!(spec as SignalFunction<Callback, T>)?.callback;\n}\n\nexport function invokeFunctionType<Callback extends FunctionCallback<T>, T>(\n spec: GenericFunctionType<Callback, T> | Nil,\n parameters: any,\n datumOrGrammarInstance?: any | IGrammarBase,\n element?: IElement | any\n): T {\n if (isNil(spec)) {\n return spec as T;\n }\n\n if (isFunction(spec)) {\n if (element) {\n return (spec as Callback).call(null, datumOrGrammarInstance, element, parameters);\n }\n return (spec as Callback).call(null, datumOrGrammarInstance, parameters);\n } else if ((spec as SignalReference).signal) {\n const signal = (spec as SignalReference).signal;\n if (isString(signal)) {\n return parameters?.[signal as string];\n }\n return (signal as IGrammarBase).output();\n } else if ((spec as SignalFunction<Callback, T>).callback) {\n if (element) {\n return (spec as SignalFunction<Callback, T>).callback.call(null, datumOrGrammarInstance, element, parameters);\n }\n return (spec as SignalFunction<Callback, T>).callback.call(null, datumOrGrammarInstance, parameters);\n }\n return spec as T;\n}\n\nexport function invokeParameterFunctionType<T>(spec: ParameterFunctionType<T>, parameters: any): T {\n if (isNil(spec)) {\n return spec as T;\n }\n\n if (isFunction(spec)) {\n return spec.call(null, parameters);\n } else if ((spec as SignalReference).signal) {\n const signal = (spec as SignalReference).signal;\n if (isString(signal)) {\n return parameters?.[signal as string];\n }\n return (signal as IGrammarBase).output();\n } else if ((spec as SignalFunction<ParameterCallback<T>, T>).callback) {\n return (spec as SignalFunction<ParameterCallback<T>, T>).callback.call(null, parameters);\n }\n return spec as T;\n}\n\nexport function getGrammarOutput(grammar: IGrammarBase | string, parameters: any) {\n return isGrammar(grammar) ? grammar.output() : parameters[grammar];\n}\n\n/**\n * 判断是否是依赖signal\n */\nexport function isSignal(obj: any) {\n return obj && (obj.signal || obj.callback);\n}\n\nexport const isGrammar = (el: any): el is IGrammarBase => {\n return el && !isNil(el.grammarType);\n};\n\nexport const parseField = <T>(field: ((datum: T) => symbol | string) | string | symbol) => {\n if (isFunction(field)) {\n return field;\n }\n return (datum: T) => datum[field];\n};\n\nexport const parseColor = (color: any): string | null => {\n if (isString(color) && Color.parseColorString(color)) {\n return color;\n }\n return null;\n};\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IRunningConfig, ITheme, SignalSpec } from '../types';
|
|
2
|
+
import type { IViewOptions, IViewThemeConfig, ViewSpec } from '../types/view';
|
|
3
|
+
export declare const BuiltInSignalID: string[];
|
|
4
|
+
export declare const builtInSignals: (option: IViewOptions, config: IViewThemeConfig, theme: ITheme) => SignalSpec<any>[];
|
|
5
|
+
export declare const normalizePadding: (value: number | {
|
|
6
|
+
top?: number;
|
|
7
|
+
left?: number;
|
|
8
|
+
right?: number;
|
|
9
|
+
bottom?: number;
|
|
10
|
+
}) => {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
right: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const normalizeMarkTree: (spec: ViewSpec) => ViewSpec;
|
|
17
|
+
export declare const normalizeRunningConfig: (runningConfig: IRunningConfig) => IRunningConfig;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.normalizeRunningConfig = exports.normalizeMarkTree = exports.normalizePadding = exports.builtInSignals = exports.BuiltInSignalID = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), constants_1 = require("../graph/constants"), constants_2 = require("../view/constants");
|
|
8
|
+
|
|
9
|
+
let markBaseId = -1;
|
|
10
|
+
|
|
11
|
+
exports.BuiltInSignalID = [ constants_2.SIGNAL_WIDTH, constants_2.SIGNAL_HEIGHT, constants_2.SIGNAL_PADDING, constants_2.SIGNAL_VIEW_WIDTH, constants_2.SIGNAL_VIEW_HEIGHT, constants_2.SIGNAL_VIEW_BOX, constants_2.SIGNAL_AUTOFIT ];
|
|
12
|
+
|
|
13
|
+
const builtInSignals = (option, config, theme) => {
|
|
14
|
+
var _a, _b, _c, _d, _e;
|
|
15
|
+
return [ {
|
|
16
|
+
id: constants_2.SIGNAL_WIDTH,
|
|
17
|
+
value: null !== (_a = option[constants_2.SIGNAL_WIDTH]) && void 0 !== _a ? _a : 0
|
|
18
|
+
}, {
|
|
19
|
+
id: constants_2.SIGNAL_HEIGHT,
|
|
20
|
+
value: null !== (_b = option[constants_2.SIGNAL_HEIGHT]) && void 0 !== _b ? _b : 0
|
|
21
|
+
}, {
|
|
22
|
+
id: constants_2.SIGNAL_PADDING,
|
|
23
|
+
value: (0, exports.normalizePadding)(null !== (_d = null !== (_c = option[constants_2.SIGNAL_PADDING]) && void 0 !== _c ? _c : config[constants_2.SIGNAL_PADDING]) && void 0 !== _d ? _d : theme.padding)
|
|
24
|
+
}, {
|
|
25
|
+
id: constants_2.SIGNAL_VIEW_WIDTH,
|
|
26
|
+
update: {
|
|
27
|
+
callback: (signal, params) => {
|
|
28
|
+
const padding = (0, exports.normalizePadding)(params[constants_2.SIGNAL_PADDING]);
|
|
29
|
+
return params[constants_2.SIGNAL_WIDTH] - padding.left - padding.right;
|
|
30
|
+
},
|
|
31
|
+
dependency: [ constants_2.SIGNAL_WIDTH, constants_2.SIGNAL_PADDING ]
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
id: constants_2.SIGNAL_VIEW_HEIGHT,
|
|
35
|
+
update: {
|
|
36
|
+
callback: (signal, params) => {
|
|
37
|
+
const padding = (0, exports.normalizePadding)(params[constants_2.SIGNAL_PADDING]);
|
|
38
|
+
return params[constants_2.SIGNAL_HEIGHT] - padding.top - padding.bottom;
|
|
39
|
+
},
|
|
40
|
+
dependency: [ constants_2.SIGNAL_HEIGHT, constants_2.SIGNAL_PADDING ]
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
id: constants_2.SIGNAL_VIEW_BOX,
|
|
44
|
+
update: {
|
|
45
|
+
callback: (signal, params) => {
|
|
46
|
+
const padding = (0, exports.normalizePadding)(params[constants_2.SIGNAL_PADDING]);
|
|
47
|
+
return (signal || new vutils_1.Bounds).setValue(padding.left, padding.top, padding.left + params[constants_2.SIGNAL_VIEW_WIDTH], padding.top + params[constants_2.SIGNAL_VIEW_HEIGHT]);
|
|
48
|
+
},
|
|
49
|
+
dependency: [ constants_2.SIGNAL_VIEW_WIDTH, constants_2.SIGNAL_VIEW_HEIGHT, constants_2.SIGNAL_PADDING ]
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
id: constants_2.SIGNAL_AUTOFIT,
|
|
53
|
+
value: null !== (_e = option[constants_2.SIGNAL_AUTOFIT]) && void 0 !== _e ? _e : config[constants_2.SIGNAL_AUTOFIT]
|
|
54
|
+
} ];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.builtInSignals = builtInSignals;
|
|
58
|
+
|
|
59
|
+
const normalizePadding = value => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
return (0, vutils_1.isNumber)(value) ? {
|
|
62
|
+
top: value,
|
|
63
|
+
bottom: value,
|
|
64
|
+
left: value,
|
|
65
|
+
right: value
|
|
66
|
+
} : {
|
|
67
|
+
top: null !== (_a = null == value ? void 0 : value.top) && void 0 !== _a ? _a : 0,
|
|
68
|
+
bottom: null !== (_b = null == value ? void 0 : value.bottom) && void 0 !== _b ? _b : 0,
|
|
69
|
+
left: null !== (_c = null == value ? void 0 : value.left) && void 0 !== _c ? _c : 0,
|
|
70
|
+
right: null !== (_d = null == value ? void 0 : value.right) && void 0 !== _d ? _d : 0
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
exports.normalizePadding = normalizePadding;
|
|
75
|
+
|
|
76
|
+
const normalizeMarkTree = spec => {
|
|
77
|
+
var _a;
|
|
78
|
+
const traverse = (spec, group) => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
spec.group = group;
|
|
81
|
+
const id = null !== (_a = spec.id) && void 0 !== _a ? _a : "VGRAMMAR_MARK_" + ++markBaseId;
|
|
82
|
+
spec.id = id, (null !== (_b = spec.marks) && void 0 !== _b ? _b : []).forEach((child => traverse(child, id)));
|
|
83
|
+
};
|
|
84
|
+
return (null !== (_a = spec.marks) && void 0 !== _a ? _a : []).forEach((mark => traverse(mark, "root"))),
|
|
85
|
+
spec;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.normalizeMarkTree = normalizeMarkTree;
|
|
89
|
+
|
|
90
|
+
const normalizeRunningConfig = runningConfig => {
|
|
91
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
92
|
+
return {
|
|
93
|
+
reuse: null !== (_a = null == runningConfig ? void 0 : runningConfig.reuse) && void 0 !== _a ? _a : constants_1.DefaultReuse,
|
|
94
|
+
morph: null !== (_b = null == runningConfig ? void 0 : runningConfig.morph) && void 0 !== _b ? _b : constants_1.DefaultMorph,
|
|
95
|
+
morphAll: null !== (_c = null == runningConfig ? void 0 : runningConfig.morphAll) && void 0 !== _c ? _c : constants_1.DefaultMorphAll,
|
|
96
|
+
animation: {
|
|
97
|
+
easing: null !== (_e = null === (_d = null == runningConfig ? void 0 : runningConfig.animation) || void 0 === _d ? void 0 : _d.easing) && void 0 !== _e ? _e : constants_1.DefaultAnimationEasing,
|
|
98
|
+
delay: null !== (_g = null === (_f = null == runningConfig ? void 0 : runningConfig.animation) || void 0 === _f ? void 0 : _f.delay) && void 0 !== _g ? _g : constants_1.DefaultAnimationDelay,
|
|
99
|
+
duration: null !== (_j = null === (_h = null == runningConfig ? void 0 : runningConfig.animation) || void 0 === _h ? void 0 : _h.duration) && void 0 !== _j ? _j : constants_1.DefaultAnimationDuration,
|
|
100
|
+
oneByOne: null !== (_l = null === (_k = null == runningConfig ? void 0 : runningConfig.animation) || void 0 === _k ? void 0 : _k.oneByOne) && void 0 !== _l ? _l : constants_1.DefaultAnimationOneByOne,
|
|
101
|
+
splitPath: null !== (_o = null === (_m = null == runningConfig ? void 0 : runningConfig.animation) || void 0 === _m ? void 0 : _m.splitPath) && void 0 !== _o ? _o : constants_1.DefaultSplitPath
|
|
102
|
+
},
|
|
103
|
+
enableExitAnimation: null !== (_p = null == runningConfig ? void 0 : runningConfig.enableExitAnimation) && void 0 !== _p ? _p : constants_1.DefaultEnableExitAnimation
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.normalizeRunningConfig = normalizeRunningConfig;
|
|
108
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/parse/view.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AACpD,kDAU4B;AAG5B,iDAQ2B;AAE3B,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;AAEP,QAAA,eAAe,GAAG;IAC7B,wBAAY;IACZ,yBAAa;IACb,0BAAc;IACd,6BAAiB;IACjB,8BAAkB;IAClB,2BAAe;IACf,0BAAc;CACf,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,MAAoB,EAAE,MAAwB,EAAE,KAAa,EAAqB,EAAE;;IACjH,OAAO;QACL,EAAE,EAAE,EAAE,wBAAY,EAAE,KAAK,EAAE,MAAA,MAAM,CAAC,wBAAY,CAAC,mCAAI,CAAC,EAAE;QACtD,EAAE,EAAE,EAAE,yBAAa,EAAE,KAAK,EAAE,MAAA,MAAM,CAAC,yBAAa,CAAC,mCAAI,CAAC,EAAE;QACxD,EAAE,EAAE,EAAE,0BAAc,EAAE,KAAK,EAAE,IAAA,wBAAgB,EAAC,MAAA,MAAA,MAAM,CAAC,0BAAc,CAAC,mCAAI,MAAM,CAAC,0BAAc,CAAC,mCAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClH;YACE,EAAE,EAAE,6BAAiB;YACrB,MAAM,EAAE;gBACN,QAAQ,EAAE,CAAC,MAAc,EAAE,MAAW,EAAE,EAAE;oBACxC,MAAM,OAAO,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,0BAAc,CAAC,CAAC,CAAC;oBACzD,OAAO,MAAM,CAAC,wBAAY,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;gBAC7D,CAAC;gBACD,UAAU,EAAE,CAAC,wBAAY,EAAE,0BAAc,CAAC;aAC3C;SACF;QACD;YACE,EAAE,EA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uBAAb,aAAa,CAAE,KAAK,mCAAI,wBAAY;QAC3C,KAAK,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,mCAAI,wBAAY;QAC3C,QAAQ,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,mCAAI,2BAAe;QACpD,SAAS,EAAE;YACT,MAAM,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,MAAM,mCAAI,kCAAsB;YAClE,KAAK,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,KAAK,mCAAI,iCAAqB;YAC/D,QAAQ,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,QAAQ,mCAAI,oCAAwB;YACxE,QAAQ,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,QAAQ,mCAAI,oCAAwB;YACxE,SAAS,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,SAAS,mCAAI,4BAAgB;SACnE;QACD,mBAAmB,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,mBAAmB,mCAAI,sCAA0B;KACtF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,sBAAsB,0BAcjC","file":"view.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport { isNumber, Bounds } from '@visactor/vutils';\nimport {\n DefaultAnimationDelay,\n DefaultAnimationDuration,\n DefaultAnimationEasing,\n DefaultAnimationOneByOne,\n DefaultEnableExitAnimation,\n DefaultMorph,\n DefaultMorphAll,\n DefaultReuse,\n DefaultSplitPath\n} from '../graph/constants';\nimport type { GroupMarkSpec, IRunningConfig, ITheme, MarkSpec, SignalSpec } from '../types';\nimport type { IViewOptions, IViewThemeConfig, ViewSpec } from '../types/view';\nimport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from '../view/constants';\n\nlet markBaseId = -1;\n\nexport const BuiltInSignalID = [\n SIGNAL_WIDTH,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_BOX,\n SIGNAL_AUTOFIT\n];\n\nexport const builtInSignals = (option: IViewOptions, config: IViewThemeConfig, theme: ITheme): SignalSpec<any>[] => {\n return [\n { id: SIGNAL_WIDTH, value: option[SIGNAL_WIDTH] ?? 0 },\n { id: SIGNAL_HEIGHT, value: option[SIGNAL_HEIGHT] ?? 0 },\n { id: SIGNAL_PADDING, value: normalizePadding(option[SIGNAL_PADDING] ?? config[SIGNAL_PADDING] ?? theme.padding) },\n {\n id: SIGNAL_VIEW_WIDTH,\n update: {\n callback: (signal: number, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return params[SIGNAL_WIDTH] - padding.left - padding.right;\n },\n dependency: [SIGNAL_WIDTH, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_VIEW_HEIGHT,\n update: {\n callback: (signal: number, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return params[SIGNAL_HEIGHT] - padding.top - padding.bottom;\n },\n dependency: [SIGNAL_HEIGHT, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_VIEW_BOX,\n update: {\n callback: (signal: IBounds, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return (signal ? signal : new Bounds()).setValue(\n padding.left,\n padding.top,\n padding.left + params[SIGNAL_VIEW_WIDTH],\n padding.top + params[SIGNAL_VIEW_HEIGHT]\n );\n },\n dependency: [SIGNAL_VIEW_WIDTH, SIGNAL_VIEW_HEIGHT, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_AUTOFIT,\n value: option[SIGNAL_AUTOFIT] ?? config[SIGNAL_AUTOFIT]\n }\n ];\n};\n\nexport const normalizePadding = (\n value: number | { top?: number; left?: number; right?: number; bottom?: number }\n): { top: number; left: number; right: number; bottom: number } => {\n if (isNumber(value)) {\n return { top: value, bottom: value, left: value, right: value };\n }\n return { top: value?.top ?? 0, bottom: value?.bottom ?? 0, left: value?.left ?? 0, right: value?.right ?? 0 };\n};\n\nexport const normalizeMarkTree = (spec: ViewSpec) => {\n const traverse = (spec: MarkSpec, group: string) => {\n spec.group = group;\n const id = spec.id ?? `VGRAMMAR_MARK_${++markBaseId}`;\n spec.id = id;\n ((spec as GroupMarkSpec).marks ?? []).forEach(child => traverse(child, id));\n };\n (spec.marks ?? []).forEach(mark => traverse(mark, 'root'));\n return spec;\n};\n\nexport const normalizeRunningConfig = (runningConfig: IRunningConfig): IRunningConfig => {\n return {\n reuse: runningConfig?.reuse ?? DefaultReuse,\n morph: runningConfig?.morph ?? DefaultMorph,\n morphAll: runningConfig?.morphAll ?? DefaultMorphAll,\n animation: {\n easing: runningConfig?.animation?.easing ?? DefaultAnimationEasing,\n delay: runningConfig?.animation?.delay ?? DefaultAnimationDelay,\n duration: runningConfig?.animation?.duration ?? DefaultAnimationDuration,\n oneByOne: runningConfig?.animation?.oneByOne ?? DefaultAnimationOneByOne,\n splitPath: runningConfig?.animation?.splitPath ?? DefaultSplitPath\n },\n enableExitAnimation: runningConfig?.enableExitAnimation ?? DefaultEnableExitAnimation\n };\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GrammarMarkType } from '../graph/enums';
|
|
2
|
+
import type { StateEncodeSpec, MarkSpec, MarkFunctionType, AttributeTransform, BaseSignleEncodeSpec } from '../types';
|
|
3
|
+
import { Mark } from '../view/mark';
|
|
4
|
+
export declare class Cell extends Mark {
|
|
5
|
+
markType: GrammarMarkType.cell;
|
|
6
|
+
protected spec: MarkSpec;
|
|
7
|
+
protected _encoders: StateEncodeSpec | null;
|
|
8
|
+
encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>): this;
|
|
9
|
+
protected _updateComponentEncoders(state: string): void;
|
|
10
|
+
protected _getEncoders(): StateEncodeSpec<Partial<Omit<import("@visactor/vrender").IGraphicAttribute, "strokeSeg" | "boundsPadding" | "pickMode" | "boundsMode" | "customPickShape" | "pickable" | "childrenPickable" | "visible" | "zIndex" | "layout" | "keepDirIn3d" | "postMatrix" | "anchor" | "anchor3d">>>;
|
|
11
|
+
getAttributeTransforms(): AttributeTransform[];
|
|
12
|
+
release(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Cell = void 0;
|
|
6
|
+
|
|
7
|
+
const encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"), attributes_1 = require("../graph/attributes");
|
|
8
|
+
|
|
9
|
+
class Cell extends mark_2.Mark {
|
|
10
|
+
encodeState(state, channel, value) {
|
|
11
|
+
return super.encodeState(state, channel, value), this._updateComponentEncoders(state),
|
|
12
|
+
this;
|
|
13
|
+
}
|
|
14
|
+
_updateComponentEncoders(state) {
|
|
15
|
+
this._encoders || (this._encoders = {});
|
|
16
|
+
const userEncoder = this.spec.encode[state];
|
|
17
|
+
if (userEncoder && "update" === state) {
|
|
18
|
+
const params = this.parameters(), scales = (0, util_1.isFunctionType)(userEncoder) ? null : Object.keys(userEncoder).reduce(((res, channel) => ((0,
|
|
19
|
+
mark_1.isScaleEncode)(userEncoder[channel]) && (res[channel] = (0, util_1.getGrammarOutput)(userEncoder[channel].scale, params)),
|
|
20
|
+
res)), {});
|
|
21
|
+
this._encoders[state] = {
|
|
22
|
+
callback: (datum, element, parameters) => {
|
|
23
|
+
const userEncodeRes = (0, encode_1.invokeEncoder)(userEncoder, datum, element, parameters);
|
|
24
|
+
if ((0, vutils_1.isNil)(userEncodeRes.size)) {
|
|
25
|
+
const sizeX = scales.x ? (0, encode_1.getBandWidthOfScale)(scales.x) : void 0, sizeY = scales.y ? (0,
|
|
26
|
+
encode_1.getBandWidthOfScale)(scales.y) : void 0;
|
|
27
|
+
(0, vutils_1.isNil)(sizeX) && (0, vutils_1.isNil)(sizeY) ? userEncodeRes.size = 10 : (0,
|
|
28
|
+
vutils_1.isNil)(sizeX) ? userEncodeRes.size = sizeY : (0, vutils_1.isNil)(sizeY) && (userEncodeRes.size = sizeX),
|
|
29
|
+
userEncodeRes.size = [ sizeX, sizeY ];
|
|
30
|
+
}
|
|
31
|
+
return (0, vutils_1.isNil)(userEncodeRes.shape) && (userEncodeRes.shape = "rect"),
|
|
32
|
+
userEncodeRes;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
} else this._encoders[state] = userEncoder;
|
|
36
|
+
}
|
|
37
|
+
_getEncoders() {
|
|
38
|
+
var _a;
|
|
39
|
+
return null !== (_a = this._encoders) && void 0 !== _a ? _a : {};
|
|
40
|
+
}
|
|
41
|
+
getAttributeTransforms() {
|
|
42
|
+
return [ {
|
|
43
|
+
channels: [ "size", "padding" ],
|
|
44
|
+
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
45
|
+
if ((0, vutils_1.isNumber)(storedAttrs.padding) && storedAttrs.padding > 0) graphicAttributes.size = (0,
|
|
46
|
+
vutils_1.isArray)(storedAttrs.size) ? storedAttrs.size.map((entry => Math.max(entry - storedAttrs.padding, 1))) : Math.max(storedAttrs.size - storedAttrs.padding, 1); else if ((0,
|
|
47
|
+
vutils_1.isArray)(storedAttrs.padding) && 2 === storedAttrs.padding.length) {
|
|
48
|
+
const arraySize = (0, vutils_1.isArray)(storedAttrs.size) ? storedAttrs.size : [ storedAttrs.size, storedAttrs.size ];
|
|
49
|
+
graphicAttributes.size = [ Math.max(arraySize[0] - storedAttrs.padding[0], 1), Math.max(arraySize[1] - storedAttrs.padding[1], 1) ];
|
|
50
|
+
} else graphicAttributes.size = storedAttrs.size;
|
|
51
|
+
},
|
|
52
|
+
storedAttrs: "paddingAttrs"
|
|
53
|
+
} ].concat(attributes_1.transformsByType.symbol);
|
|
54
|
+
}
|
|
55
|
+
release() {
|
|
56
|
+
super.release(), this._encoders = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.Cell = Cell;
|
|
61
|
+
//# sourceMappingURL=cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/cell.ts"],"names":[],"mappings":";;;AAEA,iDAA0E;AAC1E,wCAA8C;AAC9C,wCAAiE;AAUjE,uCAAoC;AACpC,6CAA4D;AAC5D,oDAAuD;AAEvD,MAAa,IAAK,SAAQ,WAAI;IAM5B,WAAW,CAAC,KAAa,EAAE,OAAsC,EAAE,KAA6B;QAC9F,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAES,wBAAwB,CAAC,KAAa;QAC9C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;SACrB;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAsC,CAAC;QAEjF,IAAI,WAAW,IAAI,KAAK,KAAK,QAAQ,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YACjC,MAAM,MAAM,GAA+B,IAAA,qBAAc,EAAC,WAAW,CAAC;gBACpE,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAA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EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;wBAEtG,iBAAiB,CAAC,IAAI,GAAG;4BACvB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;4BAClD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;yBACnD,CAAC;qBACH;yBAAM;wBACL,iBAAiB,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;qBAC3C;gBACH,CAAC;gBACD,WAAW,EAAE,cAAc;aAC5B;SAEJ,CAAC,MAAM,CAAC,6BAAgB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAlGD,oBAkGC","file":"cell.js","sourcesContent":["import type { IBaseScale } from '@visactor/vscale';\nimport type { GrammarMarkType } from '../graph/enums';\nimport { getBandWidthOfScale, invokeEncoder } from '../graph/mark/encode';\nimport { isScaleEncode } from '../parse/mark';\nimport { getGrammarOutput, isFunctionType } from '../parse/util';\nimport type {\n StateEncodeSpec,\n MarkSpec,\n IElement,\n MarkFunctionType,\n AttributeTransform,\n GetSignleEncodeSpecByType,\n BaseSignleEncodeSpec\n} from '../types';\nimport { Mark } from '../view/mark';\nimport { isArray, isNil, isNumber } from '@visactor/vutils';\nimport { transformsByType } from '../graph/attributes';\n\nexport class Cell extends Mark {\n declare markType: GrammarMarkType.cell;\n protected declare spec: MarkSpec;\n\n protected _encoders: StateEncodeSpec | null;\n\n encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>) {\n super.encodeState(state, channel, value);\n\n this._updateComponentEncoders(state);\n\n return this;\n }\n\n protected _updateComponentEncoders(state: string) {\n if (!this._encoders) {\n this._encoders = {};\n }\n\n const userEncoder = this.spec.encode[state] as GetSignleEncodeSpecByType<'cell'>;\n\n if (userEncoder && state === 'update') {\n const params = this.parameters();\n const scales: Record<string, IBaseScale> = isFunctionType(userEncoder)\n ? null\n : Object.keys(userEncoder).reduce((res, channel) => {\n if (isScaleEncode(userEncoder[channel])) {\n res[channel] = getGrammarOutput(userEncoder[channel].scale, params);\n }\n return res;\n }, {});\n\n this._encoders[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const userEncodeRes = invokeEncoder(userEncoder, datum, element, parameters);\n\n if (isNil(userEncodeRes.size)) {\n const sizeX = scales.x ? getBandWidthOfScale(scales.x) : undefined;\n const sizeY = scales.y ? getBandWidthOfScale(scales.y) : undefined;\n\n if (isNil(sizeX) && isNil(sizeY)) {\n userEncodeRes.size = 10;\n } else if (isNil(sizeX)) {\n userEncodeRes.size = sizeY;\n } else if (isNil(sizeY)) {\n userEncodeRes.size = sizeX;\n }\n\n userEncodeRes.size = [sizeX, sizeY];\n }\n\n if (isNil(userEncodeRes.shape)) {\n userEncodeRes.shape = 'rect';\n }\n\n return userEncodeRes;\n }\n } as GetSignleEncodeSpecByType<'cell'>;\n } else {\n this._encoders[state] = userEncoder;\n }\n }\n\n protected _getEncoders() {\n return this._encoders ?? {};\n }\n\n getAttributeTransforms() {\n return (\n [\n {\n channels: ['size', 'padding'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n if (isNumber(storedAttrs.padding) && storedAttrs.padding > 0) {\n graphicAttributes.size = isArray(storedAttrs.size)\n ? storedAttrs.size.map((entry: number) => Math.max(entry - storedAttrs.padding, 1))\n : Math.max(storedAttrs.size - storedAttrs.padding, 1);\n } else if (isArray(storedAttrs.padding) && storedAttrs.padding.length === 2) {\n const arraySize = isArray(storedAttrs.size) ? storedAttrs.size : [storedAttrs.size, storedAttrs.size];\n\n graphicAttributes.size = [\n Math.max(arraySize[0] - storedAttrs.padding[0], 1),\n Math.max(arraySize[1] - storedAttrs.padding[1], 1)\n ];\n } else {\n graphicAttributes.size = storedAttrs.size;\n }\n },\n storedAttrs: 'paddingAttrs'\n }\n ] as AttributeTransform[]\n ).concat(transformsByType.symbol);\n }\n\n release(): void {\n super.release();\n this._encoders = null;\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GrammarMarkType } from '../graph/enums';
|
|
2
|
+
import type { StateEncodeSpec, MarkSpec, MarkFunctionType, AttributeTransform, BaseSignleEncodeSpec } from '../types';
|
|
3
|
+
import { Mark } from '../view/mark';
|
|
4
|
+
export declare class Interval extends Mark {
|
|
5
|
+
markType: GrammarMarkType.interval;
|
|
6
|
+
protected spec: MarkSpec;
|
|
7
|
+
protected _encoders: StateEncodeSpec;
|
|
8
|
+
encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>): this;
|
|
9
|
+
protected _updateComponentEncoders(state: string): void;
|
|
10
|
+
protected _getEncoders(): StateEncodeSpec<Partial<Omit<import("@visactor/vrender").IGraphicAttribute, "strokeSeg" | "boundsPadding" | "pickMode" | "boundsMode" | "customPickShape" | "pickable" | "childrenPickable" | "visible" | "zIndex" | "layout" | "keepDirIn3d" | "postMatrix" | "anchor" | "anchor3d">>>;
|
|
11
|
+
getAttributeTransforms(): AttributeTransform[];
|
|
12
|
+
addGraphicItem(attrs: any, groupKey?: string): any;
|
|
13
|
+
release(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Interval = void 0;
|
|
6
|
+
|
|
7
|
+
const vscale_1 = require("@visactor/vscale"), enums_1 = require("../graph/enums"), encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"), graphic_1 = require("../graph/util/graphic"), attributes_1 = require("../graph/attributes");
|
|
8
|
+
|
|
9
|
+
class Interval extends mark_2.Mark {
|
|
10
|
+
encodeState(state, channel, value) {
|
|
11
|
+
return super.encodeState(state, channel, value), this._updateComponentEncoders(state),
|
|
12
|
+
this;
|
|
13
|
+
}
|
|
14
|
+
_updateComponentEncoders(state) {
|
|
15
|
+
this._encoders || (this._encoders = {});
|
|
16
|
+
const userEncoder = this.spec.encode[state];
|
|
17
|
+
if (userEncoder && "update" === state) {
|
|
18
|
+
const params = this.parameters(), scales = (0, util_1.isFunctionType)(userEncoder) ? null : Object.keys(userEncoder).reduce(((res, channel) => ((0,
|
|
19
|
+
mark_1.isScaleEncode)(userEncoder[channel]) && (res[channel] = (0, util_1.getGrammarOutput)(userEncoder[channel].scale, params)),
|
|
20
|
+
res)), {});
|
|
21
|
+
this._encoders[state] = {
|
|
22
|
+
callback: (datum, element, parameters) => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const userEncodeRes = (0, encode_1.invokeEncoder)(userEncoder, datum, element, parameters);
|
|
25
|
+
if (this.disableCoordinateTransform = !1, scales && scales.x && scales.x.type === vscale_1.ScaleEnum.Band) {
|
|
26
|
+
if (!(0, vutils_1.isNil)(scales.y)) {
|
|
27
|
+
const domain = scales.y.domain(), min = Math.min.apply(null, domain), max = Math.max.apply(null, domain), baseValue = min > 0 ? min : max < 0 ? max : 0;
|
|
28
|
+
userEncodeRes.y1 = scales.y.scale(baseValue);
|
|
29
|
+
}
|
|
30
|
+
const bandWidth = scales.x.bandwidth();
|
|
31
|
+
userEncodeRes.x = userEncodeRes.x + bandWidth / 4, userEncodeRes.x1 = userEncodeRes.x + bandWidth / 2;
|
|
32
|
+
} else if (scales && scales.y && scales.y.type === vscale_1.ScaleEnum.Band) {
|
|
33
|
+
if (!(0, vutils_1.isNil)(scales.x)) {
|
|
34
|
+
const domain = scales.x.domain(), min = Math.min.apply(null, domain), max = Math.max.apply(null, domain), baseValue = min > 0 ? min : max < 0 ? max : 0;
|
|
35
|
+
userEncodeRes.x1 = scales.x.scale(baseValue);
|
|
36
|
+
}
|
|
37
|
+
const bandWidth = scales.y.bandwidth();
|
|
38
|
+
userEncodeRes.y = userEncodeRes.y + bandWidth / 4, userEncodeRes.y1 = userEncodeRes.y + bandWidth / 2;
|
|
39
|
+
}
|
|
40
|
+
if (scales) {
|
|
41
|
+
const coord = (null !== (_b = this.view.getScaleById(null === (_a = userEncoder.x) || void 0 === _a ? void 0 : _a.scale)) && void 0 !== _b ? _b : this.view.getScaleById(null === (_c = userEncoder.y) || void 0 === _c ? void 0 : _c.scale)).getCoordinate();
|
|
42
|
+
if (coord && "polar" === coord.type) {
|
|
43
|
+
this.disableCoordinateTransform = !0;
|
|
44
|
+
const origin = coord.origin();
|
|
45
|
+
userEncodeRes.cx = origin.x, userEncodeRes.cy = origin.y;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return userEncodeRes;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
} else this._encoders[state] = userEncoder;
|
|
52
|
+
}
|
|
53
|
+
_getEncoders() {
|
|
54
|
+
var _a;
|
|
55
|
+
return null !== (_a = this._encoders) && void 0 !== _a ? _a : {};
|
|
56
|
+
}
|
|
57
|
+
getAttributeTransforms() {
|
|
58
|
+
return this.coord && "polar" === this.coord.output().type ? [ {
|
|
59
|
+
channels: [ "x", "y", "x1", "y1", "cx", "cy" ],
|
|
60
|
+
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
61
|
+
graphicAttributes.x = storedAttrs.cx, graphicAttributes.y = storedAttrs.cy, this.coord.output().isTransposed() ? (graphicAttributes.startAngle = storedAttrs.y,
|
|
62
|
+
graphicAttributes.endAngle = storedAttrs.y1, graphicAttributes.innerRadius = storedAttrs.x,
|
|
63
|
+
graphicAttributes.outerRadius = storedAttrs.x1) : (graphicAttributes.startAngle = storedAttrs.x,
|
|
64
|
+
graphicAttributes.endAngle = storedAttrs.x1, graphicAttributes.innerRadius = storedAttrs.y,
|
|
65
|
+
graphicAttributes.outerRadius = storedAttrs.y1);
|
|
66
|
+
},
|
|
67
|
+
storedAttrs: "sizeAttrs"
|
|
68
|
+
} ] : attributes_1.transformsByType.rect;
|
|
69
|
+
}
|
|
70
|
+
addGraphicItem(attrs, groupKey) {
|
|
71
|
+
const graphicItem = (0, graphic_1.createGraphicItem)(this, this.coord && "polar" === this.coord.output().type ? enums_1.GrammarMarkType.arc : enums_1.GrammarMarkType.rect, attrs);
|
|
72
|
+
return super.addGraphicItem(attrs, groupKey, graphicItem);
|
|
73
|
+
}
|
|
74
|
+
release() {
|
|
75
|
+
super.release(), this._encoders = null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.Interval = Interval;
|
|
80
|
+
//# sourceMappingURL=interval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/interval.ts"],"names":[],"mappings":";;;AAEA,6CAA6C;AAC7C,0CAAiD;AACjD,iDAAqD;AACrD,wCAA8C;AAC9C,wCAAiE;AAUjE,uCAAoC;AACpC,6CAAyC;AACzC,mDAA0D;AAE1D,oDAAuD;AAEvD,MAAa,QAAS,SAAQ,WAAI;IAMhC,WAAW,CAAC,KAAa,EAAE,OAAsC,EAAE,KAA6B;QAC9F,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAES,wBAAwB,CAAC,KAAa;QAC9C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;SACrB;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAA0C,CAAC;QAErF,IAAI,WAAW,IAAI,KAAK,KAAK,QAAQ,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,U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AvID,4BAuIC","file":"interval.js","sourcesContent":["import type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { ScaleEnum } from '@visactor/vscale';\nimport { GrammarMarkType } from '../graph/enums';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { isScaleEncode } from '../parse/mark';\nimport { getGrammarOutput, isFunctionType } from '../parse/util';\nimport type {\n StateEncodeSpec,\n MarkSpec,\n IElement,\n MarkFunctionType,\n AttributeTransform,\n GetSignleEncodeSpecByType,\n BaseSignleEncodeSpec\n} from '../types';\nimport { Mark } from '../view/mark';\nimport { isNil } from '@visactor/vutils';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport type { IPolarCoordinate } from '@visactor/vgrammar-coordinate';\nimport { transformsByType } from '../graph/attributes';\n\nexport class Interval extends Mark {\n declare markType: GrammarMarkType.interval;\n protected declare spec: MarkSpec;\n\n protected _encoders: StateEncodeSpec;\n\n encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>) {\n super.encodeState(state, channel, value);\n\n this._updateComponentEncoders(state);\n\n return this;\n }\n\n protected _updateComponentEncoders(state: string) {\n if (!this._encoders) {\n this._encoders = {};\n }\n\n const userEncoder = this.spec.encode[state] as GetSignleEncodeSpecByType<'interval'>;\n\n if (userEncoder && state === 'update') {\n const params = this.parameters();\n const scales: Record<string, IBaseScale> = isFunctionType(userEncoder)\n ? null\n : Object.keys(userEncoder).reduce((res, channel) => {\n if (isScaleEncode(userEncoder[channel])) {\n res[channel] = getGrammarOutput(userEncoder[channel].scale, params);\n }\n return res;\n }, {});\n\n this._encoders[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const userEncodeRes = invokeEncoder(userEncoder, datum, element, parameters);\n\n this.disableCoordinateTransform = false;\n if (scales && scales.x && scales.x.type === ScaleEnum.Band) {\n if (!isNil(scales.y)) {\n const domain = scales.y.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.y1 = scales.y.scale(baseValue);\n }\n const bandWidth = (scales.x as IBandLikeScale).bandwidth();\n\n // TODO: handle bandWidth dynamically\n userEncodeRes.x = userEncodeRes.x + bandWidth / 4;\n userEncodeRes.x1 = userEncodeRes.x + bandWidth / 2;\n } else if (scales && scales.y && scales.y.type === ScaleEnum.Band) {\n if (!isNil(scales.x)) {\n const domain = scales.x.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.x1 = scales.x.scale(baseValue);\n }\n const bandWidth = (scales.y as IBandLikeScale).bandwidth();\n\n userEncodeRes.y = userEncodeRes.y + bandWidth / 4;\n userEncodeRes.y1 = userEncodeRes.y + bandWidth / 2;\n }\n\n if (scales) {\n const scaleGrammar =\n this.view.getScaleById((userEncoder as any).x?.scale) ??\n this.view.getScaleById((userEncoder as any).y?.scale);\n const coord = scaleGrammar.getCoordinate();\n\n if (coord && coord.type === 'polar') {\n this.disableCoordinateTransform = true;\n const origin = (coord as IPolarCoordinate).origin();\n userEncodeRes.cx = origin.x;\n userEncodeRes.cy = origin.y;\n }\n }\n\n return userEncodeRes;\n }\n } as GetSignleEncodeSpecByType<'interval'>;\n } else {\n this._encoders[state] = userEncoder;\n }\n }\n\n protected _getEncoders() {\n return this._encoders ?? {};\n }\n\n getAttributeTransforms() {\n if (this.coord && this.coord.output().type === 'polar') {\n return [\n {\n channels: ['x', 'y', 'x1', 'y1', 'cx', 'cy'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = storedAttrs.cx;\n graphicAttributes.y = storedAttrs.cy;\n if (this.coord.output().isTransposed()) {\n graphicAttributes.startAngle = storedAttrs.y;\n graphicAttributes.endAngle = storedAttrs.y1;\n graphicAttributes.innerRadius = storedAttrs.x;\n graphicAttributes.outerRadius = storedAttrs.x1;\n } else {\n //\n graphicAttributes.startAngle = storedAttrs.x;\n graphicAttributes.endAngle = storedAttrs.x1;\n graphicAttributes.innerRadius = storedAttrs.y;\n graphicAttributes.outerRadius = storedAttrs.y1;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ] as AttributeTransform[];\n }\n\n return transformsByType.rect;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const graphicItem = createGraphicItem(\n this,\n this.coord && this.coord.output().type === 'polar' ? GrammarMarkType.arc : GrammarMarkType.rect,\n attrs\n );\n\n return super.addGraphicItem(attrs, groupKey, graphicItem);\n }\n\n release(): void {\n super.release();\n this._encoders = null;\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GrammarMarkType } from '../graph/enums';
|
|
2
|
+
import type { MarkSpec } from '../types';
|
|
3
|
+
import { Mark } from '../view/mark';
|
|
4
|
+
export declare class Text extends Mark {
|
|
5
|
+
markType: GrammarMarkType.text;
|
|
6
|
+
protected spec: MarkSpec;
|
|
7
|
+
addGraphicItem(initAttrs: any, groupKey?: string): any;
|
|
8
|
+
getAttributeTransforms(): import("../types").AttributeTransform[];
|
|
9
|
+
release(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Text = void 0;
|
|
6
|
+
|
|
7
|
+
const enums_1 = require("../graph/enums"), mark_1 = require("../view/mark"), graphic_1 = require("../graph/util/graphic"), attributes_1 = require("../graph/attributes");
|
|
8
|
+
|
|
9
|
+
class Text extends mark_1.Mark {
|
|
10
|
+
addGraphicItem(initAttrs, groupKey) {
|
|
11
|
+
const textConfig = null == initAttrs ? void 0 : initAttrs.text, isRich = "rich" === (null == textConfig ? void 0 : textConfig.type), graphicItem = (0,
|
|
12
|
+
graphic_1.createGraphicItem)(this, isRich ? enums_1.GrammarMarkType.richtext : enums_1.GrammarMarkType.text, initAttrs);
|
|
13
|
+
return isRich && (initAttrs.textConfig = []), super.addGraphicItem(initAttrs, groupKey, graphicItem);
|
|
14
|
+
}
|
|
15
|
+
getAttributeTransforms() {
|
|
16
|
+
var _a;
|
|
17
|
+
return "richtext" === (null === (_a = this.getGroupGraphicItem()) || void 0 === _a ? void 0 : _a.type) ? attributes_1.transformsByType.richtext : attributes_1.transformsByType.text;
|
|
18
|
+
}
|
|
19
|
+
release() {
|
|
20
|
+
super.release();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.Text = Text;
|
|
25
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/text.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEjD,uCAAoC;AACpC,mDAA0D;AAC1D,oDAAuD;AAEvD,MAAa,IAAK,SAAQ,WAAI;IAI5B,cAAc,CAAC,SAAc,EAAE,QAAiB;QAC9C,MAAM,UAAU,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,MAAK,MAAM,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,2BAAiB,EACnC,IAAa,EACb,MAAM,CAAC,CAAC,CAAC,uBAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAe,CAAC,IAAI,EACxD,SAAS,CACV,CAAC;QAEF,IAAI,MAAM,EAAE;YACV,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED,sBAAsB;;QACpB,OAAO,CAAA,MAAA,IAAI,CAAC,mBAAmB,EAAE,0CAAE,IAAI,MAAK,UAAU,CAAC,CAAC,CAAC,6BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,6BAAgB,CAAC,IAAI,CAAC;IAC7G,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AA3BD,oBA2BC","file":"text.js","sourcesContent":["import { GrammarMarkType } from '../graph/enums';\nimport type { IMark, MarkSpec } from '../types';\nimport { Mark } from '../view/mark';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport { transformsByType } from '../graph/attributes';\n\nexport class Text extends Mark {\n declare markType: GrammarMarkType.text;\n protected declare spec: MarkSpec;\n\n addGraphicItem(initAttrs: any, groupKey?: string) {\n const textConfig = initAttrs?.text;\n const isRich = textConfig?.type === 'rich';\n const graphicItem = createGraphicItem(\n this as IMark,\n isRich ? GrammarMarkType.richtext : GrammarMarkType.text,\n initAttrs\n );\n\n if (isRich) {\n initAttrs.textConfig = [];\n }\n\n return super.addGraphicItem(initAttrs, groupKey, graphicItem);\n }\n\n getAttributeTransforms() {\n return this.getGroupGraphicItem()?.type === 'richtext' ? transformsByType.richtext : transformsByType.text;\n }\n\n release(): void {\n super.release();\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes } from '@visactor/vrender-components';
|
|
2
|
+
import type { IComponentTheme, RecursivePartial } from '../../types';
|
|
3
|
+
export declare const dataLabel: RecursivePartial<DataLabelAttrs>;
|
|
4
|
+
export declare const lineLabel: RecursivePartial<LineLabelAttrs>;
|
|
5
|
+
export declare const rectLabel: RecursivePartial<RectLabelAttrs>;
|
|
6
|
+
export declare const symbolLabel: RecursivePartial<SymbolLabelAttrs>;
|
|
7
|
+
export declare const arcLabel: RecursivePartial<ArcLabelAttrs>;
|
|
8
|
+
export declare const pointLabel: RecursivePartial<BaseLabelAttrs>;
|
|
9
|
+
export declare const datazoom: RecursivePartial<DataZoomAttributes>;
|
|
10
|
+
export declare const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes>;
|
|
11
|
+
export declare const discretePlayer: RecursivePartial<DiscretePlayerAttributes>;
|
|
12
|
+
export declare const tooltip: RecursivePartial<TooltipAttributes>;
|
|
13
|
+
export declare const title: RecursivePartial<TitleAttrs>;
|
|
14
|
+
export declare const scrollbar: RecursivePartial<ScrollBarAttributes>;
|
|
15
|
+
export declare const defaultComponentTheme: IComponentTheme;
|