@antv/g2 5.0.18 → 5.0.20
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/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/api/chart.d.ts +175 -85
- package/esm/api/chart.js +3 -259
- package/esm/api/chart.js.map +1 -1
- package/esm/api/composition.d.ts +37 -0
- package/esm/api/{composition/base.js → composition.js} +17 -5
- package/esm/api/composition.js.map +1 -0
- package/esm/api/define.d.ts +14 -0
- package/esm/api/define.js +92 -0
- package/esm/api/define.js.map +1 -0
- package/esm/api/extend.d.ts +10 -0
- package/esm/api/extend.js +9 -0
- package/esm/api/extend.js.map +1 -0
- package/esm/api/index.d.ts +2 -0
- package/esm/api/index.js +2 -0
- package/esm/api/index.js.map +1 -1
- package/esm/api/library.d.ts +171 -1
- package/esm/api/library.js +2 -2
- package/esm/api/library.js.map +1 -1
- package/esm/api/mark.d.ts +29 -0
- package/esm/api/{mark/base.js → mark.js} +16 -4
- package/esm/api/mark.js.map +1 -0
- package/esm/api/node.d.ts +2 -2
- package/esm/api/node.js.map +1 -1
- package/esm/api/props.d.ts +170 -12
- package/esm/api/props.js +21 -102
- package/esm/api/props.js.map +1 -1
- package/esm/api/runtime.d.ts +66 -0
- package/esm/api/runtime.js +294 -0
- package/esm/api/runtime.js.map +1 -0
- package/esm/api/types.d.ts +60 -5
- package/esm/api/utils.d.ts +1 -1
- package/esm/api/utils.js +11 -13
- package/esm/api/utils.js.map +1 -1
- package/esm/component/axis.js +7 -4
- package/esm/component/axis.js.map +1 -1
- package/esm/component/legendCategory.js +4 -5
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/composition/d3Projection.js.map +1 -0
- package/esm/composition/geoPath.js.map +1 -0
- package/esm/{geo → composition}/geoView.js +1 -1
- package/esm/composition/geoView.js.map +1 -0
- package/esm/composition/index.d.ts +2 -0
- package/esm/composition/index.js +2 -0
- package/esm/composition/index.js.map +1 -1
- package/esm/data/index.d.ts +2 -0
- package/esm/data/index.js +1 -0
- package/esm/data/index.js.map +1 -1
- package/esm/data/log.d.ts +7 -0
- package/esm/data/log.js +11 -0
- package/esm/data/log.js.map +1 -0
- package/esm/index.d.ts +4 -3
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/interaction/brushFilter.js +18 -16
- package/esm/interaction/brushFilter.js.map +1 -1
- package/esm/interaction/chartIndex.js +25 -22
- package/esm/interaction/chartIndex.js.map +1 -1
- package/esm/interaction/fisheye.js +17 -13
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/legendFilter.js +32 -26
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.js +8 -9
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.d.ts +1 -1
- package/esm/interaction/tooltip.js +39 -4
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/label-transform/overlapDodgeY.js.map +1 -1
- package/esm/lib/core.d.ts +159 -0
- package/esm/lib/core.js +175 -0
- package/esm/lib/core.js.map +1 -0
- package/esm/lib/geo.d.ts +4 -0
- package/esm/lib/geo.js +9 -0
- package/esm/lib/geo.js.map +1 -0
- package/esm/lib/graph.d.ts +4 -0
- package/esm/lib/graph.js +8 -0
- package/esm/lib/graph.js.map +1 -0
- package/esm/lib/index.d.ts +6 -0
- package/esm/lib/index.js +7 -0
- package/esm/lib/index.js.map +1 -0
- package/esm/lib/lite.d.ts +64 -0
- package/esm/lib/lite.js +78 -0
- package/esm/lib/lite.js.map +1 -0
- package/esm/lib/plot.d.ts +11 -0
- package/esm/lib/plot.js +16 -0
- package/esm/lib/plot.js.map +1 -0
- package/esm/lib/std.d.ts +171 -0
- package/esm/lib/std.js +8 -0
- package/esm/lib/std.js.map +1 -0
- package/esm/mark/area.js +14 -5
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/box.js +9 -2
- package/esm/mark/box.js.map +1 -1
- package/esm/mark/cell.js +11 -5
- package/esm/mark/cell.js.map +1 -1
- package/esm/mark/connector.js +6 -2
- package/esm/mark/connector.js.map +1 -1
- package/esm/mark/density.js +10 -7
- package/esm/mark/density.js.map +1 -1
- package/esm/mark/forceGraph.js +0 -3
- package/esm/mark/forceGraph.js.map +1 -1
- package/esm/mark/heatmap.js +9 -4
- package/esm/mark/heatmap.js.map +1 -1
- package/esm/mark/image.js +9 -4
- package/esm/mark/image.js.map +1 -1
- package/esm/mark/interval.js +13 -7
- package/esm/mark/interval.js.map +1 -1
- package/esm/mark/line.js +15 -4
- package/esm/mark/line.js.map +1 -1
- package/esm/mark/lineX.js +8 -3
- package/esm/mark/lineX.js.map +1 -1
- package/esm/mark/lineY.js +8 -3
- package/esm/mark/lineY.js.map +1 -1
- package/esm/mark/link.js +12 -4
- package/esm/mark/link.js.map +1 -1
- package/esm/mark/path.js +7 -2
- package/esm/mark/path.js.map +1 -1
- package/esm/mark/point.js +28 -29
- package/esm/mark/point.js.map +1 -1
- package/esm/mark/polygon.js +7 -2
- package/esm/mark/polygon.js.map +1 -1
- package/esm/mark/range.js +4 -2
- package/esm/mark/range.js.map +1 -1
- package/esm/mark/rangeX.js +6 -2
- package/esm/mark/rangeX.js.map +1 -1
- package/esm/mark/rangeY.js +6 -2
- package/esm/mark/rangeY.js.map +1 -1
- package/esm/mark/rect.js +9 -3
- package/esm/mark/rect.js.map +1 -1
- package/esm/mark/shape.js +9 -3
- package/esm/mark/shape.js.map +1 -1
- package/esm/mark/text.js +10 -4
- package/esm/mark/text.js.map +1 -1
- package/esm/mark/treemap.js.map +1 -1
- package/esm/mark/utils.d.ts +11 -8
- package/esm/mark/utils.js +8 -7
- package/esm/mark/utils.js.map +1 -1
- package/esm/mark/vector.js +6 -2
- package/esm/mark/vector.js.map +1 -1
- package/esm/runtime/index.d.ts +1 -1
- package/esm/runtime/index.js +1 -1
- package/esm/runtime/index.js.map +1 -1
- package/esm/runtime/plot.js +32 -13
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +3 -6
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/types/component.d.ts +1 -1
- package/esm/runtime/types/mark.d.ts +4 -0
- package/esm/runtime/types/options.d.ts +4 -1
- package/esm/shape/index.d.ts +106 -101
- package/esm/shape/index.js +58 -53
- package/esm/shape/index.js.map +1 -1
- package/esm/shape/text/advance.js +3 -3
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/spec/composition.d.ts +7 -0
- package/esm/spec/dataTransform.d.ts +3 -2
- package/esm/spec/index.d.ts +1 -0
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/interaction.d.ts +4 -1
- package/esm/theme/academy.js +6 -6
- package/esm/theme/classic.js +6 -7
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/classicDark.js +6 -6
- package/esm/utils/coordinate.d.ts +2 -2
- package/esm/utils/scale.d.ts +1 -1
- package/esm/utils/scale.js +1 -1
- package/esm/utils/scale.js.map +1 -1
- package/lib/api/chart.d.ts +175 -85
- package/lib/api/chart.js +4 -263
- package/lib/api/chart.js.map +1 -1
- package/lib/api/composition.d.ts +37 -0
- package/lib/api/{composition/base.js → composition.js} +16 -5
- package/lib/api/composition.js.map +1 -0
- package/lib/api/define.d.ts +14 -0
- package/lib/api/define.js +97 -0
- package/lib/api/define.js.map +1 -0
- package/lib/api/extend.d.ts +10 -0
- package/lib/api/extend.js +13 -0
- package/lib/api/extend.js.map +1 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +5 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/library.d.ts +171 -1
- package/lib/api/library.js +2 -2
- package/lib/api/library.js.map +1 -1
- package/lib/api/mark.d.ts +29 -0
- package/lib/api/{mark/base.js → mark.js} +15 -4
- package/lib/api/mark.js.map +1 -0
- package/lib/api/node.d.ts +2 -2
- package/lib/api/node.js.map +1 -1
- package/lib/api/props.d.ts +170 -12
- package/lib/api/props.js +22 -106
- package/lib/api/props.js.map +1 -1
- package/lib/api/runtime.d.ts +66 -0
- package/lib/api/runtime.js +301 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/types.d.ts +60 -5
- package/lib/api/utils.d.ts +1 -1
- package/lib/api/utils.js +14 -16
- package/lib/api/utils.js.map +1 -1
- package/lib/component/axis.js +7 -4
- package/lib/component/axis.js.map +1 -1
- package/lib/component/legendCategory.js +4 -5
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/composition/d3Projection.js.map +1 -0
- package/lib/composition/geoPath.js.map +1 -0
- package/lib/{geo → composition}/geoView.js +1 -1
- package/lib/composition/geoView.js.map +1 -0
- package/lib/composition/index.d.ts +2 -0
- package/lib/composition/index.js +5 -1
- package/lib/composition/index.js.map +1 -1
- package/lib/data/index.d.ts +2 -0
- package/lib/data/index.js +3 -1
- package/lib/data/index.js.map +1 -1
- package/lib/data/log.d.ts +7 -0
- package/lib/data/log.js +15 -0
- package/lib/data/log.js.map +1 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +8 -3
- package/lib/index.js.map +1 -1
- package/lib/interaction/brushFilter.js +18 -16
- package/lib/interaction/brushFilter.js.map +1 -1
- package/lib/interaction/chartIndex.js +25 -22
- package/lib/interaction/chartIndex.js.map +1 -1
- package/lib/interaction/fisheye.js +17 -13
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/legendFilter.js +32 -26
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.js +8 -9
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +1 -1
- package/lib/interaction/tooltip.js +38 -3
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/label-transform/overlapDodgeY.js.map +1 -1
- package/lib/lib/core.d.ts +159 -0
- package/lib/lib/core.js +179 -0
- package/lib/lib/core.js.map +1 -0
- package/lib/lib/geo.d.ts +4 -0
- package/lib/lib/geo.js +13 -0
- package/lib/lib/geo.js.map +1 -0
- package/lib/lib/graph.d.ts +4 -0
- package/lib/lib/graph.js +12 -0
- package/lib/lib/graph.js.map +1 -0
- package/lib/lib/index.d.ts +6 -0
- package/lib/lib/index.js +16 -0
- package/lib/lib/index.js.map +1 -0
- package/lib/lib/lite.d.ts +64 -0
- package/lib/lib/lite.js +82 -0
- package/lib/lib/lite.js.map +1 -0
- package/lib/lib/plot.d.ts +11 -0
- package/lib/lib/plot.js +20 -0
- package/lib/lib/plot.js.map +1 -0
- package/lib/lib/std.d.ts +171 -0
- package/lib/lib/std.js +12 -0
- package/lib/lib/std.js.map +1 -0
- package/lib/mark/area.js +14 -5
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/box.js +9 -2
- package/lib/mark/box.js.map +1 -1
- package/lib/mark/cell.js +11 -5
- package/lib/mark/cell.js.map +1 -1
- package/lib/mark/connector.js +6 -2
- package/lib/mark/connector.js.map +1 -1
- package/lib/mark/density.js +10 -7
- package/lib/mark/density.js.map +1 -1
- package/lib/mark/forceGraph.js +0 -3
- package/lib/mark/forceGraph.js.map +1 -1
- package/lib/mark/heatmap.js +9 -4
- package/lib/mark/heatmap.js.map +1 -1
- package/lib/mark/image.js +9 -4
- package/lib/mark/image.js.map +1 -1
- package/lib/mark/interval.js +13 -7
- package/lib/mark/interval.js.map +1 -1
- package/lib/mark/line.js +15 -4
- package/lib/mark/line.js.map +1 -1
- package/lib/mark/lineX.js +8 -3
- package/lib/mark/lineX.js.map +1 -1
- package/lib/mark/lineY.js +8 -3
- package/lib/mark/lineY.js.map +1 -1
- package/lib/mark/link.js +12 -4
- package/lib/mark/link.js.map +1 -1
- package/lib/mark/path.js +7 -2
- package/lib/mark/path.js.map +1 -1
- package/lib/mark/point.js +28 -29
- package/lib/mark/point.js.map +1 -1
- package/lib/mark/polygon.js +7 -2
- package/lib/mark/polygon.js.map +1 -1
- package/lib/mark/range.js +4 -2
- package/lib/mark/range.js.map +1 -1
- package/lib/mark/rangeX.js +6 -2
- package/lib/mark/rangeX.js.map +1 -1
- package/lib/mark/rangeY.js +6 -2
- package/lib/mark/rangeY.js.map +1 -1
- package/lib/mark/rect.js +9 -3
- package/lib/mark/rect.js.map +1 -1
- package/lib/mark/shape.js +9 -3
- package/lib/mark/shape.js.map +1 -1
- package/lib/mark/text.js +10 -4
- package/lib/mark/text.js.map +1 -1
- package/lib/mark/treemap.js.map +1 -1
- package/lib/mark/utils.d.ts +11 -8
- package/lib/mark/utils.js +8 -7
- package/lib/mark/utils.js.map +1 -1
- package/lib/mark/vector.js +6 -2
- package/lib/mark/vector.js.map +1 -1
- package/lib/runtime/index.d.ts +1 -1
- package/lib/runtime/index.js +4 -4
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/plot.js +32 -13
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +3 -6
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/types/component.d.ts +1 -1
- package/lib/runtime/types/mark.d.ts +4 -0
- package/lib/runtime/types/options.d.ts +4 -1
- package/lib/shape/index.d.ts +106 -101
- package/lib/shape/index.js +71 -61
- package/lib/shape/index.js.map +1 -1
- package/lib/shape/text/advance.js +3 -3
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/spec/composition.d.ts +7 -0
- package/lib/spec/dataTransform.d.ts +3 -2
- package/lib/spec/index.d.ts +1 -0
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/interaction.d.ts +4 -1
- package/lib/theme/academy.js +6 -6
- package/lib/theme/classic.js +6 -7
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/classicDark.js +6 -6
- package/lib/utils/coordinate.d.ts +2 -2
- package/lib/utils/scale.d.ts +1 -1
- package/lib/utils/scale.js +1 -1
- package/lib/utils/scale.js.map +1 -1
- package/package.json +8 -7
- package/src/api/chart.ts +5 -341
- package/src/api/{composition/base.ts → composition.ts} +16 -8
- package/src/api/define.ts +128 -0
- package/src/api/extend.ts +36 -0
- package/src/api/index.ts +2 -0
- package/src/api/library.ts +2 -2
- package/src/api/{mark/base.ts → mark.ts} +10 -7
- package/src/api/node.ts +3 -3
- package/src/api/props.ts +30 -114
- package/src/api/runtime.ts +366 -0
- package/src/api/types.ts +95 -17
- package/src/api/utils.ts +28 -11
- package/src/component/axis.ts +10 -5
- package/src/component/legendCategory.ts +4 -6
- package/src/{geo → composition}/geoView.ts +1 -1
- package/src/composition/index.ts +2 -0
- package/src/data/index.ts +2 -0
- package/src/data/log.ts +16 -0
- package/src/index.ts +12 -3
- package/src/interaction/brushFilter.ts +31 -28
- package/src/interaction/chartIndex.ts +26 -23
- package/src/interaction/fisheye.ts +16 -12
- package/src/interaction/legendFilter.ts +45 -40
- package/src/interaction/sliderFilter.ts +15 -16
- package/src/interaction/tooltip.ts +47 -3
- package/src/label-transform/overlapDodgeY.ts +0 -1
- package/src/{stdlib/index.ts → lib/core.ts} +76 -258
- package/src/lib/geo.ts +9 -0
- package/src/lib/graph.ts +8 -0
- package/src/lib/index.ts +6 -0
- package/src/lib/lite.ts +127 -0
- package/src/lib/plot.ts +16 -0
- package/src/lib/std.ts +13 -0
- package/src/mark/area.ts +15 -6
- package/src/mark/box.ts +10 -2
- package/src/mark/cell.ts +12 -6
- package/src/mark/connector.ts +7 -3
- package/src/mark/density.ts +11 -8
- package/src/mark/forceGraph.ts +0 -3
- package/src/mark/heatmap.ts +10 -5
- package/src/mark/image.ts +10 -5
- package/src/mark/interval.ts +22 -10
- package/src/mark/line.ts +23 -5
- package/src/mark/lineX.ts +9 -4
- package/src/mark/lineY.ts +9 -4
- package/src/mark/link.ts +13 -5
- package/src/mark/path.ts +8 -3
- package/src/mark/point.ts +49 -30
- package/src/mark/polygon.ts +8 -3
- package/src/mark/range.ts +5 -3
- package/src/mark/rangeX.ts +7 -3
- package/src/mark/rangeY.ts +7 -3
- package/src/mark/rect.ts +10 -4
- package/src/mark/shape.ts +14 -3
- package/src/mark/text.ts +11 -5
- package/src/mark/treemap.ts +0 -1
- package/src/mark/utils.ts +9 -8
- package/src/mark/vector.ts +7 -3
- package/src/runtime/index.ts +1 -1
- package/src/runtime/plot.ts +41 -17
- package/src/runtime/render.ts +3 -6
- package/src/runtime/types/component.ts +1 -2
- package/src/runtime/types/mark.ts +4 -0
- package/src/runtime/types/options.ts +4 -1
- package/src/shape/index.ts +106 -110
- package/src/shape/text/advance.ts +1 -2
- package/src/spec/composition.ts +7 -0
- package/src/spec/dataTransform.ts +5 -0
- package/src/spec/index.ts +1 -0
- package/src/spec/interaction.ts +5 -1
- package/src/theme/academy.ts +6 -6
- package/src/theme/classic.ts +6 -7
- package/src/theme/classicDark.ts +6 -6
- package/src/utils/scale.ts +1 -1
- package/esm/api/composition/base.d.ts +0 -28
- package/esm/api/composition/base.js.map +0 -1
- package/esm/api/composition/facetCircle.d.ts +0 -17
- package/esm/api/composition/facetCircle.js +0 -27
- package/esm/api/composition/facetCircle.js.map +0 -1
- package/esm/api/composition/facetRect.d.ts +0 -17
- package/esm/api/composition/facetRect.js +0 -27
- package/esm/api/composition/facetRect.js.map +0 -1
- package/esm/api/composition/geoPath.d.ts +0 -20
- package/esm/api/composition/geoPath.js +0 -30
- package/esm/api/composition/geoPath.js.map +0 -1
- package/esm/api/composition/geoView.d.ts +0 -19
- package/esm/api/composition/geoView.js +0 -28
- package/esm/api/composition/geoView.js.map +0 -1
- package/esm/api/composition/index.d.ts +0 -33
- package/esm/api/composition/index.js +0 -32
- package/esm/api/composition/index.js.map +0 -1
- package/esm/api/composition/repeatMatrix.d.ts +0 -17
- package/esm/api/composition/repeatMatrix.js +0 -27
- package/esm/api/composition/repeatMatrix.js.map +0 -1
- package/esm/api/composition/spaceFlex.d.ts +0 -12
- package/esm/api/composition/spaceFlex.js +0 -19
- package/esm/api/composition/spaceFlex.js.map +0 -1
- package/esm/api/composition/spaceLayer.d.ts +0 -12
- package/esm/api/composition/spaceLayer.js +0 -19
- package/esm/api/composition/spaceLayer.js.map +0 -1
- package/esm/api/composition/timingKeyframe.d.ts +0 -11
- package/esm/api/composition/timingKeyframe.js +0 -19
- package/esm/api/composition/timingKeyframe.js.map +0 -1
- package/esm/api/composition/view.d.ts +0 -19
- package/esm/api/composition/view.js +0 -29
- package/esm/api/composition/view.js.map +0 -1
- package/esm/api/mark/base.d.ts +0 -22
- package/esm/api/mark/base.js.map +0 -1
- package/esm/api/mark/index.d.ts +0 -75
- package/esm/api/mark/index.js +0 -39
- package/esm/api/mark/index.js.map +0 -1
- package/esm/api/mark/mark.d.ts +0 -212
- package/esm/api/mark/mark.js +0 -339
- package/esm/api/mark/mark.js.map +0 -1
- package/esm/api/mark/types.d.ts +0 -26
- package/esm/api/mark/types.js +0 -2
- package/esm/api/mark/types.js.map +0 -1
- package/esm/geo/d3Projection.js.map +0 -1
- package/esm/geo/geoPath.js.map +0 -1
- package/esm/geo/geoView.js.map +0 -1
- package/esm/geo/index.d.ts +0 -9
- package/esm/geo/index.js +0 -8
- package/esm/geo/index.js.map +0 -1
- package/esm/stdlib/index.d.ts +0 -2
- package/esm/stdlib/index.js +0 -21
- package/esm/stdlib/index.js.map +0 -1
- package/lib/api/composition/base.d.ts +0 -28
- package/lib/api/composition/base.js.map +0 -1
- package/lib/api/composition/facetCircle.d.ts +0 -17
- package/lib/api/composition/facetCircle.js +0 -30
- package/lib/api/composition/facetCircle.js.map +0 -1
- package/lib/api/composition/facetRect.d.ts +0 -17
- package/lib/api/composition/facetRect.js +0 -30
- package/lib/api/composition/facetRect.js.map +0 -1
- package/lib/api/composition/geoPath.d.ts +0 -20
- package/lib/api/composition/geoPath.js +0 -33
- package/lib/api/composition/geoPath.js.map +0 -1
- package/lib/api/composition/geoView.d.ts +0 -19
- package/lib/api/composition/geoView.js +0 -31
- package/lib/api/composition/geoView.js.map +0 -1
- package/lib/api/composition/index.d.ts +0 -33
- package/lib/api/composition/index.js +0 -44
- package/lib/api/composition/index.js.map +0 -1
- package/lib/api/composition/repeatMatrix.d.ts +0 -17
- package/lib/api/composition/repeatMatrix.js +0 -30
- package/lib/api/composition/repeatMatrix.js.map +0 -1
- package/lib/api/composition/spaceFlex.d.ts +0 -12
- package/lib/api/composition/spaceFlex.js +0 -22
- package/lib/api/composition/spaceFlex.js.map +0 -1
- package/lib/api/composition/spaceLayer.d.ts +0 -12
- package/lib/api/composition/spaceLayer.js +0 -22
- package/lib/api/composition/spaceLayer.js.map +0 -1
- package/lib/api/composition/timingKeyframe.d.ts +0 -11
- package/lib/api/composition/timingKeyframe.js +0 -22
- package/lib/api/composition/timingKeyframe.js.map +0 -1
- package/lib/api/composition/view.d.ts +0 -19
- package/lib/api/composition/view.js +0 -32
- package/lib/api/composition/view.js.map +0 -1
- package/lib/api/mark/base.d.ts +0 -22
- package/lib/api/mark/base.js.map +0 -1
- package/lib/api/mark/index.d.ts +0 -75
- package/lib/api/mark/index.js +0 -43
- package/lib/api/mark/index.js.map +0 -1
- package/lib/api/mark/mark.d.ts +0 -212
- package/lib/api/mark/mark.js +0 -342
- package/lib/api/mark/mark.js.map +0 -1
- package/lib/api/mark/types.d.ts +0 -26
- package/lib/api/mark/types.js +0 -3
- package/lib/api/mark/types.js.map +0 -1
- package/lib/geo/d3Projection.js.map +0 -1
- package/lib/geo/geoPath.js.map +0 -1
- package/lib/geo/geoView.js.map +0 -1
- package/lib/geo/index.d.ts +0 -9
- package/lib/geo/index.js +0 -12
- package/lib/geo/index.js.map +0 -1
- package/lib/stdlib/index.d.ts +0 -2
- package/lib/stdlib/index.js +0 -25
- package/lib/stdlib/index.js.map +0 -1
- package/src/api/composition/facetCircle.ts +0 -36
- package/src/api/composition/facetRect.ts +0 -36
- package/src/api/composition/geoPath.ts +0 -37
- package/src/api/composition/geoView.ts +0 -39
- package/src/api/composition/index.ts +0 -57
- package/src/api/composition/repeatMatrix.ts +0 -36
- package/src/api/composition/spaceFlex.ts +0 -18
- package/src/api/composition/spaceLayer.ts +0 -18
- package/src/api/composition/timingKeyframe.ts +0 -16
- package/src/api/composition/view.ts +0 -42
- package/src/api/mark/index.ts +0 -113
- package/src/api/mark/mark.ts +0 -439
- package/src/api/mark/types.ts +0 -31
- package/src/geo/index.ts +0 -12
- /package/esm/{geo → composition}/d3Projection.d.ts +0 -0
- /package/esm/{geo → composition}/d3Projection.js +0 -0
- /package/esm/{geo → composition}/geoPath.d.ts +0 -0
- /package/esm/{geo → composition}/geoPath.js +0 -0
- /package/esm/{geo → composition}/geoView.d.ts +0 -0
- /package/lib/{geo → composition}/d3Projection.d.ts +0 -0
- /package/lib/{geo → composition}/d3Projection.js +0 -0
- /package/lib/{geo → composition}/geoPath.d.ts +0 -0
- /package/lib/{geo → composition}/geoPath.js +0 -0
- /package/lib/{geo → composition}/geoView.d.ts +0 -0
- /package/src/{geo → composition}/d3Projection.ts +0 -0
- /package/src/{geo → composition}/geoPath.ts +0 -0
package/src/mark/point.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { MarkComponent as MC, Vector2 } from '../runtime';
|
|
2
2
|
import { PointMark } from '../spec';
|
|
3
|
+
import {
|
|
4
|
+
PointBowtie,
|
|
5
|
+
PointCross,
|
|
6
|
+
PointDiamond,
|
|
7
|
+
PointHexagon,
|
|
8
|
+
PointHollowBowtie,
|
|
9
|
+
PointHollowDiamond,
|
|
10
|
+
PointHollowHexagon,
|
|
11
|
+
PointHollow,
|
|
12
|
+
PointHollowSquare,
|
|
13
|
+
PointHollowTriangle,
|
|
14
|
+
PointHollowTriangleDown,
|
|
15
|
+
PointHyphen,
|
|
16
|
+
PointLine,
|
|
17
|
+
PointTriangleDown,
|
|
18
|
+
PointPlus,
|
|
19
|
+
PointSquare,
|
|
20
|
+
PointShape,
|
|
21
|
+
PointTick,
|
|
22
|
+
PointTriangle,
|
|
23
|
+
} from '../shape';
|
|
24
|
+
import { MaybeZeroX, MaybeZeroY, MaybeSize } from '../transform';
|
|
3
25
|
import {
|
|
4
26
|
baseGeometryChannels,
|
|
5
27
|
basePostInference,
|
|
@@ -8,6 +30,28 @@ import {
|
|
|
8
30
|
tooltip2d,
|
|
9
31
|
} from './utils';
|
|
10
32
|
|
|
33
|
+
const shape = {
|
|
34
|
+
hollow: PointHollow,
|
|
35
|
+
hollowDiamond: PointHollowDiamond,
|
|
36
|
+
hollowHexagon: PointHollowHexagon,
|
|
37
|
+
hollowSquare: PointHollowSquare,
|
|
38
|
+
hollowTriangleDown: PointHollowTriangleDown,
|
|
39
|
+
hollowTriangle: PointHollowTriangle,
|
|
40
|
+
hollowBowtie: PointHollowBowtie,
|
|
41
|
+
point: PointShape,
|
|
42
|
+
plus: PointPlus,
|
|
43
|
+
diamond: PointDiamond,
|
|
44
|
+
square: PointSquare,
|
|
45
|
+
triangle: PointTriangle,
|
|
46
|
+
hexagon: PointHexagon,
|
|
47
|
+
cross: PointCross,
|
|
48
|
+
bowtie: PointBowtie,
|
|
49
|
+
hyphen: PointHyphen,
|
|
50
|
+
line: PointLine,
|
|
51
|
+
tick: PointTick,
|
|
52
|
+
triangleDown: PointTriangleDown,
|
|
53
|
+
};
|
|
54
|
+
|
|
11
55
|
export type PointOptions = Omit<PointMark, 'type'>;
|
|
12
56
|
|
|
13
57
|
/**
|
|
@@ -50,34 +94,13 @@ export const Point: MC<PointOptions> = (options) => {
|
|
|
50
94
|
};
|
|
51
95
|
};
|
|
52
96
|
|
|
53
|
-
const shapes = [
|
|
54
|
-
'hollow',
|
|
55
|
-
'hollowDiamond',
|
|
56
|
-
'hollowHexagon',
|
|
57
|
-
'hollowSquare',
|
|
58
|
-
'hollowTriangleDown',
|
|
59
|
-
'hollowTriangle',
|
|
60
|
-
'hollowBowtie',
|
|
61
|
-
'point',
|
|
62
|
-
'plus',
|
|
63
|
-
'diamond',
|
|
64
|
-
'square',
|
|
65
|
-
'triangle',
|
|
66
|
-
'hexagon',
|
|
67
|
-
'cross',
|
|
68
|
-
'bowtie',
|
|
69
|
-
'hyphen',
|
|
70
|
-
'line',
|
|
71
|
-
'tick',
|
|
72
|
-
'triangleDown',
|
|
73
|
-
];
|
|
74
|
-
|
|
75
97
|
Point.props = {
|
|
76
98
|
defaultShape: 'hollow',
|
|
77
99
|
defaultLabelShape: 'label',
|
|
78
100
|
composite: false,
|
|
101
|
+
shape,
|
|
79
102
|
channels: [
|
|
80
|
-
...baseGeometryChannels({ shapes }),
|
|
103
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
81
104
|
{ name: 'x', required: true },
|
|
82
105
|
{ name: 'y', required: true },
|
|
83
106
|
{ name: 'series', scale: 'band' },
|
|
@@ -87,12 +110,8 @@ Point.props = {
|
|
|
87
110
|
],
|
|
88
111
|
preInference: [
|
|
89
112
|
...basePreInference(),
|
|
90
|
-
{ type:
|
|
91
|
-
{ type:
|
|
92
|
-
],
|
|
93
|
-
postInference: [
|
|
94
|
-
...basePostInference(),
|
|
95
|
-
{ type: 'maybeSize' },
|
|
96
|
-
...tooltip2d(),
|
|
113
|
+
{ type: MaybeZeroX },
|
|
114
|
+
{ type: MaybeZeroY },
|
|
97
115
|
],
|
|
116
|
+
postInference: [...basePostInference(), { type: MaybeSize }, ...tooltip2d()],
|
|
98
117
|
};
|
package/src/mark/polygon.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector2, MarkComponent as MC } from '../runtime';
|
|
2
2
|
import { PolygonMark } from '../spec';
|
|
3
|
+
import { PolygonShape, PolygonRibbon } from '../shape';
|
|
3
4
|
import {
|
|
4
5
|
baseGeometryChannels,
|
|
5
6
|
basePostInference,
|
|
@@ -7,6 +8,11 @@ import {
|
|
|
7
8
|
tooltip2d,
|
|
8
9
|
} from './utils';
|
|
9
10
|
|
|
11
|
+
const shape = {
|
|
12
|
+
polygon: PolygonShape,
|
|
13
|
+
ribbon: PolygonRibbon,
|
|
14
|
+
};
|
|
15
|
+
|
|
10
16
|
export type PolygonOptions = Omit<PolygonMark, 'type'>;
|
|
11
17
|
|
|
12
18
|
/**
|
|
@@ -37,14 +43,13 @@ export const Polygon: MC<PolygonOptions> = () => {
|
|
|
37
43
|
};
|
|
38
44
|
};
|
|
39
45
|
|
|
40
|
-
const shapes = ['polygon', 'ribbon'];
|
|
41
|
-
|
|
42
46
|
Polygon.props = {
|
|
43
47
|
defaultShape: 'polygon',
|
|
44
48
|
defaultLabelShape: 'label',
|
|
45
49
|
composite: false,
|
|
50
|
+
shape,
|
|
46
51
|
channels: [
|
|
47
|
-
...baseGeometryChannels({ shapes }),
|
|
52
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
48
53
|
{ name: 'x', required: true },
|
|
49
54
|
{ name: 'y', required: true },
|
|
50
55
|
],
|
package/src/mark/range.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Mark, MarkComponent as MC, Vector2 } from '../runtime';
|
|
2
2
|
import { RangeMark } from '../spec';
|
|
3
|
+
import { RangeShape } from '../shape';
|
|
3
4
|
import {
|
|
4
5
|
baseAnnotationChannels,
|
|
5
6
|
basePostInference,
|
|
@@ -36,20 +37,21 @@ export function AbstractRange(
|
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
const shape = { range: RangeShape };
|
|
41
|
+
|
|
39
42
|
export type RangeOptions = Omit<RangeMark, 'type'>;
|
|
40
43
|
|
|
41
44
|
export const Range: MC<RangeOptions> = () => {
|
|
42
45
|
return AbstractRange();
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
const shapes = ['range'];
|
|
46
|
-
|
|
47
48
|
Range.props = {
|
|
48
49
|
defaultShape: 'range',
|
|
49
50
|
defaultLabelShape: 'label',
|
|
50
51
|
composite: false,
|
|
52
|
+
shape,
|
|
51
53
|
channels: [
|
|
52
|
-
...baseAnnotationChannels({ shapes }),
|
|
54
|
+
...baseAnnotationChannels({ shapes: Object.keys(shape) }),
|
|
53
55
|
{ name: 'x', required: true },
|
|
54
56
|
{ name: 'y', required: true },
|
|
55
57
|
],
|
package/src/mark/rangeX.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MarkComponent as MC } from '../runtime';
|
|
2
2
|
import { RangeXMark } from '../spec';
|
|
3
|
+
import { RangeShape } from '../shape';
|
|
3
4
|
import {
|
|
4
5
|
baseAnnotationChannels,
|
|
5
6
|
basePostInference,
|
|
@@ -7,20 +8,23 @@ import {
|
|
|
7
8
|
} from './utils';
|
|
8
9
|
import { AbstractRange } from './range';
|
|
9
10
|
|
|
11
|
+
const shape = {
|
|
12
|
+
range: RangeShape,
|
|
13
|
+
};
|
|
14
|
+
|
|
10
15
|
export type RangeXOptions = Omit<RangeXMark, 'type'>;
|
|
11
16
|
|
|
12
17
|
export const RangeX: MC<RangeXOptions> = () => {
|
|
13
18
|
return AbstractRange({ extendY: true });
|
|
14
19
|
};
|
|
15
20
|
|
|
16
|
-
const shapes = ['range'];
|
|
17
|
-
|
|
18
21
|
RangeX.props = {
|
|
19
22
|
defaultShape: 'range',
|
|
20
23
|
defaultLabelShape: 'label',
|
|
21
24
|
composite: false,
|
|
25
|
+
shape,
|
|
22
26
|
channels: [
|
|
23
|
-
...baseAnnotationChannels({ shapes }),
|
|
27
|
+
...baseAnnotationChannels({ shapes: Object.keys(shape) }),
|
|
24
28
|
{ name: 'x', required: true },
|
|
25
29
|
],
|
|
26
30
|
preInference: [...basePreInference()],
|
package/src/mark/rangeY.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MarkComponent as MC } from '../runtime';
|
|
2
2
|
import { RangeYMark } from '../spec';
|
|
3
|
+
import { RangeShape } from '../shape';
|
|
3
4
|
import {
|
|
4
5
|
baseAnnotationChannels,
|
|
5
6
|
basePostInference,
|
|
@@ -7,20 +8,23 @@ import {
|
|
|
7
8
|
} from './utils';
|
|
8
9
|
import { AbstractRange } from './range';
|
|
9
10
|
|
|
11
|
+
const shape = {
|
|
12
|
+
range: RangeShape,
|
|
13
|
+
};
|
|
14
|
+
|
|
10
15
|
export type RangeYOptions = Omit<RangeYMark, 'type'>;
|
|
11
16
|
|
|
12
17
|
export const RangeY: MC<RangeYOptions> = () => {
|
|
13
18
|
return AbstractRange({ extendX: true });
|
|
14
19
|
};
|
|
15
20
|
|
|
16
|
-
const shapes = ['range'];
|
|
17
|
-
|
|
18
21
|
RangeY.props = {
|
|
19
22
|
defaultShape: 'range',
|
|
20
23
|
defaultLabelShape: 'label',
|
|
21
24
|
composite: false,
|
|
25
|
+
shape,
|
|
22
26
|
channels: [
|
|
23
|
-
...baseAnnotationChannels({ shapes }),
|
|
27
|
+
...baseAnnotationChannels({ shapes: Object.keys(shape) }),
|
|
24
28
|
{ name: 'y', required: true },
|
|
25
29
|
],
|
|
26
30
|
preInference: [...basePreInference()],
|
package/src/mark/rect.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MarkComponent as MC, Vector2 } from '../runtime';
|
|
2
2
|
import { RectMark } from '../spec';
|
|
3
|
+
import { RectShape, RectHollow } from '../shape';
|
|
4
|
+
import { MaybeZeroY1 } from '../transform';
|
|
3
5
|
import {
|
|
4
6
|
baseGeometryChannels,
|
|
5
7
|
basePostInference,
|
|
@@ -7,6 +9,11 @@ import {
|
|
|
7
9
|
tooltip1d,
|
|
8
10
|
} from './utils';
|
|
9
11
|
|
|
12
|
+
const shape = {
|
|
13
|
+
rect: RectShape,
|
|
14
|
+
hollow: RectHollow,
|
|
15
|
+
};
|
|
16
|
+
|
|
10
17
|
export type RectOptions = Omit<RectMark, 'type'>;
|
|
11
18
|
|
|
12
19
|
export const Rect: MC<RectOptions> = () => {
|
|
@@ -26,18 +33,17 @@ export const Rect: MC<RectOptions> = () => {
|
|
|
26
33
|
};
|
|
27
34
|
};
|
|
28
35
|
|
|
29
|
-
const shapes = ['rect', 'hollow'];
|
|
30
|
-
|
|
31
36
|
Rect.props = {
|
|
32
37
|
defaultShape: 'rect',
|
|
33
38
|
defaultLabelShape: 'label',
|
|
34
39
|
composite: false,
|
|
40
|
+
shape,
|
|
35
41
|
channels: [
|
|
36
|
-
...baseGeometryChannels({ shapes }),
|
|
42
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
37
43
|
{ name: 'x', required: true },
|
|
38
44
|
{ name: 'y', required: true },
|
|
39
45
|
],
|
|
40
|
-
preInference: [...basePreInference(), { type:
|
|
46
|
+
preInference: [...basePreInference(), { type: MaybeZeroY1 }],
|
|
41
47
|
postInference: [...basePostInference(), ...tooltip1d()],
|
|
42
48
|
interaction: {
|
|
43
49
|
shareTooltip: true,
|
package/src/mark/shape.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Mark, MarkComponent as MC, Vector2 } from '../runtime';
|
|
2
2
|
import { ShapeMark } from '../spec';
|
|
3
|
+
import { ShapeShape } from '../shape';
|
|
4
|
+
import {
|
|
5
|
+
MaybeTuple,
|
|
6
|
+
MaybeVisualPosition,
|
|
7
|
+
MaybeFunctionAttribute,
|
|
8
|
+
} from '../transform';
|
|
3
9
|
import { basePreInference, createBandOffset, visualMark } from './utils';
|
|
4
10
|
|
|
11
|
+
const shape = {
|
|
12
|
+
shape: ShapeShape,
|
|
13
|
+
};
|
|
14
|
+
|
|
5
15
|
export type ShapeOptions = Omit<ShapeMark, 'type'>;
|
|
6
16
|
|
|
7
17
|
/**
|
|
@@ -25,14 +35,15 @@ Shape.props = {
|
|
|
25
35
|
defaultShape: 'shape',
|
|
26
36
|
defaultLabelShape: 'label',
|
|
27
37
|
composite: false,
|
|
38
|
+
shape,
|
|
28
39
|
channels: [
|
|
29
40
|
{ name: 'x', required: true },
|
|
30
41
|
{ name: 'y', required: true },
|
|
31
42
|
],
|
|
32
43
|
preInference: [
|
|
33
44
|
...basePreInference(),
|
|
34
|
-
{ type:
|
|
35
|
-
{ type:
|
|
36
|
-
{ type:
|
|
45
|
+
{ type: MaybeTuple },
|
|
46
|
+
{ type: MaybeVisualPosition },
|
|
47
|
+
{ type: MaybeFunctionAttribute },
|
|
37
48
|
],
|
|
38
49
|
};
|
package/src/mark/text.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MarkComponent as MC, Vector2, Mark } from '../runtime';
|
|
2
2
|
import { TextMark } from '../spec';
|
|
3
|
+
import { TextShape, TextBadge } from '../shape';
|
|
4
|
+
import { MaybeTuple, MaybeVisualPosition } from '../transform';
|
|
3
5
|
import {
|
|
4
6
|
baseGeometryChannels,
|
|
5
7
|
basePostInference,
|
|
@@ -9,6 +11,11 @@ import {
|
|
|
9
11
|
visualMark,
|
|
10
12
|
} from './utils';
|
|
11
13
|
|
|
14
|
+
const shape = {
|
|
15
|
+
text: TextShape,
|
|
16
|
+
badge: TextBadge,
|
|
17
|
+
};
|
|
18
|
+
|
|
12
19
|
export type TextOptions = Omit<TextMark, 'type'>;
|
|
13
20
|
|
|
14
21
|
export const Text: MC<TextOptions> = (options) => {
|
|
@@ -25,14 +32,13 @@ export const Text: MC<TextOptions> = (options) => {
|
|
|
25
32
|
}) as Mark;
|
|
26
33
|
};
|
|
27
34
|
|
|
28
|
-
const shapes = ['text', 'badge'];
|
|
29
|
-
|
|
30
35
|
Text.props = {
|
|
31
36
|
defaultShape: 'text',
|
|
32
37
|
defaultLabelShape: 'label',
|
|
33
38
|
composite: false,
|
|
39
|
+
shape,
|
|
34
40
|
channels: [
|
|
35
|
-
...baseGeometryChannels({ shapes }),
|
|
41
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
36
42
|
{ name: 'x', required: true },
|
|
37
43
|
{ name: 'y', required: true },
|
|
38
44
|
{ name: 'text', scale: 'identity' },
|
|
@@ -41,8 +47,8 @@ Text.props = {
|
|
|
41
47
|
],
|
|
42
48
|
preInference: [
|
|
43
49
|
...basePreInference(),
|
|
44
|
-
{ type:
|
|
45
|
-
{ type:
|
|
50
|
+
{ type: MaybeTuple },
|
|
51
|
+
{ type: MaybeVisualPosition },
|
|
46
52
|
],
|
|
47
53
|
postInference: [...basePostInference(), ...tooltip2d()],
|
|
48
54
|
};
|
package/src/mark/treemap.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
import { subObject } from '../utils/helper';
|
|
12
12
|
import { CompositionComponent as CC } from '../runtime';
|
|
13
13
|
import { TreemapMark } from '../spec';
|
|
14
|
-
import { getBBoxSize } from '../utils/size';
|
|
15
14
|
import { maybeTooltip } from '../utils/mark';
|
|
16
15
|
import { generateHierarchyRoot, field } from './utils';
|
|
17
16
|
|
package/src/mark/utils.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { Primitive } from 'd3-array';
|
|
|
4
4
|
import { Vector2 } from '@antv/coord';
|
|
5
5
|
import { Scale } from '../runtime/types/component';
|
|
6
6
|
import { Channel } from '../runtime';
|
|
7
|
+
import { MaybeKey, MaybeTitle, MaybeTooltip } from '../transform';
|
|
7
8
|
|
|
8
9
|
export type ChannelOptions = {
|
|
9
|
-
shapes?: string[];
|
|
10
|
+
shapes?: (string | { (...args: any[]); props?: Record<string, any> })[];
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export function baseChannels(options: ChannelOptions = {}): Channel[] {
|
|
@@ -31,22 +32,22 @@ export function baseGeometryChannels(options: ChannelOptions = {}): Channel[] {
|
|
|
31
32
|
|
|
32
33
|
export function tooltip2d() {
|
|
33
34
|
return [
|
|
34
|
-
{ type:
|
|
35
|
-
{ type:
|
|
35
|
+
{ type: MaybeTitle, channel: 'color' },
|
|
36
|
+
{ type: MaybeTooltip, channel: ['x', 'y'] },
|
|
36
37
|
];
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export function tooltip1d() {
|
|
40
41
|
return [
|
|
41
|
-
{ type:
|
|
42
|
-
{ type:
|
|
42
|
+
{ type: MaybeTitle, channel: 'x' },
|
|
43
|
+
{ type: MaybeTooltip, channel: ['y'] },
|
|
43
44
|
];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export function tooltipXd() {
|
|
47
48
|
return [
|
|
48
|
-
{ type:
|
|
49
|
-
{ type:
|
|
49
|
+
{ type: MaybeTitle, channel: 'color' },
|
|
50
|
+
{ type: MaybeTooltip, channel: ['position'] },
|
|
50
51
|
];
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -57,7 +58,7 @@ export function baseAnnotationChannels(
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export function basePreInference() {
|
|
60
|
-
return [{ type:
|
|
61
|
+
return [{ type: MaybeKey }];
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
export function basePostInference() {
|
package/src/mark/vector.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MarkComponent as MC, Vector2 } from '../runtime';
|
|
2
2
|
import { VectorMark } from '../spec';
|
|
3
|
+
import { VectorShape } from '../shape';
|
|
3
4
|
import {
|
|
4
5
|
baseGeometryChannels,
|
|
5
6
|
basePostInference,
|
|
@@ -7,6 +8,10 @@ import {
|
|
|
7
8
|
tooltip2d,
|
|
8
9
|
} from './utils';
|
|
9
10
|
|
|
11
|
+
const shape = {
|
|
12
|
+
vector: VectorShape,
|
|
13
|
+
};
|
|
14
|
+
|
|
10
15
|
export type VectorOptions = Omit<VectorMark, 'type'>;
|
|
11
16
|
|
|
12
17
|
/**
|
|
@@ -37,14 +42,13 @@ export const Vector: MC<VectorOptions> = () => {
|
|
|
37
42
|
};
|
|
38
43
|
};
|
|
39
44
|
|
|
40
|
-
const shapes = ['vector'];
|
|
41
|
-
|
|
42
45
|
Vector.props = {
|
|
43
46
|
defaultShape: 'vector',
|
|
44
47
|
defaultLabelShape: 'label',
|
|
45
48
|
composite: false,
|
|
49
|
+
shape,
|
|
46
50
|
channels: [
|
|
47
|
-
...baseGeometryChannels({ shapes }),
|
|
51
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
48
52
|
{ name: 'x', required: true },
|
|
49
53
|
{ name: 'y', required: true },
|
|
50
54
|
{ name: 'rotate', required: true, scale: 'identity' },
|
package/src/runtime/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './constant';
|
|
2
|
-
export { render, renderToMountedElement, destroy } from './render';
|
|
3
2
|
export * from './types/common';
|
|
4
3
|
export * from './types/component';
|
|
5
4
|
export * from './types/options';
|
|
@@ -7,3 +6,4 @@ export * from './types/transform';
|
|
|
7
6
|
export * from './types/encode';
|
|
8
7
|
export * from './types/mark';
|
|
9
8
|
export * from './types/data';
|
|
9
|
+
export { render, renderToMountedElement, destroy } from './render';
|
package/src/runtime/plot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vector2 } from '@antv/coord';
|
|
2
2
|
import { DisplayObject, IAnimation as GAnimation, Rect } from '@antv/g';
|
|
3
3
|
import { deepMix, upperFirst } from '@antv/util';
|
|
4
|
-
import { group, groups } from 'd3-array';
|
|
4
|
+
import { group, groups, sort } from 'd3-array';
|
|
5
5
|
import { format } from 'd3-format';
|
|
6
6
|
import { mapObject } from '../utils/array';
|
|
7
7
|
import { ChartEvent } from '../utils/event';
|
|
@@ -237,12 +237,27 @@ export async function plot<T extends G2ViewTree>(
|
|
|
237
237
|
const viewInstanceof = (
|
|
238
238
|
viewContainer: Map<G2ViewDescriptor, DisplayObject>,
|
|
239
239
|
) => {
|
|
240
|
-
return Array.from(viewContainer.entries()).map(([view, container]) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
options
|
|
244
|
-
|
|
245
|
-
|
|
240
|
+
return Array.from(viewContainer.entries()).map(([view, container]) => {
|
|
241
|
+
// Index state by component or interaction name,
|
|
242
|
+
// such as legend, scrollbar, brushFilter.
|
|
243
|
+
// Each state transform options to another options.
|
|
244
|
+
const store = new Map<any, (options: G2ViewTree) => G2ViewTree>();
|
|
245
|
+
const setState = (key, reducer = (x) => x) => store.set(key, reducer);
|
|
246
|
+
const update = createUpdateView(select(container), library, context);
|
|
247
|
+
const options = viewNode.get(view);
|
|
248
|
+
return {
|
|
249
|
+
view,
|
|
250
|
+
container,
|
|
251
|
+
options,
|
|
252
|
+
setState,
|
|
253
|
+
update: async () => {
|
|
254
|
+
// Apply all state functions to get new options.
|
|
255
|
+
const reducer = compose(Array.from(store.values()));
|
|
256
|
+
const newOptions = reducer(options);
|
|
257
|
+
return await update(newOptions);
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
});
|
|
246
261
|
};
|
|
247
262
|
|
|
248
263
|
// Interactions for enter views.
|
|
@@ -1335,7 +1350,7 @@ function createMarkShapeFunction(
|
|
|
1335
1350
|
library,
|
|
1336
1351
|
);
|
|
1337
1352
|
const { data: abstractData } = mark;
|
|
1338
|
-
const { defaultShape, data } = state;
|
|
1353
|
+
const { defaultShape, data, shape: shapeLibrary } = state;
|
|
1339
1354
|
const point2d = data.map((d) => d.points);
|
|
1340
1355
|
const { theme, coordinate } = view;
|
|
1341
1356
|
const { type: markType, style = {} } = mark;
|
|
@@ -1364,11 +1379,13 @@ function createMarkShapeFunction(
|
|
|
1364
1379
|
valueOf(d, abstractDatum, I, abstractData),
|
|
1365
1380
|
);
|
|
1366
1381
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1382
|
+
// Try get shape from mark first, then from library.
|
|
1383
|
+
const shapeFunction = shapeLibrary[shape]
|
|
1384
|
+
? shapeLibrary[shape](visualStyle, shapeContext)
|
|
1385
|
+
: useShape(
|
|
1386
|
+
{ ...visualStyle, type: shapeName(mark, shape) },
|
|
1387
|
+
shapeContext,
|
|
1388
|
+
);
|
|
1372
1389
|
|
|
1373
1390
|
const defaults = getDefaultsStyle(theme, markType, shape, defaultShape);
|
|
1374
1391
|
return shapeFunction(points, value, defaults, point2d);
|
|
@@ -1408,19 +1425,24 @@ function createAnimationFunction(
|
|
|
1408
1425
|
AnimationComponent,
|
|
1409
1426
|
Animation
|
|
1410
1427
|
>('animation', library);
|
|
1411
|
-
const { defaultShape } = state;
|
|
1428
|
+
const { defaultShape, shape: shapeLibrary } = state;
|
|
1412
1429
|
const { theme, coordinate } = view;
|
|
1430
|
+
|
|
1413
1431
|
const upperType = upperFirst(type) as 'Enter' | 'Exit' | 'Update';
|
|
1414
1432
|
const key:
|
|
1415
1433
|
| 'defaultEnterAnimation'
|
|
1416
1434
|
| 'defaultExitAnimation'
|
|
1417
1435
|
| 'defaultUpdateAnimation' = `default${upperType}Animation`;
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1436
|
+
|
|
1437
|
+
// Get shape from mark first, then from library.
|
|
1438
|
+
const { [key]: defaultAnimation } =
|
|
1439
|
+
shapeLibrary[defaultShape]?.props ||
|
|
1440
|
+
createShape(shapeName(mark, defaultShape)).props;
|
|
1441
|
+
|
|
1421
1442
|
const { [type]: defaultEffectTiming = {} } = theme;
|
|
1422
1443
|
const animate = mark.animate?.[type] || {};
|
|
1423
1444
|
const context = { coordinate };
|
|
1445
|
+
|
|
1424
1446
|
return (data, from, to) => {
|
|
1425
1447
|
const {
|
|
1426
1448
|
[`${type}Type`]: animation,
|
|
@@ -1428,11 +1450,13 @@ function createAnimationFunction(
|
|
|
1428
1450
|
[`${type}Duration`]: duration,
|
|
1429
1451
|
[`${type}Easing`]: easing,
|
|
1430
1452
|
} = data;
|
|
1453
|
+
|
|
1431
1454
|
const options = {
|
|
1432
1455
|
type: animation || defaultAnimation,
|
|
1433
1456
|
...animate,
|
|
1434
1457
|
};
|
|
1435
1458
|
if (!options.type) return null;
|
|
1459
|
+
|
|
1436
1460
|
const animateFunction = useAnimation(options, context);
|
|
1437
1461
|
const value = { delay, duration, easing };
|
|
1438
1462
|
const A = animateFunction(from, to, deepMix(defaultEffectTiming, value));
|
package/src/runtime/render.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Renderer as CanvasRenderer } from '@antv/g-canvas';
|
|
|
3
3
|
import { Plugin as DragAndDropPlugin } from '@antv/g-plugin-dragndrop';
|
|
4
4
|
import { deepMix } from '@antv/util';
|
|
5
5
|
import EventEmitter from '@antv/event-emitter';
|
|
6
|
-
import { createLibrary } from '../stdlib';
|
|
7
6
|
import { select } from '../utils/selection';
|
|
8
7
|
import { ChartEvent } from '../utils/event';
|
|
9
8
|
import { error } from '../utils/helper';
|
|
@@ -80,11 +79,10 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
80
79
|
const keyed = inferKeys(options);
|
|
81
80
|
const {
|
|
82
81
|
canvas = Canvas(width, height),
|
|
83
|
-
library = createLibrary(),
|
|
84
82
|
emitter = new EventEmitter(),
|
|
83
|
+
library,
|
|
85
84
|
} = context;
|
|
86
85
|
context.canvas = canvas;
|
|
87
|
-
context.library = library;
|
|
88
86
|
context.emitter = emitter;
|
|
89
87
|
canvas.resize(width, height);
|
|
90
88
|
|
|
@@ -121,12 +119,12 @@ export function renderToMountedElement<T extends G2ViewTree = G2ViewTree>(
|
|
|
121
119
|
},
|
|
122
120
|
): DisplayObject {
|
|
123
121
|
// Initialize the context if it is not provided.
|
|
124
|
-
const { width = 640, height = 480
|
|
122
|
+
const { width = 640, height = 480 } = options;
|
|
125
123
|
const keyed = inferKeys(options);
|
|
126
124
|
const {
|
|
127
|
-
library = createLibrary(),
|
|
128
125
|
group = new Group(),
|
|
129
126
|
emitter = new EventEmitter(),
|
|
127
|
+
library,
|
|
130
128
|
} = context;
|
|
131
129
|
|
|
132
130
|
if (!group?.parentElement) {
|
|
@@ -135,7 +133,6 @@ export function renderToMountedElement<T extends G2ViewTree = G2ViewTree>(
|
|
|
135
133
|
|
|
136
134
|
const selection = select(group);
|
|
137
135
|
context.group = group;
|
|
138
|
-
context.library = library;
|
|
139
136
|
context.emitter = emitter;
|
|
140
137
|
|
|
141
138
|
emitter.emit(ChartEvent.BEFORE_RENDER);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Coordinate, Transformation } from '@antv/coord';
|
|
2
2
|
import EventEmitter from '@antv/event-emitter';
|
|
3
3
|
import { DisplayObject, IAnimation as GAnimation, IDocument } from '@antv/g';
|
|
4
|
-
import { G2Layout } from 'component/utils';
|
|
5
4
|
import {
|
|
6
5
|
G2Theme,
|
|
7
6
|
G2ViewInstance,
|
|
@@ -67,7 +66,7 @@ export type G2ComponentValue =
|
|
|
67
66
|
|
|
68
67
|
export type G2BaseComponent<
|
|
69
68
|
R = any,
|
|
70
|
-
O = Record<string, unknown
|
|
69
|
+
O = Record<string, unknown>,
|
|
71
70
|
P = Record<string, unknown>,
|
|
72
71
|
C = Record<string, unknown>,
|
|
73
72
|
> = {
|
|
@@ -27,6 +27,10 @@ export type MarkProps = {
|
|
|
27
27
|
channels?: Channel[];
|
|
28
28
|
preInference?: TransformSpec[];
|
|
29
29
|
postInference?: TransformSpec[];
|
|
30
|
+
shape?: Record<
|
|
31
|
+
string,
|
|
32
|
+
{ (...args: any[]): any; props?: Record<string, any> }
|
|
33
|
+
>;
|
|
30
34
|
composite?: boolean;
|
|
31
35
|
interaction?: {
|
|
32
36
|
shareTooltip?: boolean;
|