minerva-design 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/custom-elements.json +122 -5
- package/dist/angular/fesm2022/minerva-angular.mjs +55 -0
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +23 -2
- package/dist/charts/canvas.d.cts +2 -1
- package/dist/charts/canvas.d.ts +2 -1
- package/dist/charts/core.d.cts +1 -1
- package/dist/charts/core.d.ts +1 -1
- package/dist/charts/engine/canvas.cjs +1 -1
- package/dist/charts/engine/canvas.cjs.map +1 -1
- package/dist/charts/engine/canvas.js +2 -1
- package/dist/charts/engine/canvas.js.map +1 -1
- package/dist/charts/engine/chart.cjs +1 -1
- package/dist/charts/engine/chart.cjs.map +1 -1
- package/dist/charts/engine/chart.js +144 -143
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/controller.cjs +2 -2
- package/dist/charts/engine/controller.cjs.map +1 -1
- package/dist/charts/engine/controller.d.cts +3 -1
- package/dist/charts/engine/controller.d.ts +3 -1
- package/dist/charts/engine/controller.js +130 -132
- package/dist/charts/engine/controller.js.map +1 -1
- package/dist/charts/engine/defaults.cjs.map +1 -1
- package/dist/charts/engine/defaults.d.cts +4 -4
- package/dist/charts/engine/defaults.d.ts +4 -4
- package/dist/charts/engine/defaults.js.map +1 -1
- package/dist/charts/engine/graph/chart.cjs +1 -1
- package/dist/charts/engine/graph/chart.cjs.map +1 -1
- package/dist/charts/engine/graph/chart.js +740 -597
- package/dist/charts/engine/graph/chart.js.map +1 -1
- package/dist/charts/engine/graph/dag.cjs +1 -1
- package/dist/charts/engine/graph/dag.cjs.map +1 -1
- package/dist/charts/engine/graph/dag.js +191 -166
- package/dist/charts/engine/graph/dag.js.map +1 -1
- package/dist/charts/engine/graph/force.cjs +1 -1
- package/dist/charts/engine/graph/force.cjs.map +1 -1
- package/dist/charts/engine/graph/force.d.cts +9 -0
- package/dist/charts/engine/graph/force.d.ts +9 -0
- package/dist/charts/engine/graph/force.js +279 -181
- package/dist/charts/engine/graph/force.js.map +1 -1
- package/dist/charts/engine/graph/geometry.cjs +1 -1
- package/dist/charts/engine/graph/geometry.cjs.map +1 -1
- package/dist/charts/engine/graph/geometry.d.cts +14 -1
- package/dist/charts/engine/graph/geometry.d.ts +14 -1
- package/dist/charts/engine/graph/geometry.js +77 -24
- package/dist/charts/engine/graph/geometry.js.map +1 -1
- package/dist/charts/engine/graph/model.cjs +1 -1
- package/dist/charts/engine/graph/model.cjs.map +1 -1
- package/dist/charts/engine/graph/model.d.cts +9 -0
- package/dist/charts/engine/graph/model.d.ts +9 -0
- package/dist/charts/engine/graph/model.js +63 -43
- package/dist/charts/engine/graph/model.js.map +1 -1
- package/dist/charts/engine/graph/types.d.cts +14 -0
- package/dist/charts/engine/graph/types.d.ts +14 -0
- package/dist/charts/engine/graph/worker.cjs +12 -6
- package/dist/charts/engine/graph/worker.cjs.map +1 -1
- package/dist/charts/engine/graph/worker.js +12 -6
- package/dist/charts/engine/graph/worker.js.map +1 -1
- package/dist/charts/engine/labels.cjs.map +1 -1
- package/dist/charts/engine/labels.d.cts +17 -0
- package/dist/charts/engine/labels.d.ts +17 -0
- package/dist/charts/engine/labels.js.map +1 -1
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.d.cts +33 -0
- package/dist/charts/engine/model.d.ts +33 -0
- package/dist/charts/engine/model.js +149 -126
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/orderbook/field.cjs +37 -0
- package/dist/charts/engine/orderbook/field.cjs.map +1 -0
- package/dist/charts/engine/orderbook/field.d.cts +92 -0
- package/dist/charts/engine/orderbook/field.d.ts +92 -0
- package/dist/charts/engine/orderbook/field.js +297 -0
- package/dist/charts/engine/orderbook/field.js.map +1 -0
- package/dist/charts/engine/orderbook/heatmap.cjs +1 -1
- package/dist/charts/engine/orderbook/heatmap.cjs.map +1 -1
- package/dist/charts/engine/orderbook/heatmap.js +413 -441
- package/dist/charts/engine/orderbook/heatmap.js.map +1 -1
- package/dist/charts/engine/orderbook/host.cjs +1 -1
- package/dist/charts/engine/orderbook/host.cjs.map +1 -1
- package/dist/charts/engine/orderbook/host.d.cts +8 -1
- package/dist/charts/engine/orderbook/host.d.ts +8 -1
- package/dist/charts/engine/orderbook/host.js +27 -5
- package/dist/charts/engine/orderbook/host.js.map +1 -1
- package/dist/charts/engine/orderbook/ladder.cjs +1 -1
- package/dist/charts/engine/orderbook/ladder.cjs.map +1 -1
- package/dist/charts/engine/orderbook/ladder.js +1 -1
- package/dist/charts/engine/orderbook/ladder.js.map +1 -1
- package/dist/charts/engine/orderbook/layout.cjs +1 -1
- package/dist/charts/engine/orderbook/layout.cjs.map +1 -1
- package/dist/charts/engine/orderbook/layout.d.cts +5 -0
- package/dist/charts/engine/orderbook/layout.d.ts +5 -0
- package/dist/charts/engine/orderbook/layout.js +8 -2
- package/dist/charts/engine/orderbook/layout.js.map +1 -1
- package/dist/charts/engine/orderbook/tape.cjs +1 -1
- package/dist/charts/engine/orderbook/tape.cjs.map +1 -1
- package/dist/charts/engine/orderbook/tape.js +3 -3
- package/dist/charts/engine/orderbook/tape.js.map +1 -1
- package/dist/charts/engine/orderbook/types.d.cts +12 -4
- package/dist/charts/engine/orderbook/types.d.ts +12 -4
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +17 -0
- package/dist/charts/engine/overlay.d.ts +17 -0
- package/dist/charts/engine/overlay.js +29 -13
- package/dist/charts/engine/overlay.js.map +1 -1
- package/dist/charts/engine/presets.cjs +1 -1
- package/dist/charts/engine/presets.cjs.map +1 -1
- package/dist/charts/engine/presets.d.cts +12 -2
- package/dist/charts/engine/presets.d.ts +12 -2
- package/dist/charts/engine/presets.js +8 -2
- package/dist/charts/engine/presets.js.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.js +13 -9
- package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
- package/dist/charts/engine/renderers/follow.cjs +2 -0
- package/dist/charts/engine/renderers/follow.cjs.map +1 -0
- package/dist/charts/engine/renderers/follow.d.cts +8 -0
- package/dist/charts/engine/renderers/follow.d.ts +8 -0
- package/dist/charts/engine/renderers/follow.js +10 -0
- package/dist/charts/engine/renderers/follow.js.map +1 -0
- package/dist/charts/engine/renderers/gl-budget.cjs +2 -0
- package/dist/charts/engine/renderers/gl-budget.cjs.map +1 -0
- package/dist/charts/engine/renderers/gl-budget.d.cts +32 -0
- package/dist/charts/engine/renderers/gl-budget.d.ts +32 -0
- package/dist/charts/engine/renderers/gl-budget.js +95 -0
- package/dist/charts/engine/renderers/gl-budget.js.map +1 -0
- package/dist/charts/engine/renderers/gl.cjs +1 -1
- package/dist/charts/engine/renderers/gl.cjs.map +1 -1
- package/dist/charts/engine/renderers/gl.js +1 -1
- package/dist/charts/engine/renderers/gl.js.map +1 -1
- package/dist/charts/engine/renderers/shaders.cjs +9 -6
- package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
- package/dist/charts/engine/renderers/shaders.d.cts +1 -1
- package/dist/charts/engine/renderers/shaders.d.ts +1 -1
- package/dist/charts/engine/renderers/shaders.js +9 -6
- package/dist/charts/engine/renderers/shaders.js.map +1 -1
- package/dist/charts/engine/renderers/types.cjs.map +1 -1
- package/dist/charts/engine/renderers/types.d.cts +2 -0
- package/dist/charts/engine/renderers/types.d.ts +2 -0
- package/dist/charts/engine/renderers/types.js.map +1 -1
- package/dist/charts/engine/renderers/webgl.cjs +1 -1
- package/dist/charts/engine/renderers/webgl.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgl.js +85 -64
- package/dist/charts/engine/renderers/webgl.js.map +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgl2.js +72 -58
- package/dist/charts/engine/renderers/webgl2.js.map +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgpu.js +1 -1
- package/dist/charts/engine/renderers/webgpu.js.map +1 -1
- package/dist/charts/engine/scene.cjs +1 -1
- package/dist/charts/engine/scene.cjs.map +1 -1
- package/dist/charts/engine/scene.d.cts +51 -4
- package/dist/charts/engine/scene.d.ts +51 -4
- package/dist/charts/engine/scene.js +188 -122
- package/dist/charts/engine/scene.js.map +1 -1
- package/dist/charts/engine/shapes/chord.cjs +1 -1
- package/dist/charts/engine/shapes/chord.cjs.map +1 -1
- package/dist/charts/engine/shapes/chord.js +108 -103
- package/dist/charts/engine/shapes/chord.js.map +1 -1
- package/dist/charts/engine/shapes/types.d.cts +5 -3
- package/dist/charts/engine/shapes/types.d.ts +5 -3
- package/dist/charts/engine/three-d/canvas2d.cjs +1 -1
- package/dist/charts/engine/three-d/canvas2d.cjs.map +1 -1
- package/dist/charts/engine/three-d/canvas2d.d.cts +36 -1
- package/dist/charts/engine/three-d/canvas2d.d.ts +36 -1
- package/dist/charts/engine/three-d/canvas2d.js +155 -80
- package/dist/charts/engine/three-d/canvas2d.js.map +1 -1
- package/dist/charts/engine/three-d/chart.cjs +1 -1
- package/dist/charts/engine/three-d/chart.cjs.map +1 -1
- package/dist/charts/engine/three-d/chart.js +219 -215
- package/dist/charts/engine/three-d/chart.js.map +1 -1
- package/dist/charts/engine/three-d/oit.cjs +109 -0
- package/dist/charts/engine/three-d/oit.cjs.map +1 -0
- package/dist/charts/engine/three-d/oit.d.cts +34 -0
- package/dist/charts/engine/three-d/oit.d.ts +34 -0
- package/dist/charts/engine/three-d/oit.js +111 -0
- package/dist/charts/engine/three-d/oit.js.map +1 -0
- package/dist/charts/engine/three-d/render-types.cjs +1 -1
- package/dist/charts/engine/three-d/render-types.cjs.map +1 -1
- package/dist/charts/engine/three-d/render-types.d.cts +16 -3
- package/dist/charts/engine/three-d/render-types.d.ts +16 -3
- package/dist/charts/engine/three-d/render-types.js +6 -9
- package/dist/charts/engine/three-d/render-types.js.map +1 -1
- package/dist/charts/engine/three-d/shaders.cjs +52 -26
- package/dist/charts/engine/three-d/shaders.cjs.map +1 -1
- package/dist/charts/engine/three-d/shaders.d.cts +11 -3
- package/dist/charts/engine/three-d/shaders.d.ts +11 -3
- package/dist/charts/engine/three-d/shaders.js +84 -40
- package/dist/charts/engine/three-d/shaders.js.map +1 -1
- package/dist/charts/engine/three-d/sort.cjs +1 -1
- package/dist/charts/engine/three-d/sort.cjs.map +1 -1
- package/dist/charts/engine/three-d/sort.d.cts +6 -4
- package/dist/charts/engine/three-d/sort.d.ts +6 -4
- package/dist/charts/engine/three-d/sort.js +51 -39
- package/dist/charts/engine/three-d/sort.js.map +1 -1
- package/dist/charts/engine/three-d/types.d.cts +9 -0
- package/dist/charts/engine/three-d/types.d.ts +9 -0
- package/dist/charts/engine/three-d/webgl.cjs +1 -1
- package/dist/charts/engine/three-d/webgl.cjs.map +1 -1
- package/dist/charts/engine/three-d/webgl.d.cts +9 -0
- package/dist/charts/engine/three-d/webgl.d.ts +9 -0
- package/dist/charts/engine/three-d/webgl.js +199 -76
- package/dist/charts/engine/three-d/webgl.js.map +1 -1
- package/dist/charts/engine/three-d/webgpu.cjs +1 -1
- package/dist/charts/engine/three-d/webgpu.cjs.map +1 -1
- package/dist/charts/engine/three-d/webgpu.js +225 -99
- package/dist/charts/engine/three-d/webgpu.js.map +1 -1
- package/dist/charts/engine/trading/chart.cjs +1 -1
- package/dist/charts/engine/trading/chart.cjs.map +1 -1
- package/dist/charts/engine/trading/chart.d.cts +0 -1
- package/dist/charts/engine/trading/chart.d.ts +0 -1
- package/dist/charts/engine/trading/chart.js +1048 -883
- package/dist/charts/engine/trading/chart.js.map +1 -1
- package/dist/charts/engine/trading/drawings.cjs +2 -2
- package/dist/charts/engine/trading/drawings.cjs.map +1 -1
- package/dist/charts/engine/trading/drawings.d.cts +6 -0
- package/dist/charts/engine/trading/drawings.d.ts +6 -0
- package/dist/charts/engine/trading/drawings.js +100 -88
- package/dist/charts/engine/trading/drawings.js.map +1 -1
- package/dist/charts/engine/trading/format.cjs +1 -1
- package/dist/charts/engine/trading/format.cjs.map +1 -1
- package/dist/charts/engine/trading/format.d.cts +6 -0
- package/dist/charts/engine/trading/format.d.ts +6 -0
- package/dist/charts/engine/trading/format.js +42 -30
- package/dist/charts/engine/trading/format.js.map +1 -1
- package/dist/charts/engine/trading/geometry.cjs +1 -1
- package/dist/charts/engine/trading/geometry.cjs.map +1 -1
- package/dist/charts/engine/trading/geometry.d.cts +16 -0
- package/dist/charts/engine/trading/geometry.d.ts +16 -0
- package/dist/charts/engine/trading/geometry.js +19 -4
- package/dist/charts/engine/trading/geometry.js.map +1 -1
- package/dist/charts/engine/trading/labels.cjs +1 -1
- package/dist/charts/engine/trading/labels.cjs.map +1 -1
- package/dist/charts/engine/trading/labels.js +24 -4
- package/dist/charts/engine/trading/labels.js.map +1 -1
- package/dist/charts/engine/trading/studies.cjs +1 -1
- package/dist/charts/engine/trading/studies.cjs.map +1 -1
- package/dist/charts/engine/trading/studies.d.cts +8 -0
- package/dist/charts/engine/trading/studies.d.ts +8 -0
- package/dist/charts/engine/trading/studies.js +4 -1
- package/dist/charts/engine/trading/studies.js.map +1 -1
- package/dist/charts/engine/trading/types.d.cts +34 -11
- package/dist/charts/engine/trading/types.d.ts +34 -11
- package/dist/charts/engine/types.d.cts +25 -4
- package/dist/charts/engine/types.d.ts +25 -4
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.js +20 -15
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/graph.cjs +1 -1
- package/dist/charts/react/graph.cjs.map +1 -1
- package/dist/charts/react/graph.d.cts +6 -0
- package/dist/charts/react/graph.d.ts +6 -0
- package/dist/charts/react/graph.js +28 -27
- package/dist/charts/react/graph.js.map +1 -1
- package/dist/charts/react/orderbook.cjs +1 -1
- package/dist/charts/react/orderbook.cjs.map +1 -1
- package/dist/charts/react/orderbook.d.cts +3 -1
- package/dist/charts/react/orderbook.d.ts +3 -1
- package/dist/charts/react/orderbook.js +1 -0
- package/dist/charts/react/orderbook.js.map +1 -1
- package/dist/charts/react/shapes.cjs.map +1 -1
- package/dist/charts/react/shapes.d.cts +4 -3
- package/dist/charts/react/shapes.d.ts +4 -3
- package/dist/charts/react/shapes.js.map +1 -1
- package/dist/charts/react/three-d.cjs +1 -1
- package/dist/charts/react/three-d.cjs.map +1 -1
- package/dist/charts/react/three-d.d.cts +7 -0
- package/dist/charts/react/three-d.d.ts +7 -0
- package/dist/charts/react/three-d.js +14 -13
- package/dist/charts/react/three-d.js.map +1 -1
- package/dist/charts/react/trading.cjs.map +1 -1
- package/dist/charts/react/trading.d.cts +3 -3
- package/dist/charts/react/trading.d.ts +3 -3
- package/dist/charts/react/trading.js.map +1 -1
- package/dist/core/contracts.cjs +1 -1
- package/dist/core/contracts.cjs.map +1 -1
- package/dist/core/contracts.js +1 -1
- package/dist/core/contracts.js.map +1 -1
- package/dist/native/charts/src/canvas.cjs +1 -1
- package/dist/native/charts/src/canvas.js +4 -3
- package/dist/native/charts/src/engine/controller.cjs +2 -2
- package/dist/native/charts/src/engine/controller.cjs.map +1 -1
- package/dist/native/charts/src/engine/controller.js +102 -104
- package/dist/native/charts/src/engine/controller.js.map +1 -1
- package/dist/native/charts/src/engine/labels.cjs +1 -1
- package/dist/native/charts/src/engine/labels.cjs.map +1 -1
- package/dist/native/charts/src/engine/labels.js +14 -1
- package/dist/native/charts/src/engine/labels.js.map +1 -1
- package/dist/native/charts/src/engine/model.cjs +1 -1
- package/dist/native/charts/src/engine/model.cjs.map +1 -1
- package/dist/native/charts/src/engine/model.js +180 -157
- package/dist/native/charts/src/engine/model.js.map +1 -1
- package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
- package/dist/native/charts/src/engine/overlay.js.map +1 -1
- package/dist/native/charts/src/engine/presets.cjs +1 -1
- package/dist/native/charts/src/engine/presets.cjs.map +1 -1
- package/dist/native/charts/src/engine/presets.js +8 -2
- package/dist/native/charts/src/engine/presets.js.map +1 -1
- package/dist/native/charts/src/engine/scene.cjs +1 -1
- package/dist/native/charts/src/engine/scene.cjs.map +1 -1
- package/dist/native/charts/src/engine/scene.js +188 -122
- package/dist/native/charts/src/engine/scene.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/chord.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/chord.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/chord.js +108 -103
- package/dist/native/charts/src/engine/shapes/chord.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/layout.cjs +2 -2
- package/dist/native/charts/src/engine/shapes/layout.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/layout.js +88 -73
- package/dist/native/charts/src/engine/shapes/layout.js.map +1 -1
- package/dist/native/components/Chart/ChartBase.cjs +1 -1
- package/dist/native/components/Chart/ChartBase.cjs.map +1 -1
- package/dist/native/components/Chart/ChartBase.js +127 -115
- package/dist/native/components/Chart/ChartBase.js.map +1 -1
- package/dist/native/components/Chart/charts.cjs +1 -1
- package/dist/native/components/Chart/charts.cjs.map +1 -1
- package/dist/native/components/Chart/charts.js +8 -5
- package/dist/native/components/Chart/charts.js.map +1 -1
- package/dist/native/components/Chart/scene.cjs +1 -1
- package/dist/native/components/Chart/scene.cjs.map +1 -1
- package/dist/native/components/Chart/scene.d.cts +6 -1
- package/dist/native/components/Chart/scene.d.ts +6 -1
- package/dist/native/components/Chart/scene.js +99 -50
- package/dist/native/components/Chart/scene.js.map +1 -1
- package/dist/native/components/Chart/types.d.cts +7 -1
- package/dist/native/components/Chart/types.d.ts +7 -1
- package/dist/native/components/Charts/charts.cjs +1 -1
- package/dist/native/components/Charts/charts.cjs.map +1 -1
- package/dist/native/components/Charts/charts.js +23 -18
- package/dist/native/components/Charts/charts.js.map +1 -1
- package/dist/native/components/ShapeChart/ShapeChartBase.cjs +1 -1
- package/dist/native/components/ShapeChart/ShapeChartBase.cjs.map +1 -1
- package/dist/native/components/ShapeChart/ShapeChartBase.d.cts +1 -1
- package/dist/native/components/ShapeChart/ShapeChartBase.d.ts +1 -1
- package/dist/native/components/ShapeChart/ShapeChartBase.js +97 -107
- package/dist/native/components/ShapeChart/ShapeChartBase.js.map +1 -1
- package/dist/native/components/ShapeChart/geometry.cjs +1 -1
- package/dist/native/components/ShapeChart/geometry.cjs.map +1 -1
- package/dist/native/components/ShapeChart/geometry.js +120 -36
- package/dist/native/components/ShapeChart/geometry.js.map +1 -1
- package/dist/native/components/ShapeChart/types.d.cts +6 -4
- package/dist/native/components/ShapeChart/types.d.ts +6 -4
- package/dist/native/source/components/Chart/ChartBase.tsx +19 -6
- package/dist/native/source/components/Chart/charts.tsx +10 -3
- package/dist/native/source/components/Chart/scene.tsx +85 -0
- package/dist/native/source/components/Chart/types.ts +7 -0
- package/dist/native/source/components/Charts/charts.tsx +7 -0
- package/dist/native/source/components/ShapeChart/ShapeChartBase.tsx +10 -36
- package/dist/native/source/components/ShapeChart/geometry.ts +188 -18
- package/dist/native/source/components/ShapeChart/types.ts +6 -4
- package/dist/taro/chart-a11y.d.ts +7 -0
- package/dist/taro/charts.d.ts +4 -1
- package/dist/taro/index.js +3212 -3049
- package/dist/taro/shape-charts.d.ts +6 -4
- package/dist/uni/AreaChart.vue +2 -1
- package/dist/uni/AreaChart.vue.d.ts +1 -1
- package/dist/uni/BarChart.vue +2 -1
- package/dist/uni/BarChart.vue.d.ts +1 -1
- package/dist/uni/BoxPlotChart.vue +2 -1
- package/dist/uni/BubbleChart.vue +2 -1
- package/dist/uni/CandlestickChart.vue +2 -1
- package/dist/uni/Chart.vue +2 -1
- package/dist/uni/Divider.vue.d.ts +1 -1
- package/dist/uni/DonutChart.vue.d.ts +1 -1
- package/dist/uni/GanttChart.vue +2 -1
- package/dist/uni/GanttChart.vue.d.ts +11 -0
- package/dist/uni/GaugeChart.vue.d.ts +1 -1
- package/dist/uni/HeatmapChart.vue +2 -1
- package/dist/uni/HistogramChart.vue +2 -1
- package/dist/uni/HorizontalBarChart.vue +2 -1
- package/dist/uni/HorizontalBarChart.vue.d.ts +1 -1
- package/dist/uni/LineChart.vue +2 -1
- package/dist/uni/MixedChart.vue +2 -1
- package/dist/uni/PieChart.vue.d.ts +1 -1
- package/dist/uni/QuadrantChart.vue +2 -1
- package/dist/uni/RangeAreaChart.vue +2 -1
- package/dist/uni/ScatterChart.vue +2 -1
- package/dist/uni/Sparkline.vue +2 -1
- package/dist/uni/WaterfallChart.vue +2 -1
- package/dist/uni/chart-a11y.d.ts +7 -0
- package/dist/uni/chart-a11y.js +29 -0
- package/dist/uni/chart-canvas.d.ts +9 -0
- package/dist/uni/chart-canvas.js +11 -1
- package/dist/uni/chart-types.d.ts +8 -1
- package/dist/uni/chart-types.js +5 -1
- package/dist/uni/charts-canvas.js +2 -1
- package/dist/uni/named-chart-options.d.ts +2 -0
- package/dist/uni/named-chart-options.js +3 -0
- package/dist/uni/shape-chart-canvas.d.ts +0 -2
- package/dist/uni/shape-chart-canvas.js +4 -36
- package/dist/uni/shape-chart-types.d.ts +2 -2
- package/dist/uni/shape-chart-types.js +2 -2
- package/dist/vue/components/Chart/Bar3DChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/DependencyGraph.vue.d.ts +2 -0
- package/dist/vue/components/Chart/GanttChart.vue.d.ts +15 -0
- package/dist/vue/components/Chart/GanttChart.vue.js.map +1 -1
- package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/vue/components/Chart/GraphChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/Line3DChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/Surface3DChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/TradingChart.vue.d.ts +9 -0
- package/dist/vue/components/Chart/TreeChart.vue.d.ts +2 -0
- package/dist/vue/components/Chart/graph.d.ts +3 -0
- package/dist/vue/components/Chart/graph.js +2 -0
- package/dist/vue/components/Chart/graph.js.map +1 -1
- package/dist/vue/components/Chart/three-d.d.ts +3 -0
- package/dist/vue/components/Chart/three-d.js +2 -0
- package/dist/vue/components/Chart/three-d.js.map +1 -1
- package/dist/vue/components/Chart/trading.d.ts +7 -2
- package/dist/vue/components/Chart/trading.js +1 -0
- package/dist/vue/components/Chart/trading.js.map +1 -1
- package/dist/weapp/area-chart/index.wxml +1 -1
- package/dist/weapp/bar-chart/index.wxml +1 -1
- package/dist/weapp/box-plot-chart/index.wxml +1 -1
- package/dist/weapp/bubble-chart/index.wxml +1 -1
- package/dist/weapp/candlestick-chart/index.wxml +1 -1
- package/dist/weapp/chart/index.wxml +1 -1
- package/dist/weapp/charts/canvas.js +326 -54
- package/dist/weapp/charts/core.js +2 -0
- package/dist/weapp/controls.js +58 -27
- package/dist/weapp/gantt-chart/index.wxml +1 -1
- package/dist/weapp/heatmap-chart/index.wxml +1 -1
- package/dist/weapp/histogram-chart/index.wxml +1 -1
- package/dist/weapp/horizontal-bar-chart/index.wxml +1 -1
- package/dist/weapp/line-chart/index.wxml +1 -1
- package/dist/weapp/mixed-chart/index.wxml +1 -1
- package/dist/weapp/quadrant-chart/index.wxml +1 -1
- package/dist/weapp/range-area-chart/index.wxml +1 -1
- package/dist/weapp/scatter-chart/index.wxml +1 -1
- package/dist/weapp/sparkline/index.wxml +1 -1
- package/dist/weapp/types.d.ts +11 -2
- package/dist/weapp/waterfall-chart/index.wxml +1 -1
- package/dist/web-components/components/chart/extended.d.ts +4 -0
- package/dist/web-components/components/chart/extended.js +8 -2
- package/dist/web-components/components/chart/extended.js.map +1 -1
- package/dist/web-components/components/chart-3d/chart-3d.d.ts +1 -1
- package/dist/web-components/components/chart-3d/chart-3d.js.map +1 -1
- package/dist/web-components/components/graph/graph.d.ts +2 -0
- package/dist/web-components/components/graph/graph.js +3 -2
- package/dist/web-components/components/graph/graph.js.map +1 -1
- package/dist/web-components/components/trading-chart/trading-chart.d.ts +1 -1
- package/dist/web-components/components/trading-chart/trading-chart.js.map +1 -1
- package/dist/web-components/html-custom-data.json +45 -0
- package/dist/web-components/types/react.d.ts +4 -4
- package/dist/web-components/types/solid.d.ts +8 -8
- package/dist/web-components/types/svelte.d.ts +8 -8
- package/dist/web-components/types/vue.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartBase.cjs","names":["createChartController","measureChartText","drawStatic","useState","View","part","tooltipCard","useTheme","useMemo","chartThemeInput","useRef","StyleSheet","chartAriaLabel","drawHover","require_MinervaProvider","require_parts","require_labels","require_controller","require_measure","require_scene","require_theme","react","react_native","react_jsx_runtime","engineOptions","props","CUSTOM_TOOLTIP","idOf","id","t","index","requestFrame","callback","createChartStore","version","frame","listeners","cache","origin","touches","dragsPoints","o","draggable","options","claimed","notify","listener","cancelFrame","controller","size","local","sync","n","event","i","p","previous","store","next","scene","key","view","plot","family","value","active","changed","last","touch","base","CustomTooltip","setSize","left","anchor","top","width","height","w","h","ChartBase","handlers","fonts","theme","tokens","customTooltip","renderTooltip","resolved","applied","current","handlersRef","offs","e","v","off","handleRef","onLayout","tooltip","content","style","overlay"],"sources":["../../../../../native/src/components/Chart/ChartBase.tsx"],"sourcesContent":["// The chart host of React Native: owns a platform-free chart controller\n// (@minerva/charts/canvas: options, model, zoom, gestures, scene in pixels)\n// and draws its scene with views (./scene). Touches go through the\n// responder system; the drawing is `pointerEvents=\"none\"`, so every touch\n// lands on the surface and positions come from page coordinates.\n\nimport {\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n StyleSheet,\n View,\n type DimensionValue,\n type GestureResponderEvent,\n type LayoutChangeEvent,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport {\n chartAriaLabel,\n createChartController,\n type ChartController,\n type ChartDragEvent,\n type ChartHoverEvent,\n type ChartOptions,\n type ChartPlotClickEvent,\n type ChartRect,\n type ChartScene,\n type ChartThemeInput,\n type ChartTooltipOptions,\n type ChartView,\n} from \"@minerva/charts/canvas\";\nimport { useTheme } from \"../../theme/MinervaProvider\";\nimport { part } from \"../../internal/parts\";\nimport { measureChartText } from \"./measure\";\nimport { drawHover, drawStatic, tooltipCard } from \"./scene\";\nimport { chartThemeInput } from \"./theme\";\nimport type { ChartCommonProps, ChartHandle } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n | \"locale\"\n | \"labels\"\n > &\n Pick<ChartOptions, \"series\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n locale: props.locale,\n labels: props.labels,\n});\n\ntype TooltipResult = Exclude<\n ReturnType<NonNullable<ChartTooltipOptions[\"render\"]>>,\n string | null\n>;\n/** Non-string result of `tooltip.render`: the engine lays a tooltip out without drawing text */\nconst CUSTOM_TOOLTIP = {} as unknown as TooltipResult;\n\ninterface TouchPoint {\n identifier?: number | string;\n pageX: number;\n pageY: number;\n locationX?: number;\n locationY?: number;\n}\n\nconst idOf = (t: TouchPoint, index: number) => {\n const id = Number(t.identifier);\n return Number.isFinite(id) ? id : index;\n};\n\ntype Frame = { cancel: () => void };\n\nconst requestFrame = (callback: () => void): Frame => {\n if (typeof requestAnimationFrame === \"function\") {\n const id = requestAnimationFrame(callback);\n return { cancel: () => cancelAnimationFrame(id) };\n }\n const id = setTimeout(callback, 16);\n return { cancel: () => clearTimeout(id) };\n};\n\n/**\n * External store of a chart: the controller, a version bumped when its\n * scene must be drawn again (coalesced per frame), the touches being\n * tracked and the cache of the static layers.\n */\ninterface ChartStore {\n controller: ChartController;\n /** Options of the controller (`setOptions` of the controller) */\n setOptions: (options: ChartOptions) => void;\n subscribe: (listener: () => void) => () => void;\n version: () => number;\n /** Draws again now */\n commit: () => void;\n /** Static layers of a scene (cached while model / view / size are the same) */\n layers: (scene: ChartScene, family: string | undefined) => ReactNode;\n /** Last single-finger position (anchor of a custom tooltip) */\n anchor: { x: number; y: number } | null;\n /**\n * First finger (responder grant); returns whether the chart owns the\n * gesture, which keeps native scroll views from taking it (Android)\n */\n touchStart: (event: GestureResponderEvent) => boolean;\n /** Another finger touches the chart */\n touchAdd: (event: GestureResponderEvent) => void;\n /** Moves (drawn on the next frame) */\n touchMove: (event: GestureResponderEvent) => void;\n touchEnd: (event: GestureResponderEvent) => void;\n touchCancel: () => void;\n /** Whether the chart keeps the touches (pinch, point drag, pan when zoomed) */\n holdsGesture: () => boolean;\n}\n\nfunction createChartStore(\n options: ChartOptions,\n theme: ChartThemeInput,\n size: [number, number] | null,\n): ChartStore {\n let version = 0;\n let frame: Frame | null = null;\n const listeners = new Set<() => void>();\n let cache: { key: unknown[]; node: ReactNode } | null = null;\n let origin = { x: 0, y: 0 };\n const touches = new Map<number, { x: number; y: number }>();\n const dragsPoints = (o: ChartOptions) =>\n typeof o.interaction === \"object\" && !!o.interaction.dragPoints;\n let draggable = dragsPoints(options);\n /** The current touch sequence started on the plot of a draggable chart */\n let claimed = false;\n\n const notify = () => {\n version++;\n listeners.forEach((listener) => listener());\n };\n const cancelFrame = () => {\n frame?.cancel();\n frame = null;\n };\n const schedule = () => {\n if (frame || !listeners.size) return;\n frame = requestFrame(() => {\n frame = null;\n notify();\n });\n };\n\n const controller = createChartController({\n options,\n theme,\n measureText: measureChartText,\n onInvalidate: schedule,\n });\n if (size) controller.setSize(size[0], size[1]);\n\n const local = (t: TouchPoint) => ({\n x: t.pageX - origin.x,\n y: t.pageY - origin.y,\n });\n\n /** Feeds the controller the fingers that appeared or moved */\n const sync = (event: GestureResponderEvent) => {\n const n = event.nativeEvent;\n const list: readonly TouchPoint[] = n.touches?.length\n ? n.touches\n : [n as unknown as TouchPoint];\n list.forEach((t, i) => {\n const id = idOf(t, i);\n const p = local(t);\n const previous = touches.get(id);\n if (!previous) {\n touches.set(id, p);\n controller.pointerDown(p.x, p.y, { id, touch: true });\n } else if (previous.x !== p.x || previous.y !== p.y) {\n touches.set(id, p);\n controller.pointerMove(p.x, p.y, { id, touch: true });\n }\n });\n if (touches.size === 1) store.anchor = [...touches.values()][0];\n };\n\n const store: ChartStore = {\n controller,\n setOptions(next) {\n draggable = dragsPoints(next);\n controller.setOptions(next);\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n if (!listeners.size) cancelFrame();\n };\n },\n version: () => version,\n commit() {\n cancelFrame();\n notify();\n },\n layers(scene, family) {\n const { plot } = scene.layout;\n const { view } = scene;\n const key = [\n scene.model,\n scene.annotations,\n scene.theme,\n scene.width,\n scene.height,\n view.x[0],\n view.x[1],\n view.y[0],\n view.y[1],\n plot.x,\n plot.y,\n plot.width,\n plot.height,\n family,\n ];\n if (!cache || cache.key.some((value, i) => value !== key[i]))\n cache = { key, node: drawStatic(scene, family) };\n return cache.node;\n },\n anchor: null,\n touchStart(event) {\n const n = event.nativeEvent as unknown as TouchPoint;\n // the drawing ignores touches: `location` is relative to the surface\n if (!touches.size && n.locationX !== undefined)\n origin = { x: n.pageX - n.locationX, y: n.pageY - (n.locationY ?? 0) };\n sync(event);\n store.commit();\n // draggable points: the drag only starts after the touch slop, too\n // late to keep a scroll view from stealing the touch: claim it now\n const plot = controller.getPlotRect();\n const p = touches.values().next().value;\n claimed =\n draggable &&\n !!plot &&\n !!p &&\n p.x >= plot.x &&\n p.x <= plot.x + plot.width &&\n p.y >= plot.y &&\n p.y <= plot.y + plot.height;\n return store.holdsGesture();\n },\n touchAdd(event) {\n sync(event);\n store.commit();\n },\n touchMove: sync,\n touchEnd(event) {\n const n = event.nativeEvent;\n const active = new Set(\n (n.touches ?? []).map((t, i) => idOf(t as TouchPoint, i)),\n );\n const changed: readonly TouchPoint[] = n.changedTouches?.length\n ? n.changedTouches\n : [n as unknown as TouchPoint];\n for (const [id, last] of [...touches]) {\n if (active.has(id)) continue;\n const touch = changed.find((t, i) => idOf(t, i) === id);\n const p = touch ? local(touch) : last;\n touches.delete(id);\n if (touches.size === 0) store.anchor = p;\n controller.pointerUp(p.x, p.y, { id, touch: true });\n }\n store.commit();\n },\n touchCancel() {\n for (const id of touches.keys()) controller.pointerCancel({ id });\n touches.clear();\n store.commit();\n },\n holdsGesture() {\n if (touches.size > 1 || (claimed && touches.size > 0)) return true;\n const scene = controller.getScene();\n if (!scene) return false;\n if (scene.dragging) return true;\n const { base } = scene.model;\n const view = controller.getView();\n return (\n view.x[0] !== base.x[0] ||\n view.x[1] !== base.x[1] ||\n view.y[0] !== base.y[0] ||\n view.y[1] !== base.y[1]\n );\n },\n };\n return store;\n}\n\n/** A `renderTooltip` node, placed next to the finger once measured */\nfunction CustomTooltip({\n scene,\n anchor,\n children,\n}: {\n scene: ChartScene;\n anchor: { x: number; y: number };\n children: ReactNode;\n}) {\n const [size, setSize] = useState<{ width: number; height: number } | null>(\n null,\n );\n const { width, height } = scene;\n let left = anchor.x + 14;\n let top = anchor.y;\n if (size) {\n if (left + size.width > width - 4) left = anchor.x - 14 - size.width;\n left = Math.max(4, Math.min(left, width - size.width - 4));\n top = Math.max(\n 4,\n Math.min(anchor.y - size.height / 2, height - size.height - 4),\n );\n }\n return (\n <View\n pointerEvents=\"none\"\n {...part(\"chart\", \"tooltip\", { custom: true })}\n onLayout={(e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n setSize((previous) =>\n previous && previous.width === w && previous.height === h\n ? previous\n : { width: w, height: h },\n );\n }}\n style={[\n tooltipCard(scene),\n {\n // laid out at the origin (full width available), moved by a transform\n left: 0,\n top: 0,\n maxWidth: Math.max(0, width - 8),\n padding: 8,\n opacity: size ? 1 : 0,\n transform: [{ translateX: left }, { translateY: top }],\n },\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: DimensionValue;\n width?: DimensionValue;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n handleRef?: Ref<ChartHandle>;\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the plot area, given the plot rectangle */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\n/** Sizes the chart, forwards options / theme / touches to the controller and draws its scene */\nexport function ChartBase({\n options,\n height = 320,\n width = \"100%\",\n style,\n testID,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const { tokens, fonts } = useTheme();\n const family = fonts.sans;\n const theme = useMemo(() => chartThemeInput(tokens), [tokens]);\n const customTooltip = !!renderTooltip && options.tooltip !== false;\n const resolved = useMemo((): ChartOptions => {\n if (!customTooltip) return options;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return { ...options, tooltip: { ...base, render: () => CUSTOM_TOOLTIP } };\n }, [options, customTooltip]);\n\n const [store] = useState(() =>\n createChartStore(\n resolved,\n theme,\n typeof width === \"number\" && typeof height === \"number\"\n ? [width, height]\n : null,\n ),\n );\n const { controller } = store;\n useSyncExternalStore(store.subscribe, store.version, store.version);\n\n const applied = useRef({ options: resolved, theme });\n useLayoutEffect(() => {\n const current = applied.current;\n if (current.theme === theme && current.options === resolved) return;\n if (current.theme !== theme) controller.setTheme(theme);\n if (current.options !== resolved) store.setOptions(resolved);\n applied.current = { options: resolved, theme };\n store.commit();\n }, [controller, store, resolved, theme]);\n\n useLayoutEffect(() => {\n if (typeof width !== \"number\" || typeof height !== \"number\") return;\n const scene = controller.getScene();\n if (scene && scene.width === width && scene.height === height) return;\n controller.setSize(width, height);\n store.commit();\n }, [controller, store, width, height]);\n\n const handlersRef = useRef<Handlers>(handlers);\n useLayoutEffect(() => {\n handlersRef.current = handlers;\n });\n useEffect(() => {\n const h = handlersRef;\n const offs = [\n controller.on(\"hover\", (e) => h.current.onHover?.(e)),\n controller.on(\"click\", (e) => h.current.onPointClick?.(e)),\n controller.on(\"plotClick\", (e) => h.current.onPlotClick?.(e)),\n controller.on(\"zoom\", (v) => h.current.onZoom?.(v)),\n controller.on(\"drag\", (e) => h.current.onDrag?.(e)),\n controller.on(\"drop\", (e) => h.current.onDrop?.(e)),\n ];\n return () => offs.forEach((off) => off());\n }, [controller]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (view) => controller.setView(view),\n getPlotRect: () => controller.getPlotRect(),\n getController: () => controller,\n }),\n [controller],\n );\n\n const onLayout = (e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n const scene = controller.getScene();\n if (scene && scene.width === w && scene.height === h) return;\n controller.setSize(w, h);\n store.commit();\n };\n\n const scene = controller.getScene();\n let tooltip: ReactNode = null;\n const event = scene?.hover?.tooltip ? scene.hover.event : null;\n if (scene && event && customTooltip && renderTooltip) {\n const content = renderTooltip(event);\n const anchor = store.anchor ?? scene.hover?.marks[0] ?? null;\n if (\n content !== null &&\n content !== undefined &&\n content !== false &&\n anchor\n )\n tooltip = (\n <CustomTooltip scene={scene} anchor={anchor}>\n {content}\n </CustomTooltip>\n );\n }\n\n return (\n <View\n testID={testID}\n onLayout={onLayout}\n style={[{ width, height }, style]}\n {...part(\"chart\", \"root\")}\n >\n <View\n style={StyleSheet.absoluteFill}\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={\n options.ariaLabel ?? (scene ? chartAriaLabel(scene.model) : undefined)\n }\n onStartShouldSetResponder={() => true}\n onResponderTerminationRequest={() => !store.holdsGesture()}\n onResponderGrant={store.touchStart}\n onResponderStart={store.touchAdd}\n onResponderMove={store.touchMove}\n onResponderEnd={store.touchEnd}\n onResponderRelease={store.touchEnd}\n onResponderTerminate={store.touchCancel}\n {...part(\"chart\", \"surface\")}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {scene ? store.layers(scene, family) : null}\n {scene ? drawHover(scene, family, customTooltip) : null}\n </View>\n </View>\n {overlay && scene ? (\n <View\n pointerEvents=\"box-none\"\n style={{\n position: \"absolute\",\n left: scene.layout.plot.x,\n top: scene.layout.plot.y,\n width: scene.layout.plot.width,\n height: scene.layout.plot.height,\n }}\n {...part(\"chart\", \"overlay\")}\n >\n {overlay(scene.layout.plot)}\n </View>\n ) : null}\n {tooltip}\n </View>\n );\n}\n"],"mappings":"uYAyDA,IAAawB,EACX,IAgBkB,CAClB,OAAQC,EAAM,OACd,MAAOA,EAAM,MACb,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,YAAaA,EAAM,YACnB,YAAaA,EAAM,YACnB,QAASA,EAAM,QACf,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,OAAQA,EAAM,OACd,OAAQA,EAAM,MAChB,GAOMC,EAAiB,CAAC,EAUlBC,GAAQ,EAAe,IAAkB,CAC7C,IAAMC,EAAK,OAAOC,EAAE,UAAU,EAC9B,OAAO,OAAO,SAASD,CAAE,EAAIA,EAAKE,CACpC,EAIMC,EAAgB,GAAgC,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nB,EAAAA,KAAD,CAAM,cAAc,OAAO,MAAOO,EAAAA,WAAW,aAA7C,SAAA,CACGgD,EAAQF,EAAM,OAAOE,EAAOI,CAAM,EAAI,KACtCJ,EAAQ9C,EAAAA,UAAU8C,EAAOI,EAAQqB,CAAa,EAAI,IAC/C,GACF,CAAA,EACLe,GAAWxC,GACV,EAAApC,EAAA,IAAA,CAACnB,EAAAA,KAAD,CACE,cAAc,WACd,MAAO,CACL,SAAU,WACV,KAAMuD,EAAM,OAAO,KAAK,EACxB,IAAKA,EAAM,OAAO,KAAK,EACvB,MAAOA,EAAM,OAAO,KAAK,MACzB,OAAQA,EAAM,OAAO,KAAK,MAC5B,EACA,GAAItD,EAAAA,KAAK,QAAS,SAAS,EAE1B,SAAA8F,EAAQxC,EAAM,OAAO,IAAI,CACtB,CAAA,EACJ,KACHqC,CACG,GAEV"}
|
|
1
|
+
{"version":3,"file":"ChartBase.cjs","names":["createChartController","measureChartText","drawStatic","useState","View","part","tooltipCard","useTheme","useI18n","useMemo","chartThemeInput","useRef","StyleSheet","describeChart","drawHover","require_MinervaProvider","require_parts","require_labels","require_controller","require_measure","require_scene","require_theme","react","react_native","react_jsx_runtime","engineOptions","props","CUSTOM_TOOLTIP","idOf","id","t","index","requestFrame","callback","createChartStore","version","frame","listeners","cache","origin","touches","dragsPoints","o","draggable","options","claimed","notify","listener","cancelFrame","controller","size","local","sync","n","event","i","p","previous","store","next","scene","key","view","plot","family","value","active","changed","last","touch","base","CustomTooltip","setSize","left","anchor","top","width","height","w","h","ChartBase","handlers","fonts","theme","tokens","customTooltip","renderTooltip","resolved","localized","language","applied","current","handlersRef","offs","e","v","off","handleRef","onLayout","tooltip","content","style","overlay"],"sources":["../../../../../native/src/components/Chart/ChartBase.tsx"],"sourcesContent":["// The chart host of React Native: owns a platform-free chart controller\n// (@minerva/charts/canvas: options, model, zoom, gestures, scene in pixels)\n// and draws its scene with views (./scene). Touches go through the\n// responder system; the drawing is `pointerEvents=\"none\"`, so every touch\n// lands on the surface and positions come from page coordinates.\n\nimport {\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n StyleSheet,\n View,\n type DimensionValue,\n type GestureResponderEvent,\n type LayoutChangeEvent,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport {\n createChartController,\n describeChart,\n type ChartController,\n type ChartDragEvent,\n type ChartHoverEvent,\n type ChartOptions,\n type ChartPlotClickEvent,\n type ChartRect,\n type ChartScene,\n type ChartThemeInput,\n type ChartTooltipOptions,\n type ChartView,\n} from \"@minerva/charts/canvas\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { part } from \"../../internal/parts\";\nimport { measureChartText } from \"./measure\";\nimport { drawHover, drawStatic, tooltipCard } from \"./scene\";\nimport { chartThemeInput } from \"./theme\";\nimport type { ChartCommonProps, ChartHandle } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n | \"locale\"\n | \"labels\"\n > &\n Pick<ChartOptions, \"series\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n locale: props.locale,\n labels: props.labels,\n});\n\ntype TooltipResult = Exclude<\n ReturnType<NonNullable<ChartTooltipOptions[\"render\"]>>,\n string | null\n>;\n/** Non-string result of `tooltip.render`: the engine lays a tooltip out without drawing text */\nconst CUSTOM_TOOLTIP = {} as unknown as TooltipResult;\n\ninterface TouchPoint {\n identifier?: number | string;\n pageX: number;\n pageY: number;\n locationX?: number;\n locationY?: number;\n}\n\nconst idOf = (t: TouchPoint, index: number) => {\n const id = Number(t.identifier);\n return Number.isFinite(id) ? id : index;\n};\n\ntype Frame = { cancel: () => void };\n\nconst requestFrame = (callback: () => void): Frame => {\n if (typeof requestAnimationFrame === \"function\") {\n const id = requestAnimationFrame(callback);\n return { cancel: () => cancelAnimationFrame(id) };\n }\n const id = setTimeout(callback, 16);\n return { cancel: () => clearTimeout(id) };\n};\n\n/**\n * External store of a chart: the controller, a version bumped when its\n * scene must be drawn again (coalesced per frame), the touches being\n * tracked and the cache of the static layers.\n */\ninterface ChartStore {\n controller: ChartController;\n /** Options of the controller (`setOptions` of the controller) */\n setOptions: (options: ChartOptions) => void;\n subscribe: (listener: () => void) => () => void;\n version: () => number;\n /** Draws again now */\n commit: () => void;\n /** Static layers of a scene (cached while model / view / size are the same) */\n layers: (scene: ChartScene, family: string | undefined) => ReactNode;\n /** Last single-finger position (anchor of a custom tooltip) */\n anchor: { x: number; y: number } | null;\n /**\n * First finger (responder grant); returns whether the chart owns the\n * gesture, which keeps native scroll views from taking it (Android)\n */\n touchStart: (event: GestureResponderEvent) => boolean;\n /** Another finger touches the chart */\n touchAdd: (event: GestureResponderEvent) => void;\n /** Moves (drawn on the next frame) */\n touchMove: (event: GestureResponderEvent) => void;\n touchEnd: (event: GestureResponderEvent) => void;\n touchCancel: () => void;\n /** Whether the chart keeps the touches (pinch, point drag, pan when zoomed) */\n holdsGesture: () => boolean;\n}\n\nfunction createChartStore(\n options: ChartOptions,\n theme: ChartThemeInput,\n size: [number, number] | null,\n): ChartStore {\n let version = 0;\n let frame: Frame | null = null;\n const listeners = new Set<() => void>();\n let cache: { key: unknown[]; node: ReactNode } | null = null;\n let origin = { x: 0, y: 0 };\n const touches = new Map<number, { x: number; y: number }>();\n const dragsPoints = (o: ChartOptions) =>\n typeof o.interaction === \"object\" && !!o.interaction.dragPoints;\n let draggable = dragsPoints(options);\n /** The current touch sequence started on the plot of a draggable chart */\n let claimed = false;\n\n const notify = () => {\n version++;\n listeners.forEach((listener) => listener());\n };\n const cancelFrame = () => {\n frame?.cancel();\n frame = null;\n };\n const schedule = () => {\n if (frame || !listeners.size) return;\n frame = requestFrame(() => {\n frame = null;\n notify();\n });\n };\n\n const controller = createChartController({\n options,\n theme,\n measureText: measureChartText,\n onInvalidate: schedule,\n });\n if (size) controller.setSize(size[0], size[1]);\n\n const local = (t: TouchPoint) => ({\n x: t.pageX - origin.x,\n y: t.pageY - origin.y,\n });\n\n /** Feeds the controller the fingers that appeared or moved */\n const sync = (event: GestureResponderEvent) => {\n const n = event.nativeEvent;\n const list: readonly TouchPoint[] = n.touches?.length\n ? n.touches\n : [n as unknown as TouchPoint];\n list.forEach((t, i) => {\n const id = idOf(t, i);\n const p = local(t);\n const previous = touches.get(id);\n if (!previous) {\n touches.set(id, p);\n controller.pointerDown(p.x, p.y, { id, touch: true });\n } else if (previous.x !== p.x || previous.y !== p.y) {\n touches.set(id, p);\n controller.pointerMove(p.x, p.y, { id, touch: true });\n }\n });\n if (touches.size === 1) store.anchor = [...touches.values()][0];\n };\n\n const store: ChartStore = {\n controller,\n setOptions(next) {\n draggable = dragsPoints(next);\n controller.setOptions(next);\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n if (!listeners.size) cancelFrame();\n };\n },\n version: () => version,\n commit() {\n cancelFrame();\n notify();\n },\n layers(scene, family) {\n const { plot } = scene.layout;\n const { view } = scene;\n const key = [\n scene.model,\n scene.annotations,\n scene.theme,\n scene.width,\n scene.height,\n view.x[0],\n view.x[1],\n view.y[0],\n view.y[1],\n plot.x,\n plot.y,\n plot.width,\n plot.height,\n family,\n ];\n if (!cache || cache.key.some((value, i) => value !== key[i]))\n cache = { key, node: drawStatic(scene, family) };\n return cache.node;\n },\n anchor: null,\n touchStart(event) {\n const n = event.nativeEvent as unknown as TouchPoint;\n // the drawing ignores touches: `location` is relative to the surface\n if (!touches.size && n.locationX !== undefined)\n origin = { x: n.pageX - n.locationX, y: n.pageY - (n.locationY ?? 0) };\n sync(event);\n store.commit();\n // draggable points: the drag only starts after the touch slop, too\n // late to keep a scroll view from stealing the touch: claim it now\n const plot = controller.getPlotRect();\n const p = touches.values().next().value;\n claimed =\n draggable &&\n !!plot &&\n !!p &&\n p.x >= plot.x &&\n p.x <= plot.x + plot.width &&\n p.y >= plot.y &&\n p.y <= plot.y + plot.height;\n return store.holdsGesture();\n },\n touchAdd(event) {\n sync(event);\n store.commit();\n },\n touchMove: sync,\n touchEnd(event) {\n const n = event.nativeEvent;\n const active = new Set(\n (n.touches ?? []).map((t, i) => idOf(t as TouchPoint, i)),\n );\n const changed: readonly TouchPoint[] = n.changedTouches?.length\n ? n.changedTouches\n : [n as unknown as TouchPoint];\n for (const [id, last] of [...touches]) {\n if (active.has(id)) continue;\n const touch = changed.find((t, i) => idOf(t, i) === id);\n const p = touch ? local(touch) : last;\n touches.delete(id);\n if (touches.size === 0) store.anchor = p;\n controller.pointerUp(p.x, p.y, { id, touch: true });\n }\n store.commit();\n },\n touchCancel() {\n for (const id of touches.keys()) controller.pointerCancel({ id });\n touches.clear();\n store.commit();\n },\n holdsGesture() {\n if (touches.size > 1 || (claimed && touches.size > 0)) return true;\n const scene = controller.getScene();\n if (!scene) return false;\n if (scene.dragging) return true;\n const { base } = scene.model;\n const view = controller.getView();\n return (\n view.x[0] !== base.x[0] ||\n view.x[1] !== base.x[1] ||\n view.y[0] !== base.y[0] ||\n view.y[1] !== base.y[1]\n );\n },\n };\n return store;\n}\n\n/** A `renderTooltip` node, placed next to the finger once measured */\nfunction CustomTooltip({\n scene,\n anchor,\n children,\n}: {\n scene: ChartScene;\n anchor: { x: number; y: number };\n children: ReactNode;\n}) {\n const [size, setSize] = useState<{ width: number; height: number } | null>(\n null,\n );\n const { width, height } = scene;\n let left = anchor.x + 14;\n let top = anchor.y;\n if (size) {\n if (left + size.width > width - 4) left = anchor.x - 14 - size.width;\n left = Math.max(4, Math.min(left, width - size.width - 4));\n top = Math.max(\n 4,\n Math.min(anchor.y - size.height / 2, height - size.height - 4),\n );\n }\n return (\n <View\n pointerEvents=\"none\"\n {...part(\"chart\", \"tooltip\", { custom: true })}\n onLayout={(e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n setSize((previous) =>\n previous && previous.width === w && previous.height === h\n ? previous\n : { width: w, height: h },\n );\n }}\n style={[\n tooltipCard(scene),\n {\n // laid out at the origin (full width available), moved by a transform\n left: 0,\n top: 0,\n maxWidth: Math.max(0, width - 8),\n padding: 8,\n opacity: size ? 1 : 0,\n transform: [{ translateX: left }, { translateY: top }],\n },\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: DimensionValue;\n width?: DimensionValue;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n handleRef?: Ref<ChartHandle>;\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the plot area, given the plot rectangle */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\n/** Sizes the chart, forwards options / theme / touches to the controller and draws its scene */\nexport function ChartBase({\n options,\n height = 320,\n width = \"100%\",\n style,\n testID,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const { tokens, fonts } = useTheme();\n const { language } = useI18n();\n const family = fonts.sans;\n const theme = useMemo(() => chartThemeInput(tokens), [tokens]);\n const customTooltip = !!renderTooltip && options.tooltip !== false;\n const resolved = useMemo((): ChartOptions => {\n // The chart's own locale wins over the language of the provider.\n const localized = options.locale\n ? options\n : { ...options, locale: language };\n if (!customTooltip) return localized;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return {\n ...localized,\n tooltip: { ...base, render: () => CUSTOM_TOOLTIP },\n };\n }, [options, customTooltip, language]);\n\n const [store] = useState(() =>\n createChartStore(\n resolved,\n theme,\n typeof width === \"number\" && typeof height === \"number\"\n ? [width, height]\n : null,\n ),\n );\n const { controller } = store;\n useSyncExternalStore(store.subscribe, store.version, store.version);\n\n const applied = useRef({ options: resolved, theme });\n useLayoutEffect(() => {\n const current = applied.current;\n if (current.theme === theme && current.options === resolved) return;\n if (current.theme !== theme) controller.setTheme(theme);\n if (current.options !== resolved) store.setOptions(resolved);\n applied.current = { options: resolved, theme };\n store.commit();\n }, [controller, store, resolved, theme]);\n\n useLayoutEffect(() => {\n if (typeof width !== \"number\" || typeof height !== \"number\") return;\n const scene = controller.getScene();\n if (scene && scene.width === width && scene.height === height) return;\n controller.setSize(width, height);\n store.commit();\n }, [controller, store, width, height]);\n\n const handlersRef = useRef<Handlers>(handlers);\n useLayoutEffect(() => {\n handlersRef.current = handlers;\n });\n useEffect(() => {\n const h = handlersRef;\n const offs = [\n controller.on(\"hover\", (e) => h.current.onHover?.(e)),\n controller.on(\"click\", (e) => h.current.onPointClick?.(e)),\n controller.on(\"plotClick\", (e) => h.current.onPlotClick?.(e)),\n controller.on(\"zoom\", (v) => h.current.onZoom?.(v)),\n controller.on(\"drag\", (e) => h.current.onDrag?.(e)),\n controller.on(\"drop\", (e) => h.current.onDrop?.(e)),\n ];\n return () => offs.forEach((off) => off());\n }, [controller]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (view) => controller.setView(view),\n getPlotRect: () => controller.getPlotRect(),\n getController: () => controller,\n }),\n [controller],\n );\n\n const onLayout = (e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n const scene = controller.getScene();\n if (scene && scene.width === w && scene.height === h) return;\n controller.setSize(w, h);\n store.commit();\n };\n\n const scene = controller.getScene();\n let tooltip: ReactNode = null;\n const event = scene?.hover?.tooltip ? scene.hover.event : null;\n if (scene && event && customTooltip && renderTooltip) {\n const content = renderTooltip(event);\n const anchor = store.anchor ?? scene.hover?.marks[0] ?? null;\n if (\n content !== null &&\n content !== undefined &&\n content !== false &&\n anchor\n )\n tooltip = (\n <CustomTooltip scene={scene} anchor={anchor}>\n {content}\n </CustomTooltip>\n );\n }\n\n return (\n <View\n testID={testID}\n onLayout={onLayout}\n style={[{ width, height }, style]}\n {...part(\"chart\", \"root\")}\n >\n <View\n style={StyleSheet.absoluteFill}\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={\n resolved.ariaLabel ??\n describeChart({\n locale: resolved.locale,\n labels: resolved.labels,\n series: scene?.model.series,\n })\n }\n onStartShouldSetResponder={() => true}\n onResponderTerminationRequest={() => !store.holdsGesture()}\n onResponderGrant={store.touchStart}\n onResponderStart={store.touchAdd}\n onResponderMove={store.touchMove}\n onResponderEnd={store.touchEnd}\n onResponderRelease={store.touchEnd}\n onResponderTerminate={store.touchCancel}\n {...part(\"chart\", \"surface\")}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {scene ? store.layers(scene, family) : null}\n {scene ? drawHover(scene, family, customTooltip) : null}\n </View>\n </View>\n {overlay && scene ? (\n <View\n pointerEvents=\"box-none\"\n style={{\n position: \"absolute\",\n left: scene.layout.plot.x,\n top: scene.layout.plot.y,\n width: scene.layout.plot.width,\n height: scene.layout.plot.height,\n }}\n {...part(\"chart\", \"overlay\")}\n >\n {overlay(scene.layout.plot)}\n </View>\n ) : null}\n {tooltip}\n </View>\n );\n}\n"],"mappings":"uYAyDA,IAAayB,EACX,IAgBkB,CAClB,OAAQC,EAAM,OACd,MAAOA,EAAM,MACb,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,YAAaA,EAAM,YACnB,YAAaA,EAAM,YACnB,QAASA,EAAM,QACf,QAASA,EAAM,QACf,U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kB,QAClB,mBACE2E,EAAS,WACT1E,EAAAA,cAAc,CACZ,OAAQ0E,EAAS,OACjB,OAAQA,EAAS,OACjB,OAAQ3B,GAAO,MAAM,MACvB,CAAC,EAEH,8BAAiC,GACjC,kCAAqC,CAACF,EAAM,aAAa,EACzD,iBAAkBA,EAAM,WACxB,iBAAkBA,EAAM,SACxB,gBAAiBA,EAAM,UACvB,eAAgBA,EAAM,SACtB,mBAAoBA,EAAM,SAC1B,qBAAsBA,EAAM,YAC5B,GAAIrD,EAAAA,KAAK,QAAS,SAAS,EAE3B,UAAA,EAAAmB,EAAA,KAAA,CAACpB,EAAAA,KAAD,CAAM,cAAc,OAAO,MAAOQ,EAAAA,WAAW,aAA7C,SAAA,CACGgD,EAAQF,EAAM,OAAOE,EAAOI,CAAM,EAAI,KACtCJ,EAAQ9C,EAAAA,UAAU8C,EAAOI,EAAQqB,CAAa,EAAI,IAC/C,GACF,CAAA,EACLiB,GAAW1C,GACV,EAAApC,EAAA,IAAA,CAACpB,EAAAA,KAAD,CACE,cAAc,WACd,MAAO,CACL,SAAU,WACV,KAAMwD,EAAM,OAAO,KAAK,EACxB,IAAKA,EAAM,OAAO,KAAK,EACvB,MAAOA,EAAM,OAAO,KAAK,MACzB,OAAQA,EAAM,OAAO,KAAK,MAC5B,EACA,GAAIvD,EAAAA,KAAK,QAAS,SAAS,EAE1B,SAAAiG,EAAQ1C,EAAM,OAAO,IAAI,CACtB,CAAA,EACJ,KACHuC,CACG,GAEV"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { part as
|
|
3
|
-
import {
|
|
4
|
-
import { createChartController as
|
|
1
|
+
import { useI18n as e, useTheme as t } from "../../theme/MinervaProvider.js";
|
|
2
|
+
import { part as n } from "../../internal/parts.js";
|
|
3
|
+
import { describeChart as r } from "../../charts/src/engine/labels.js";
|
|
4
|
+
import { createChartController as i } from "../../charts/src/engine/controller.js";
|
|
5
5
|
import "../../charts/src/canvas.js";
|
|
6
|
-
import { measureChartText as
|
|
7
|
-
import { drawHover as
|
|
8
|
-
import { chartThemeInput as
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { StyleSheet as
|
|
11
|
-
import { jsx as
|
|
6
|
+
import { measureChartText as a } from "./measure.js";
|
|
7
|
+
import { drawHover as o, drawStatic as s, tooltipCard as c } from "./scene.js";
|
|
8
|
+
import { chartThemeInput as l } from "./theme.js";
|
|
9
|
+
import { useEffect as u, useImperativeHandle as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
10
|
+
import { StyleSheet as _, View as v } from "react-native";
|
|
11
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/Chart/ChartBase.tsx
|
|
13
|
-
var
|
|
13
|
+
var x = (e) => ({
|
|
14
14
|
series: e.series,
|
|
15
15
|
xAxis: e.xAxis,
|
|
16
16
|
yAxis: e.yAxis,
|
|
@@ -24,10 +24,10 @@ var b = (e) => ({
|
|
|
24
24
|
ariaLabel: e.ariaLabel,
|
|
25
25
|
locale: e.locale,
|
|
26
26
|
labels: e.labels
|
|
27
|
-
}),
|
|
27
|
+
}), S = {}, C = (e, t) => {
|
|
28
28
|
let n = Number(e.identifier);
|
|
29
29
|
return Number.isFinite(n) ? n : t;
|
|
30
|
-
},
|
|
30
|
+
}, w = (e) => {
|
|
31
31
|
if (typeof requestAnimationFrame == "function") {
|
|
32
32
|
let t = requestAnimationFrame(e);
|
|
33
33
|
return { cancel: () => cancelAnimationFrame(t) };
|
|
@@ -35,21 +35,21 @@ var b = (e) => ({
|
|
|
35
35
|
let t = setTimeout(e, 16);
|
|
36
36
|
return { cancel: () => clearTimeout(t) };
|
|
37
37
|
};
|
|
38
|
-
function
|
|
39
|
-
let
|
|
38
|
+
function T(e, t, n) {
|
|
39
|
+
let r = 0, o = null, c = /* @__PURE__ */ new Set(), l = null, u = {
|
|
40
40
|
x: 0,
|
|
41
41
|
y: 0
|
|
42
42
|
}, d = /* @__PURE__ */ new Map(), f = (e) => typeof e.interaction == "object" && !!e.interaction.dragPoints, p = f(e), m = !1, h = () => {
|
|
43
|
-
|
|
43
|
+
r++, c.forEach((e) => e());
|
|
44
44
|
}, g = () => {
|
|
45
|
-
|
|
46
|
-
}, _ =
|
|
45
|
+
o?.cancel(), o = null;
|
|
46
|
+
}, _ = i({
|
|
47
47
|
options: e,
|
|
48
48
|
theme: t,
|
|
49
|
-
measureText:
|
|
49
|
+
measureText: a,
|
|
50
50
|
onInvalidate: () => {
|
|
51
|
-
!
|
|
52
|
-
|
|
51
|
+
!o && c.size && (o = w(() => {
|
|
52
|
+
o = null, h();
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -60,7 +60,7 @@ function w(e, t, n) {
|
|
|
60
60
|
}), y = (e) => {
|
|
61
61
|
let t = e.nativeEvent;
|
|
62
62
|
(t.touches?.length ? t.touches : [t]).forEach((e, t) => {
|
|
63
|
-
let n =
|
|
63
|
+
let n = C(e, t), r = v(e), i = d.get(n);
|
|
64
64
|
i ? (i.x !== r.x || i.y !== r.y) && (d.set(n, r), _.pointerMove(r.x, r.y, {
|
|
65
65
|
id: n,
|
|
66
66
|
touch: !0
|
|
@@ -79,7 +79,7 @@ function w(e, t, n) {
|
|
|
79
79
|
c.delete(e), c.size || g();
|
|
80
80
|
};
|
|
81
81
|
},
|
|
82
|
-
version: () =>
|
|
82
|
+
version: () => r,
|
|
83
83
|
commit() {
|
|
84
84
|
g(), h();
|
|
85
85
|
},
|
|
@@ -102,7 +102,7 @@ function w(e, t, n) {
|
|
|
102
102
|
];
|
|
103
103
|
return (!l || l.key.some((e, t) => e !== i[t])) && (l = {
|
|
104
104
|
key: i,
|
|
105
|
-
node:
|
|
105
|
+
node: s(e, t)
|
|
106
106
|
}), l.node;
|
|
107
107
|
},
|
|
108
108
|
anchor: null,
|
|
@@ -120,10 +120,10 @@ function w(e, t, n) {
|
|
|
120
120
|
},
|
|
121
121
|
touchMove: y,
|
|
122
122
|
touchEnd(e) {
|
|
123
|
-
let t = e.nativeEvent, n = new Set((t.touches ?? []).map((e, t) =>
|
|
123
|
+
let t = e.nativeEvent, n = new Set((t.touches ?? []).map((e, t) => C(e, t))), r = t.changedTouches?.length ? t.changedTouches : [t];
|
|
124
124
|
for (let [e, t] of [...d]) {
|
|
125
125
|
if (n.has(e)) continue;
|
|
126
|
-
let i = r.find((t, n) =>
|
|
126
|
+
let i = r.find((t, n) => C(t, n) === e), a = i ? v(i) : t;
|
|
127
127
|
d.delete(e), d.size === 0 && (b.anchor = a), _.pointerUp(a.x, a.y, {
|
|
128
128
|
id: e,
|
|
129
129
|
touch: !0
|
|
@@ -146,11 +146,11 @@ function w(e, t, n) {
|
|
|
146
146
|
};
|
|
147
147
|
return b;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
let [i, a] =
|
|
151
|
-
return i && (l + i.width > o - 4 && (l =
|
|
149
|
+
function E({ scene: e, anchor: t, children: r }) {
|
|
150
|
+
let [i, a] = h(null), { width: o, height: s } = e, l = t.x + 14, u = t.y;
|
|
151
|
+
return i && (l + i.width > o - 4 && (l = t.x - 14 - i.width), l = Math.max(4, Math.min(l, o - i.width - 4)), u = Math.max(4, Math.min(t.y - i.height / 2, s - i.height - 4))), /* @__PURE__ */ y(v, {
|
|
152
152
|
pointerEvents: "none",
|
|
153
|
-
...
|
|
153
|
+
...n("chart", "tooltip", { custom: !0 }),
|
|
154
154
|
onLayout: (e) => {
|
|
155
155
|
let { width: t, height: n } = e.nativeEvent.layout;
|
|
156
156
|
a((e) => e && e.width === t && e.height === n ? e : {
|
|
@@ -158,7 +158,7 @@ function T({ scene: e, anchor: n, children: r }) {
|
|
|
158
158
|
height: n
|
|
159
159
|
});
|
|
160
160
|
},
|
|
161
|
-
style: [
|
|
161
|
+
style: [c(e), {
|
|
162
162
|
left: 0,
|
|
163
163
|
top: 0,
|
|
164
164
|
maxWidth: Math.max(0, o - 8),
|
|
@@ -169,122 +169,134 @@ function T({ scene: e, anchor: n, children: r }) {
|
|
|
169
169
|
children: r
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
let { tokens:
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
function D({ options: i, height: a = 320, width: s = "100%", style: c, testID: x, handleRef: C, renderTooltip: w, overlay: D, ...O }) {
|
|
173
|
+
let { tokens: k, fonts: A } = t(), { language: j } = e(), M = A.sans, N = p(() => l(k), [k]), P = !!w && i.tooltip !== !1, F = p(() => {
|
|
174
|
+
let e = i.locale ? i : {
|
|
175
|
+
...i,
|
|
176
|
+
locale: j
|
|
177
|
+
};
|
|
178
|
+
if (!P) return e;
|
|
179
|
+
let t = typeof i.tooltip == "object" ? i.tooltip : {};
|
|
176
180
|
return {
|
|
177
|
-
...
|
|
181
|
+
...e,
|
|
178
182
|
tooltip: {
|
|
179
|
-
...
|
|
180
|
-
render: () =>
|
|
183
|
+
...t,
|
|
184
|
+
render: () => S
|
|
181
185
|
}
|
|
182
186
|
};
|
|
183
|
-
}, [r, M]), [P] = m(() => w(N, j, typeof o == "number" && typeof i == "number" ? [o, i] : null)), { controller: F } = P;
|
|
184
|
-
h(P.subscribe, P.version, P.version);
|
|
185
|
-
let I = p({
|
|
186
|
-
options: N,
|
|
187
|
-
theme: j
|
|
188
|
-
});
|
|
189
|
-
d(() => {
|
|
190
|
-
let e = I.current;
|
|
191
|
-
(e.theme !== j || e.options !== N) && (e.theme !== j && F.setTheme(j), e.options !== N && P.setOptions(N), I.current = {
|
|
192
|
-
options: N,
|
|
193
|
-
theme: j
|
|
194
|
-
}, P.commit());
|
|
195
187
|
}, [
|
|
196
|
-
|
|
188
|
+
i,
|
|
197
189
|
P,
|
|
198
|
-
N,
|
|
199
190
|
j
|
|
200
|
-
]),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
191
|
+
]), [I] = h(() => T(F, N, typeof s == "number" && typeof a == "number" ? [s, a] : null)), { controller: L } = I;
|
|
192
|
+
g(I.subscribe, I.version, I.version);
|
|
193
|
+
let R = m({
|
|
194
|
+
options: F,
|
|
195
|
+
theme: N
|
|
196
|
+
});
|
|
197
|
+
f(() => {
|
|
198
|
+
let e = R.current;
|
|
199
|
+
(e.theme !== N || e.options !== F) && (e.theme !== N && L.setTheme(N), e.options !== F && I.setOptions(F), R.current = {
|
|
200
|
+
options: F,
|
|
201
|
+
theme: N
|
|
202
|
+
}, I.commit());
|
|
204
203
|
}, [
|
|
204
|
+
L,
|
|
205
|
+
I,
|
|
205
206
|
F,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
N
|
|
208
|
+
]), f(() => {
|
|
209
|
+
if (typeof s != "number" || typeof a != "number") return;
|
|
210
|
+
let e = L.getScene();
|
|
211
|
+
e && e.width === s && e.height === a || (L.setSize(s, a), I.commit());
|
|
212
|
+
}, [
|
|
213
|
+
L,
|
|
214
|
+
I,
|
|
215
|
+
s,
|
|
216
|
+
a
|
|
209
217
|
]);
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}),
|
|
214
|
-
let e =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
let z = m(O);
|
|
219
|
+
f(() => {
|
|
220
|
+
z.current = O;
|
|
221
|
+
}), u(() => {
|
|
222
|
+
let e = z, t = [
|
|
223
|
+
L.on("hover", (t) => e.current.onHover?.(t)),
|
|
224
|
+
L.on("click", (t) => e.current.onPointClick?.(t)),
|
|
225
|
+
L.on("plotClick", (t) => e.current.onPlotClick?.(t)),
|
|
226
|
+
L.on("zoom", (t) => e.current.onZoom?.(t)),
|
|
227
|
+
L.on("drag", (t) => e.current.onDrag?.(t)),
|
|
228
|
+
L.on("drop", (t) => e.current.onDrop?.(t))
|
|
221
229
|
];
|
|
222
230
|
return () => t.forEach((e) => e());
|
|
223
|
-
}, [
|
|
224
|
-
resetZoom: () =>
|
|
225
|
-
getView: () =>
|
|
226
|
-
setView: (e) =>
|
|
227
|
-
getPlotRect: () =>
|
|
228
|
-
getController: () =>
|
|
229
|
-
}), [
|
|
230
|
-
let
|
|
231
|
-
let { width: t, height: n } = e.nativeEvent.layout, r =
|
|
232
|
-
r && r.width === t && r.height === n || (
|
|
233
|
-
},
|
|
234
|
-
if (
|
|
235
|
-
let e =
|
|
236
|
-
e != null && e !== !1 && t && (
|
|
237
|
-
scene:
|
|
231
|
+
}, [L]), d(C, () => ({
|
|
232
|
+
resetZoom: () => L.resetZoom(),
|
|
233
|
+
getView: () => L.getView(),
|
|
234
|
+
setView: (e) => L.setView(e),
|
|
235
|
+
getPlotRect: () => L.getPlotRect(),
|
|
236
|
+
getController: () => L
|
|
237
|
+
}), [L]);
|
|
238
|
+
let B = (e) => {
|
|
239
|
+
let { width: t, height: n } = e.nativeEvent.layout, r = L.getScene();
|
|
240
|
+
r && r.width === t && r.height === n || (L.setSize(t, n), I.commit());
|
|
241
|
+
}, V = L.getScene(), H = null, U = V?.hover?.tooltip ? V.hover.event : null;
|
|
242
|
+
if (V && U && P && w) {
|
|
243
|
+
let e = w(U), t = I.anchor ?? V.hover?.marks[0] ?? null;
|
|
244
|
+
e != null && e !== !1 && t && (H = /* @__PURE__ */ y(E, {
|
|
245
|
+
scene: V,
|
|
238
246
|
anchor: t,
|
|
239
247
|
children: e
|
|
240
248
|
}));
|
|
241
249
|
}
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
testID:
|
|
244
|
-
onLayout:
|
|
250
|
+
return /* @__PURE__ */ b(v, {
|
|
251
|
+
testID: x,
|
|
252
|
+
onLayout: B,
|
|
245
253
|
style: [{
|
|
246
|
-
width:
|
|
247
|
-
height:
|
|
248
|
-
},
|
|
249
|
-
...
|
|
254
|
+
width: s,
|
|
255
|
+
height: a
|
|
256
|
+
}, c],
|
|
257
|
+
...n("chart", "root"),
|
|
250
258
|
children: [
|
|
251
|
-
/* @__PURE__ */ v
|
|
252
|
-
style:
|
|
259
|
+
/* @__PURE__ */ y(v, {
|
|
260
|
+
style: _.absoluteFill,
|
|
253
261
|
accessible: !0,
|
|
254
262
|
accessibilityRole: "image",
|
|
255
|
-
accessibilityLabel:
|
|
263
|
+
accessibilityLabel: F.ariaLabel ?? r({
|
|
264
|
+
locale: F.locale,
|
|
265
|
+
labels: F.labels,
|
|
266
|
+
series: V?.model.series
|
|
267
|
+
}),
|
|
256
268
|
onStartShouldSetResponder: () => !0,
|
|
257
|
-
onResponderTerminationRequest: () => !
|
|
258
|
-
onResponderGrant:
|
|
259
|
-
onResponderStart:
|
|
260
|
-
onResponderMove:
|
|
261
|
-
onResponderEnd:
|
|
262
|
-
onResponderRelease:
|
|
263
|
-
onResponderTerminate:
|
|
264
|
-
...
|
|
265
|
-
children: /* @__PURE__ */
|
|
269
|
+
onResponderTerminationRequest: () => !I.holdsGesture(),
|
|
270
|
+
onResponderGrant: I.touchStart,
|
|
271
|
+
onResponderStart: I.touchAdd,
|
|
272
|
+
onResponderMove: I.touchMove,
|
|
273
|
+
onResponderEnd: I.touchEnd,
|
|
274
|
+
onResponderRelease: I.touchEnd,
|
|
275
|
+
onResponderTerminate: I.touchCancel,
|
|
276
|
+
...n("chart", "surface"),
|
|
277
|
+
children: /* @__PURE__ */ b(v, {
|
|
266
278
|
pointerEvents: "none",
|
|
267
|
-
style:
|
|
268
|
-
children: [
|
|
279
|
+
style: _.absoluteFill,
|
|
280
|
+
children: [V ? I.layers(V, M) : null, V ? o(V, M, P) : null]
|
|
269
281
|
})
|
|
270
282
|
}),
|
|
271
|
-
|
|
283
|
+
D && V ? /* @__PURE__ */ y(v, {
|
|
272
284
|
pointerEvents: "box-none",
|
|
273
285
|
style: {
|
|
274
286
|
position: "absolute",
|
|
275
|
-
left:
|
|
276
|
-
top:
|
|
277
|
-
width:
|
|
278
|
-
height:
|
|
287
|
+
left: V.layout.plot.x,
|
|
288
|
+
top: V.layout.plot.y,
|
|
289
|
+
width: V.layout.plot.width,
|
|
290
|
+
height: V.layout.plot.height
|
|
279
291
|
},
|
|
280
|
-
...
|
|
281
|
-
children:
|
|
292
|
+
...n("chart", "overlay"),
|
|
293
|
+
children: D(V.layout.plot)
|
|
282
294
|
}) : null,
|
|
283
|
-
|
|
295
|
+
H
|
|
284
296
|
]
|
|
285
297
|
});
|
|
286
298
|
}
|
|
287
299
|
//#endregion
|
|
288
|
-
export {
|
|
300
|
+
export { D as ChartBase, x as engineOptions };
|
|
289
301
|
|
|
290
302
|
//# sourceMappingURL=ChartBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartBase.js","names":["engineOptions","props","CUSTOM_TOOLTIP","idOf","id","t","index","requestFrame","callback","createChartStore","version","frame","listeners","cache","origin","touches","dragsPoints","o","draggable","options","claimed","notify","listener","cancelFrame","controller","createChartController","measureChartText","size","local","sync","n","event","i","p","previous","store","next","scene","key","view","plot","family","value","drawStatic","active","changed","last","touch","base","CustomTooltip","setSize","useState","left","anchor","top","width","height","View","part","w","h","tooltipCard","ChartBase","handlers","useTheme","fonts","theme","useMemo","chartThemeInput","tokens","customTooltip","renderTooltip","resolved","applied","useRef","useLayoutEffect","current","handlersRef","useEffect","offs","e","v","off","useImperativeHandle","handleRef","onLayout","tooltip","content","style","StyleSheet","chartAriaLabel","drawHover","overlay"],"sources":["../../../../../native/src/components/Chart/ChartBase.tsx"],"sourcesContent":["// The chart host of React Native: owns a platform-free chart controller\n// (@minerva/charts/canvas: options, model, zoom, gestures, scene in pixels)\n// and draws its scene with views (./scene). Touches go through the\n// responder system; the drawing is `pointerEvents=\"none\"`, so every touch\n// lands on the surface and positions come from page coordinates.\n\nimport {\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n StyleSheet,\n View,\n type DimensionValue,\n type GestureResponderEvent,\n type LayoutChangeEvent,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport {\n chartAriaLabel,\n createChartController,\n type ChartController,\n type ChartDragEvent,\n type ChartHoverEvent,\n type ChartOptions,\n type ChartPlotClickEvent,\n type ChartRect,\n type ChartScene,\n type ChartThemeInput,\n type ChartTooltipOptions,\n type ChartView,\n} from \"@minerva/charts/canvas\";\nimport { useTheme } from \"../../theme/MinervaProvider\";\nimport { part } from \"../../internal/parts\";\nimport { measureChartText } from \"./measure\";\nimport { drawHover, drawStatic, tooltipCard } from \"./scene\";\nimport { chartThemeInput } from \"./theme\";\nimport type { ChartCommonProps, ChartHandle } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n | \"locale\"\n | \"labels\"\n > &\n Pick<ChartOptions, \"series\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n locale: props.locale,\n labels: props.labels,\n});\n\ntype TooltipResult = Exclude<\n ReturnType<NonNullable<ChartTooltipOptions[\"render\"]>>,\n string | null\n>;\n/** Non-string result of `tooltip.render`: the engine lays a tooltip out without drawing text */\nconst CUSTOM_TOOLTIP = {} as unknown as TooltipResult;\n\ninterface TouchPoint {\n identifier?: number | string;\n pageX: number;\n pageY: number;\n locationX?: number;\n locationY?: number;\n}\n\nconst idOf = (t: TouchPoint, index: number) => {\n const id = Number(t.identifier);\n return Number.isFinite(id) ? id : index;\n};\n\ntype Frame = { cancel: () => void };\n\nconst requestFrame = (callback: () => void): Frame => {\n if (typeof requestAnimationFrame === \"function\") {\n const id = requestAnimationFrame(callback);\n return { cancel: () => cancelAnimationFrame(id) };\n }\n const id = setTimeout(callback, 16);\n return { cancel: () => clearTimeout(id) };\n};\n\n/**\n * External store of a chart: the controller, a version bumped when its\n * scene must be drawn again (coalesced per frame), the touches being\n * tracked and the cache of the static layers.\n */\ninterface ChartStore {\n controller: ChartController;\n /** Options of the controller (`setOptions` of the controller) */\n setOptions: (options: ChartOptions) => void;\n subscribe: (listener: () => void) => () => void;\n version: () => number;\n /** Draws again now */\n commit: () => void;\n /** Static layers of a scene (cached while model / view / size are the same) */\n layers: (scene: ChartScene, family: string | undefined) => ReactNode;\n /** Last single-finger position (anchor of a custom tooltip) */\n anchor: { x: number; y: number } | null;\n /**\n * First finger (responder grant); returns whether the chart owns the\n * gesture, which keeps native scroll views from taking it (Android)\n */\n touchStart: (event: GestureResponderEvent) => boolean;\n /** Another finger touches the chart */\n touchAdd: (event: GestureResponderEvent) => void;\n /** Moves (drawn on the next frame) */\n touchMove: (event: GestureResponderEvent) => void;\n touchEnd: (event: GestureResponderEvent) => void;\n touchCancel: () => void;\n /** Whether the chart keeps the touches (pinch, point drag, pan when zoomed) */\n holdsGesture: () => boolean;\n}\n\nfunction createChartStore(\n options: ChartOptions,\n theme: ChartThemeInput,\n size: [number, number] | null,\n): ChartStore {\n let version = 0;\n let frame: Frame | null = null;\n const listeners = new Set<() => void>();\n let cache: { key: unknown[]; node: ReactNode } | null = null;\n let origin = { x: 0, y: 0 };\n const touches = new Map<number, { x: number; y: number }>();\n const dragsPoints = (o: ChartOptions) =>\n typeof o.interaction === \"object\" && !!o.interaction.dragPoints;\n let draggable = dragsPoints(options);\n /** The current touch sequence started on the plot of a draggable chart */\n let claimed = false;\n\n const notify = () => {\n version++;\n listeners.forEach((listener) => listener());\n };\n const cancelFrame = () => {\n frame?.cancel();\n frame = null;\n };\n const schedule = () => {\n if (frame || !listeners.size) return;\n frame = requestFrame(() => {\n frame = null;\n notify();\n });\n };\n\n const controller = createChartController({\n options,\n theme,\n measureText: measureChartText,\n onInvalidate: schedule,\n });\n if (size) controller.setSize(size[0], size[1]);\n\n const local = (t: TouchPoint) => ({\n x: t.pageX - origin.x,\n y: t.pageY - origin.y,\n });\n\n /** Feeds the controller the fingers that appeared or moved */\n const sync = (event: GestureResponderEvent) => {\n const n = event.nativeEvent;\n const list: readonly TouchPoint[] = n.touches?.length\n ? n.touches\n : [n as unknown as TouchPoint];\n list.forEach((t, i) => {\n const id = idOf(t, i);\n const p = local(t);\n const previous = touches.get(id);\n if (!previous) {\n touches.set(id, p);\n controller.pointerDown(p.x, p.y, { id, touch: true });\n } else if (previous.x !== p.x || previous.y !== p.y) {\n touches.set(id, p);\n controller.pointerMove(p.x, p.y, { id, touch: true });\n }\n });\n if (touches.size === 1) store.anchor = [...touches.values()][0];\n };\n\n const store: ChartStore = {\n controller,\n setOptions(next) {\n draggable = dragsPoints(next);\n controller.setOptions(next);\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n if (!listeners.size) cancelFrame();\n };\n },\n version: () => version,\n commit() {\n cancelFrame();\n notify();\n },\n layers(scene, family) {\n const { plot } = scene.layout;\n const { view } = scene;\n const key = [\n scene.model,\n scene.annotations,\n scene.theme,\n scene.width,\n scene.height,\n view.x[0],\n view.x[1],\n view.y[0],\n view.y[1],\n plot.x,\n plot.y,\n plot.width,\n plot.height,\n family,\n ];\n if (!cache || cache.key.some((value, i) => value !== key[i]))\n cache = { key, node: drawStatic(scene, family) };\n return cache.node;\n },\n anchor: null,\n touchStart(event) {\n const n = event.nativeEvent as unknown as TouchPoint;\n // the drawing ignores touches: `location` is relative to the surface\n if (!touches.size && n.locationX !== undefined)\n origin = { x: n.pageX - n.locationX, y: n.pageY - (n.locationY ?? 0) };\n sync(event);\n store.commit();\n // draggable points: the drag only starts after the touch slop, too\n // late to keep a scroll view from stealing the touch: claim it now\n const plot = controller.getPlotRect();\n const p = touches.values().next().value;\n claimed =\n draggable &&\n !!plot &&\n !!p &&\n p.x >= plot.x &&\n p.x <= plot.x + plot.width &&\n p.y >= plot.y &&\n p.y <= plot.y + plot.height;\n return store.holdsGesture();\n },\n touchAdd(event) {\n sync(event);\n store.commit();\n },\n touchMove: sync,\n touchEnd(event) {\n const n = event.nativeEvent;\n const active = new Set(\n (n.touches ?? []).map((t, i) => idOf(t as TouchPoint, i)),\n );\n const changed: readonly TouchPoint[] = n.changedTouches?.length\n ? n.changedTouches\n : [n as unknown as TouchPoint];\n for (const [id, last] of [...touches]) {\n if (active.has(id)) continue;\n const touch = changed.find((t, i) => idOf(t, i) === id);\n const p = touch ? local(touch) : last;\n touches.delete(id);\n if (touches.size === 0) store.anchor = p;\n controller.pointerUp(p.x, p.y, { id, touch: true });\n }\n store.commit();\n },\n touchCancel() {\n for (const id of touches.keys()) controller.pointerCancel({ id });\n touches.clear();\n store.commit();\n },\n holdsGesture() {\n if (touches.size > 1 || (claimed && touches.size > 0)) return true;\n const scene = controller.getScene();\n if (!scene) return false;\n if (scene.dragging) return true;\n const { base } = scene.model;\n const view = controller.getView();\n return (\n view.x[0] !== base.x[0] ||\n view.x[1] !== base.x[1] ||\n view.y[0] !== base.y[0] ||\n view.y[1] !== base.y[1]\n );\n },\n };\n return store;\n}\n\n/** A `renderTooltip` node, placed next to the finger once measured */\nfunction CustomTooltip({\n scene,\n anchor,\n children,\n}: {\n scene: ChartScene;\n anchor: { x: number; y: number };\n children: ReactNode;\n}) {\n const [size, setSize] = useState<{ width: number; height: number } | null>(\n null,\n );\n const { width, height } = scene;\n let left = anchor.x + 14;\n let top = anchor.y;\n if (size) {\n if (left + size.width > width - 4) left = anchor.x - 14 - size.width;\n left = Math.max(4, Math.min(left, width - size.width - 4));\n top = Math.max(\n 4,\n Math.min(anchor.y - size.height / 2, height - size.height - 4),\n );\n }\n return (\n <View\n pointerEvents=\"none\"\n {...part(\"chart\", \"tooltip\", { custom: true })}\n onLayout={(e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n setSize((previous) =>\n previous && previous.width === w && previous.height === h\n ? previous\n : { width: w, height: h },\n );\n }}\n style={[\n tooltipCard(scene),\n {\n // laid out at the origin (full width available), moved by a transform\n left: 0,\n top: 0,\n maxWidth: Math.max(0, width - 8),\n padding: 8,\n opacity: size ? 1 : 0,\n transform: [{ translateX: left }, { translateY: top }],\n },\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: DimensionValue;\n width?: DimensionValue;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n handleRef?: Ref<ChartHandle>;\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the plot area, given the plot rectangle */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\n/** Sizes the chart, forwards options / theme / touches to the controller and draws its scene */\nexport function ChartBase({\n options,\n height = 320,\n width = \"100%\",\n style,\n testID,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const { tokens, fonts } = useTheme();\n const family = fonts.sans;\n const theme = useMemo(() => chartThemeInput(tokens), [tokens]);\n const customTooltip = !!renderTooltip && options.tooltip !== false;\n const resolved = useMemo((): ChartOptions => {\n if (!customTooltip) return options;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return { ...options, tooltip: { ...base, render: () => CUSTOM_TOOLTIP } };\n }, [options, customTooltip]);\n\n const [store] = useState(() =>\n createChartStore(\n resolved,\n theme,\n typeof width === \"number\" && typeof height === \"number\"\n ? [width, height]\n : null,\n ),\n );\n const { controller } = store;\n useSyncExternalStore(store.subscribe, store.version, store.version);\n\n const applied = useRef({ options: resolved, theme });\n useLayoutEffect(() => {\n const current = applied.current;\n if (current.theme === theme && current.options === resolved) return;\n if (current.theme !== theme) controller.setTheme(theme);\n if (current.options !== resolved) store.setOptions(resolved);\n applied.current = { options: resolved, theme };\n store.commit();\n }, [controller, store, resolved, theme]);\n\n useLayoutEffect(() => {\n if (typeof width !== \"number\" || typeof height !== \"number\") return;\n const scene = controller.getScene();\n if (scene && scene.width === width && scene.height === height) return;\n controller.setSize(width, height);\n store.commit();\n }, [controller, store, width, height]);\n\n const handlersRef = useRef<Handlers>(handlers);\n useLayoutEffect(() => {\n handlersRef.current = handlers;\n });\n useEffect(() => {\n const h = handlersRef;\n const offs = [\n controller.on(\"hover\", (e) => h.current.onHover?.(e)),\n controller.on(\"click\", (e) => h.current.onPointClick?.(e)),\n controller.on(\"plotClick\", (e) => h.current.onPlotClick?.(e)),\n controller.on(\"zoom\", (v) => h.current.onZoom?.(v)),\n controller.on(\"drag\", (e) => h.current.onDrag?.(e)),\n controller.on(\"drop\", (e) => h.current.onDrop?.(e)),\n ];\n return () => offs.forEach((off) => off());\n }, [controller]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (view) => controller.setView(view),\n getPlotRect: () => controller.getPlotRect(),\n getController: () => controller,\n }),\n [controller],\n );\n\n const onLayout = (e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n const scene = controller.getScene();\n if (scene && scene.width === w && scene.height === h) return;\n controller.setSize(w, h);\n store.commit();\n };\n\n const scene = controller.getScene();\n let tooltip: ReactNode = null;\n const event = scene?.hover?.tooltip ? scene.hover.event : null;\n if (scene && event && customTooltip && renderTooltip) {\n const content = renderTooltip(event);\n const anchor = store.anchor ?? scene.hover?.marks[0] ?? null;\n if (\n content !== null &&\n content !== undefined &&\n content !== false &&\n anchor\n )\n tooltip = (\n <CustomTooltip scene={scene} anchor={anchor}>\n {content}\n </CustomTooltip>\n );\n }\n\n return (\n <View\n testID={testID}\n onLayout={onLayout}\n style={[{ width, height }, style]}\n {...part(\"chart\", \"root\")}\n >\n <View\n style={StyleSheet.absoluteFill}\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={\n options.ariaLabel ?? (scene ? chartAriaLabel(scene.model) : undefined)\n }\n onStartShouldSetResponder={() => true}\n onResponderTerminationRequest={() => !store.holdsGesture()}\n onResponderGrant={store.touchStart}\n onResponderStart={store.touchAdd}\n onResponderMove={store.touchMove}\n onResponderEnd={store.touchEnd}\n onResponderRelease={store.touchEnd}\n onResponderTerminate={store.touchCancel}\n {...part(\"chart\", \"surface\")}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {scene ? store.layers(scene, family) : null}\n {scene ? drawHover(scene, family, customTooltip) : null}\n </View>\n </View>\n {overlay && scene ? (\n <View\n pointerEvents=\"box-none\"\n style={{\n position: \"absolute\",\n left: scene.layout.plot.x,\n top: scene.layout.plot.y,\n width: scene.layout.plot.width,\n height: scene.layout.plot.height,\n }}\n {...part(\"chart\", \"overlay\")}\n >\n {overlay(scene.layout.plot)}\n </View>\n ) : null}\n {tooltip}\n </View>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAyDA,IAAaA,KACX,OAgBkB;CAClB,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,OAAOA,EAAM;CACb,QAAQA,EAAM;CACd,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,aAAaA,EAAM;CACnB,aAAaA,EAAM;CACnB,SAASA,EAAM;CACf,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,QAAQA,EAAM;CACd,QAAQA,EAAM;AAChB,IAOMC,IAAiB,CAAC,GAUlBC,KAAQ,GAAe,MAAkB;CAC7C,IAAMC,IAAK,OAAOC,EAAE,UAAU;CAC9B,OAAO,OAAO,SAASD,CAAE,IAAIA,IAAKE;AACpC,GAIMC,KAAgB,MAAgC;CACpD,IAAI,OAAO,yBAA0B,YAAY;EAC/C,IAAMH,IAAK,sBAAsBI,CAAQ;EACzC,OAAO,EAAE,cAAc,qBAAqBJ,CAAE,EAAE;CAClD;CACA,IAAMA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GACtB,CAAA,IACJ;GACHiD;EACG;;AAEV"}
|
|
1
|
+
{"version":3,"file":"ChartBase.js","names":["engineOptions","props","CUSTOM_TOOLTIP","idOf","id","t","index","requestFrame","callback","createChartStore","version","frame","listeners","cache","origin","touches","dragsPoints","o","draggable","options","claimed","notify","listener","cancelFrame","controller","createChartController","measureChartText","size","local","sync","n","event","i","p","previous","store","next","scene","key","view","plot","family","value","drawStatic","active","changed","last","touch","base","CustomTooltip","setSize","useState","left","anchor","top","width","height","View","part","w","h","tooltipCard","ChartBase","handlers","useTheme","useI18n","fonts","theme","useMemo","chartThemeInput","tokens","customTooltip","renderTooltip","resolved","localized","language","applied","useRef","useLayoutEffect","current","handlersRef","useEffect","offs","e","v","off","useImperativeHandle","handleRef","onLayout","tooltip","content","style","StyleSheet","describeChart","drawHover","overlay"],"sources":["../../../../../native/src/components/Chart/ChartBase.tsx"],"sourcesContent":["// The chart host of React Native: owns a platform-free chart controller\n// (@minerva/charts/canvas: options, model, zoom, gestures, scene in pixels)\n// and draws its scene with views (./scene). Touches go through the\n// responder system; the drawing is `pointerEvents=\"none\"`, so every touch\n// lands on the surface and positions come from page coordinates.\n\nimport {\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n StyleSheet,\n View,\n type DimensionValue,\n type GestureResponderEvent,\n type LayoutChangeEvent,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport {\n createChartController,\n describeChart,\n type ChartController,\n type ChartDragEvent,\n type ChartHoverEvent,\n type ChartOptions,\n type ChartPlotClickEvent,\n type ChartRect,\n type ChartScene,\n type ChartThemeInput,\n type ChartTooltipOptions,\n type ChartView,\n} from \"@minerva/charts/canvas\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { part } from \"../../internal/parts\";\nimport { measureChartText } from \"./measure\";\nimport { drawHover, drawStatic, tooltipCard } from \"./scene\";\nimport { chartThemeInput } from \"./theme\";\nimport type { ChartCommonProps, ChartHandle } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n | \"locale\"\n | \"labels\"\n > &\n Pick<ChartOptions, \"series\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n locale: props.locale,\n labels: props.labels,\n});\n\ntype TooltipResult = Exclude<\n ReturnType<NonNullable<ChartTooltipOptions[\"render\"]>>,\n string | null\n>;\n/** Non-string result of `tooltip.render`: the engine lays a tooltip out without drawing text */\nconst CUSTOM_TOOLTIP = {} as unknown as TooltipResult;\n\ninterface TouchPoint {\n identifier?: number | string;\n pageX: number;\n pageY: number;\n locationX?: number;\n locationY?: number;\n}\n\nconst idOf = (t: TouchPoint, index: number) => {\n const id = Number(t.identifier);\n return Number.isFinite(id) ? id : index;\n};\n\ntype Frame = { cancel: () => void };\n\nconst requestFrame = (callback: () => void): Frame => {\n if (typeof requestAnimationFrame === \"function\") {\n const id = requestAnimationFrame(callback);\n return { cancel: () => cancelAnimationFrame(id) };\n }\n const id = setTimeout(callback, 16);\n return { cancel: () => clearTimeout(id) };\n};\n\n/**\n * External store of a chart: the controller, a version bumped when its\n * scene must be drawn again (coalesced per frame), the touches being\n * tracked and the cache of the static layers.\n */\ninterface ChartStore {\n controller: ChartController;\n /** Options of the controller (`setOptions` of the controller) */\n setOptions: (options: ChartOptions) => void;\n subscribe: (listener: () => void) => () => void;\n version: () => number;\n /** Draws again now */\n commit: () => void;\n /** Static layers of a scene (cached while model / view / size are the same) */\n layers: (scene: ChartScene, family: string | undefined) => ReactNode;\n /** Last single-finger position (anchor of a custom tooltip) */\n anchor: { x: number; y: number } | null;\n /**\n * First finger (responder grant); returns whether the chart owns the\n * gesture, which keeps native scroll views from taking it (Android)\n */\n touchStart: (event: GestureResponderEvent) => boolean;\n /** Another finger touches the chart */\n touchAdd: (event: GestureResponderEvent) => void;\n /** Moves (drawn on the next frame) */\n touchMove: (event: GestureResponderEvent) => void;\n touchEnd: (event: GestureResponderEvent) => void;\n touchCancel: () => void;\n /** Whether the chart keeps the touches (pinch, point drag, pan when zoomed) */\n holdsGesture: () => boolean;\n}\n\nfunction createChartStore(\n options: ChartOptions,\n theme: ChartThemeInput,\n size: [number, number] | null,\n): ChartStore {\n let version = 0;\n let frame: Frame | null = null;\n const listeners = new Set<() => void>();\n let cache: { key: unknown[]; node: ReactNode } | null = null;\n let origin = { x: 0, y: 0 };\n const touches = new Map<number, { x: number; y: number }>();\n const dragsPoints = (o: ChartOptions) =>\n typeof o.interaction === \"object\" && !!o.interaction.dragPoints;\n let draggable = dragsPoints(options);\n /** The current touch sequence started on the plot of a draggable chart */\n let claimed = false;\n\n const notify = () => {\n version++;\n listeners.forEach((listener) => listener());\n };\n const cancelFrame = () => {\n frame?.cancel();\n frame = null;\n };\n const schedule = () => {\n if (frame || !listeners.size) return;\n frame = requestFrame(() => {\n frame = null;\n notify();\n });\n };\n\n const controller = createChartController({\n options,\n theme,\n measureText: measureChartText,\n onInvalidate: schedule,\n });\n if (size) controller.setSize(size[0], size[1]);\n\n const local = (t: TouchPoint) => ({\n x: t.pageX - origin.x,\n y: t.pageY - origin.y,\n });\n\n /** Feeds the controller the fingers that appeared or moved */\n const sync = (event: GestureResponderEvent) => {\n const n = event.nativeEvent;\n const list: readonly TouchPoint[] = n.touches?.length\n ? n.touches\n : [n as unknown as TouchPoint];\n list.forEach((t, i) => {\n const id = idOf(t, i);\n const p = local(t);\n const previous = touches.get(id);\n if (!previous) {\n touches.set(id, p);\n controller.pointerDown(p.x, p.y, { id, touch: true });\n } else if (previous.x !== p.x || previous.y !== p.y) {\n touches.set(id, p);\n controller.pointerMove(p.x, p.y, { id, touch: true });\n }\n });\n if (touches.size === 1) store.anchor = [...touches.values()][0];\n };\n\n const store: ChartStore = {\n controller,\n setOptions(next) {\n draggable = dragsPoints(next);\n controller.setOptions(next);\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n if (!listeners.size) cancelFrame();\n };\n },\n version: () => version,\n commit() {\n cancelFrame();\n notify();\n },\n layers(scene, family) {\n const { plot } = scene.layout;\n const { view } = scene;\n const key = [\n scene.model,\n scene.annotations,\n scene.theme,\n scene.width,\n scene.height,\n view.x[0],\n view.x[1],\n view.y[0],\n view.y[1],\n plot.x,\n plot.y,\n plot.width,\n plot.height,\n family,\n ];\n if (!cache || cache.key.some((value, i) => value !== key[i]))\n cache = { key, node: drawStatic(scene, family) };\n return cache.node;\n },\n anchor: null,\n touchStart(event) {\n const n = event.nativeEvent as unknown as TouchPoint;\n // the drawing ignores touches: `location` is relative to the surface\n if (!touches.size && n.locationX !== undefined)\n origin = { x: n.pageX - n.locationX, y: n.pageY - (n.locationY ?? 0) };\n sync(event);\n store.commit();\n // draggable points: the drag only starts after the touch slop, too\n // late to keep a scroll view from stealing the touch: claim it now\n const plot = controller.getPlotRect();\n const p = touches.values().next().value;\n claimed =\n draggable &&\n !!plot &&\n !!p &&\n p.x >= plot.x &&\n p.x <= plot.x + plot.width &&\n p.y >= plot.y &&\n p.y <= plot.y + plot.height;\n return store.holdsGesture();\n },\n touchAdd(event) {\n sync(event);\n store.commit();\n },\n touchMove: sync,\n touchEnd(event) {\n const n = event.nativeEvent;\n const active = new Set(\n (n.touches ?? []).map((t, i) => idOf(t as TouchPoint, i)),\n );\n const changed: readonly TouchPoint[] = n.changedTouches?.length\n ? n.changedTouches\n : [n as unknown as TouchPoint];\n for (const [id, last] of [...touches]) {\n if (active.has(id)) continue;\n const touch = changed.find((t, i) => idOf(t, i) === id);\n const p = touch ? local(touch) : last;\n touches.delete(id);\n if (touches.size === 0) store.anchor = p;\n controller.pointerUp(p.x, p.y, { id, touch: true });\n }\n store.commit();\n },\n touchCancel() {\n for (const id of touches.keys()) controller.pointerCancel({ id });\n touches.clear();\n store.commit();\n },\n holdsGesture() {\n if (touches.size > 1 || (claimed && touches.size > 0)) return true;\n const scene = controller.getScene();\n if (!scene) return false;\n if (scene.dragging) return true;\n const { base } = scene.model;\n const view = controller.getView();\n return (\n view.x[0] !== base.x[0] ||\n view.x[1] !== base.x[1] ||\n view.y[0] !== base.y[0] ||\n view.y[1] !== base.y[1]\n );\n },\n };\n return store;\n}\n\n/** A `renderTooltip` node, placed next to the finger once measured */\nfunction CustomTooltip({\n scene,\n anchor,\n children,\n}: {\n scene: ChartScene;\n anchor: { x: number; y: number };\n children: ReactNode;\n}) {\n const [size, setSize] = useState<{ width: number; height: number } | null>(\n null,\n );\n const { width, height } = scene;\n let left = anchor.x + 14;\n let top = anchor.y;\n if (size) {\n if (left + size.width > width - 4) left = anchor.x - 14 - size.width;\n left = Math.max(4, Math.min(left, width - size.width - 4));\n top = Math.max(\n 4,\n Math.min(anchor.y - size.height / 2, height - size.height - 4),\n );\n }\n return (\n <View\n pointerEvents=\"none\"\n {...part(\"chart\", \"tooltip\", { custom: true })}\n onLayout={(e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n setSize((previous) =>\n previous && previous.width === w && previous.height === h\n ? previous\n : { width: w, height: h },\n );\n }}\n style={[\n tooltipCard(scene),\n {\n // laid out at the origin (full width available), moved by a transform\n left: 0,\n top: 0,\n maxWidth: Math.max(0, width - 8),\n padding: 8,\n opacity: size ? 1 : 0,\n transform: [{ translateX: left }, { translateY: top }],\n },\n ]}\n >\n {children}\n </View>\n );\n}\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: DimensionValue;\n width?: DimensionValue;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n handleRef?: Ref<ChartHandle>;\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the plot area, given the plot rectangle */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\n/** Sizes the chart, forwards options / theme / touches to the controller and draws its scene */\nexport function ChartBase({\n options,\n height = 320,\n width = \"100%\",\n style,\n testID,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const { tokens, fonts } = useTheme();\n const { language } = useI18n();\n const family = fonts.sans;\n const theme = useMemo(() => chartThemeInput(tokens), [tokens]);\n const customTooltip = !!renderTooltip && options.tooltip !== false;\n const resolved = useMemo((): ChartOptions => {\n // The chart's own locale wins over the language of the provider.\n const localized = options.locale\n ? options\n : { ...options, locale: language };\n if (!customTooltip) return localized;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return {\n ...localized,\n tooltip: { ...base, render: () => CUSTOM_TOOLTIP },\n };\n }, [options, customTooltip, language]);\n\n const [store] = useState(() =>\n createChartStore(\n resolved,\n theme,\n typeof width === \"number\" && typeof height === \"number\"\n ? [width, height]\n : null,\n ),\n );\n const { controller } = store;\n useSyncExternalStore(store.subscribe, store.version, store.version);\n\n const applied = useRef({ options: resolved, theme });\n useLayoutEffect(() => {\n const current = applied.current;\n if (current.theme === theme && current.options === resolved) return;\n if (current.theme !== theme) controller.setTheme(theme);\n if (current.options !== resolved) store.setOptions(resolved);\n applied.current = { options: resolved, theme };\n store.commit();\n }, [controller, store, resolved, theme]);\n\n useLayoutEffect(() => {\n if (typeof width !== \"number\" || typeof height !== \"number\") return;\n const scene = controller.getScene();\n if (scene && scene.width === width && scene.height === height) return;\n controller.setSize(width, height);\n store.commit();\n }, [controller, store, width, height]);\n\n const handlersRef = useRef<Handlers>(handlers);\n useLayoutEffect(() => {\n handlersRef.current = handlers;\n });\n useEffect(() => {\n const h = handlersRef;\n const offs = [\n controller.on(\"hover\", (e) => h.current.onHover?.(e)),\n controller.on(\"click\", (e) => h.current.onPointClick?.(e)),\n controller.on(\"plotClick\", (e) => h.current.onPlotClick?.(e)),\n controller.on(\"zoom\", (v) => h.current.onZoom?.(v)),\n controller.on(\"drag\", (e) => h.current.onDrag?.(e)),\n controller.on(\"drop\", (e) => h.current.onDrop?.(e)),\n ];\n return () => offs.forEach((off) => off());\n }, [controller]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (view) => controller.setView(view),\n getPlotRect: () => controller.getPlotRect(),\n getController: () => controller,\n }),\n [controller],\n );\n\n const onLayout = (e: LayoutChangeEvent) => {\n const { width: w, height: h } = e.nativeEvent.layout;\n const scene = controller.getScene();\n if (scene && scene.width === w && scene.height === h) return;\n controller.setSize(w, h);\n store.commit();\n };\n\n const scene = controller.getScene();\n let tooltip: ReactNode = null;\n const event = scene?.hover?.tooltip ? scene.hover.event : null;\n if (scene && event && customTooltip && renderTooltip) {\n const content = renderTooltip(event);\n const anchor = store.anchor ?? scene.hover?.marks[0] ?? null;\n if (\n content !== null &&\n content !== undefined &&\n content !== false &&\n anchor\n )\n tooltip = (\n <CustomTooltip scene={scene} anchor={anchor}>\n {content}\n </CustomTooltip>\n );\n }\n\n return (\n <View\n testID={testID}\n onLayout={onLayout}\n style={[{ width, height }, style]}\n {...part(\"chart\", \"root\")}\n >\n <View\n style={StyleSheet.absoluteFill}\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={\n resolved.ariaLabel ??\n describeChart({\n locale: resolved.locale,\n labels: resolved.labels,\n series: scene?.model.series,\n })\n }\n onStartShouldSetResponder={() => true}\n onResponderTerminationRequest={() => !store.holdsGesture()}\n onResponderGrant={store.touchStart}\n onResponderStart={store.touchAdd}\n onResponderMove={store.touchMove}\n onResponderEnd={store.touchEnd}\n onResponderRelease={store.touchEnd}\n onResponderTerminate={store.touchCancel}\n {...part(\"chart\", \"surface\")}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {scene ? store.layers(scene, family) : null}\n {scene ? drawHover(scene, family, customTooltip) : null}\n </View>\n </View>\n {overlay && scene ? (\n <View\n pointerEvents=\"box-none\"\n style={{\n position: \"absolute\",\n left: scene.layout.plot.x,\n top: scene.layout.plot.y,\n width: scene.layout.plot.width,\n height: scene.layout.plot.height,\n }}\n {...part(\"chart\", \"overlay\")}\n >\n {overlay(scene.layout.plot)}\n </View>\n ) : null}\n {tooltip}\n </View>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAyDA,IAAaA,KACX,OAgBkB;CAClB,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,OAAOA,EAAM;CACb,QAAQA,EAAM;CACd,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,aAAaA,EAAM;CACnB,aAAaA,EAAM;CACnB,SAASA,EAAM;CACf,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,QAAQA,EAAM;CACd,QAAQA,EAAM;AAChB,IAOMC,IAAiB,CAAC,GAUlBC,KAAQ,GAAe,MAAkB;CAC7C,IAAMC,IAAK,OAAOC,EAAE,UAAU;CAC9B,OAAO,OAAO,SAASD,CAAE,IAAIA,IAAKE;AACpC,GAIMC,KAAgB,MAAgC;CACpD,IAAI,OAAO,yBAA0B,YAAY;EAC/C,IAAMH,IAAK,sBAAsBI,CAAQ;EACzC,OAAO,EAAE,cAAc,qBAAqBJ,CAAE,EAAE;CAClD;CACA,IAAMA,IAAK,WAAWI,GAAU,EAAE;CAClC,OAAO,EAAE,cAAc,aAAaJ,CAAE,EAAE;AAC1C;AAkCA,SAASK,EACP,GACA,GACA,GACY;CACZ,IAAIC,IAAU,GACVC,IAAsB,MACpBC,oBAAY,IAAI,IAAgB,GAClC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