@antv/g2 5.0.18 → 5.0.19
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 +1017 -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 +9 -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 +170 -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/index.d.ts +4 -3
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/label-transform/overlapDodgeY.js.map +1 -1
- package/esm/lib/core.d.ts +158 -0
- package/esm/lib/core.js +174 -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 +170 -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 +11 -7
- 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/index.d.ts +1 -0
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/interaction.d.ts +2 -0
- 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 +1017 -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 +9 -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 +170 -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/index.d.ts +4 -3
- package/lib/index.js +8 -3
- package/lib/index.js.map +1 -1
- package/lib/label-transform/overlapDodgeY.js.map +1 -1
- package/lib/lib/core.d.ts +158 -0
- package/lib/lib/core.js +178 -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 +170 -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 +11 -7
- 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/index.d.ts +1 -0
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/interaction.d.ts +2 -0
- 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 +34 -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/index.ts +12 -3
- package/src/label-transform/overlapDodgeY.ts +0 -1
- package/src/{stdlib/index.ts → lib/core.ts} +74 -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 +19 -10
- 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/index.ts +1 -0
- package/src/spec/interaction.ts +2 -0
- 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/esm/api/chart.js
CHANGED
|
@@ -1,261 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
8
|
-
var t = {};
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
12
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
13
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
14
|
-
t[p[i]] = s[p[i]];
|
|
15
|
-
}
|
|
16
|
-
return t;
|
|
17
|
-
};
|
|
18
|
-
import { Canvas as GCanvas } from '@antv/g';
|
|
19
|
-
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
|
|
20
|
-
import { Plugin as DragAndDropPlugin } from '@antv/g-plugin-dragndrop';
|
|
21
|
-
import { debounce } from '@antv/util';
|
|
22
|
-
import EventEmitter from '@antv/event-emitter';
|
|
23
|
-
import { render, destroy } from '../runtime';
|
|
24
|
-
import { ChartEvent } from '../utils/event';
|
|
25
|
-
import { defineProps, nodeProps, containerProps, } from './props';
|
|
26
|
-
import { mark } from './mark';
|
|
27
|
-
import { composition, View } from './composition';
|
|
1
|
+
import { extend } from './extend';
|
|
28
2
|
import { library } from './library';
|
|
29
|
-
import {
|
|
30
|
-
export const
|
|
31
|
-
export const props = [
|
|
32
|
-
{ name: 'data', type: 'value' },
|
|
33
|
-
{ name: 'width', type: 'value' },
|
|
34
|
-
{ name: 'height', type: 'value' },
|
|
35
|
-
{ name: 'coordinate', type: 'value' },
|
|
36
|
-
{ name: 'interaction', type: 'object' },
|
|
37
|
-
{ name: 'theme', type: 'object' },
|
|
38
|
-
{ name: 'title', type: 'value' },
|
|
39
|
-
{ name: 'transform', type: 'array' },
|
|
40
|
-
{ name: 'scale', type: 'object' },
|
|
41
|
-
{ name: 'axis', type: 'object' },
|
|
42
|
-
{ name: 'legend', type: 'object' },
|
|
43
|
-
{ name: 'style', type: 'object' },
|
|
44
|
-
{ name: 'labelTransform', type: 'array' },
|
|
45
|
-
...nodeProps(mark),
|
|
46
|
-
...containerProps(composition),
|
|
47
|
-
];
|
|
48
|
-
let Chart = class Chart extends View {
|
|
49
|
-
constructor(options) {
|
|
50
|
-
const _a = options || {}, { container, canvas, renderer, plugins } = _a, rest = __rest(_a, ["container", "canvas", "renderer", "plugins"]);
|
|
51
|
-
super(rest, 'view');
|
|
52
|
-
// Identifies whether bindAutoFit.
|
|
53
|
-
this._hasBindAutoFit = false;
|
|
54
|
-
this._rendering = false;
|
|
55
|
-
this._trailing = false;
|
|
56
|
-
this._trailingResolve = null;
|
|
57
|
-
this._trailingReject = null;
|
|
58
|
-
this._previousDefinedType = null;
|
|
59
|
-
this._onResize = debounce(() => {
|
|
60
|
-
this.forceFit();
|
|
61
|
-
}, 300);
|
|
62
|
-
this._renderer = renderer || new CanvasRenderer();
|
|
63
|
-
this._plugins = plugins || [];
|
|
64
|
-
this._container = normalizeContainer(container);
|
|
65
|
-
this._emitter = new EventEmitter();
|
|
66
|
-
this._context = { library, emitter: this._emitter, canvas };
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
if (this._rendering)
|
|
70
|
-
return this._addToTrailing();
|
|
71
|
-
if (!this._context.canvas)
|
|
72
|
-
this._createCanvas();
|
|
73
|
-
this._bindAutoFit();
|
|
74
|
-
this._rendering = true;
|
|
75
|
-
const finished = new Promise((resolve, reject) => render(this._computedOptions(), this._context, this._createResolve(resolve), this._createReject(reject)));
|
|
76
|
-
const [finished1, resolve, reject] = createEmptyPromise();
|
|
77
|
-
finished
|
|
78
|
-
.then(resolve)
|
|
79
|
-
.catch(reject)
|
|
80
|
-
.then(() => this._renderTrailing());
|
|
81
|
-
return finished1;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @overload
|
|
85
|
-
* @param {G2ViewTree} [options]
|
|
86
|
-
* @returns {Chart|G2ViewTree}
|
|
87
|
-
*/
|
|
88
|
-
options(options) {
|
|
89
|
-
if (arguments.length === 0)
|
|
90
|
-
return optionsOf(this);
|
|
91
|
-
const { type } = options;
|
|
92
|
-
if (type)
|
|
93
|
-
this._previousDefinedType = type;
|
|
94
|
-
updateRoot(this, options, this._previousDefinedType);
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
getContainer() {
|
|
98
|
-
return this._container;
|
|
99
|
-
}
|
|
100
|
-
getContext() {
|
|
101
|
-
return this._context;
|
|
102
|
-
}
|
|
103
|
-
on(event, callback, once) {
|
|
104
|
-
this._emitter.on(event, callback, once);
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
once(event, callback) {
|
|
108
|
-
this._emitter.once(event, callback);
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
emit(event, ...args) {
|
|
112
|
-
this._emitter.emit(event, ...args);
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
off(event, callback) {
|
|
116
|
-
this._emitter.off(event, callback);
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
clear() {
|
|
120
|
-
const options = this.options();
|
|
121
|
-
this.emit(ChartEvent.BEFORE_CLEAR);
|
|
122
|
-
this._reset();
|
|
123
|
-
destroy(options, this._context, false);
|
|
124
|
-
this.emit(ChartEvent.AFTER_CLEAR);
|
|
125
|
-
}
|
|
126
|
-
destroy() {
|
|
127
|
-
const options = this.options();
|
|
128
|
-
this.emit(ChartEvent.BEFORE_DESTROY);
|
|
129
|
-
this._unbindAutoFit();
|
|
130
|
-
this._reset();
|
|
131
|
-
destroy(options, this._context, true);
|
|
132
|
-
removeContainer(this._container);
|
|
133
|
-
this.emit(ChartEvent.AFTER_DESTROY);
|
|
134
|
-
}
|
|
135
|
-
forceFit() {
|
|
136
|
-
// Don't fit if size do not change.
|
|
137
|
-
this.options['autoFit'] = true;
|
|
138
|
-
const { width, height } = sizeOf(this.options(), this._container);
|
|
139
|
-
if (width === this._width && height === this._height) {
|
|
140
|
-
return Promise.resolve(this);
|
|
141
|
-
}
|
|
142
|
-
// Don't call changeSize to prevent update width and height of options.
|
|
143
|
-
this.emit(ChartEvent.BEFORE_CHANGE_SIZE);
|
|
144
|
-
const finished = this.render();
|
|
145
|
-
finished.then(() => {
|
|
146
|
-
this.emit(ChartEvent.AFTER_CHANGE_SIZE);
|
|
147
|
-
});
|
|
148
|
-
return finished;
|
|
149
|
-
}
|
|
150
|
-
changeSize(width, height) {
|
|
151
|
-
if (width === this._width && height === this._height) {
|
|
152
|
-
return Promise.resolve(this);
|
|
153
|
-
}
|
|
154
|
-
this.emit(ChartEvent.BEFORE_CHANGE_SIZE);
|
|
155
|
-
this.width(width);
|
|
156
|
-
this.height(height);
|
|
157
|
-
const finished = this.render();
|
|
158
|
-
finished.then(() => {
|
|
159
|
-
this.emit(ChartEvent.AFTER_CHANGE_SIZE);
|
|
160
|
-
});
|
|
161
|
-
return finished;
|
|
162
|
-
}
|
|
163
|
-
_reset() {
|
|
164
|
-
const KEYS = ['theme', 'type', 'width', 'height', 'autoFit'];
|
|
165
|
-
this.type = 'view';
|
|
166
|
-
this.value = Object.fromEntries(Object.entries(this.value).filter(([key]) => key.startsWith('margin') ||
|
|
167
|
-
key.startsWith('padding') ||
|
|
168
|
-
key.startsWith('inset') ||
|
|
169
|
-
KEYS.includes(key)));
|
|
170
|
-
this.children = [];
|
|
171
|
-
}
|
|
172
|
-
_renderTrailing() {
|
|
173
|
-
if (!this._trailing)
|
|
174
|
-
return;
|
|
175
|
-
this._trailing = false;
|
|
176
|
-
this.render()
|
|
177
|
-
.then(() => {
|
|
178
|
-
const trailingResolve = this._trailingResolve.bind(this);
|
|
179
|
-
this._trailingResolve = null;
|
|
180
|
-
trailingResolve(this);
|
|
181
|
-
})
|
|
182
|
-
.catch((error) => {
|
|
183
|
-
const trailingReject = this._trailingReject.bind(this);
|
|
184
|
-
this._trailingReject = null;
|
|
185
|
-
trailingReject(error);
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
_createResolve(resolve) {
|
|
189
|
-
return () => {
|
|
190
|
-
this._rendering = false;
|
|
191
|
-
resolve(this);
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
_createReject(reject) {
|
|
195
|
-
return (error) => {
|
|
196
|
-
this._rendering = false;
|
|
197
|
-
reject(error);
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
// Update actual size and key.
|
|
201
|
-
_computedOptions() {
|
|
202
|
-
const options = this.options();
|
|
203
|
-
const { key = G2_CHART_KEY } = options;
|
|
204
|
-
const { width, height } = sizeOf(options, this._container);
|
|
205
|
-
this._width = width;
|
|
206
|
-
this._height = height;
|
|
207
|
-
this._key = key;
|
|
208
|
-
return Object.assign(Object.assign({ key: this._key }, options), { width, height });
|
|
209
|
-
}
|
|
210
|
-
// Create canvas if it does not exist.
|
|
211
|
-
// DragAndDropPlugin is for interaction.
|
|
212
|
-
// It is OK to register more than one time, G will handle this.
|
|
213
|
-
_createCanvas() {
|
|
214
|
-
const { width, height } = sizeOf(this.options(), this._container);
|
|
215
|
-
this._plugins.push(new DragAndDropPlugin());
|
|
216
|
-
this._plugins.forEach((d) => this._renderer.registerPlugin(d));
|
|
217
|
-
this._context.canvas = new GCanvas({
|
|
218
|
-
container: this._container,
|
|
219
|
-
width,
|
|
220
|
-
height,
|
|
221
|
-
renderer: this._renderer,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
_addToTrailing() {
|
|
225
|
-
var _a;
|
|
226
|
-
// Resolve previous promise, and give up this task.
|
|
227
|
-
(_a = this._trailingResolve) === null || _a === void 0 ? void 0 : _a.call(this, this);
|
|
228
|
-
// Create new task.
|
|
229
|
-
this._trailing = true;
|
|
230
|
-
const promise = new Promise((resolve, reject) => {
|
|
231
|
-
this._trailingResolve = resolve;
|
|
232
|
-
this._trailingReject = reject;
|
|
233
|
-
});
|
|
234
|
-
return promise;
|
|
235
|
-
}
|
|
236
|
-
_bindAutoFit() {
|
|
237
|
-
const options = this.options();
|
|
238
|
-
const { autoFit } = options;
|
|
239
|
-
if (this._hasBindAutoFit) {
|
|
240
|
-
// If it was bind before, unbind it now.
|
|
241
|
-
if (!autoFit)
|
|
242
|
-
this._unbindAutoFit();
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
if (autoFit) {
|
|
246
|
-
this._hasBindAutoFit = true;
|
|
247
|
-
window.addEventListener('resize', this._onResize);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
_unbindAutoFit() {
|
|
251
|
-
if (this._hasBindAutoFit) {
|
|
252
|
-
this._hasBindAutoFit = false;
|
|
253
|
-
window.removeEventListener('resize', this._onResize);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
Chart = __decorate([
|
|
258
|
-
defineProps(props)
|
|
259
|
-
], Chart);
|
|
260
|
-
export { Chart };
|
|
3
|
+
import { Runtime } from './runtime';
|
|
4
|
+
export const Chart = extend(Runtime, library);
|
|
261
5
|
//# sourceMappingURL=chart.js.map
|
package/esm/api/chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","sourceRoot":"src/","sources":["api/chart.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"src/","sources":["api/chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Coordinate } from '@antv/coord';
|
|
2
|
+
import { DisplayObject } from '@antv/g';
|
|
3
|
+
import { Scale, G2Theme, G2ViewDescriptor } from '../runtime';
|
|
4
|
+
import { Composition as Spec } from '../spec';
|
|
5
|
+
import { Node } from './node';
|
|
6
|
+
import { compositionProps } from './props';
|
|
7
|
+
import { PropsOf } from './types';
|
|
8
|
+
export interface CompositionNode<T = any> extends PropsOf<typeof compositionProps, any, // todo Remove this when update types of Spec.
|
|
9
|
+
// todo Remove this when update types of Spec.
|
|
10
|
+
CompositionNode & T> {
|
|
11
|
+
}
|
|
12
|
+
export declare class CompositionNode extends Node<Spec & {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}> {
|
|
15
|
+
protected _key: string;
|
|
16
|
+
/**
|
|
17
|
+
* Change current node data and its children data.
|
|
18
|
+
*/
|
|
19
|
+
changeData(data: any): Promise<import("./runtime").Runtime<import("../spec").G2Spec>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get view instance by key.
|
|
22
|
+
*/
|
|
23
|
+
getView(): G2ViewDescriptor;
|
|
24
|
+
getScale(): Record<string, Scale>;
|
|
25
|
+
getScaleByChannel(channel: string): Scale;
|
|
26
|
+
getCoordinate(): Coordinate;
|
|
27
|
+
getTheme(): G2Theme;
|
|
28
|
+
getGroup(): DisplayObject;
|
|
29
|
+
/**
|
|
30
|
+
* Show the view.
|
|
31
|
+
*/
|
|
32
|
+
show(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Hide the view.
|
|
35
|
+
*/
|
|
36
|
+
hide(): void;
|
|
37
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { hide, show } from '../utils/style';
|
|
8
|
+
import { Node } from './node';
|
|
9
|
+
import { defineProps } from './define';
|
|
10
|
+
import { compositionProps } from './props';
|
|
11
|
+
let CompositionNode = class CompositionNode extends Node {
|
|
4
12
|
/**
|
|
5
13
|
* Change current node data and its children data.
|
|
6
14
|
*/
|
|
@@ -71,5 +79,9 @@ export class CompositionNode extends Node {
|
|
|
71
79
|
return;
|
|
72
80
|
group.isVisible() && hide(group);
|
|
73
81
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
82
|
+
};
|
|
83
|
+
CompositionNode = __decorate([
|
|
84
|
+
defineProps(compositionProps)
|
|
85
|
+
], CompositionNode);
|
|
86
|
+
export { CompositionNode };
|
|
87
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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export type NodePropertyDescriptor = {
|
|
3
|
+
type: 'object' | 'value' | 'array' | 'node' | 'container' | 'mix';
|
|
4
|
+
key?: string;
|
|
5
|
+
ctor?: new (...args: any[]) => any;
|
|
6
|
+
};
|
|
7
|
+
type NodeClass = new (props: any, type?: string) => Node;
|
|
8
|
+
/**
|
|
9
|
+
* A decorator to define different type of attribute setter or
|
|
10
|
+
* getter for current node.
|
|
11
|
+
*/
|
|
12
|
+
export declare function defineProps(descriptors: Record<string, NodePropertyDescriptor>): (Node: NodeClass) => any;
|
|
13
|
+
export declare function nodeProps(node: Record<string, new (...args: any[]) => any>): Record<string, NodePropertyDescriptor>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { isStrictObject } from '../utils/helper';
|
|
2
|
+
function defineValueProp(Node, name, { key = name }) {
|
|
3
|
+
Node.prototype[name] = function (value) {
|
|
4
|
+
if (arguments.length === 0)
|
|
5
|
+
return this.attr(key);
|
|
6
|
+
return this.attr(key, value);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function defineArrayProp(Node, name, { key = name }) {
|
|
10
|
+
Node.prototype[name] = function (value) {
|
|
11
|
+
if (arguments.length === 0)
|
|
12
|
+
return this.attr(key);
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return this.attr(key, value);
|
|
15
|
+
const array = [...(this.attr(key) || []), value];
|
|
16
|
+
return this.attr(key, array);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function defineObjectProp(Node, name, { key: k = name }) {
|
|
20
|
+
Node.prototype[name] = function (key, value) {
|
|
21
|
+
if (arguments.length === 0)
|
|
22
|
+
return this.attr(k);
|
|
23
|
+
if (arguments.length === 1 && typeof key !== 'string') {
|
|
24
|
+
return this.attr(k, key);
|
|
25
|
+
}
|
|
26
|
+
const obj = this.attr(k) || {};
|
|
27
|
+
obj[key] = arguments.length === 1 ? true : value;
|
|
28
|
+
return this.attr(k, obj);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function defineMixProp(Node, name, descriptor) {
|
|
32
|
+
Node.prototype[name] = function (key) {
|
|
33
|
+
if (arguments.length === 0)
|
|
34
|
+
return this.attr(name);
|
|
35
|
+
if (Array.isArray(key))
|
|
36
|
+
return this.attr(name, { items: key });
|
|
37
|
+
if (isStrictObject(key) &&
|
|
38
|
+
(key.title !== undefined || key.items !== undefined)) {
|
|
39
|
+
return this.attr(name, key);
|
|
40
|
+
}
|
|
41
|
+
if (key === null || key === false)
|
|
42
|
+
return this.attr(name, key);
|
|
43
|
+
const obj = this.attr(name) || {};
|
|
44
|
+
const { items = [] } = obj;
|
|
45
|
+
items.push(key);
|
|
46
|
+
obj.items = items;
|
|
47
|
+
return this.attr(name, obj);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function defineNodeProp(Node, name, { ctor }) {
|
|
51
|
+
Node.prototype[name] = function (hocMark) {
|
|
52
|
+
const node = this.append(ctor);
|
|
53
|
+
if (name === 'mark') {
|
|
54
|
+
node.type = hocMark;
|
|
55
|
+
}
|
|
56
|
+
return node;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function defineContainerProp(Node, name, { ctor }) {
|
|
60
|
+
Node.prototype[name] = function () {
|
|
61
|
+
this.type = null;
|
|
62
|
+
return this.append(ctor);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A decorator to define different type of attribute setter or
|
|
67
|
+
* getter for current node.
|
|
68
|
+
*/
|
|
69
|
+
export function defineProps(descriptors) {
|
|
70
|
+
return (Node) => {
|
|
71
|
+
for (const [name, descriptor] of Object.entries(descriptors)) {
|
|
72
|
+
const { type } = descriptor;
|
|
73
|
+
if (type === 'value')
|
|
74
|
+
defineValueProp(Node, name, descriptor);
|
|
75
|
+
else if (type === 'array')
|
|
76
|
+
defineArrayProp(Node, name, descriptor);
|
|
77
|
+
else if (type === 'object')
|
|
78
|
+
defineObjectProp(Node, name, descriptor);
|
|
79
|
+
else if (type === 'node')
|
|
80
|
+
defineNodeProp(Node, name, descriptor);
|
|
81
|
+
else if (type === 'container')
|
|
82
|
+
defineContainerProp(Node, name, descriptor);
|
|
83
|
+
else if (type === 'mix')
|
|
84
|
+
defineMixProp(Node, name, descriptor);
|
|
85
|
+
}
|
|
86
|
+
return Node;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function nodeProps(node) {
|
|
90
|
+
return Object.fromEntries(Object.entries(node).map(([name, ctor]) => [name, { type: 'node', ctor }]));
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"src/","sources":["api/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAWjD,SAAS,eAAe,CACtB,IAAe,EACf,IAAY,EACZ,EAAE,GAAG,GAAG,IAAI,EAA0B;IAEtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,KAAK;QACpC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,IAAe,EACf,IAAY,EACZ,EAAE,GAAG,GAAG,IAAI,EAA0B;IAEtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,KAAK;QACpC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,CAAC,GAAG,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+
import { Runtime, RuntimeOptions } from './runtime';
|
|
4
|
+
import { MarkOf, CompositionOf as Of } from './types';
|
|
5
|
+
import { MarkNode } from './mark';
|
|
6
|
+
import { CompositionNode } from './composition';
|
|
7
|
+
type CompositionOf<Library> = Of<Library, (composite?: any) => CompositionNode<CompositionOf<Library> & MarkOf<Library, (composite?: any) => MarkNode>> & MarkOf<Library, (composite?: any) => MarkNode> & CompositionOf<Library>>;
|
|
8
|
+
export declare function extend<Spec extends G2Spec = G2Spec, Library extends G2Library = G2Library>(Runtime: new (options: RuntimeOptions) => Runtime<Spec>, library: Library): new (options?: RuntimeOptions) => Runtime<Spec> & MarkOf<Library, (composite?: any) => MarkNode> & CompositionOf<Library>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend.js","sourceRoot":"src/","sources":["api/extend.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,MAAM,CAIpB,OAAuD,EACvD,OAAgB;IAIhB,MAAM,KAAM,SAAQ,OAAO;QACzB,YAAY,OAAoC;YAC9C,KAAK,iCAAM,OAAO,KAAE,GAAG,EAAE,OAAO,IAAG,CAAC;QACtC,CAAC;KACF;IACD,OAAO,KAAY,CAAC;AACtB,CAAC"}
|
package/esm/api/index.d.ts
CHANGED
package/esm/api/index.js
CHANGED
|
@@ -2,4 +2,6 @@ export { Chart } from './chart';
|
|
|
2
2
|
export { MarkNode } from './mark';
|
|
3
3
|
export { CompositionNode } from './composition';
|
|
4
4
|
export { register } from './library';
|
|
5
|
+
export { Runtime } from './runtime';
|
|
6
|
+
export { extend } from './extend';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/esm/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|