@antv/g2 5.0.11 → 5.0.13
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/CHANGELOG.md +192 -0
- package/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/animation/fadeIn.js +2 -3
- package/esm/animation/fadeIn.js.map +1 -1
- package/esm/animation/fadeOut.js +2 -3
- package/esm/animation/fadeOut.js.map +1 -1
- package/esm/animation/growInX.js +3 -3
- package/esm/animation/growInX.js.map +1 -1
- package/esm/animation/growInY.js +3 -3
- package/esm/animation/growInY.js.map +1 -1
- package/esm/animation/morphing.js +3 -3
- package/esm/animation/morphing.js.map +1 -1
- package/esm/animation/pathIn.js +2 -3
- package/esm/animation/pathIn.js.map +1 -1
- package/esm/animation/scaleInX.js +4 -4
- package/esm/animation/scaleInX.js.map +1 -1
- package/esm/animation/scaleInY.js +4 -4
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/animation/scaleOutX.js +4 -4
- package/esm/animation/scaleOutX.js.map +1 -1
- package/esm/animation/scaleOutY.js +4 -4
- package/esm/animation/scaleOutY.js.map +1 -1
- package/esm/animation/utils.d.ts +0 -2
- package/esm/animation/utils.js +0 -16
- package/esm/animation/utils.js.map +1 -1
- package/esm/animation/waveIn.js +5 -5
- package/esm/animation/waveIn.js.map +1 -1
- package/esm/animation/zoomIn.js +2 -3
- package/esm/animation/zoomIn.js.map +1 -1
- package/esm/animation/zoomOut.js +2 -3
- package/esm/animation/zoomOut.js.map +1 -1
- package/esm/api/mark/index.d.ts +12 -4
- package/esm/api/mark/index.js +6 -2
- package/esm/api/mark/index.js.map +1 -1
- package/esm/api/mark/mark.d.ts +30 -4
- package/esm/api/mark/mark.js +47 -4
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +7 -1
- package/esm/api/utils.js +7 -4
- package/esm/api/utils.js.map +1 -1
- package/esm/component/axis.js +32 -22
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisRadar.js +5 -4
- package/esm/component/axisRadar.js.map +1 -1
- package/esm/component/index.d.ts +2 -0
- package/esm/component/index.js +1 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/legendCategory.js +36 -43
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +21 -14
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/legendContinuousSize.js +1 -3
- package/esm/component/legendContinuousSize.js.map +1 -1
- package/esm/component/legends.d.ts +3 -0
- package/esm/component/legends.js +9 -0
- package/esm/component/legends.js.map +1 -0
- package/esm/component/scrollbar.js +8 -5
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/utils.d.ts +1 -1
- package/esm/component/utils.js +15 -9
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetRect.js +13 -17
- package/esm/composition/facetRect.js.map +1 -1
- package/esm/composition/mark.js +4 -10
- package/esm/composition/mark.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/utils/venn/circleintersection.d.ts +33 -0
- package/esm/data/utils/venn/circleintersection.js +192 -0
- package/esm/data/utils/venn/circleintersection.js.map +1 -0
- package/esm/data/utils/venn/diagram.d.ts +2 -0
- package/esm/data/utils/venn/diagram.js +44 -0
- package/esm/data/utils/venn/diagram.js.map +1 -0
- package/esm/data/utils/venn/index.d.ts +5 -0
- package/esm/data/utils/venn/index.js +6 -0
- package/esm/data/utils/venn/index.js.map +1 -0
- package/esm/data/utils/venn/layout.d.ts +27 -0
- package/esm/data/utils/venn/layout.js +607 -0
- package/esm/data/utils/venn/layout.js.map +1 -0
- package/esm/data/venn.d.ts +7 -0
- package/esm/data/venn.js +34 -0
- package/esm/data/venn.js.map +1 -0
- package/esm/interaction/brushAxisHighlight.d.ts +5 -3
- package/esm/interaction/brushAxisHighlight.js +126 -12
- package/esm/interaction/brushAxisHighlight.js.map +1 -1
- package/esm/interaction/brushHighlight.d.ts +3 -3
- package/esm/interaction/brushHighlight.js +12 -7
- package/esm/interaction/brushHighlight.js.map +1 -1
- package/esm/interaction/brushXHighlight.d.ts +1 -1
- package/esm/interaction/brushYHighlight.d.ts +1 -1
- package/esm/interaction/elementHighlight.d.ts +2 -2
- package/esm/interaction/elementHighlight.js +41 -7
- package/esm/interaction/elementHighlight.js.map +1 -1
- package/esm/interaction/elementHighlightByColor.d.ts +1 -1
- package/esm/interaction/elementHighlightByX.d.ts +1 -1
- package/esm/interaction/elementSelect.d.ts +2 -2
- package/esm/interaction/elementSelect.js +43 -14
- package/esm/interaction/elementSelect.js.map +1 -1
- package/esm/interaction/elementSelectByColor.d.ts +1 -1
- package/esm/interaction/elementSelectByX.d.ts +1 -1
- package/esm/interaction/index.d.ts +1 -0
- package/esm/interaction/index.js +1 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/legendFilter.js +44 -13
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/legendHighlight.d.ts +1 -1
- package/esm/interaction/legendHighlight.js +53 -15
- package/esm/interaction/legendHighlight.js.map +1 -1
- package/esm/interaction/scrollbarFilter.d.ts +2 -0
- package/esm/interaction/scrollbarFilter.js +25 -0
- package/esm/interaction/scrollbarFilter.js.map +1 -0
- package/esm/interaction/sliderFilter.d.ts +1 -1
- package/esm/interaction/sliderFilter.js +75 -19
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.js +25 -19
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/interaction/utils.d.ts +3 -1
- package/esm/interaction/utils.js +5 -2
- package/esm/interaction/utils.js.map +1 -1
- package/esm/label-transform/contrastReverse.js +1 -1
- package/esm/label-transform/contrastReverse.js.map +1 -1
- package/esm/label-transform/overflowHide.js +2 -2
- package/esm/label-transform/overflowHide.js.map +1 -1
- package/esm/label-transform/overlapHide.js +1 -1
- package/esm/label-transform/overlapHide.js.map +1 -1
- package/esm/mark/area.js +6 -2
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/boxplot.d.ts +1 -1
- package/esm/mark/boxplot.js +43 -47
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/mark/forceGraph.d.ts +1 -1
- package/esm/mark/forceGraph.js +74 -76
- package/esm/mark/forceGraph.js.map +1 -1
- package/esm/mark/gauge.d.ts +1 -1
- package/esm/mark/gauge.js +96 -99
- package/esm/mark/gauge.js.map +1 -1
- package/esm/mark/line.js.map +1 -1
- package/esm/mark/pack.js +49 -57
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/sankey.d.ts +1 -1
- package/esm/mark/sankey.js +86 -88
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/tree.d.ts +1 -1
- package/esm/mark/tree.js +62 -64
- package/esm/mark/tree.js.map +1 -1
- package/esm/mark/treemap.js +60 -65
- package/esm/mark/treemap.js.map +1 -1
- package/esm/mark/wordCloud.d.ts +1 -1
- package/esm/mark/wordCloud.js +33 -38
- package/esm/mark/wordCloud.js.map +1 -1
- package/esm/runtime/component.d.ts +8 -1
- package/esm/runtime/component.js +344 -86
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/layout.d.ts +4 -0
- package/esm/runtime/layout.js +141 -18
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/library.d.ts +4 -2
- package/esm/runtime/library.js +8 -2
- package/esm/runtime/library.js.map +1 -1
- package/esm/runtime/plot.js +97 -45
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.d.ts +2 -1
- package/esm/runtime/scale.js +81 -4
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +12 -9
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/component.d.ts +27 -20
- package/esm/runtime/types/mark.d.ts +6 -2
- package/esm/runtime/types/options.d.ts +3 -6
- package/esm/runtime/types/theme.d.ts +3 -2
- package/esm/shape/area/area.js +4 -3
- package/esm/shape/area/area.js.map +1 -1
- package/esm/shape/area/curve.js +18 -18
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/area/hv.js +3 -3
- package/esm/shape/area/hv.js.map +1 -1
- package/esm/shape/area/hvh.js +3 -3
- package/esm/shape/area/hvh.js.map +1 -1
- package/esm/shape/area/smooth.js +4 -3
- package/esm/shape/area/smooth.js.map +1 -1
- package/esm/shape/area/vh.js +3 -3
- package/esm/shape/area/vh.js.map +1 -1
- package/esm/shape/box/box.js +9 -10
- package/esm/shape/box/box.js.map +1 -1
- package/esm/shape/box/violin.js +9 -10
- package/esm/shape/box/violin.js.map +1 -1
- package/esm/shape/connector/connector.js +6 -6
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/density/density.js +9 -10
- package/esm/shape/density/density.js.map +1 -1
- package/esm/shape/heatmap/heatmap.js +7 -10
- package/esm/shape/heatmap/heatmap.js.map +1 -1
- package/esm/shape/image/image.js +9 -11
- package/esm/shape/image/image.js.map +1 -1
- package/esm/shape/index.d.ts +2 -0
- package/esm/shape/index.js +1 -0
- package/esm/shape/index.js.map +1 -1
- package/esm/shape/interval/color.d.ts +9 -1
- package/esm/shape/interval/color.js +30 -20
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/interval/funnel.js +8 -8
- package/esm/shape/interval/funnel.js.map +1 -1
- package/esm/shape/interval/hollow.js +2 -2
- package/esm/shape/interval/hollow.js.map +1 -1
- package/esm/shape/interval/pyramid.js +2 -2
- package/esm/shape/interval/pyramid.js.map +1 -1
- package/esm/shape/interval/rect.d.ts +10 -1
- package/esm/shape/interval/rect.js +2 -2
- package/esm/shape/interval/rect.js.map +1 -1
- package/esm/shape/label/label.js +3 -2
- package/esm/shape/label/label.js.map +1 -1
- package/esm/shape/line/curve.js +11 -11
- package/esm/shape/line/curve.js.map +1 -1
- package/esm/shape/line/hv.js +2 -2
- package/esm/shape/line/hv.js.map +1 -1
- package/esm/shape/line/hvh.js +2 -2
- package/esm/shape/line/hvh.js.map +1 -1
- package/esm/shape/line/line.js +4 -3
- package/esm/shape/line/line.js.map +1 -1
- package/esm/shape/line/smooth.js +4 -3
- package/esm/shape/line/smooth.js.map +1 -1
- package/esm/shape/line/trail.d.ts +3 -0
- package/esm/shape/line/trail.js +74 -0
- package/esm/shape/line/trail.js.map +1 -0
- package/esm/shape/line/vh.js +2 -2
- package/esm/shape/line/vh.js.map +1 -1
- package/esm/shape/lineXY/line.js +9 -10
- package/esm/shape/lineXY/line.js.map +1 -1
- package/esm/shape/link/arc.js +7 -8
- package/esm/shape/link/arc.js.map +1 -1
- package/esm/shape/link/link.js +3 -3
- package/esm/shape/link/link.js.map +1 -1
- package/esm/shape/link/smooth.js +7 -8
- package/esm/shape/link/smooth.js.map +1 -1
- package/esm/shape/link/vhv.js +7 -8
- package/esm/shape/link/vhv.js.map +1 -1
- package/esm/shape/path/color.js +12 -11
- package/esm/shape/path/color.js.map +1 -1
- package/esm/shape/path/hollow.js +2 -2
- package/esm/shape/path/hollow.js.map +1 -1
- package/esm/shape/path/path.js +2 -2
- package/esm/shape/path/path.js.map +1 -1
- package/esm/shape/point/bowtie.js +2 -2
- package/esm/shape/point/bowtie.js.map +1 -1
- package/esm/shape/point/color.js +6 -7
- package/esm/shape/point/color.js.map +1 -1
- package/esm/shape/point/cross.js +2 -2
- package/esm/shape/point/cross.js.map +1 -1
- package/esm/shape/point/diamond.js +2 -2
- package/esm/shape/point/diamond.js.map +1 -1
- package/esm/shape/point/hexagon.js +2 -2
- package/esm/shape/point/hexagon.js.map +1 -1
- package/esm/shape/point/hollow.js +2 -2
- package/esm/shape/point/hollow.js.map +1 -1
- package/esm/shape/point/hollowBowtie.js +2 -2
- package/esm/shape/point/hollowBowtie.js.map +1 -1
- package/esm/shape/point/hollowDiamond.js +2 -2
- package/esm/shape/point/hollowDiamond.js.map +1 -1
- package/esm/shape/point/hollowHexagon.js +2 -2
- package/esm/shape/point/hollowHexagon.js.map +1 -1
- package/esm/shape/point/hollowSquare.js +2 -2
- package/esm/shape/point/hollowSquare.js.map +1 -1
- package/esm/shape/point/hollowTriangle.js +2 -2
- package/esm/shape/point/hollowTriangle.js.map +1 -1
- package/esm/shape/point/hollowTriangleDown.js +2 -2
- package/esm/shape/point/hollowTriangleDown.js.map +1 -1
- package/esm/shape/point/hyphen.js +2 -2
- package/esm/shape/point/hyphen.js.map +1 -1
- package/esm/shape/point/line.js +2 -2
- package/esm/shape/point/line.js.map +1 -1
- package/esm/shape/point/plus.js +2 -2
- package/esm/shape/point/plus.js.map +1 -1
- package/esm/shape/point/point.js +2 -2
- package/esm/shape/point/point.js.map +1 -1
- package/esm/shape/point/square.js +2 -2
- package/esm/shape/point/square.js.map +1 -1
- package/esm/shape/point/tick.js +2 -2
- package/esm/shape/point/tick.js.map +1 -1
- package/esm/shape/point/triangle.js +2 -2
- package/esm/shape/point/triangle.js.map +1 -1
- package/esm/shape/point/triangleDown.js +2 -2
- package/esm/shape/point/triangleDown.js.map +1 -1
- package/esm/shape/polygon/polygon.js +11 -12
- package/esm/shape/polygon/polygon.js.map +1 -1
- package/esm/shape/polygon/ribbon.js +8 -8
- package/esm/shape/polygon/ribbon.js.map +1 -1
- package/esm/shape/shape/shape.js +1 -1
- package/esm/shape/shape/shape.js.map +1 -1
- package/esm/shape/text/advance.js +5 -1
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/text/badge.js +8 -9
- package/esm/shape/text/badge.js.map +1 -1
- package/esm/shape/text/text.d.ts +1 -1
- package/esm/shape/text/text.js +7 -20
- package/esm/shape/text/text.js.map +1 -1
- package/esm/shape/utils.d.ts +1 -6
- package/esm/shape/utils.js +0 -10
- package/esm/shape/utils.js.map +1 -1
- package/esm/shape/vector/vector.js +9 -10
- package/esm/shape/vector/vector.js.map +1 -1
- package/esm/spec/dataTransform.d.ts +24 -2
- package/esm/spec/mark.d.ts +4 -4
- package/esm/stdlib/index.js +6 -6
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.js +21 -4
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/classic.js +33 -10
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/classicDark.js +34 -8
- package/esm/theme/classicDark.js.map +1 -1
- package/esm/utils/coordinate.d.ts +1 -1
- package/esm/utils/number.d.ts +4 -0
- package/esm/utils/number.js +7 -0
- package/esm/utils/number.js.map +1 -0
- package/esm/utils/scale.d.ts +2 -1
- package/esm/utils/scale.js +30 -11
- package/esm/utils/scale.js.map +1 -1
- package/esm/utils/vector.d.ts +1 -0
- package/esm/utils/vector.js +3 -0
- package/esm/utils/vector.js.map +1 -1
- package/lib/animation/fadeIn.js +2 -3
- package/lib/animation/fadeIn.js.map +1 -1
- package/lib/animation/fadeOut.js +2 -3
- package/lib/animation/fadeOut.js.map +1 -1
- package/lib/animation/growInX.js +3 -3
- package/lib/animation/growInX.js.map +1 -1
- package/lib/animation/growInY.js +3 -3
- package/lib/animation/growInY.js.map +1 -1
- package/lib/animation/morphing.js +2 -2
- package/lib/animation/morphing.js.map +1 -1
- package/lib/animation/pathIn.js +2 -3
- package/lib/animation/pathIn.js.map +1 -1
- package/lib/animation/scaleInX.js +4 -4
- package/lib/animation/scaleInX.js.map +1 -1
- package/lib/animation/scaleInY.js +4 -4
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/animation/scaleOutX.js +4 -4
- package/lib/animation/scaleOutX.js.map +1 -1
- package/lib/animation/scaleOutY.js +4 -4
- package/lib/animation/scaleOutY.js.map +1 -1
- package/lib/animation/utils.d.ts +0 -2
- package/lib/animation/utils.js +1 -18
- package/lib/animation/utils.js.map +1 -1
- package/lib/animation/waveIn.js +5 -5
- package/lib/animation/waveIn.js.map +1 -1
- package/lib/animation/zoomIn.js +2 -3
- package/lib/animation/zoomIn.js.map +1 -1
- package/lib/animation/zoomOut.js +2 -3
- package/lib/animation/zoomOut.js.map +1 -1
- package/lib/api/mark/index.d.ts +12 -4
- package/lib/api/mark/index.js +5 -1
- package/lib/api/mark/index.js.map +1 -1
- package/lib/api/mark/mark.d.ts +30 -4
- package/lib/api/mark/mark.js +48 -5
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +7 -1
- package/lib/api/utils.js +7 -4
- package/lib/api/utils.js.map +1 -1
- package/lib/component/axis.js +31 -21
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisRadar.js +5 -4
- package/lib/component/axisRadar.js.map +1 -1
- package/lib/component/index.d.ts +2 -0
- package/lib/component/index.js +3 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/legendCategory.js +36 -43
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +21 -14
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/legendContinuousSize.js +1 -3
- package/lib/component/legendContinuousSize.js.map +1 -1
- package/lib/component/legends.d.ts +3 -0
- package/lib/component/legends.js +13 -0
- package/lib/component/legends.js.map +1 -0
- package/lib/component/scrollbar.js +8 -5
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/utils.d.ts +1 -1
- package/lib/component/utils.js +15 -9
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetRect.js +12 -16
- package/lib/composition/facetRect.js.map +1 -1
- package/lib/composition/mark.js +4 -10
- package/lib/composition/mark.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/utils/venn/circleintersection.d.ts +33 -0
- package/lib/data/utils/venn/circleintersection.js +202 -0
- package/lib/data/utils/venn/circleintersection.js.map +1 -0
- package/lib/data/utils/venn/diagram.d.ts +2 -0
- package/lib/data/utils/venn/diagram.js +48 -0
- package/lib/data/utils/venn/diagram.js.map +1 -0
- package/lib/data/utils/venn/index.d.ts +5 -0
- package/lib/data/utils/venn/index.js +12 -0
- package/lib/data/utils/venn/index.js.map +1 -0
- package/lib/data/utils/venn/layout.d.ts +27 -0
- package/lib/data/utils/venn/layout.js +620 -0
- package/lib/data/utils/venn/layout.js.map +1 -0
- package/lib/data/venn.d.ts +7 -0
- package/lib/data/venn.js +38 -0
- package/lib/data/venn.js.map +1 -0
- package/lib/interaction/brushAxisHighlight.d.ts +5 -3
- package/lib/interaction/brushAxisHighlight.js +126 -12
- package/lib/interaction/brushAxisHighlight.js.map +1 -1
- package/lib/interaction/brushHighlight.d.ts +3 -3
- package/lib/interaction/brushHighlight.js +12 -7
- package/lib/interaction/brushHighlight.js.map +1 -1
- package/lib/interaction/brushXHighlight.d.ts +1 -1
- package/lib/interaction/brushYHighlight.d.ts +1 -1
- package/lib/interaction/elementHighlight.d.ts +2 -2
- package/lib/interaction/elementHighlight.js +40 -6
- package/lib/interaction/elementHighlight.js.map +1 -1
- package/lib/interaction/elementHighlightByColor.d.ts +1 -1
- package/lib/interaction/elementHighlightByX.d.ts +1 -1
- package/lib/interaction/elementSelect.d.ts +2 -2
- package/lib/interaction/elementSelect.js +42 -13
- package/lib/interaction/elementSelect.js.map +1 -1
- package/lib/interaction/elementSelectByColor.d.ts +1 -1
- package/lib/interaction/elementSelectByX.d.ts +1 -1
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/index.js +3 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/legendFilter.js +44 -13
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/legendHighlight.d.ts +1 -1
- package/lib/interaction/legendHighlight.js +53 -15
- package/lib/interaction/legendHighlight.js.map +1 -1
- package/lib/interaction/scrollbarFilter.d.ts +2 -0
- package/lib/interaction/scrollbarFilter.js +29 -0
- package/lib/interaction/scrollbarFilter.js.map +1 -0
- package/lib/interaction/sliderFilter.d.ts +1 -1
- package/lib/interaction/sliderFilter.js +73 -17
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.js +24 -18
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/interaction/utils.d.ts +3 -1
- package/lib/interaction/utils.js +7 -3
- package/lib/interaction/utils.js.map +1 -1
- package/lib/label-transform/contrastReverse.js +1 -1
- package/lib/label-transform/contrastReverse.js.map +1 -1
- package/lib/label-transform/overflowHide.js +2 -2
- package/lib/label-transform/overflowHide.js.map +1 -1
- package/lib/label-transform/overlapHide.js +1 -1
- package/lib/label-transform/overlapHide.js.map +1 -1
- package/lib/mark/area.js +6 -2
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/boxplot.d.ts +1 -1
- package/lib/mark/boxplot.js +43 -47
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/mark/forceGraph.d.ts +1 -1
- package/lib/mark/forceGraph.js +74 -76
- package/lib/mark/forceGraph.js.map +1 -1
- package/lib/mark/gauge.d.ts +1 -1
- package/lib/mark/gauge.js +96 -99
- package/lib/mark/gauge.js.map +1 -1
- package/lib/mark/line.js.map +1 -1
- package/lib/mark/pack.js +49 -57
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/sankey.d.ts +1 -1
- package/lib/mark/sankey.js +86 -88
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/tree.d.ts +1 -1
- package/lib/mark/tree.js +62 -64
- package/lib/mark/tree.js.map +1 -1
- package/lib/mark/treemap.js +60 -65
- package/lib/mark/treemap.js.map +1 -1
- package/lib/mark/wordCloud.d.ts +1 -1
- package/lib/mark/wordCloud.js +32 -37
- package/lib/mark/wordCloud.js.map +1 -1
- package/lib/runtime/component.d.ts +8 -1
- package/lib/runtime/component.js +349 -85
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/layout.d.ts +4 -0
- package/lib/runtime/layout.js +141 -17
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/library.d.ts +4 -2
- package/lib/runtime/library.js +10 -3
- package/lib/runtime/library.js.map +1 -1
- package/lib/runtime/plot.js +92 -40
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.d.ts +2 -1
- package/lib/runtime/scale.js +81 -3
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +12 -9
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/component.d.ts +27 -20
- package/lib/runtime/types/mark.d.ts +6 -2
- package/lib/runtime/types/options.d.ts +3 -6
- package/lib/runtime/types/theme.d.ts +3 -2
- package/lib/shape/area/area.js +4 -3
- package/lib/shape/area/area.js.map +1 -1
- package/lib/shape/area/curve.js +17 -17
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/area/hv.js +3 -3
- package/lib/shape/area/hv.js.map +1 -1
- package/lib/shape/area/hvh.js +3 -3
- package/lib/shape/area/hvh.js.map +1 -1
- package/lib/shape/area/smooth.js +4 -3
- package/lib/shape/area/smooth.js.map +1 -1
- package/lib/shape/area/vh.js +3 -3
- package/lib/shape/area/vh.js.map +1 -1
- package/lib/shape/box/box.js +8 -9
- package/lib/shape/box/box.js.map +1 -1
- package/lib/shape/box/violin.js +8 -9
- package/lib/shape/box/violin.js.map +1 -1
- package/lib/shape/connector/connector.js +5 -5
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/density/density.js +8 -9
- package/lib/shape/density/density.js.map +1 -1
- package/lib/shape/heatmap/heatmap.js +6 -9
- package/lib/shape/heatmap/heatmap.js.map +1 -1
- package/lib/shape/image/image.js +8 -10
- package/lib/shape/image/image.js.map +1 -1
- package/lib/shape/index.d.ts +2 -0
- package/lib/shape/index.js +4 -2
- package/lib/shape/index.js.map +1 -1
- package/lib/shape/interval/color.d.ts +9 -1
- package/lib/shape/interval/color.js +29 -19
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/interval/funnel.js +7 -7
- package/lib/shape/interval/funnel.js.map +1 -1
- package/lib/shape/interval/hollow.js +2 -2
- package/lib/shape/interval/hollow.js.map +1 -1
- package/lib/shape/interval/pyramid.js +2 -2
- package/lib/shape/interval/pyramid.js.map +1 -1
- package/lib/shape/interval/rect.d.ts +10 -1
- package/lib/shape/interval/rect.js +2 -2
- package/lib/shape/interval/rect.js.map +1 -1
- package/lib/shape/label/label.js +3 -2
- package/lib/shape/label/label.js.map +1 -1
- package/lib/shape/line/curve.js +10 -10
- package/lib/shape/line/curve.js.map +1 -1
- package/lib/shape/line/hv.js +2 -2
- package/lib/shape/line/hv.js.map +1 -1
- package/lib/shape/line/hvh.js +2 -2
- package/lib/shape/line/hvh.js.map +1 -1
- package/lib/shape/line/line.js +4 -3
- package/lib/shape/line/line.js.map +1 -1
- package/lib/shape/line/smooth.js +4 -3
- package/lib/shape/line/smooth.js.map +1 -1
- package/lib/shape/line/trail.d.ts +3 -0
- package/lib/shape/line/trail.js +78 -0
- package/lib/shape/line/trail.js.map +1 -0
- package/lib/shape/line/vh.js +2 -2
- package/lib/shape/line/vh.js.map +1 -1
- package/lib/shape/lineXY/line.js +8 -9
- package/lib/shape/lineXY/line.js.map +1 -1
- package/lib/shape/link/arc.js +6 -7
- package/lib/shape/link/arc.js.map +1 -1
- package/lib/shape/link/link.js +3 -3
- package/lib/shape/link/link.js.map +1 -1
- package/lib/shape/link/smooth.js +6 -7
- package/lib/shape/link/smooth.js.map +1 -1
- package/lib/shape/link/vhv.js +6 -7
- package/lib/shape/link/vhv.js.map +1 -1
- package/lib/shape/path/color.js +11 -10
- package/lib/shape/path/color.js.map +1 -1
- package/lib/shape/path/hollow.js +2 -2
- package/lib/shape/path/hollow.js.map +1 -1
- package/lib/shape/path/path.js +2 -2
- package/lib/shape/path/path.js.map +1 -1
- package/lib/shape/point/bowtie.js +2 -2
- package/lib/shape/point/bowtie.js.map +1 -1
- package/lib/shape/point/color.js +5 -6
- package/lib/shape/point/color.js.map +1 -1
- package/lib/shape/point/cross.js +2 -2
- package/lib/shape/point/cross.js.map +1 -1
- package/lib/shape/point/diamond.js +2 -2
- package/lib/shape/point/diamond.js.map +1 -1
- package/lib/shape/point/hexagon.js +2 -2
- package/lib/shape/point/hexagon.js.map +1 -1
- package/lib/shape/point/hollow.js +2 -2
- package/lib/shape/point/hollow.js.map +1 -1
- package/lib/shape/point/hollowBowtie.js +2 -2
- package/lib/shape/point/hollowBowtie.js.map +1 -1
- package/lib/shape/point/hollowDiamond.js +2 -2
- package/lib/shape/point/hollowDiamond.js.map +1 -1
- package/lib/shape/point/hollowHexagon.js +2 -2
- package/lib/shape/point/hollowHexagon.js.map +1 -1
- package/lib/shape/point/hollowSquare.js +2 -2
- package/lib/shape/point/hollowSquare.js.map +1 -1
- package/lib/shape/point/hollowTriangle.js +2 -2
- package/lib/shape/point/hollowTriangle.js.map +1 -1
- package/lib/shape/point/hollowTriangleDown.js +2 -2
- package/lib/shape/point/hollowTriangleDown.js.map +1 -1
- package/lib/shape/point/hyphen.js +2 -2
- package/lib/shape/point/hyphen.js.map +1 -1
- package/lib/shape/point/line.js +2 -2
- package/lib/shape/point/line.js.map +1 -1
- package/lib/shape/point/plus.js +2 -2
- package/lib/shape/point/plus.js.map +1 -1
- package/lib/shape/point/point.js +2 -2
- package/lib/shape/point/point.js.map +1 -1
- package/lib/shape/point/square.js +2 -2
- package/lib/shape/point/square.js.map +1 -1
- package/lib/shape/point/tick.js +2 -2
- package/lib/shape/point/tick.js.map +1 -1
- package/lib/shape/point/triangle.js +2 -2
- package/lib/shape/point/triangle.js.map +1 -1
- package/lib/shape/point/triangleDown.js +2 -2
- package/lib/shape/point/triangleDown.js.map +1 -1
- package/lib/shape/polygon/polygon.js +10 -11
- package/lib/shape/polygon/polygon.js.map +1 -1
- package/lib/shape/polygon/ribbon.js +7 -7
- package/lib/shape/polygon/ribbon.js.map +1 -1
- package/lib/shape/shape/shape.js +1 -1
- package/lib/shape/shape/shape.js.map +1 -1
- package/lib/shape/text/advance.js +5 -1
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/text/badge.js +7 -8
- package/lib/shape/text/badge.js.map +1 -1
- package/lib/shape/text/text.d.ts +1 -1
- package/lib/shape/text/text.js +6 -19
- package/lib/shape/text/text.js.map +1 -1
- package/lib/shape/utils.d.ts +1 -6
- package/lib/shape/utils.js +1 -12
- package/lib/shape/utils.js.map +1 -1
- package/lib/shape/vector/vector.js +8 -9
- package/lib/shape/vector/vector.js.map +1 -1
- package/lib/spec/dataTransform.d.ts +24 -2
- package/lib/spec/mark.d.ts +4 -4
- package/lib/stdlib/index.js +2 -2
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.js +21 -4
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/classic.js +33 -10
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/classicDark.js +34 -8
- package/lib/theme/classicDark.js.map +1 -1
- package/lib/utils/coordinate.d.ts +1 -1
- package/lib/utils/number.d.ts +4 -0
- package/lib/utils/number.js +11 -0
- package/lib/utils/number.js.map +1 -0
- package/lib/utils/scale.d.ts +2 -1
- package/lib/utils/scale.js +32 -12
- package/lib/utils/scale.js.map +1 -1
- package/lib/utils/vector.d.ts +1 -0
- package/lib/utils/vector.js +5 -1
- package/lib/utils/vector.js.map +1 -1
- package/package.json +4 -1
- package/src/animation/fadeIn.ts +2 -5
- package/src/animation/fadeOut.ts +2 -3
- package/src/animation/growInX.ts +3 -9
- package/src/animation/growInY.ts +3 -9
- package/src/animation/morphing.ts +3 -3
- package/src/animation/pathIn.ts +2 -3
- package/src/animation/scaleInX.ts +5 -7
- package/src/animation/scaleInY.ts +5 -7
- package/src/animation/scaleOutX.ts +5 -7
- package/src/animation/scaleOutY.ts +5 -7
- package/src/animation/utils.ts +0 -26
- package/src/animation/waveIn.ts +6 -8
- package/src/animation/zoomIn.ts +2 -6
- package/src/animation/zoomOut.ts +2 -6
- package/src/api/mark/index.ts +16 -4
- package/src/api/mark/mark.ts +60 -4
- package/src/api/mark/types.ts +8 -1
- package/src/api/utils.ts +7 -4
- package/src/component/axis.ts +40 -27
- package/src/component/axisRadar.ts +6 -7
- package/src/component/index.ts +2 -0
- package/src/component/legendCategory.ts +43 -64
- package/src/component/legendContinuous.ts +33 -19
- package/src/component/legendContinuousSize.ts +1 -4
- package/src/component/legends.ts +14 -0
- package/src/component/scrollbar.ts +11 -8
- package/src/component/utils.ts +19 -11
- package/src/composition/facetRect.ts +14 -17
- package/src/composition/mark.ts +7 -4
- package/src/data/index.ts +2 -0
- package/src/data/utils/venn/circleintersection.ts +235 -0
- package/src/data/utils/venn/diagram.ts +47 -0
- package/src/data/utils/venn/index.ts +5 -0
- package/src/data/utils/venn/layout.ts +769 -0
- package/src/data/venn.ts +58 -0
- package/src/interaction/brushAxisHighlight.ts +130 -11
- package/src/interaction/brushHighlight.ts +11 -6
- package/src/interaction/elementHighlight.ts +40 -3
- package/src/interaction/elementSelect.ts +49 -10
- package/src/interaction/index.ts +1 -0
- package/src/interaction/legendFilter.ts +47 -13
- package/src/interaction/legendHighlight.ts +55 -14
- package/src/interaction/scrollbarFilter.ts +32 -0
- package/src/interaction/sliderFilter.ts +108 -28
- package/src/interaction/tooltip.ts +43 -22
- package/src/interaction/utils.ts +8 -1
- package/src/label-transform/contrastReverse.ts +1 -1
- package/src/label-transform/overflowHide.ts +2 -2
- package/src/label-transform/overlapHide.ts +1 -1
- package/src/mark/area.ts +5 -2
- package/src/mark/boxplot.ts +84 -87
- package/src/mark/forceGraph.ts +98 -97
- package/src/mark/gauge.ts +147 -147
- package/src/mark/line.ts +2 -2
- package/src/mark/pack.ts +80 -81
- package/src/mark/sankey.ts +123 -125
- package/src/mark/tree.ts +89 -87
- package/src/mark/treemap.ts +90 -89
- package/src/mark/wordCloud.ts +53 -56
- package/src/runtime/component.ts +464 -109
- package/src/runtime/layout.ts +207 -19
- package/src/runtime/library.ts +11 -4
- package/src/runtime/plot.ts +151 -62
- package/src/runtime/scale.ts +103 -5
- package/src/runtime/transform.ts +18 -9
- package/src/runtime/types/component.ts +29 -37
- package/src/runtime/types/mark.ts +13 -2
- package/src/runtime/types/options.ts +1 -10
- package/src/runtime/types/theme.ts +3 -2
- package/src/shape/area/area.ts +4 -3
- package/src/shape/area/curve.ts +20 -29
- package/src/shape/area/hv.ts +3 -8
- package/src/shape/area/hvh.ts +3 -3
- package/src/shape/area/smooth.ts +4 -8
- package/src/shape/area/vh.ts +3 -8
- package/src/shape/box/box.ts +11 -12
- package/src/shape/box/violin.ts +11 -14
- package/src/shape/connector/connector.ts +6 -12
- package/src/shape/density/density.ts +9 -15
- package/src/shape/heatmap/heatmap.ts +7 -11
- package/src/shape/image/image.ts +9 -16
- package/src/shape/index.ts +4 -0
- package/src/shape/interval/color.ts +43 -24
- package/src/shape/interval/funnel.ts +8 -14
- package/src/shape/interval/hollow.ts +2 -2
- package/src/shape/interval/pyramid.ts +2 -2
- package/src/shape/interval/rect.ts +12 -3
- package/src/shape/label/label.ts +3 -2
- package/src/shape/line/curve.ts +11 -20
- package/src/shape/line/hv.ts +2 -2
- package/src/shape/line/hvh.ts +2 -2
- package/src/shape/line/line.ts +4 -3
- package/src/shape/line/smooth.ts +4 -8
- package/src/shape/line/trail.ts +72 -0
- package/src/shape/line/vh.ts +2 -2
- package/src/shape/lineXY/line.ts +14 -15
- package/src/shape/link/arc.ts +9 -14
- package/src/shape/link/link.ts +3 -3
- package/src/shape/link/smooth.ts +7 -13
- package/src/shape/link/vhv.ts +8 -16
- package/src/shape/path/color.ts +15 -17
- package/src/shape/path/hollow.ts +2 -2
- package/src/shape/path/path.ts +2 -2
- package/src/shape/point/bowtie.ts +5 -2
- package/src/shape/point/color.ts +6 -12
- package/src/shape/point/cross.ts +5 -2
- package/src/shape/point/diamond.ts +5 -2
- package/src/shape/point/hexagon.ts +5 -2
- package/src/shape/point/hollow.ts +5 -2
- package/src/shape/point/hollowBowtie.ts +5 -2
- package/src/shape/point/hollowDiamond.ts +9 -6
- package/src/shape/point/hollowHexagon.ts +9 -6
- package/src/shape/point/hollowSquare.ts +5 -2
- package/src/shape/point/hollowTriangle.ts +9 -6
- package/src/shape/point/hollowTriangleDown.ts +12 -6
- package/src/shape/point/hyphen.ts +5 -2
- package/src/shape/point/line.ts +5 -2
- package/src/shape/point/plus.ts +5 -2
- package/src/shape/point/point.ts +5 -2
- package/src/shape/point/square.ts +5 -2
- package/src/shape/point/tick.ts +5 -2
- package/src/shape/point/triangle.ts +5 -2
- package/src/shape/point/triangleDown.ts +9 -6
- package/src/shape/polygon/polygon.ts +11 -19
- package/src/shape/polygon/ribbon.ts +8 -15
- package/src/shape/shape/shape.ts +1 -1
- package/src/shape/text/advance.ts +5 -1
- package/src/shape/text/badge.ts +8 -16
- package/src/shape/text/text.ts +7 -12
- package/src/shape/utils.ts +0 -17
- package/src/shape/vector/vector.ts +9 -15
- package/src/spec/dataTransform.ts +25 -0
- package/src/spec/mark.ts +9 -4
- package/src/stdlib/index.ts +8 -0
- package/src/theme/academy.ts +21 -4
- package/src/theme/classic.ts +33 -10
- package/src/theme/classicDark.ts +34 -8
- package/src/utils/number.ts +6 -0
- package/src/utils/scale.ts +29 -10
- package/src/utils/vector.ts +4 -0
package/lib/mark/pack.js
CHANGED
|
@@ -15,9 +15,45 @@ exports.Pack = void 0;
|
|
|
15
15
|
const util_1 = require("@antv/util");
|
|
16
16
|
const d3_hierarchy_1 = require("d3-hierarchy");
|
|
17
17
|
const helper_1 = require("../utils/helper");
|
|
18
|
-
const size_1 = require("../utils/size");
|
|
19
18
|
const mark_1 = require("../utils/mark");
|
|
20
19
|
const utils_1 = require("./utils");
|
|
20
|
+
const GET_DEFAULT_LAYOUT_OPTIONS = (width, height) => ({
|
|
21
|
+
size: [width, height],
|
|
22
|
+
padding: 0,
|
|
23
|
+
sort: (a, b) => b.value - a.value,
|
|
24
|
+
});
|
|
25
|
+
const GET_DEFAULT_OPTIONS = (width, height, encode) => ({
|
|
26
|
+
type: 'point',
|
|
27
|
+
axis: false,
|
|
28
|
+
legend: false,
|
|
29
|
+
scale: {
|
|
30
|
+
x: { domain: [0, width] },
|
|
31
|
+
y: { domain: [0, height] },
|
|
32
|
+
size: { type: 'identity' },
|
|
33
|
+
},
|
|
34
|
+
encode: {
|
|
35
|
+
x: 'x',
|
|
36
|
+
y: 'y',
|
|
37
|
+
size: 'r',
|
|
38
|
+
shape: 'point',
|
|
39
|
+
},
|
|
40
|
+
style: {
|
|
41
|
+
fill: !encode.color ? (d) => (d.height === 0 ? '#ddd' : '#fff') : undefined,
|
|
42
|
+
stroke: !encode.color ? (d) => (d.height === 0 ? '' : '#000') : undefined,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const DEFAULT_LABEL_OPTIONS = {
|
|
46
|
+
text: '',
|
|
47
|
+
position: 'inside',
|
|
48
|
+
textOverflow: 'clip',
|
|
49
|
+
wordWrap: true,
|
|
50
|
+
maxLines: 1,
|
|
51
|
+
wordWrapWidth: (d) => d.r * 2,
|
|
52
|
+
};
|
|
53
|
+
const DEFAULT_TOOLTIP_OPTIONS = {
|
|
54
|
+
title: (d) => d.data.name,
|
|
55
|
+
items: [{ field: 'value' }],
|
|
56
|
+
};
|
|
21
57
|
const dataTransform = (data, layout, encode) => {
|
|
22
58
|
const { value } = encode;
|
|
23
59
|
const root = (0, util_1.isArray)(data)
|
|
@@ -28,62 +64,18 @@ const dataTransform = (data, layout, encode) => {
|
|
|
28
64
|
(0, d3_hierarchy_1.pack)().size(layout.size).padding(layout.padding)(root);
|
|
29
65
|
return root.descendants();
|
|
30
66
|
};
|
|
31
|
-
const Pack = (markOptions) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
legend: false,
|
|
44
|
-
scale: {
|
|
45
|
-
x: { domain: [0, width] },
|
|
46
|
-
y: { domain: [0, height] },
|
|
47
|
-
size: { type: 'identity' },
|
|
48
|
-
},
|
|
49
|
-
encode: {
|
|
50
|
-
x: 'x',
|
|
51
|
-
y: 'y',
|
|
52
|
-
size: 'r',
|
|
53
|
-
shape: 'point',
|
|
54
|
-
},
|
|
55
|
-
style: {
|
|
56
|
-
fill: !encode.color
|
|
57
|
-
? (d) => (d.height === 0 ? '#ddd' : '#fff')
|
|
58
|
-
: undefined,
|
|
59
|
-
stroke: !encode.color
|
|
60
|
-
? (d) => (d.height === 0 ? '' : '#000')
|
|
61
|
-
: undefined,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const DEFAULT_LABEL_OPTIONS = {
|
|
65
|
-
text: '',
|
|
66
|
-
position: 'inside',
|
|
67
|
-
textOverflow: 'clip',
|
|
68
|
-
wordWrap: true,
|
|
69
|
-
maxLines: 1,
|
|
70
|
-
wordWrapWidth: (d) => d.r * 2,
|
|
71
|
-
};
|
|
72
|
-
const DEFAULT_TOOLTIP_OPTIONS = {
|
|
73
|
-
title: (d) => d.data.name,
|
|
74
|
-
items: [{ field: 'value' }],
|
|
75
|
-
};
|
|
76
|
-
const transformedData = dataTransform(data, (0, util_1.deepMix)({}, DEFAULT_LAYOUT_OPTIONS, layout), (0, util_1.deepMix)({}, DEFAULT_OPTIONS['encode'], encode));
|
|
77
|
-
const labelStyle = (0, helper_1.subObject)(style, 'label');
|
|
78
|
-
return [
|
|
79
|
-
(0, util_1.deepMix)({}, DEFAULT_OPTIONS, Object.assign(Object.assign({ data: transformedData, encode,
|
|
80
|
-
scale,
|
|
81
|
-
style, labels: [
|
|
82
|
-
Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), labelStyle),
|
|
83
|
-
...labels,
|
|
84
|
-
] }, resOptions), { tooltip: (0, mark_1.maybeTooltip)(tooltip, DEFAULT_TOOLTIP_OPTIONS), axis: false })),
|
|
85
|
-
];
|
|
86
|
-
};
|
|
67
|
+
const Pack = (markOptions, context) => {
|
|
68
|
+
const { width, height } = context;
|
|
69
|
+
const { data, encode = {}, scale = {}, style = {}, layout = {}, labels = [], tooltip = {} } = markOptions, resOptions = __rest(markOptions, ["data", "encode", "scale", "style", "layout", "labels", "tooltip"]);
|
|
70
|
+
const DEFAULT_OPTIONS = GET_DEFAULT_OPTIONS(width, height, encode);
|
|
71
|
+
const transformedData = dataTransform(data, (0, util_1.deepMix)({}, GET_DEFAULT_LAYOUT_OPTIONS(width, height), layout), (0, util_1.deepMix)({}, DEFAULT_OPTIONS['encode'], encode));
|
|
72
|
+
const labelStyle = (0, helper_1.subObject)(style, 'label');
|
|
73
|
+
return (0, util_1.deepMix)({}, DEFAULT_OPTIONS, Object.assign(Object.assign({ data: transformedData, encode,
|
|
74
|
+
scale,
|
|
75
|
+
style, labels: [
|
|
76
|
+
Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), labelStyle),
|
|
77
|
+
...labels,
|
|
78
|
+
] }, resOptions), { tooltip: (0, mark_1.maybeTooltip)(tooltip, DEFAULT_TOOLTIP_OPTIONS), axis: false }));
|
|
87
79
|
};
|
|
88
80
|
exports.Pack = Pack;
|
|
89
81
|
exports.Pack.props = {};
|
package/lib/mark/pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","sourceRoot":"src/","sources":["mark/pack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAA8C;AAC9C,+CAAuE;AAEvE,4CAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"src/","sources":["mark/pack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAA8C;AAC9C,+CAAuE;AAEvE,4CAA4C;AAE5C,wCAA6C;AAC7C,mCAAgC;AAEhC,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACrD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;CAClC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,KAAK,EAAE;QACL,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE;QACzB,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CA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AC;IAEF,MAAM,UAAU,GAAG,IAAA,kBAAS,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,IAAA,cAAO,EAAC,EAAE,EAAE,eAAe,gCAChC,IAAI,EAAE,eAAe,EACrB,MAAM;QACN,KAAK;QACL,KAAK,EACL,MAAM,EAAE;4CAED,qBAAqB,GACrB,UAAU;YAEf,GAAG,MAAM;SACV,IACE,UAAU,KACb,OAAO,EAAE,IAAA,mBAAY,EAAC,OAAO,EAAE,uBAAuB,CAAC,EACvD,IAAI,EAAE,KAAK,IACX,CAAC;AACL,CAAC,CAAC;AAxCW,QAAA,IAAI,QAwCf;AAEF,YAAI,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/mark/sankey.d.ts
CHANGED
package/lib/mark/sankey.js
CHANGED
|
@@ -17,100 +17,98 @@ const sankey_1 = require("../data/sankey");
|
|
|
17
17
|
const helper_1 = require("../utils/helper");
|
|
18
18
|
const mark_1 = require("../utils/mark");
|
|
19
19
|
const utils_1 = require("./utils");
|
|
20
|
+
const DEFAULT_LAYOUT_OPTIONS = {
|
|
21
|
+
nodeId: (d) => d.key,
|
|
22
|
+
nodeWidth: 0.02,
|
|
23
|
+
nodePadding: 0.02,
|
|
24
|
+
};
|
|
25
|
+
const DEFAULT_NODE_OPTIONS = {
|
|
26
|
+
type: 'polygon',
|
|
27
|
+
axis: false,
|
|
28
|
+
legend: false,
|
|
29
|
+
encode: {
|
|
30
|
+
shape: 'polygon',
|
|
31
|
+
x: 'x',
|
|
32
|
+
y: 'y',
|
|
33
|
+
},
|
|
34
|
+
scale: {
|
|
35
|
+
x: { type: 'identity' },
|
|
36
|
+
y: { type: 'identity' },
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
stroke: '#000',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const DEFAULT_LINK_OPTIONS = {
|
|
43
|
+
type: 'polygon',
|
|
44
|
+
axis: false,
|
|
45
|
+
legend: false,
|
|
46
|
+
encode: {
|
|
47
|
+
shape: 'ribbon',
|
|
48
|
+
x: 'x',
|
|
49
|
+
y: 'y',
|
|
50
|
+
},
|
|
51
|
+
style: {
|
|
52
|
+
fillOpacity: 0.5,
|
|
53
|
+
stroke: undefined,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
const DEFAULT_LABEL_OPTIONS = {
|
|
57
|
+
textAlign: (d) => (d.x[0] < 0.5 ? 'start' : 'end'),
|
|
58
|
+
position: (d) => (d.x[0] < 0.5 ? 'right' : 'left'),
|
|
59
|
+
fontSize: 10,
|
|
60
|
+
};
|
|
20
61
|
/**
|
|
21
62
|
* @todo Add interaction
|
|
22
63
|
* @todo Add source-link color mode
|
|
23
64
|
*/
|
|
24
65
|
const Sankey = (options) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
fillOpacity: 0.5,
|
|
58
|
-
stroke: undefined,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
const DEFAULT_LABEL_OPTIONS = {
|
|
62
|
-
textAlign: (d) => (d.x[0] < 0.5 ? 'start' : 'end'),
|
|
63
|
-
position: (d) => (d.x[0] < 0.5 ? 'right' : 'left'),
|
|
64
|
-
fontSize: 10,
|
|
65
|
-
};
|
|
66
|
-
return () => {
|
|
67
|
-
const { data, encode = {}, scale, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
|
|
68
|
-
// Initialize data, generating nodes by link if is not specified.
|
|
69
|
-
const { links, nodes } = (0, utils_1.initializeData)(data, encode);
|
|
70
|
-
// Extract encode for node and link.
|
|
71
|
-
const nodeEncode = (0, helper_1.subObject)(encode, 'node');
|
|
72
|
-
const linkEncode = (0, helper_1.subObject)(encode, 'link');
|
|
73
|
-
const { key: nodeKey = (d) => d.key, color = nodeKey } = nodeEncode;
|
|
74
|
-
// Transform data, using nodeKey as nodeId.
|
|
75
|
-
const { links: linkData, nodes: nodeData } = (0, sankey_1.Sankey)(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), { nodeId: (0, utils_1.field)(nodeKey) }), layout))({ links, nodes });
|
|
76
|
-
// Extract label style and apply defaults.
|
|
77
|
-
const _a = (0, helper_1.subObject)(style, 'label'), { text = nodeKey, spacing = 5 } = _a, labelStyle = __rest(_a, ["text", "spacing"]);
|
|
78
|
-
const key1 = (0, utils_1.field)(nodeKey);
|
|
79
|
-
const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
|
|
80
|
-
title: key1,
|
|
81
|
-
items: [{ field: 'value' }],
|
|
82
|
-
}, true);
|
|
83
|
-
const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
|
|
84
|
-
title: '',
|
|
85
|
-
items: [
|
|
86
|
-
(d) => ({ name: 'source', value: key1(d.source) }),
|
|
87
|
-
(d) => ({ name: 'target', value: key1(d.target) }),
|
|
66
|
+
const { data, encode = {}, scale, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
|
|
67
|
+
// Initialize data, generating nodes by link if is not specified.
|
|
68
|
+
const { links, nodes } = (0, utils_1.initializeData)(data, encode);
|
|
69
|
+
// Extract encode for node and link.
|
|
70
|
+
const nodeEncode = (0, helper_1.subObject)(encode, 'node');
|
|
71
|
+
const linkEncode = (0, helper_1.subObject)(encode, 'link');
|
|
72
|
+
const { key: nodeKey = (d) => d.key, color = nodeKey } = nodeEncode;
|
|
73
|
+
// Transform data, using nodeKey as nodeId.
|
|
74
|
+
const { links: linkData, nodes: nodeData } = (0, sankey_1.Sankey)(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), { nodeId: (0, utils_1.field)(nodeKey) }), layout))({ links, nodes });
|
|
75
|
+
// Extract label style and apply defaults.
|
|
76
|
+
const _a = (0, helper_1.subObject)(style, 'label'), { text = nodeKey, spacing = 5 } = _a, labelStyle = __rest(_a, ["text", "spacing"]);
|
|
77
|
+
const key1 = (0, utils_1.field)(nodeKey);
|
|
78
|
+
const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
|
|
79
|
+
title: key1,
|
|
80
|
+
items: [{ field: 'value' }],
|
|
81
|
+
}, true);
|
|
82
|
+
const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
|
|
83
|
+
title: '',
|
|
84
|
+
items: [
|
|
85
|
+
(d) => ({ name: 'source', value: key1(d.source) }),
|
|
86
|
+
(d) => ({ name: 'target', value: key1(d.target) }),
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
return [
|
|
90
|
+
(0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
|
|
91
|
+
data: nodeData,
|
|
92
|
+
encode: Object.assign(Object.assign({}, nodeEncode), { color }),
|
|
93
|
+
scale,
|
|
94
|
+
style: (0, helper_1.subObject)(style, 'node'),
|
|
95
|
+
labels: [
|
|
96
|
+
Object.assign(Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), { text, dx: (d) => (d.x[0] < 0.5 ? spacing : -spacing) }), labelStyle),
|
|
97
|
+
...nodeLabels,
|
|
88
98
|
],
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
axis: false,
|
|
103
|
-
}),
|
|
104
|
-
(0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
|
|
105
|
-
data: linkData,
|
|
106
|
-
encode: linkEncode,
|
|
107
|
-
labels: linkLabels,
|
|
108
|
-
style: Object.assign({ fill: linkEncode.color ? undefined : '#aaa', strokeWidth: 0 }, (0, helper_1.subObject)(style, 'link')),
|
|
109
|
-
tooltip: linkTooltip,
|
|
110
|
-
animate: (0, mark_1.maybeAnimation)(animate, 'link'),
|
|
111
|
-
}),
|
|
112
|
-
];
|
|
113
|
-
};
|
|
99
|
+
tooltip: nodeTooltip,
|
|
100
|
+
animate: (0, mark_1.maybeAnimation)(animate, 'node'),
|
|
101
|
+
axis: false,
|
|
102
|
+
}),
|
|
103
|
+
(0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
|
|
104
|
+
data: linkData,
|
|
105
|
+
encode: linkEncode,
|
|
106
|
+
labels: linkLabels,
|
|
107
|
+
style: Object.assign({ fill: linkEncode.color ? undefined : '#aaa', strokeWidth: 0 }, (0, helper_1.subObject)(style, 'link')),
|
|
108
|
+
tooltip: linkTooltip,
|
|
109
|
+
animate: (0, mark_1.maybeAnimation)(animate, 'link'),
|
|
110
|
+
}),
|
|
111
|
+
];
|
|
114
112
|
};
|
|
115
113
|
exports.Sankey = Sankey;
|
|
116
114
|
exports.Sankey.props = {};
|
package/lib/mark/sankey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sankey.js","sourceRoot":"src/","sources":["mark/sankey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AAGrC,2CAA2D;AAC3D,4CAA4C;AAC5C,wCAA2D;AAC3D,mCAAgD;
|
|
1
|
+
{"version":3,"file":"sankey.js","sourceRoot":"src/","sources":["mark/sankey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AAGrC,2CAA2D;AAC3D,4CAA4C;AAC5C,wCAA2D;AAC3D,mCAAgD;AAEhD,MAAM,sBAAsB,GA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X,IAAA,kBAAS,EAAC,KAAK,EAAE,MAAM,CAAC,CAC5B;YACD,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,IAAA,qBAAc,EAAC,OAAO,EAAE,MAAM,CAAC;SACzC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC;AAtFW,QAAA,MAAM,UAsFjB;AAEF,cAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
package/lib/mark/tree.d.ts
CHANGED
package/lib/mark/tree.js
CHANGED
|
@@ -5,72 +5,70 @@ const util_1 = require("@antv/util");
|
|
|
5
5
|
const helper_1 = require("../utils/helper");
|
|
6
6
|
const tree_1 = require("../data/tree");
|
|
7
7
|
const mark_1 = require("../utils/mark");
|
|
8
|
+
const DEFAULT_LAYOUT_OPTIONS = {
|
|
9
|
+
sortBy: (a, b) => b.value - a.value,
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_NODE_OPTIONS = {
|
|
12
|
+
axis: false,
|
|
13
|
+
legend: false,
|
|
14
|
+
type: 'point',
|
|
15
|
+
encode: {
|
|
16
|
+
x: 'x',
|
|
17
|
+
y: 'y',
|
|
18
|
+
size: 2,
|
|
19
|
+
shape: 'point',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const DEFAULT_LINK_OPTIONS = {
|
|
23
|
+
type: 'link',
|
|
24
|
+
encode: {
|
|
25
|
+
x: 'x',
|
|
26
|
+
y: 'y',
|
|
27
|
+
shape: 'smooth',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const DEFAULT_LABEL_OPTIONS = {
|
|
31
|
+
text: '',
|
|
32
|
+
fontSize: 10,
|
|
33
|
+
};
|
|
8
34
|
const Tree = (options) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
title: 'name',
|
|
41
|
-
items: ['value'],
|
|
42
|
-
}, true);
|
|
43
|
-
const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
|
|
44
|
-
title: '',
|
|
45
|
-
items: [
|
|
46
|
-
(d) => ({ name: 'source', value: d.source.name }),
|
|
47
|
-
(d) => ({ name: 'target', value: d.target.name }),
|
|
35
|
+
const { data, encode = {}, scale = {}, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
|
|
36
|
+
const valueEncode = encode === null || encode === void 0 ? void 0 : encode.value;
|
|
37
|
+
const { nodes, edges } = (0, tree_1.Tree)(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), layout), { field: valueEncode }))(data);
|
|
38
|
+
const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
|
|
39
|
+
title: 'name',
|
|
40
|
+
items: ['value'],
|
|
41
|
+
}, true);
|
|
42
|
+
const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
|
|
43
|
+
title: '',
|
|
44
|
+
items: [
|
|
45
|
+
(d) => ({ name: 'source', value: d.source.name }),
|
|
46
|
+
(d) => ({ name: 'target', value: d.target.name }),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
return [
|
|
50
|
+
(0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
|
|
51
|
+
data: edges,
|
|
52
|
+
encode: (0, helper_1.subObject)(encode, 'link'),
|
|
53
|
+
scale: (0, helper_1.subObject)(scale, 'link'),
|
|
54
|
+
labels: linkLabels,
|
|
55
|
+
style: Object.assign({ stroke: '#999' }, (0, helper_1.subObject)(style, 'link')),
|
|
56
|
+
tooltip: linkTooltip,
|
|
57
|
+
animate: (0, mark_1.maybeAnimation)(animate, 'link'),
|
|
58
|
+
}),
|
|
59
|
+
(0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
|
|
60
|
+
data: nodes,
|
|
61
|
+
scale: (0, helper_1.subObject)(scale, 'node'),
|
|
62
|
+
encode: (0, helper_1.subObject)(encode, 'node'),
|
|
63
|
+
labels: [
|
|
64
|
+
Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), (0, helper_1.subObject)(style, 'label')),
|
|
65
|
+
...nodeLabels,
|
|
48
66
|
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
(0,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
scale: (0, helper_1.subObject)(scale, 'link'),
|
|
55
|
-
labels: linkLabels,
|
|
56
|
-
style: Object.assign({ stroke: '#999' }, (0, helper_1.subObject)(style, 'link')),
|
|
57
|
-
tooltip: linkTooltip,
|
|
58
|
-
animate: (0, mark_1.maybeAnimation)(animate, 'link'),
|
|
59
|
-
}),
|
|
60
|
-
(0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
|
|
61
|
-
data: nodes,
|
|
62
|
-
scale: (0, helper_1.subObject)(scale, 'node'),
|
|
63
|
-
encode: (0, helper_1.subObject)(encode, 'node'),
|
|
64
|
-
labels: [
|
|
65
|
-
Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), (0, helper_1.subObject)(style, 'label')),
|
|
66
|
-
...nodeLabels,
|
|
67
|
-
],
|
|
68
|
-
style: Object.assign({}, (0, helper_1.subObject)(style, 'node')),
|
|
69
|
-
tooltip: nodeTooltip,
|
|
70
|
-
animate: (0, mark_1.maybeAnimation)(animate, 'node'),
|
|
71
|
-
}),
|
|
72
|
-
];
|
|
73
|
-
};
|
|
67
|
+
style: Object.assign({}, (0, helper_1.subObject)(style, 'node')),
|
|
68
|
+
tooltip: nodeTooltip,
|
|
69
|
+
animate: (0, mark_1.maybeAnimation)(animate, 'node'),
|
|
70
|
+
}),
|
|
71
|
+
];
|
|
74
72
|
};
|
|
75
73
|
exports.Tree = Tree;
|
|
76
74
|
exports.Tree.props = {};
|
package/lib/mark/tree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"src/","sources":["mark/tree.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,4CAA4C;AAG5C,uCAGsB;AACtB,wCAA2D;
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"src/","sources":["mark/tree.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,4CAA4C;AAG5C,uCAGsB;AACtB,wCAA2D;AAE3D,MAAM,sBAAsB,GAAyB;IACnD,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;CACpC,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,OAAO;IACb,MAAM,EAAE;QACN,CAAC,EAAE,GAAG;QACN,CAAC,EAAE,GAAG;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACN,CAAC,EAAE,GAAG;QACN,CAAC,EAAE,GAAG;QACN,KAAK,EAAE,QAAQ;KAChB;CACF,CAAC;AAEF,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,EAAE;CACb,CAAC;AAIK,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC/C,MAAM,EACJ,IAAI,EACJ,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,EAAE,EACV,KAAK,GAAG,EAAE,EACV,MAAM,GAAG,EAAE,EACX,UAAU,GAAG,E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