minerva-design 1.4.0 → 1.5.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 +9 -0
- package/README.md +21 -21
- package/custom-elements.json +4047 -1703
- package/dist/angular/fesm2022/minerva-angular.mjs +1436 -5
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +573 -4
- package/dist/charts/canvas.d.cts +2 -2
- package/dist/charts/canvas.d.ts +2 -2
- package/dist/charts/core.cjs +1 -1
- package/dist/charts/core.d.cts +6 -4
- package/dist/charts/core.d.ts +6 -4
- package/dist/charts/core.js +24 -16
- package/dist/charts/engine/axis.cjs +1 -1
- package/dist/charts/engine/axis.cjs.map +1 -1
- package/dist/charts/engine/axis.js +42 -19
- package/dist/charts/engine/axis.js.map +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 +154 -127
- 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 +365 -251
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/color.cjs +1 -1
- package/dist/charts/engine/color.cjs.map +1 -1
- package/dist/charts/engine/color.d.cts +18 -0
- package/dist/charts/engine/color.d.ts +18 -0
- package/dist/charts/engine/color.js +48 -2
- package/dist/charts/engine/color.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 +32 -1
- package/dist/charts/engine/controller.d.ts +32 -1
- package/dist/charts/engine/controller.js +310 -263
- package/dist/charts/engine/controller.js.map +1 -1
- package/dist/charts/engine/data.cjs +1 -1
- package/dist/charts/engine/data.cjs.map +1 -1
- package/dist/charts/engine/data.d.cts +3 -1
- package/dist/charts/engine/data.d.ts +3 -1
- package/dist/charts/engine/data.js +6 -4
- package/dist/charts/engine/data.js.map +1 -1
- package/dist/charts/engine/defaults.cjs +2 -0
- package/dist/charts/engine/defaults.cjs.map +1 -0
- package/dist/charts/engine/defaults.d.cts +20 -0
- package/dist/charts/engine/defaults.d.ts +20 -0
- package/dist/charts/engine/defaults.js +35 -0
- package/dist/charts/engine/defaults.js.map +1 -0
- package/dist/charts/engine/format.cjs +1 -1
- package/dist/charts/engine/format.cjs.map +1 -1
- package/dist/charts/engine/format.d.cts +6 -0
- package/dist/charts/engine/format.d.ts +6 -0
- package/dist/charts/engine/format.js +15 -2
- package/dist/charts/engine/format.js.map +1 -1
- package/dist/charts/engine/graph/chart.cjs +2 -0
- package/dist/charts/engine/graph/chart.cjs.map +1 -0
- package/dist/charts/engine/graph/chart.d.cts +3 -0
- package/dist/charts/engine/graph/chart.d.ts +3 -0
- package/dist/charts/engine/graph/chart.js +1565 -0
- package/dist/charts/engine/graph/chart.js.map +1 -0
- package/dist/charts/engine/graph/circular.cjs +2 -0
- package/dist/charts/engine/graph/circular.cjs.map +1 -0
- package/dist/charts/engine/graph/circular.d.cts +16 -0
- package/dist/charts/engine/graph/circular.d.ts +16 -0
- package/dist/charts/engine/graph/circular.js +62 -0
- package/dist/charts/engine/graph/circular.js.map +1 -0
- package/dist/charts/engine/graph/dag.cjs +2 -0
- package/dist/charts/engine/graph/dag.cjs.map +1 -0
- package/dist/charts/engine/graph/dag.d.cts +34 -0
- package/dist/charts/engine/graph/dag.d.ts +34 -0
- package/dist/charts/engine/graph/dag.js +314 -0
- package/dist/charts/engine/graph/dag.js.map +1 -0
- package/dist/charts/engine/graph/dom.cjs +2 -0
- package/dist/charts/engine/graph/dom.cjs.map +1 -0
- package/dist/charts/engine/graph/dom.d.cts +23 -0
- package/dist/charts/engine/graph/dom.d.ts +23 -0
- package/dist/charts/engine/graph/dom.js +158 -0
- package/dist/charts/engine/graph/dom.js.map +1 -0
- package/dist/charts/engine/graph/force.cjs +2 -0
- package/dist/charts/engine/graph/force.cjs.map +1 -0
- package/dist/charts/engine/graph/force.d.cts +67 -0
- package/dist/charts/engine/graph/force.d.ts +67 -0
- package/dist/charts/engine/graph/force.js +325 -0
- package/dist/charts/engine/graph/force.js.map +1 -0
- package/dist/charts/engine/graph/geometry.cjs +2 -0
- package/dist/charts/engine/graph/geometry.cjs.map +1 -0
- package/dist/charts/engine/graph/geometry.d.cts +37 -0
- package/dist/charts/engine/graph/geometry.d.ts +37 -0
- package/dist/charts/engine/graph/geometry.js +144 -0
- package/dist/charts/engine/graph/geometry.js.map +1 -0
- package/dist/charts/engine/graph/index.cjs +1 -0
- package/dist/charts/engine/graph/index.d.cts +6 -0
- package/dist/charts/engine/graph/index.d.ts +6 -0
- package/dist/charts/engine/graph/index.js +6 -0
- package/dist/charts/engine/graph/labels.cjs +2 -0
- package/dist/charts/engine/graph/labels.cjs.map +1 -0
- package/dist/charts/engine/graph/labels.d.cts +12 -0
- package/dist/charts/engine/graph/labels.d.ts +12 -0
- package/dist/charts/engine/graph/labels.js +128 -0
- package/dist/charts/engine/graph/labels.js.map +1 -0
- package/dist/charts/engine/graph/model.cjs +2 -0
- package/dist/charts/engine/graph/model.cjs.map +1 -0
- package/dist/charts/engine/graph/model.d.cts +43 -0
- package/dist/charts/engine/graph/model.d.ts +43 -0
- package/dist/charts/engine/graph/model.js +88 -0
- package/dist/charts/engine/graph/model.js.map +1 -0
- package/dist/charts/engine/graph/sizing.cjs +2 -0
- package/dist/charts/engine/graph/sizing.cjs.map +1 -0
- package/dist/charts/engine/graph/sizing.d.cts +33 -0
- package/dist/charts/engine/graph/sizing.d.ts +33 -0
- package/dist/charts/engine/graph/sizing.js +60 -0
- package/dist/charts/engine/graph/sizing.js.map +1 -0
- package/dist/charts/engine/graph/tree.cjs +2 -0
- package/dist/charts/engine/graph/tree.cjs.map +1 -0
- package/dist/charts/engine/graph/tree.d.cts +30 -0
- package/dist/charts/engine/graph/tree.d.ts +30 -0
- package/dist/charts/engine/graph/tree.js +218 -0
- package/dist/charts/engine/graph/tree.js.map +1 -0
- package/dist/charts/engine/graph/types.d.cts +626 -0
- package/dist/charts/engine/graph/types.d.ts +626 -0
- package/dist/charts/engine/graph/worker.cjs +46 -0
- package/dist/charts/engine/graph/worker.cjs.map +1 -0
- package/dist/charts/engine/graph/worker.d.cts +36 -0
- package/dist/charts/engine/graph/worker.d.ts +36 -0
- package/dist/charts/engine/graph/worker.js +129 -0
- package/dist/charts/engine/graph/worker.js.map +1 -0
- package/dist/charts/engine/items.cjs +1 -1
- package/dist/charts/engine/items.cjs.map +1 -1
- package/dist/charts/engine/items.d.cts +15 -2
- package/dist/charts/engine/items.d.ts +15 -2
- package/dist/charts/engine/items.js +131 -112
- package/dist/charts/engine/items.js.map +1 -1
- package/dist/charts/engine/labels.cjs +1 -1
- package/dist/charts/engine/labels.cjs.map +1 -1
- package/dist/charts/engine/labels.js +28 -4
- package/dist/charts/engine/labels.js.map +1 -1
- package/dist/charts/engine/layout.cjs +1 -1
- package/dist/charts/engine/layout.cjs.map +1 -1
- package/dist/charts/engine/layout.d.cts +9 -0
- package/dist/charts/engine/layout.d.ts +9 -0
- package/dist/charts/engine/layout.js +11 -2
- package/dist/charts/engine/layout.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 +40 -3
- package/dist/charts/engine/model.d.ts +40 -3
- package/dist/charts/engine/model.js +246 -165
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/orderbook/format.cjs +1 -1
- package/dist/charts/engine/orderbook/format.cjs.map +1 -1
- package/dist/charts/engine/orderbook/format.d.cts +3 -2
- package/dist/charts/engine/orderbook/format.d.ts +3 -2
- package/dist/charts/engine/orderbook/format.js +5 -5
- package/dist/charts/engine/orderbook/format.js.map +1 -1
- 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 +527 -408
- package/dist/charts/engine/orderbook/heatmap.js.map +1 -1
- package/dist/charts/engine/orderbook/layout.cjs +2 -0
- package/dist/charts/engine/orderbook/layout.cjs.map +1 -0
- package/dist/charts/engine/orderbook/layout.d.cts +37 -0
- package/dist/charts/engine/orderbook/layout.d.ts +37 -0
- package/dist/charts/engine/orderbook/layout.js +70 -0
- package/dist/charts/engine/orderbook/layout.js.map +1 -0
- 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 +1 -1
- package/dist/charts/engine/orderbook/tape.js.map +1 -1
- package/dist/charts/engine/orderbook/types.d.cts +18 -2
- package/dist/charts/engine/orderbook/types.d.ts +18 -2
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +10 -0
- package/dist/charts/engine/overlay.d.ts +10 -0
- package/dist/charts/engine/overlay.js +6 -0
- package/dist/charts/engine/overlay.js.map +1 -1
- package/dist/charts/engine/presets.cjs +2 -2
- package/dist/charts/engine/presets.cjs.map +1 -1
- package/dist/charts/engine/presets.d.cts +25 -3
- package/dist/charts/engine/presets.d.ts +25 -3
- package/dist/charts/engine/presets.js +115 -101
- package/dist/charts/engine/presets.js.map +1 -1
- package/dist/charts/engine/renderers/detect.cjs +1 -1
- package/dist/charts/engine/renderers/detect.cjs.map +1 -1
- package/dist/charts/engine/renderers/detect.d.cts +2 -1
- package/dist/charts/engine/renderers/detect.d.ts +2 -1
- package/dist/charts/engine/renderers/detect.js +23 -21
- package/dist/charts/engine/renderers/detect.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 +57 -4
- package/dist/charts/engine/scene.d.ts +57 -4
- package/dist/charts/engine/scene.js +335 -182
- package/dist/charts/engine/scene.js.map +1 -1
- package/dist/charts/engine/shapes/bullet.cjs +1 -1
- package/dist/charts/engine/shapes/bullet.cjs.map +1 -1
- package/dist/charts/engine/shapes/bullet.js +110 -110
- package/dist/charts/engine/shapes/bullet.js.map +1 -1
- package/dist/charts/engine/shapes/chart.cjs +1 -1
- package/dist/charts/engine/shapes/chart.cjs.map +1 -1
- package/dist/charts/engine/shapes/chart.js +4 -1
- package/dist/charts/engine/shapes/chart.js.map +1 -1
- package/dist/charts/engine/shapes/chord.cjs +2 -0
- package/dist/charts/engine/shapes/chord.cjs.map +1 -0
- package/dist/charts/engine/shapes/chord.d.cts +18 -0
- package/dist/charts/engine/shapes/chord.d.ts +18 -0
- package/dist/charts/engine/shapes/chord.js +414 -0
- package/dist/charts/engine/shapes/chord.js.map +1 -0
- package/dist/charts/engine/shapes/draw.cjs +1 -1
- package/dist/charts/engine/shapes/draw.cjs.map +1 -1
- package/dist/charts/engine/shapes/draw.d.cts +5 -1
- package/dist/charts/engine/shapes/draw.d.ts +5 -1
- package/dist/charts/engine/shapes/draw.js +47 -17
- package/dist/charts/engine/shapes/draw.js.map +1 -1
- package/dist/charts/engine/shapes/hit.cjs +1 -1
- package/dist/charts/engine/shapes/hit.cjs.map +1 -1
- package/dist/charts/engine/shapes/hit.d.cts +3 -1
- package/dist/charts/engine/shapes/hit.d.ts +3 -1
- package/dist/charts/engine/shapes/hit.js +75 -46
- package/dist/charts/engine/shapes/hit.js.map +1 -1
- package/dist/charts/engine/shapes/index.d.cts +3 -2
- package/dist/charts/engine/shapes/index.d.ts +3 -2
- package/dist/charts/engine/shapes/labels.cjs +1 -1
- package/dist/charts/engine/shapes/labels.cjs.map +1 -1
- package/dist/charts/engine/shapes/labels.js +12 -4
- package/dist/charts/engine/shapes/labels.js.map +1 -1
- package/dist/charts/engine/shapes/layout.cjs +2 -2
- package/dist/charts/engine/shapes/layout.cjs.map +1 -1
- package/dist/charts/engine/shapes/layout.d.cts +3 -1
- package/dist/charts/engine/shapes/layout.d.ts +3 -1
- package/dist/charts/engine/shapes/layout.js +106 -78
- package/dist/charts/engine/shapes/layout.js.map +1 -1
- package/dist/charts/engine/shapes/scene.cjs +1 -1
- package/dist/charts/engine/shapes/scene.cjs.map +1 -1
- package/dist/charts/engine/shapes/scene.d.cts +33 -3
- package/dist/charts/engine/shapes/scene.d.ts +33 -3
- package/dist/charts/engine/shapes/scene.js +62 -19
- package/dist/charts/engine/shapes/scene.js.map +1 -1
- package/dist/charts/engine/shapes/types.d.cts +119 -8
- package/dist/charts/engine/shapes/types.d.ts +119 -8
- package/dist/charts/engine/signature.cjs +1 -1
- package/dist/charts/engine/signature.cjs.map +1 -1
- package/dist/charts/engine/signature.js +1 -1
- package/dist/charts/engine/signature.js.map +1 -1
- 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 +5 -2
- package/dist/charts/engine/three-d/canvas2d.d.ts +5 -2
- package/dist/charts/engine/three-d/canvas2d.js +89 -65
- package/dist/charts/engine/three-d/canvas2d.js.map +1 -1
- package/dist/charts/engine/three-d/detect.cjs +1 -1
- package/dist/charts/engine/three-d/detect.cjs.map +1 -1
- package/dist/charts/engine/three-d/detect.d.cts +3 -2
- package/dist/charts/engine/three-d/detect.d.ts +3 -2
- package/dist/charts/engine/three-d/detect.js +22 -20
- package/dist/charts/engine/three-d/detect.js.map +1 -1
- package/dist/charts/engine/three-d/geometry.cjs +1 -1
- package/dist/charts/engine/three-d/geometry.cjs.map +1 -1
- package/dist/charts/engine/three-d/geometry.d.cts +6 -0
- package/dist/charts/engine/three-d/geometry.d.ts +6 -0
- package/dist/charts/engine/three-d/geometry.js +106 -90
- package/dist/charts/engine/three-d/geometry.js.map +1 -1
- package/dist/charts/engine/three-d/model.cjs +1 -1
- package/dist/charts/engine/three-d/model.cjs.map +1 -1
- package/dist/charts/engine/three-d/model.d.cts +2 -0
- package/dist/charts/engine/three-d/model.d.ts +2 -0
- package/dist/charts/engine/three-d/model.js +2 -0
- package/dist/charts/engine/three-d/model.js.map +1 -1
- package/dist/charts/engine/three-d/overlay.cjs +1 -1
- package/dist/charts/engine/three-d/overlay.cjs.map +1 -1
- package/dist/charts/engine/three-d/overlay.js +43 -36
- package/dist/charts/engine/three-d/overlay.js.map +1 -1
- 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 +24 -3
- package/dist/charts/engine/three-d/render-types.d.ts +24 -3
- package/dist/charts/engine/three-d/render-types.js +6 -7
- package/dist/charts/engine/three-d/render-types.js.map +1 -1
- package/dist/charts/engine/three-d/shaders.cjs +63 -28
- package/dist/charts/engine/three-d/shaders.cjs.map +1 -1
- package/dist/charts/engine/three-d/shaders.d.cts +2 -3
- package/dist/charts/engine/three-d/shaders.d.ts +2 -3
- package/dist/charts/engine/three-d/shaders.js +41 -22
- 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 +15 -4
- package/dist/charts/engine/three-d/sort.d.ts +15 -4
- package/dist/charts/engine/three-d/sort.js +117 -43
- package/dist/charts/engine/three-d/sort.js.map +1 -1
- package/dist/charts/engine/three-d/types.d.cts +27 -0
- package/dist/charts/engine/three-d/types.d.ts +27 -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.js +15 -13
- 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 +50 -39
- 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 +10 -0
- package/dist/charts/engine/trading/chart.d.ts +10 -0
- package/dist/charts/engine/trading/chart.js +1475 -776
- package/dist/charts/engine/trading/chart.js.map +1 -1
- package/dist/charts/engine/trading/drawings.cjs +2 -1
- package/dist/charts/engine/trading/drawings.cjs.map +1 -1
- package/dist/charts/engine/trading/drawings.d.cts +47 -9
- package/dist/charts/engine/trading/drawings.d.ts +47 -9
- package/dist/charts/engine/trading/drawings.js +338 -75
- 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 +13 -0
- package/dist/charts/engine/trading/format.d.ts +13 -0
- package/dist/charts/engine/trading/format.js +51 -19
- package/dist/charts/engine/trading/format.js.map +1 -1
- package/dist/charts/engine/trading/index.cjs +1 -1
- package/dist/charts/engine/trading/index.d.cts +2 -1
- package/dist/charts/engine/trading/index.d.ts +2 -1
- package/dist/charts/engine/trading/index.js +4 -3
- package/dist/charts/engine/trading/indicators.cjs +1 -1
- package/dist/charts/engine/trading/indicators.cjs.map +1 -1
- package/dist/charts/engine/trading/indicators.d.cts +180 -10
- package/dist/charts/engine/trading/indicators.d.ts +180 -10
- package/dist/charts/engine/trading/indicators.js +449 -173
- package/dist/charts/engine/trading/indicators.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 +84 -4
- package/dist/charts/engine/trading/labels.js.map +1 -1
- package/dist/charts/engine/trading/store.cjs +1 -1
- package/dist/charts/engine/trading/store.cjs.map +1 -1
- package/dist/charts/engine/trading/store.d.cts +21 -0
- package/dist/charts/engine/trading/store.d.ts +21 -0
- package/dist/charts/engine/trading/store.js +22 -1
- package/dist/charts/engine/trading/store.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 +41 -8
- package/dist/charts/engine/trading/studies.d.ts +41 -8
- package/dist/charts/engine/trading/studies.js +349 -93
- package/dist/charts/engine/trading/studies.js.map +1 -1
- package/dist/charts/engine/trading/sync.cjs +2 -0
- package/dist/charts/engine/trading/sync.cjs.map +1 -0
- package/dist/charts/engine/trading/sync.d.cts +8 -0
- package/dist/charts/engine/trading/sync.d.ts +8 -0
- package/dist/charts/engine/trading/sync.js +25 -0
- package/dist/charts/engine/trading/sync.js.map +1 -0
- package/dist/charts/engine/trading/types.d.cts +484 -9
- package/dist/charts/engine/trading/types.d.ts +484 -9
- package/dist/charts/engine/types.d.cts +82 -8
- package/dist/charts/engine/types.d.ts +82 -8
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.d.cts +3 -2
- package/dist/charts/index.d.ts +3 -2
- package/dist/charts/index.js +30 -22
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.js +46 -34
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/graph.cjs +2 -0
- package/dist/charts/react/graph.cjs.map +1 -0
- package/dist/charts/react/graph.d.cts +213 -0
- package/dist/charts/react/graph.d.ts +213 -0
- package/dist/charts/react/graph.js +159 -0
- package/dist/charts/react/graph.js.map +1 -0
- package/dist/charts/react/shapes.cjs +1 -1
- package/dist/charts/react/shapes.cjs.map +1 -1
- package/dist/charts/react/shapes.d.cts +87 -4
- package/dist/charts/react/shapes.d.ts +87 -4
- package/dist/charts/react/shapes.js +55 -12
- package/dist/charts/react/shapes.js.map +1 -1
- package/dist/charts/react/trading.cjs +1 -1
- package/dist/charts/react/trading.cjs.map +1 -1
- package/dist/charts/react/trading.d.cts +53 -1
- package/dist/charts/react/trading.d.ts +53 -1
- package/dist/charts/react/trading.js +68 -37
- package/dist/charts/react/trading.js.map +1 -1
- package/dist/charts/react/types.d.cts +11 -0
- package/dist/charts/react/types.d.ts +11 -0
- 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 +3 -3
- package/dist/native/charts/src/engine/axis.cjs +1 -1
- package/dist/native/charts/src/engine/axis.cjs.map +1 -1
- package/dist/native/charts/src/engine/axis.js +42 -19
- package/dist/native/charts/src/engine/axis.js.map +1 -1
- package/dist/native/charts/src/engine/color.cjs +1 -1
- package/dist/native/charts/src/engine/color.cjs.map +1 -1
- package/dist/native/charts/src/engine/color.js +47 -5
- package/dist/native/charts/src/engine/color.js.map +1 -1
- 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 +300 -253
- package/dist/native/charts/src/engine/controller.js.map +1 -1
- package/dist/native/charts/src/engine/data.cjs +1 -1
- package/dist/native/charts/src/engine/data.cjs.map +1 -1
- package/dist/native/charts/src/engine/data.js +6 -4
- package/dist/native/charts/src/engine/data.js.map +1 -1
- package/dist/native/charts/src/engine/format.cjs +1 -1
- package/dist/native/charts/src/engine/format.cjs.map +1 -1
- package/dist/native/charts/src/engine/format.js +15 -2
- package/dist/native/charts/src/engine/format.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 +28 -4
- package/dist/native/charts/src/engine/labels.js.map +1 -1
- package/dist/native/charts/src/engine/layout.cjs +1 -1
- package/dist/native/charts/src/engine/layout.cjs.map +1 -1
- package/dist/native/charts/src/engine/layout.js +11 -2
- package/dist/native/charts/src/engine/layout.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 +252 -171
- 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 +2 -2
- package/dist/native/charts/src/engine/presets.cjs.map +1 -1
- package/dist/native/charts/src/engine/presets.js +104 -90
- 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 +341 -188
- package/dist/native/charts/src/engine/scene.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/bullet.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/bullet.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/bullet.js +110 -110
- package/dist/native/charts/src/engine/shapes/bullet.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/calendar.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/calendar.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/calendar.js +21 -16
- package/dist/native/charts/src/engine/shapes/calendar.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/chord.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/chord.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/chord.js +414 -0
- package/dist/native/charts/src/engine/shapes/chord.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/draw.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/draw.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/draw.js +47 -17
- package/dist/native/charts/src/engine/shapes/draw.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/hit.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/hit.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/hit.js +73 -44
- package/dist/native/charts/src/engine/shapes/hit.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/labels.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/labels.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/labels.js +12 -4
- package/dist/native/charts/src/engine/shapes/labels.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 +117 -90
- package/dist/native/charts/src/engine/shapes/layout.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/scene.cjs +1 -1
- package/dist/native/charts/src/engine/shapes/scene.cjs.map +1 -1
- package/dist/native/charts/src/engine/shapes/scene.js +62 -19
- package/dist/native/charts/src/engine/shapes/scene.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.js +140 -71
- package/dist/native/components/Chart/scene.js.map +1 -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 +54 -42
- package/dist/native/components/Charts/charts.js.map +1 -1
- package/dist/native/components/Charts/types.d.cts +11 -0
- package/dist/native/components/Charts/types.d.ts +11 -0
- 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.js +1 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.js.map +1 -1
- package/dist/native/components/ShapeChart/charts.cjs +1 -1
- package/dist/native/components/ShapeChart/charts.cjs.map +1 -1
- package/dist/native/components/ShapeChart/charts.d.cts +6 -1
- package/dist/native/components/ShapeChart/charts.d.ts +6 -1
- package/dist/native/components/ShapeChart/charts.js +138 -96
- package/dist/native/components/ShapeChart/charts.js.map +1 -1
- package/dist/native/components/ShapeChart/draw.cjs +1 -1
- package/dist/native/components/ShapeChart/draw.cjs.map +1 -1
- package/dist/native/components/ShapeChart/draw.d.cts +1 -1
- package/dist/native/components/ShapeChart/draw.d.ts +1 -1
- package/dist/native/components/ShapeChart/draw.js +26 -17
- package/dist/native/components/ShapeChart/draw.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 +138 -59
- package/dist/native/components/ShapeChart/geometry.js.map +1 -1
- package/dist/native/components/ShapeChart/index.cjs +1 -1
- package/dist/native/components/ShapeChart/index.d.cts +1 -1
- package/dist/native/components/ShapeChart/index.d.ts +1 -1
- package/dist/native/components/ShapeChart/index.js +2 -2
- package/dist/native/components/ShapeChart/recorder.cjs +1 -1
- package/dist/native/components/ShapeChart/recorder.cjs.map +1 -1
- package/dist/native/components/ShapeChart/recorder.d.cts +10 -1
- package/dist/native/components/ShapeChart/recorder.d.ts +10 -1
- package/dist/native/components/ShapeChart/recorder.js +19 -10
- package/dist/native/components/ShapeChart/recorder.js.map +1 -1
- package/dist/native/components/ShapeChart/types.d.cts +92 -7
- package/dist/native/components/ShapeChart/types.d.ts +92 -7
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.js +2 -2
- package/dist/native/source/components/Chart/scene.tsx +158 -14
- package/dist/native/source/components/Charts/charts.tsx +30 -2
- package/dist/native/source/components/Charts/types.ts +11 -0
- package/dist/native/source/components/ShapeChart/ShapeChartBase.tsx +2 -0
- package/dist/native/source/components/ShapeChart/charts.tsx +91 -35
- package/dist/native/source/components/ShapeChart/draw.tsx +39 -8
- package/dist/native/source/components/ShapeChart/geometry.ts +189 -8
- package/dist/native/source/components/ShapeChart/index.ts +1 -0
- package/dist/native/source/components/ShapeChart/recorder.ts +20 -5
- package/dist/native/source/components/ShapeChart/types.ts +96 -5
- package/dist/native/source/manifest.ts +1 -0
- package/dist/taro/charts.d.ts +25 -5
- package/dist/taro/index.js +3900 -2836
- package/dist/taro/shape-charts.d.ts +96 -4
- package/dist/uni/AreaChart.vue.d.ts +5 -1
- package/dist/uni/Badge.vue.d.ts +1 -1
- package/dist/uni/BarChart.vue.d.ts +5 -1
- package/dist/uni/BoxPlotChart.vue.d.ts +8 -0
- package/dist/uni/BubbleChart.vue.d.ts +4 -0
- package/dist/uni/BulletChart.vue.d.ts +4 -0
- package/dist/uni/CalendarHeatmap.vue.d.ts +2 -0
- package/dist/uni/CandlestickChart.vue.d.ts +4 -0
- package/dist/uni/Chart.vue.d.ts +4 -0
- package/dist/uni/ChordChart.vue +93 -0
- package/dist/uni/ChordChart.vue.d.ts +136 -0
- package/dist/uni/DonutChart.vue.d.ts +4 -0
- package/dist/uni/FunnelChart.vue.d.ts +4 -0
- package/dist/uni/GanttChart.vue.d.ts +4 -0
- package/dist/uni/GaugeChart.vue.d.ts +4 -0
- package/dist/uni/HeatmapChart.vue.d.ts +8 -2
- package/dist/uni/HistogramChart.vue.d.ts +4 -0
- package/dist/uni/HorizontalBarChart.vue.d.ts +3 -1
- package/dist/uni/LineChart.vue.d.ts +4 -0
- package/dist/uni/MixedChart.vue.d.ts +4 -0
- package/dist/uni/PieChart.vue.d.ts +4 -0
- package/dist/uni/QuadrantChart.vue.d.ts +4 -0
- package/dist/uni/RadarChart.vue.d.ts +4 -0
- package/dist/uni/RadialBarChart.vue.d.ts +4 -0
- package/dist/uni/RangeAreaChart.vue.d.ts +4 -0
- package/dist/uni/SankeyChart.vue.d.ts +4 -0
- package/dist/uni/ScatterChart.vue.d.ts +4 -0
- package/dist/uni/Sparkline.vue.d.ts +4 -0
- package/dist/uni/SunburstChart.vue.d.ts +4 -0
- package/dist/uni/ToastProvider.vue.d.ts +1 -1
- package/dist/uni/TreemapChart.vue.d.ts +4 -0
- package/dist/uni/WaterfallChart.vue.d.ts +9 -0
- package/dist/uni/chart-canvas.d.ts +3 -0
- package/dist/uni/chart-canvas.js +4 -0
- package/dist/uni/chart-types.d.ts +28 -4
- package/dist/uni/chart-types.js +26 -2
- package/dist/uni/charts-canvas.js +1 -1
- package/dist/uni/index.d.ts +2 -1
- package/dist/uni/index.js +1 -0
- package/dist/uni/manifest.d.ts +7 -0
- package/dist/uni/manifest.js +10 -0
- package/dist/uni/named-chart-options.d.ts +9 -2
- package/dist/uni/named-chart-options.js +18 -1
- package/dist/uni/shape-chart-canvas.d.ts +3 -1
- package/dist/uni/shape-chart-canvas.js +15 -24
- package/dist/uni/shape-chart-types.d.ts +52 -2
- package/dist/uni/shape-chart-types.js +44 -0
- package/dist/vue/charts-global.d.ts +48 -0
- package/dist/vue/charts.d.ts +18 -0
- package/dist/vue/charts.js +56 -0
- package/dist/vue/charts.js.map +1 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue.d.ts +8 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue.js.map +1 -1
- package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/vue/components/Chart/ChordChart.vue.d.ts +153 -0
- package/dist/vue/components/Chart/ChordChart.vue.js +7 -0
- package/dist/vue/components/Chart/ChordChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/ChordChart.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/vue/components/Chart/ChordChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/DependencyGraph.vue.d.ts +179 -0
- package/dist/vue/components/Chart/DependencyGraph.vue.js +7 -0
- package/dist/vue/components/Chart/DependencyGraph.vue.js.map +1 -0
- package/dist/vue/components/Chart/DependencyGraph.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/vue/components/Chart/DependencyGraph.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/GanttChart.vue.d.ts +4 -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 +4 -1
- 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 +184 -0
- package/dist/vue/components/Chart/GraphChart.vue.js +7 -0
- package/dist/vue/components/Chart/GraphChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/GraphChart.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/vue/components/Chart/GraphChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/HeatmapChart.vue.d.ts +9 -5
- package/dist/vue/components/Chart/HeatmapChart.vue.js.map +1 -1
- package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/vue/components/Chart/OrderBookHeatmap.vue.d.ts +2 -0
- package/dist/vue/components/Chart/TimeAndSales.vue.d.ts +2 -0
- package/dist/vue/components/Chart/TradingChart.vue.d.ts +49 -1
- package/dist/vue/components/Chart/TradingChart.vue.js.map +1 -1
- package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/vue/components/Chart/TreeChart.vue.d.ts +172 -0
- package/dist/vue/components/Chart/TreeChart.vue.js +7 -0
- package/dist/vue/components/Chart/TreeChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/TreeChart.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/vue/components/Chart/TreeChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/WaterfallChart.vue.d.ts +12 -1
- package/dist/vue/components/Chart/WaterfallChart.vue.js.map +1 -1
- package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/vue/components/Chart/graph.d.ts +153 -0
- package/dist/vue/components/Chart/graph.js +135 -0
- package/dist/vue/components/Chart/graph.js.map +1 -0
- package/dist/vue/components/Chart/index.d.ts +5 -1
- package/dist/vue/components/Chart/index.js +5 -1
- package/dist/vue/components/Chart/orderbook.d.ts +5 -1
- package/dist/vue/components/Chart/orderbook.js +2 -0
- package/dist/vue/components/Chart/orderbook.js.map +1 -1
- package/dist/vue/components/Chart/trading.d.ts +24 -2
- package/dist/vue/components/Chart/trading.js +8 -0
- package/dist/vue/components/Chart/trading.js.map +1 -1
- package/dist/vue/components/Chart/types.d.ts +74 -2
- package/dist/vue/global.d.ts +2 -38
- package/dist/vue/groups/charts.js +10 -2
- package/dist/vue/groups/charts.js.map +1 -1
- package/dist/vue/index.js +6 -2
- package/dist/vue/internal/register.d.ts +7 -0
- package/dist/vue/internal/register.js +14 -0
- package/dist/vue/internal/register.js.map +1 -0
- package/dist/vue/plugin.d.ts +9 -4
- package/dist/vue/plugin.js +6 -11
- package/dist/vue/plugin.js.map +1 -1
- package/dist/weapp/charts/canvas.js +1687 -147
- package/dist/weapp/charts/core.js +1 -0
- package/dist/weapp/chord-chart/index.js +1 -0
- package/dist/weapp/chord-chart/index.json +1 -0
- package/dist/weapp/chord-chart/index.wxml +1 -0
- package/dist/weapp/chord-chart/index.wxss +1 -0
- package/dist/weapp/controls.js +92 -32
- package/dist/weapp/types.d.ts +87 -4
- package/dist/web-components/components/chart/charts.d.ts +4 -2
- package/dist/web-components/components/chart/charts.js +8 -1
- package/dist/web-components/components/chart/charts.js.map +1 -1
- package/dist/web-components/components/chart/extended.d.ts +17 -7
- package/dist/web-components/components/chart/extended.js +23 -9
- package/dist/web-components/components/chart/extended.js.map +1 -1
- package/dist/web-components/components/chart/shapes-extended.d.ts +37 -1
- package/dist/web-components/components/chart/shapes-extended.js +27 -1
- package/dist/web-components/components/chart/shapes-extended.js.map +1 -1
- package/dist/web-components/components/graph/graph.d.ts +154 -0
- package/dist/web-components/components/graph/graph.js +149 -0
- package/dist/web-components/components/graph/graph.js.map +1 -0
- package/dist/web-components/components/trading-chart/trading-chart.d.ts +49 -2
- package/dist/web-components/components/trading-chart/trading-chart.js +62 -0
- package/dist/web-components/components/trading-chart/trading-chart.js.map +1 -1
- package/dist/web-components/elements/chart.d.ts +1 -1
- package/dist/web-components/elements/chart.js +6 -5
- package/dist/web-components/elements/chart.js.map +1 -1
- package/dist/web-components/elements/graph.d.ts +2 -0
- package/dist/web-components/elements/graph.js +12 -0
- package/dist/web-components/elements/graph.js.map +1 -0
- package/dist/web-components/html-custom-data.json +273 -4
- package/dist/web-components/types/react.d.ts +63 -4
- package/dist/web-components/types/solid.d.ts +55 -8
- package/dist/web-components/types/svelte.d.ts +55 -8
- package/dist/web-components/types/vue.d.ts +55 -4
- package/package.json +16 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartPadding } from '../types.cjs';
|
|
2
2
|
/** Kind of shape chart */
|
|
3
|
-
export type ShapeChartType = "pie" | "radar" | "gauge" | "funnel" | "treemap" | "sankey" | "sunburst" | "radialBar" | "calendarHeatmap" | "bullet";
|
|
3
|
+
export type ShapeChartType = "pie" | "radar" | "gauge" | "funnel" | "treemap" | "sankey" | "sunburst" | "radialBar" | "calendarHeatmap" | "bullet" | "chord";
|
|
4
4
|
/** A named value (pie slice, funnel stage) */
|
|
5
5
|
export interface ShapeDatum {
|
|
6
6
|
/** Name shown in the legend, the labels and the tooltip */
|
|
@@ -29,7 +29,9 @@ export interface ShapeHoverEvent {
|
|
|
29
29
|
* Index of the slice / stage / series / leaf (treemap: in the flattened
|
|
30
30
|
* leaves; sunburst: of the node, in depth-first order; sankey: of the node,
|
|
31
31
|
* or the number of nodes + the link index for a link; calendar heatmap:
|
|
32
|
-
* days since the first day shown; radial bar / bullet: of the datum
|
|
32
|
+
* days since the first day shown; radial bar / bullet: of the datum;
|
|
33
|
+
* chord: of the group, or the number of groups × (1 + source index) +
|
|
34
|
+
* target index for a ribbon)
|
|
33
35
|
*/
|
|
34
36
|
index: number;
|
|
35
37
|
/** Radar: index of the indicator closest to the pointer */
|
|
@@ -43,7 +45,7 @@ export interface ShapeHoverEvent {
|
|
|
43
45
|
* treemap / sunburst: of the root, gauge: of the range, radial bar: of the
|
|
44
46
|
* bar's max, bullet: of the target (else of the scale), sankey: of the
|
|
45
47
|
* flow entering the diagram (links: of the source node), calendar heatmap:
|
|
46
|
-
* of the largest day)
|
|
48
|
+
* of the largest day, chord: of all the flows)
|
|
47
49
|
*/
|
|
48
50
|
percent: number;
|
|
49
51
|
/** Resolved CSS color of the mark */
|
|
@@ -52,10 +54,12 @@ export interface ShapeHoverEvent {
|
|
|
52
54
|
path?: string[];
|
|
53
55
|
/** Calendar heatmap: day of the cell, `YYYY-MM-DD` */
|
|
54
56
|
date?: string;
|
|
55
|
-
/** Sankey: name of the source node of the hovered link */
|
|
57
|
+
/** Sankey / chord: name of the source node / group of the hovered link or ribbon */
|
|
56
58
|
source?: string;
|
|
57
|
-
/** Sankey: name of the target node of the hovered link */
|
|
59
|
+
/** Sankey / chord: name of the target node / group of the hovered link or ribbon */
|
|
58
60
|
target?: string;
|
|
61
|
+
/** Chord: flow from the target back to the source of the hovered ribbon */
|
|
62
|
+
reverseValue?: number;
|
|
59
63
|
}
|
|
60
64
|
/** Tooltip of a shape chart */
|
|
61
65
|
export interface ShapeTooltipOptions {
|
|
@@ -95,6 +99,8 @@ export interface ShapeChartLabels {
|
|
|
95
99
|
ofTarget: string;
|
|
96
100
|
/** Bullet tooltip row: name of the qualitative range of the value */
|
|
97
101
|
range: string;
|
|
102
|
+
/** Chord tooltip row: the flow from the target back to the source */
|
|
103
|
+
reverse: string;
|
|
98
104
|
/** Name of a radar series without `name`, `Series {index}` (1-based) */
|
|
99
105
|
series: string;
|
|
100
106
|
/** Accessible name of a pie chart */
|
|
@@ -123,6 +129,8 @@ export interface ShapeChartLabels {
|
|
|
123
129
|
calendarHeatmap: string;
|
|
124
130
|
/** Accessible name of a bullet chart */
|
|
125
131
|
bulletChart: string;
|
|
132
|
+
/** Accessible name of a chord diagram */
|
|
133
|
+
chordChart: string;
|
|
126
134
|
}
|
|
127
135
|
/** Options shared by every shape chart */
|
|
128
136
|
export interface ShapeChartCommonOptions {
|
|
@@ -154,7 +162,7 @@ export interface ShapeChartCommonOptions {
|
|
|
154
162
|
/**
|
|
155
163
|
* Indexes of the hidden slices / stages / radar series / top-level treemap
|
|
156
164
|
* or sunburst nodes / sankey nodes / radial bars / bullet rows / calendar
|
|
157
|
-
* heatmap levels. When set, the chart is controlled: this list wins over
|
|
165
|
+
* heatmap levels / chord groups. When set, the chart is controlled: this list wins over
|
|
158
166
|
* the legend state, and legend clicks (or `toggle()`) only emit the
|
|
159
167
|
* `toggle` event, whose `hiddenIndexes` should be passed back here.
|
|
160
168
|
*/
|
|
@@ -657,11 +665,114 @@ export interface BulletChartOptions extends ShapeChartCommonOptions {
|
|
|
657
665
|
*/
|
|
658
666
|
ticks?: boolean;
|
|
659
667
|
}
|
|
668
|
+
/** A group (arc) of a chord diagram */
|
|
669
|
+
export interface ChordGroup {
|
|
670
|
+
/** Name shown in the label, the legend and the tooltip; links refer to the group by this name (or by index) */
|
|
671
|
+
name: string;
|
|
672
|
+
/** Color of the arc (and of the ribbons' ends); the palette when omitted */
|
|
673
|
+
color?: string;
|
|
674
|
+
}
|
|
675
|
+
/** A flow between two groups of a chord diagram */
|
|
676
|
+
export interface ChordLink {
|
|
677
|
+
/** Source group: its name, or its index in `groups` */
|
|
678
|
+
source: string | number;
|
|
679
|
+
/** Target group: its name, or its index in `groups` */
|
|
680
|
+
target: string | number;
|
|
681
|
+
/** Size of the flow (negative values count as 0; flows between the same ends add up) */
|
|
682
|
+
value: number;
|
|
683
|
+
/** Color of the ribbon; follows `ribbonColor` when omitted */
|
|
684
|
+
color?: string;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Chord diagram: flows between groups placed around a circle, as ribbons
|
|
688
|
+
* whose ends are proportional to the flow in each direction
|
|
689
|
+
*/
|
|
690
|
+
export interface ChordChartOptions extends ShapeChartCommonOptions {
|
|
691
|
+
type: "chord";
|
|
692
|
+
/**
|
|
693
|
+
* Groups (names or `{ name, color }`), in their order around the circle;
|
|
694
|
+
* groups only named by `links` are appended. With `matrix`, unnamed rows
|
|
695
|
+
* are numbered from 1.
|
|
696
|
+
*/
|
|
697
|
+
groups?: readonly (string | ChordGroup)[];
|
|
698
|
+
/** Square flow matrix: `matrix[i][j]` flows from group `i` to group `j` (used when `links` is absent) */
|
|
699
|
+
matrix?: readonly (readonly number[])[];
|
|
700
|
+
/** Flows as a list (by group name or index); takes precedence over `matrix` */
|
|
701
|
+
links?: readonly ChordLink[];
|
|
702
|
+
/**
|
|
703
|
+
* `false`: one ribbon per pair of groups, each end as wide as the flow
|
|
704
|
+
* leaving that end, arcs sized by the outgoing flows. `true`: one ribbon
|
|
705
|
+
* per direction (same width at both ends), arcs sized by the outgoing plus
|
|
706
|
+
* the incoming flows; flows from a group to itself are ignored.
|
|
707
|
+
* @default false
|
|
708
|
+
*/
|
|
709
|
+
directed?: boolean;
|
|
710
|
+
/**
|
|
711
|
+
* Arrowheads at the target end of the ribbons
|
|
712
|
+
* @default true when `directed`
|
|
713
|
+
*/
|
|
714
|
+
arrows?: boolean;
|
|
715
|
+
/**
|
|
716
|
+
* Gap between the groups, in degrees
|
|
717
|
+
* @default 2
|
|
718
|
+
*/
|
|
719
|
+
padAngle?: number;
|
|
720
|
+
/**
|
|
721
|
+
* Angle of the first group, degrees clockwise from 12 o'clock
|
|
722
|
+
* @default 0
|
|
723
|
+
*/
|
|
724
|
+
startAngle?: number;
|
|
725
|
+
/**
|
|
726
|
+
* Order of the groups around the circle
|
|
727
|
+
* @default "none" (data order)
|
|
728
|
+
*/
|
|
729
|
+
sortGroups?: "none" | "ascending" | "descending";
|
|
730
|
+
/**
|
|
731
|
+
* Order of the ribbon ends along an arc: `auto` puts the flows toward the
|
|
732
|
+
* next groups at the end of the arc (fewest crossings); otherwise the
|
|
733
|
+
* order of the groups, or by value
|
|
734
|
+
* @default "auto"
|
|
735
|
+
*/
|
|
736
|
+
sortSubgroups?: "auto" | "none" | "ascending" | "descending";
|
|
737
|
+
/**
|
|
738
|
+
* Color of the ribbons without `color`: a gradient from the source to the
|
|
739
|
+
* target color, one of the two, or a neutral gray
|
|
740
|
+
* @default "gradient"
|
|
741
|
+
*/
|
|
742
|
+
ribbonColor?: "gradient" | "source" | "target" | "neutral";
|
|
743
|
+
/**
|
|
744
|
+
* Opacity of the ribbons, 0-1 (hovered ribbons are more opaque)
|
|
745
|
+
* @default 0.65
|
|
746
|
+
*/
|
|
747
|
+
ribbonOpacity?: number;
|
|
748
|
+
/**
|
|
749
|
+
* Thickness of the group arcs, in pixels
|
|
750
|
+
* @default 6% of the radius (8-18 px)
|
|
751
|
+
*/
|
|
752
|
+
arcWidth?: number;
|
|
753
|
+
/**
|
|
754
|
+
* Value ticks outside the arcs (labelled where there is room); a number sets the step between ticks
|
|
755
|
+
* @default true when the diagram is large enough
|
|
756
|
+
*/
|
|
757
|
+
ticks?: boolean | number;
|
|
758
|
+
/**
|
|
759
|
+
* Formats the tick labels
|
|
760
|
+
* @default compact numbers of the `locale` (not `format`, whose units would crowd the ticks)
|
|
761
|
+
*/
|
|
762
|
+
tickFormat?: (value: number) => string;
|
|
763
|
+
/**
|
|
764
|
+
* Group labels: `tangential` along the arc, `radial` along the radius,
|
|
765
|
+
* `auto` tangential when every name fits its arc, radial otherwise;
|
|
766
|
+
* labels that would collide are shortened or skipped
|
|
767
|
+
* @default "auto"
|
|
768
|
+
*/
|
|
769
|
+
labels?: "auto" | "tangential" | "radial" | "none";
|
|
770
|
+
}
|
|
660
771
|
/** Options of a shape chart, by `type` */
|
|
661
|
-
export type ShapeChartOptions = PieChartOptions | RadarChartOptions | GaugeChartOptions | FunnelChartOptions | TreemapChartOptions | SankeyChartOptions | SunburstChartOptions | RadialBarChartOptions | CalendarHeatmapOptions | BulletChartOptions;
|
|
772
|
+
export type ShapeChartOptions = PieChartOptions | RadarChartOptions | GaugeChartOptions | FunnelChartOptions | TreemapChartOptions | SankeyChartOptions | SunburstChartOptions | RadialBarChartOptions | CalendarHeatmapOptions | BulletChartOptions | ChordChartOptions;
|
|
662
773
|
/** A legend item was clicked (or `toggle()` was called) */
|
|
663
774
|
export interface ShapeToggleEvent {
|
|
664
|
-
/** Index of the toggled entry (slice, stage, series, top-level node, sankey node, bar, row or
|
|
775
|
+
/** Index of the toggled entry (slice, stage, series, top-level node, sankey node, bar, row, level or chord group) */
|
|
665
776
|
index: number;
|
|
666
777
|
/** Whether that entry is (or, in a controlled chart, would be) hidden */
|
|
667
778
|
hidden: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartPadding } from '../types.js';
|
|
2
2
|
/** Kind of shape chart */
|
|
3
|
-
export type ShapeChartType = "pie" | "radar" | "gauge" | "funnel" | "treemap" | "sankey" | "sunburst" | "radialBar" | "calendarHeatmap" | "bullet";
|
|
3
|
+
export type ShapeChartType = "pie" | "radar" | "gauge" | "funnel" | "treemap" | "sankey" | "sunburst" | "radialBar" | "calendarHeatmap" | "bullet" | "chord";
|
|
4
4
|
/** A named value (pie slice, funnel stage) */
|
|
5
5
|
export interface ShapeDatum {
|
|
6
6
|
/** Name shown in the legend, the labels and the tooltip */
|
|
@@ -29,7 +29,9 @@ export interface ShapeHoverEvent {
|
|
|
29
29
|
* Index of the slice / stage / series / leaf (treemap: in the flattened
|
|
30
30
|
* leaves; sunburst: of the node, in depth-first order; sankey: of the node,
|
|
31
31
|
* or the number of nodes + the link index for a link; calendar heatmap:
|
|
32
|
-
* days since the first day shown; radial bar / bullet: of the datum
|
|
32
|
+
* days since the first day shown; radial bar / bullet: of the datum;
|
|
33
|
+
* chord: of the group, or the number of groups × (1 + source index) +
|
|
34
|
+
* target index for a ribbon)
|
|
33
35
|
*/
|
|
34
36
|
index: number;
|
|
35
37
|
/** Radar: index of the indicator closest to the pointer */
|
|
@@ -43,7 +45,7 @@ export interface ShapeHoverEvent {
|
|
|
43
45
|
* treemap / sunburst: of the root, gauge: of the range, radial bar: of the
|
|
44
46
|
* bar's max, bullet: of the target (else of the scale), sankey: of the
|
|
45
47
|
* flow entering the diagram (links: of the source node), calendar heatmap:
|
|
46
|
-
* of the largest day)
|
|
48
|
+
* of the largest day, chord: of all the flows)
|
|
47
49
|
*/
|
|
48
50
|
percent: number;
|
|
49
51
|
/** Resolved CSS color of the mark */
|
|
@@ -52,10 +54,12 @@ export interface ShapeHoverEvent {
|
|
|
52
54
|
path?: string[];
|
|
53
55
|
/** Calendar heatmap: day of the cell, `YYYY-MM-DD` */
|
|
54
56
|
date?: string;
|
|
55
|
-
/** Sankey: name of the source node of the hovered link */
|
|
57
|
+
/** Sankey / chord: name of the source node / group of the hovered link or ribbon */
|
|
56
58
|
source?: string;
|
|
57
|
-
/** Sankey: name of the target node of the hovered link */
|
|
59
|
+
/** Sankey / chord: name of the target node / group of the hovered link or ribbon */
|
|
58
60
|
target?: string;
|
|
61
|
+
/** Chord: flow from the target back to the source of the hovered ribbon */
|
|
62
|
+
reverseValue?: number;
|
|
59
63
|
}
|
|
60
64
|
/** Tooltip of a shape chart */
|
|
61
65
|
export interface ShapeTooltipOptions {
|
|
@@ -95,6 +99,8 @@ export interface ShapeChartLabels {
|
|
|
95
99
|
ofTarget: string;
|
|
96
100
|
/** Bullet tooltip row: name of the qualitative range of the value */
|
|
97
101
|
range: string;
|
|
102
|
+
/** Chord tooltip row: the flow from the target back to the source */
|
|
103
|
+
reverse: string;
|
|
98
104
|
/** Name of a radar series without `name`, `Series {index}` (1-based) */
|
|
99
105
|
series: string;
|
|
100
106
|
/** Accessible name of a pie chart */
|
|
@@ -123,6 +129,8 @@ export interface ShapeChartLabels {
|
|
|
123
129
|
calendarHeatmap: string;
|
|
124
130
|
/** Accessible name of a bullet chart */
|
|
125
131
|
bulletChart: string;
|
|
132
|
+
/** Accessible name of a chord diagram */
|
|
133
|
+
chordChart: string;
|
|
126
134
|
}
|
|
127
135
|
/** Options shared by every shape chart */
|
|
128
136
|
export interface ShapeChartCommonOptions {
|
|
@@ -154,7 +162,7 @@ export interface ShapeChartCommonOptions {
|
|
|
154
162
|
/**
|
|
155
163
|
* Indexes of the hidden slices / stages / radar series / top-level treemap
|
|
156
164
|
* or sunburst nodes / sankey nodes / radial bars / bullet rows / calendar
|
|
157
|
-
* heatmap levels. When set, the chart is controlled: this list wins over
|
|
165
|
+
* heatmap levels / chord groups. When set, the chart is controlled: this list wins over
|
|
158
166
|
* the legend state, and legend clicks (or `toggle()`) only emit the
|
|
159
167
|
* `toggle` event, whose `hiddenIndexes` should be passed back here.
|
|
160
168
|
*/
|
|
@@ -657,11 +665,114 @@ export interface BulletChartOptions extends ShapeChartCommonOptions {
|
|
|
657
665
|
*/
|
|
658
666
|
ticks?: boolean;
|
|
659
667
|
}
|
|
668
|
+
/** A group (arc) of a chord diagram */
|
|
669
|
+
export interface ChordGroup {
|
|
670
|
+
/** Name shown in the label, the legend and the tooltip; links refer to the group by this name (or by index) */
|
|
671
|
+
name: string;
|
|
672
|
+
/** Color of the arc (and of the ribbons' ends); the palette when omitted */
|
|
673
|
+
color?: string;
|
|
674
|
+
}
|
|
675
|
+
/** A flow between two groups of a chord diagram */
|
|
676
|
+
export interface ChordLink {
|
|
677
|
+
/** Source group: its name, or its index in `groups` */
|
|
678
|
+
source: string | number;
|
|
679
|
+
/** Target group: its name, or its index in `groups` */
|
|
680
|
+
target: string | number;
|
|
681
|
+
/** Size of the flow (negative values count as 0; flows between the same ends add up) */
|
|
682
|
+
value: number;
|
|
683
|
+
/** Color of the ribbon; follows `ribbonColor` when omitted */
|
|
684
|
+
color?: string;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Chord diagram: flows between groups placed around a circle, as ribbons
|
|
688
|
+
* whose ends are proportional to the flow in each direction
|
|
689
|
+
*/
|
|
690
|
+
export interface ChordChartOptions extends ShapeChartCommonOptions {
|
|
691
|
+
type: "chord";
|
|
692
|
+
/**
|
|
693
|
+
* Groups (names or `{ name, color }`), in their order around the circle;
|
|
694
|
+
* groups only named by `links` are appended. With `matrix`, unnamed rows
|
|
695
|
+
* are numbered from 1.
|
|
696
|
+
*/
|
|
697
|
+
groups?: readonly (string | ChordGroup)[];
|
|
698
|
+
/** Square flow matrix: `matrix[i][j]` flows from group `i` to group `j` (used when `links` is absent) */
|
|
699
|
+
matrix?: readonly (readonly number[])[];
|
|
700
|
+
/** Flows as a list (by group name or index); takes precedence over `matrix` */
|
|
701
|
+
links?: readonly ChordLink[];
|
|
702
|
+
/**
|
|
703
|
+
* `false`: one ribbon per pair of groups, each end as wide as the flow
|
|
704
|
+
* leaving that end, arcs sized by the outgoing flows. `true`: one ribbon
|
|
705
|
+
* per direction (same width at both ends), arcs sized by the outgoing plus
|
|
706
|
+
* the incoming flows; flows from a group to itself are ignored.
|
|
707
|
+
* @default false
|
|
708
|
+
*/
|
|
709
|
+
directed?: boolean;
|
|
710
|
+
/**
|
|
711
|
+
* Arrowheads at the target end of the ribbons
|
|
712
|
+
* @default true when `directed`
|
|
713
|
+
*/
|
|
714
|
+
arrows?: boolean;
|
|
715
|
+
/**
|
|
716
|
+
* Gap between the groups, in degrees
|
|
717
|
+
* @default 2
|
|
718
|
+
*/
|
|
719
|
+
padAngle?: number;
|
|
720
|
+
/**
|
|
721
|
+
* Angle of the first group, degrees clockwise from 12 o'clock
|
|
722
|
+
* @default 0
|
|
723
|
+
*/
|
|
724
|
+
startAngle?: number;
|
|
725
|
+
/**
|
|
726
|
+
* Order of the groups around the circle
|
|
727
|
+
* @default "none" (data order)
|
|
728
|
+
*/
|
|
729
|
+
sortGroups?: "none" | "ascending" | "descending";
|
|
730
|
+
/**
|
|
731
|
+
* Order of the ribbon ends along an arc: `auto` puts the flows toward the
|
|
732
|
+
* next groups at the end of the arc (fewest crossings); otherwise the
|
|
733
|
+
* order of the groups, or by value
|
|
734
|
+
* @default "auto"
|
|
735
|
+
*/
|
|
736
|
+
sortSubgroups?: "auto" | "none" | "ascending" | "descending";
|
|
737
|
+
/**
|
|
738
|
+
* Color of the ribbons without `color`: a gradient from the source to the
|
|
739
|
+
* target color, one of the two, or a neutral gray
|
|
740
|
+
* @default "gradient"
|
|
741
|
+
*/
|
|
742
|
+
ribbonColor?: "gradient" | "source" | "target" | "neutral";
|
|
743
|
+
/**
|
|
744
|
+
* Opacity of the ribbons, 0-1 (hovered ribbons are more opaque)
|
|
745
|
+
* @default 0.65
|
|
746
|
+
*/
|
|
747
|
+
ribbonOpacity?: number;
|
|
748
|
+
/**
|
|
749
|
+
* Thickness of the group arcs, in pixels
|
|
750
|
+
* @default 6% of the radius (8-18 px)
|
|
751
|
+
*/
|
|
752
|
+
arcWidth?: number;
|
|
753
|
+
/**
|
|
754
|
+
* Value ticks outside the arcs (labelled where there is room); a number sets the step between ticks
|
|
755
|
+
* @default true when the diagram is large enough
|
|
756
|
+
*/
|
|
757
|
+
ticks?: boolean | number;
|
|
758
|
+
/**
|
|
759
|
+
* Formats the tick labels
|
|
760
|
+
* @default compact numbers of the `locale` (not `format`, whose units would crowd the ticks)
|
|
761
|
+
*/
|
|
762
|
+
tickFormat?: (value: number) => string;
|
|
763
|
+
/**
|
|
764
|
+
* Group labels: `tangential` along the arc, `radial` along the radius,
|
|
765
|
+
* `auto` tangential when every name fits its arc, radial otherwise;
|
|
766
|
+
* labels that would collide are shortened or skipped
|
|
767
|
+
* @default "auto"
|
|
768
|
+
*/
|
|
769
|
+
labels?: "auto" | "tangential" | "radial" | "none";
|
|
770
|
+
}
|
|
660
771
|
/** Options of a shape chart, by `type` */
|
|
661
|
-
export type ShapeChartOptions = PieChartOptions | RadarChartOptions | GaugeChartOptions | FunnelChartOptions | TreemapChartOptions | SankeyChartOptions | SunburstChartOptions | RadialBarChartOptions | CalendarHeatmapOptions | BulletChartOptions;
|
|
772
|
+
export type ShapeChartOptions = PieChartOptions | RadarChartOptions | GaugeChartOptions | FunnelChartOptions | TreemapChartOptions | SankeyChartOptions | SunburstChartOptions | RadialBarChartOptions | CalendarHeatmapOptions | BulletChartOptions | ChordChartOptions;
|
|
662
773
|
/** A legend item was clicked (or `toggle()` was called) */
|
|
663
774
|
export interface ShapeToggleEvent {
|
|
664
|
-
/** Index of the toggled entry (slice, stage, series, top-level node, sankey node, bar, row or
|
|
775
|
+
/** Index of the toggled entry (slice, stage, series, top-level node, sankey node, bar, row, level or chord group) */
|
|
665
776
|
index: number;
|
|
666
777
|
/** Whether that entry is (or, in a controlled chart, would be) hidden */
|
|
667
778
|
hidden: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=new WeakMap,t=0,n=n=>{let r=e.get(n);return r===void 0&&e.set(n,r=++t),r},r=(e,t,r)=>{let{base:i}=e,a=`${t}|${e.baseline}|${e.percent}|${i.x[0]},${i.x[1]}|${i.y[0]},${i.y[1]}`;for(let t of e.series)a+=`\n${t.key}|${t.type}|${n(t.cols)}|${t.colorCss}|${t.hidden}|${t.lineWidth}|${t.pointSize}|${t.opacity}|${t.barOffset}|${t.barHalfWidth}|${r(t.index)??``}|${t.curve}|${t.radius}`,t.type===`candlestick`?a+=`|${t.upColor}/${t.downColor}`:t.type===`heatmap
|
|
1
|
+
var e=new WeakMap,t=0,n=n=>{let r=e.get(n);return r===void 0&&e.set(n,r=++t),r},r=(e,t,r)=>{let{base:i}=e,a=`${t}|${e.baseline}|${e.percent}|${i.x[0]},${i.x[1]}|${i.y[0]},${i.y[1]}`;for(let t of e.series)a+=`\n${t.key}|${t.type}|${n(t.cols)}|${t.colorCss}|${t.hidden}|${t.lineWidth}|${t.pointSize}|${t.opacity}|${t.barOffset}|${t.barHalfWidth}|${r(t.index)??``}|${t.curve}|${t.radius}`,t.type===`candlestick`?a+=`|${t.upColor}/${t.downColor}`:t.type===`heatmap`?a+=`|${t.colorScale.join(`;`)}/${t.valueRange[0]},${t.valueRange[1]}/${t.colorMidpoint}/${t.cellHalf.x},${t.cellHalf.y}`:t.type===`boxplot`&&(a+=`|${t.outlierShape}/${t.outlierSize}`);return a};exports.itemsSignature=r;
|
|
2
2
|
//# sourceMappingURL=signature.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.cjs","names":["ids","counter","idOf","id","value","itemsSignature","model","signature","themeKey","base","s","stackOf"],"sources":["../../../../charts/src/engine/signature.ts"],"sourcesContent":["// Signature of what the render items (GPU buffers) of a model depend on:\n// when it is unchanged, the items of the previous model can be kept.\n\nimport type { ChartModel } from \"./model\";\n\nconst ids = new WeakMap<object, number>();\nlet counter = 0;\n\n/** Stable id of an object (data columns compare by identity) */\nconst idOf = (value: object): number => {\n let id = ids.get(value);\n if (id === undefined) ids.set(value, (id = ++counter));\n return id;\n};\n\n/**\n * Every input of `buildItems` (and of the origin of its positions): data\n * identity, types, colors, visibility, widths, bar layout, stacks, curves,\n * radii, candlestick and heatmap colors. `themeKey` covers the colors resolved\n * from the theme that the model doesn't spell out (per-point colors);\n * `stackOf` gives the `stack` option of a series.\n */\nexport const itemsSignature = (\n model: ChartModel,\n themeKey: number | string,\n stackOf: (index: number) => string | undefined,\n): string => {\n const { base } = model;\n let signature = `${themeKey}|${model.baseline}|${model.percent}|${base.x[0]},${base.x[1]}|${base.y[0]},${base.y[1]}`;\n for (const s of model.series) {\n signature += `\\n${s.key}|${s.type}|${idOf(s.cols)}|${s.colorCss}|${s.hidden}|${s.lineWidth}|${s.pointSize}|${s.opacity}|${s.barOffset}|${s.barHalfWidth}|${stackOf(s.index) ?? \"\"}|${s.curve}|${s.radius}`;\n if (s.type === \"candlestick\") signature += `|${s.upColor}/${s.downColor}`;\n else if (s.type === \"heatmap\")\n signature += `|${s.colorScale.join(\";\")}/${s.valueRange[0]},${s.valueRange[1]}/${s.cellHalf.x},${s.cellHalf.y}`;\n }\n return signature;\n};\n"],"mappings":"AAKA,IAAMA,EAAM,IAAI,QACZC,EAAU,EAGRC,EAAQ,GAA0B,CACtC,IAAIC,EAAKH,EAAI,IAAII,CAAK,EAEtB,OADID,IAAO,IAAA,IAAWH,EAAI,IAAII,EAAQ,EAAK,EAAEH,CAAQ,EAC9CE,CACT,EASaE,GACX,EACA,EACA,IACW,CACX,GAAM,CAAE,QAASC,EACbC,EAAY,GAAGC,EAAS,GAAGF,EAAM,SAAS,GAAGA,EAAM,QAAQ,GAAGG,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,KAChH,IAAK,IAAMC,KAAKJ,EAAM,OACpB,GAAa,KAAKI,EAAE,IAAI,GAAGA,EAAE,KAAK,GAAGR,EAAKQ,EAAE,IAAI,EAAE,GAAGA,EAAE,SAAS,GAAGA,EAAE,OAAO,GAAGA,EAAE,UAAU,GAAGA,EAAE,UAAU,GAAGA,EAAE,QAAQ,GAAGA,EAAE,UAAU,GAAGA,EAAE,aAAa,GAAGC,EAAQD,EAAE,KAAK,GAAK,GAAG,GAAGA,EAAE,MAAM,GAAGA,EAAE,SAC9LA,EAAE,OAAS,cAAe,GAAa,IAAIA,EAAE,QAAQ,GAAGA,EAAE,YACrDA,EAAE,OAAS,
|
|
1
|
+
{"version":3,"file":"signature.cjs","names":["ids","counter","idOf","id","value","itemsSignature","model","signature","themeKey","base","s","stackOf"],"sources":["../../../../charts/src/engine/signature.ts"],"sourcesContent":["// Signature of what the render items (GPU buffers) of a model depend on:\n// when it is unchanged, the items of the previous model can be kept.\n\nimport type { ChartModel } from \"./model\";\n\nconst ids = new WeakMap<object, number>();\nlet counter = 0;\n\n/** Stable id of an object (data columns compare by identity) */\nconst idOf = (value: object): number => {\n let id = ids.get(value);\n if (id === undefined) ids.set(value, (id = ++counter));\n return id;\n};\n\n/**\n * Every input of `buildItems` (and of the origin of its positions): data\n * identity, types, colors, visibility, widths, bar layout, stacks, curves,\n * radii, candlestick and heatmap colors. `themeKey` covers the colors resolved\n * from the theme that the model doesn't spell out (per-point colors);\n * `stackOf` gives the `stack` option of a series.\n */\nexport const itemsSignature = (\n model: ChartModel,\n themeKey: number | string,\n stackOf: (index: number) => string | undefined,\n): string => {\n const { base } = model;\n let signature = `${themeKey}|${model.baseline}|${model.percent}|${base.x[0]},${base.x[1]}|${base.y[0]},${base.y[1]}`;\n for (const s of model.series) {\n signature += `\\n${s.key}|${s.type}|${idOf(s.cols)}|${s.colorCss}|${s.hidden}|${s.lineWidth}|${s.pointSize}|${s.opacity}|${s.barOffset}|${s.barHalfWidth}|${stackOf(s.index) ?? \"\"}|${s.curve}|${s.radius}`;\n if (s.type === \"candlestick\") signature += `|${s.upColor}/${s.downColor}`;\n else if (s.type === \"heatmap\")\n signature += `|${s.colorScale.join(\";\")}/${s.valueRange[0]},${s.valueRange[1]}/${s.colorMidpoint}/${s.cellHalf.x},${s.cellHalf.y}`;\n else if (s.type === \"boxplot\")\n signature += `|${s.outlierShape}/${s.outlierSize}`;\n }\n return signature;\n};\n"],"mappings":"AAKA,IAAMA,EAAM,IAAI,QACZC,EAAU,EAGRC,EAAQ,GAA0B,CACtC,IAAIC,EAAKH,EAAI,IAAII,CAAK,EAEtB,OADID,IAAO,IAAA,IAAWH,EAAI,IAAII,EAAQ,EAAK,EAAEH,CAAQ,EAC9CE,CACT,EASaE,GACX,EACA,EACA,IACW,CACX,GAAM,CAAE,QAASC,EACbC,EAAY,GAAGC,EAAS,GAAGF,EAAM,SAAS,GAAGA,EAAM,QAAQ,GAAGG,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,KAChH,IAAK,IAAMC,KAAKJ,EAAM,OACpB,GAAa,KAAKI,EAAE,IAAI,GAAGA,EAAE,KAAK,GAAGR,EAAKQ,EAAE,IAAI,EAAE,GAAGA,EAAE,SAAS,GAAGA,EAAE,OAAO,GAAGA,EAAE,UAAU,GAAGA,EAAE,UAAU,GAAGA,EAAE,QAAQ,GAAGA,EAAE,UAAU,GAAGA,EAAE,aAAa,GAAGC,EAAQD,EAAE,KAAK,GAAK,GAAG,GAAGA,EAAE,MAAM,GAAGA,EAAE,SAC9LA,EAAE,OAAS,cAAe,GAAa,IAAIA,EAAE,QAAQ,GAAGA,EAAE,YACrDA,EAAE,OAAS,UAClB,GAAa,IAAIA,EAAE,WAAW,KAAK,GAAG,EAAE,GAAGA,EAAE,WAAW,GAAG,GAAGA,EAAE,WAAW,GAAG,GAAGA,EAAE,cAAc,GAAGA,EAAE,SAAS,EAAE,GAAGA,EAAE,SAAS,IACxHA,EAAE,OAAS,YAClB,GAAa,IAAIA,EAAE,aAAa,GAAGA,EAAE,eAEzC,OAAOH,CACT"}
|
|
@@ -4,7 +4,7 @@ var e = /* @__PURE__ */ new WeakMap(), t = 0, n = (n) => {
|
|
|
4
4
|
return r === void 0 && e.set(n, r = ++t), r;
|
|
5
5
|
}, r = (e, t, r) => {
|
|
6
6
|
let { base: i } = e, a = `${t}|${e.baseline}|${e.percent}|${i.x[0]},${i.x[1]}|${i.y[0]},${i.y[1]}`;
|
|
7
|
-
for (let t of e.series) a += `\n${t.key}|${t.type}|${n(t.cols)}|${t.colorCss}|${t.hidden}|${t.lineWidth}|${t.pointSize}|${t.opacity}|${t.barOffset}|${t.barHalfWidth}|${r(t.index) ?? ""}|${t.curve}|${t.radius}`, t.type === "candlestick" ? a += `|${t.upColor}/${t.downColor}` : t.type === "heatmap"
|
|
7
|
+
for (let t of e.series) a += `\n${t.key}|${t.type}|${n(t.cols)}|${t.colorCss}|${t.hidden}|${t.lineWidth}|${t.pointSize}|${t.opacity}|${t.barOffset}|${t.barHalfWidth}|${r(t.index) ?? ""}|${t.curve}|${t.radius}`, t.type === "candlestick" ? a += `|${t.upColor}/${t.downColor}` : t.type === "heatmap" ? a += `|${t.colorScale.join(";")}/${t.valueRange[0]},${t.valueRange[1]}/${t.colorMidpoint}/${t.cellHalf.x},${t.cellHalf.y}` : t.type === "boxplot" && (a += `|${t.outlierShape}/${t.outlierSize}`);
|
|
8
8
|
return a;
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","names":["ids","counter","idOf","id","value","itemsSignature","model","signature","themeKey","base","s","stackOf"],"sources":["../../../../charts/src/engine/signature.ts"],"sourcesContent":["// Signature of what the render items (GPU buffers) of a model depend on:\n// when it is unchanged, the items of the previous model can be kept.\n\nimport type { ChartModel } from \"./model\";\n\nconst ids = new WeakMap<object, number>();\nlet counter = 0;\n\n/** Stable id of an object (data columns compare by identity) */\nconst idOf = (value: object): number => {\n let id = ids.get(value);\n if (id === undefined) ids.set(value, (id = ++counter));\n return id;\n};\n\n/**\n * Every input of `buildItems` (and of the origin of its positions): data\n * identity, types, colors, visibility, widths, bar layout, stacks, curves,\n * radii, candlestick and heatmap colors. `themeKey` covers the colors resolved\n * from the theme that the model doesn't spell out (per-point colors);\n * `stackOf` gives the `stack` option of a series.\n */\nexport const itemsSignature = (\n model: ChartModel,\n themeKey: number | string,\n stackOf: (index: number) => string | undefined,\n): string => {\n const { base } = model;\n let signature = `${themeKey}|${model.baseline}|${model.percent}|${base.x[0]},${base.x[1]}|${base.y[0]},${base.y[1]}`;\n for (const s of model.series) {\n signature += `\\n${s.key}|${s.type}|${idOf(s.cols)}|${s.colorCss}|${s.hidden}|${s.lineWidth}|${s.pointSize}|${s.opacity}|${s.barOffset}|${s.barHalfWidth}|${stackOf(s.index) ?? \"\"}|${s.curve}|${s.radius}`;\n if (s.type === \"candlestick\") signature += `|${s.upColor}/${s.downColor}`;\n else if (s.type === \"heatmap\")\n signature += `|${s.colorScale.join(\";\")}/${s.valueRange[0]},${s.valueRange[1]}/${s.cellHalf.x},${s.cellHalf.y}`;\n }\n return signature;\n};\n"],"mappings":";AAKA,IAAMA,oBAAM,IAAI,QAAwB,GACpCC,IAAU,GAGRC,KAAQ,MAA0B;CACtC,IAAIC,IAAKH,EAAI,IAAII,CAAK;CAEtB,OADID,MAAO,KAAA,KAAWH,EAAI,IAAII,GAAQ,IAAK,EAAEH,CAAQ,GAC9CE;AACT,GASaE,KACX,GACA,GACA,MACW;CACX,IAAM,EAAE,YAASC,GACbC,IAAY,GAAGC,EAAS,GAAGF,EAAM,SAAS,GAAGA,EAAM,QAAQ,GAAGG,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE;CAChH,KAAK,IAAMC,KAAKJ,EAAM,QAEpB,AADA,KAAa,KAAKI,EAAE,IAAI,GAAGA,EAAE,KAAK,GAAGR,EAAKQ,EAAE,IAAI,EAAE,GAAGA,EAAE,SAAS,GAAGA,EAAE,OAAO,GAAGA,EAAE,UAAU,GAAGA,EAAE,UAAU,GAAGA,EAAE,QAAQ,GAAGA,EAAE,UAAU,GAAGA,EAAE,aAAa,GAAGC,EAAQD,EAAE,KAAK,KAAK,GAAG,GAAGA,EAAE,MAAM,GAAGA,EAAE,UAC9LA,EAAE,SAAS,gBAAe,KAAa,IAAIA,EAAE,QAAQ,GAAGA,EAAE,cACrDA,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"signature.js","names":["ids","counter","idOf","id","value","itemsSignature","model","signature","themeKey","base","s","stackOf"],"sources":["../../../../charts/src/engine/signature.ts"],"sourcesContent":["// Signature of what the render items (GPU buffers) of a model depend on:\n// when it is unchanged, the items of the previous model can be kept.\n\nimport type { ChartModel } from \"./model\";\n\nconst ids = new WeakMap<object, number>();\nlet counter = 0;\n\n/** Stable id of an object (data columns compare by identity) */\nconst idOf = (value: object): number => {\n let id = ids.get(value);\n if (id === undefined) ids.set(value, (id = ++counter));\n return id;\n};\n\n/**\n * Every input of `buildItems` (and of the origin of its positions): data\n * identity, types, colors, visibility, widths, bar layout, stacks, curves,\n * radii, candlestick and heatmap colors. `themeKey` covers the colors resolved\n * from the theme that the model doesn't spell out (per-point colors);\n * `stackOf` gives the `stack` option of a series.\n */\nexport const itemsSignature = (\n model: ChartModel,\n themeKey: number | string,\n stackOf: (index: number) => string | undefined,\n): string => {\n const { base } = model;\n let signature = `${themeKey}|${model.baseline}|${model.percent}|${base.x[0]},${base.x[1]}|${base.y[0]},${base.y[1]}`;\n for (const s of model.series) {\n signature += `\\n${s.key}|${s.type}|${idOf(s.cols)}|${s.colorCss}|${s.hidden}|${s.lineWidth}|${s.pointSize}|${s.opacity}|${s.barOffset}|${s.barHalfWidth}|${stackOf(s.index) ?? \"\"}|${s.curve}|${s.radius}`;\n if (s.type === \"candlestick\") signature += `|${s.upColor}/${s.downColor}`;\n else if (s.type === \"heatmap\")\n signature += `|${s.colorScale.join(\";\")}/${s.valueRange[0]},${s.valueRange[1]}/${s.colorMidpoint}/${s.cellHalf.x},${s.cellHalf.y}`;\n else if (s.type === \"boxplot\")\n signature += `|${s.outlierShape}/${s.outlierSize}`;\n }\n return signature;\n};\n"],"mappings":";AAKA,IAAMA,oBAAM,IAAI,QAAwB,GACpCC,IAAU,GAGRC,KAAQ,MAA0B;CACtC,IAAIC,IAAKH,EAAI,IAAII,CAAK;CAEtB,OADID,MAAO,KAAA,KAAWH,EAAI,IAAII,GAAQ,IAAK,EAAEH,CAAQ,GAC9CE;AACT,GASaE,KACX,GACA,GACA,MACW;CACX,IAAM,EAAE,YAASC,GACbC,IAAY,GAAGC,EAAS,GAAGF,EAAM,SAAS,GAAGA,EAAM,QAAQ,GAAGG,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE,GAAG,GAAGA,EAAK,EAAE;CAChH,KAAK,IAAMC,KAAKJ,EAAM,QAEpB,AADA,KAAa,KAAKI,EAAE,IAAI,GAAGA,EAAE,KAAK,GAAGR,EAAKQ,EAAE,IAAI,EAAE,GAAGA,EAAE,SAAS,GAAGA,EAAE,OAAO,GAAGA,EAAE,UAAU,GAAGA,EAAE,UAAU,GAAGA,EAAE,QAAQ,GAAGA,EAAE,UAAU,GAAGA,EAAE,aAAa,GAAGC,EAAQD,EAAE,KAAK,KAAK,GAAG,GAAGA,EAAE,MAAM,GAAGA,EAAE,UAC9LA,EAAE,SAAS,gBAAe,KAAa,IAAIA,EAAE,QAAQ,GAAGA,EAAE,cACrDA,EAAE,SAAS,YAClB,KAAa,IAAIA,EAAE,WAAW,KAAK,GAAG,EAAE,GAAGA,EAAE,WAAW,GAAG,GAAGA,EAAE,WAAW,GAAG,GAAGA,EAAE,cAAc,GAAGA,EAAE,SAAS,EAAE,GAAGA,EAAE,SAAS,MACxHA,EAAE,SAAS,cAClB,KAAa,IAAIA,EAAE,aAAa,GAAGA,EAAE;CAEzC,OAAOH;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./render-types.cjs");var t=
|
|
1
|
+
const e=require("./render-types.cjs");var t=0,n=1,r=2,i=32,a=2.2,o=(e,t)=>{let n=Math.max(0,Math.min(1,t*.6+.5-e)),r=e/t;return[n+(1-n)*Math.exp(-1.2*r*r),.2*n]},s=(e,t,n,r,i,a,o)=>{let s=new Float32Array(i),c=new Float32Array(i),l=new Float32Array(i),u=new Float32Array(i);for(let d=0;d<i;d++){let i=d*n+r,f=t[i],p=t[i+1],m=t[i+2],h=e[3]*f+e[7]*p+e[11]*m+e[15],g=1/(h>1e-9?h:1e-9);s[d]=((e[0]*f+e[4]*p+e[8]*m+e[12])*g+1)*.5*a,c[d]=(1-(e[1]*f+e[5]*p+e[9]*m+e[13])*g)*.5*o,l[d]=(e[2]*f+e[6]*p+e[10]*m+e[14])*g,u[d]=h}return{x:s,y:c,z:l,w:u}},c=e=>e<0?0:e>255?255:Math.round(e),l=i=>{let o=i.getContext(`2d`);if(!o)return null;let l=new Map,f=(e,t,n)=>{let r=c(e)<<16|c(t)<<8|c(n),i=l.get(r);return i===void 0&&(i=`rgb(${r>>16},${r>>8&255},${r&255})`,l.size>4096&&l.clear(),l.set(r,i)),i},p=new Map,m=(e,t,n)=>{let r=c(e)>>4<<8|c(t)>>4<<4|c(n)>>4,a=p.get(r);return a===void 0&&(a=d(i,(r>>8&15)*17,(r>>4&15)*17,(r&15)*17),p.set(r,a)),a},h=(c,l)=>{let{width:d,height:p}=i,h=l.dpr;o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,d,p);let g=e.drawOrder(c),_=l.viewProj,[v,y,b,x]=l.lighting,S=l.light,C=l.fog[0]*255,w=l.fog[1]*255,T=l.fog[2]*255,E=[],D=[],O=[],k=0;for(let e of g)k+=e.kind===`mesh`?e.indices.length/3:e.count;let A=new Float32Array(k),j=new Uint8Array(k),M=new Uint16Array(k),N=new Uint32Array(k),P=0;g.forEach((e,i)=>{let a=e.kind===`mesh`?e.vertices:e.data;if(D.push(new Float32Array(a)),O.push(new Uint8Array(a)),e.kind===`mesh`){let n=D[i],r=s(_,n,7,0,e.vertexCount,d,p);E.push(r);let a=e.indices;for(let e=0;e+2<a.length;e+=3){let n=a[e],o=a[e+1],s=a[e+2];r.w[n]<=0||r.w[o]<=0||r.w[s]<=0||(A[P]=(r.z[n]+r.z[o]+r.z[s])/3,j[P]=t,M[P]=i,N[P]=e,P++)}}else if(e.kind===`points`){let t=D[i],r=s(_,t,5,0,e.count,d,p);E.push(r);for(let t=0;t<e.count;t++)r.w[t]<=0||(A[P]=r.z[t],j[P]=n,M[P]=i,N[P]=t,P++)}else{let t=D[i],n=s(_,t,7,0,e.count,d,p),a=s(_,t,7,3,e.count,d,p);E.push({x:u(n.x,a.x),y:u(n.y,a.y),z:u(n.z,a.z),w:u(n.w,a.w)});let o=e.bias*5;for(let t=0;t<e.count;t++)n.w[t]<=0||a.w[t]<=0||(A[P]=(n.z[t]+a.z[t])/2-o,j[P]=r,M[P]=i,N[P]=t,P++)}});let F=new Uint32Array(P);for(let e=0;e<P;e++)F[e]=e;F.sort((e,t)=>A[t]-A[e]),o.lineJoin=`round`,o.lineCap=`round`;let I=-1,L=e=>{e!==I&&(o.globalAlpha=e,I=e)},R=!1,z=e=>{e!==R&&(o.globalCompositeOperation=e?`lighter`:`source-over`,R=e)},B=l.distance-l.radius;for(let e=0;e<P;e++){let i=F[e],s=g[M[i]],c=E[M[i]],u=D[M[i]],d=O[M[i]];if(!s||!c||!u||!d)continue;let p=N[i];if(z(s.kind===`points`&&!!s.additive),s.kind===`mesh`&&j[i]===t){let e=s.indices[p],t=s.indices[p+1],n=s.indices[p+2],r=u[e*7],i=u[e*7+1],a=u[e*7+2],m=u[t*7]-r,h=u[t*7+1]-i,g=u[t*7+2]-a,_=u[n*7]-r,C=u[n*7+1]-i,w=u[n*7+2]-a,T=h*w-g*C,E=g*_-m*w,D=m*C-h*_,O=Math.hypot(T,E,D)||1;T/=O,E/=O,D/=O;let k=l.eye[0]-r,A=l.eye[1]-i,j=l.eye[2]-a,M=Math.hypot(k,A,j)||1;k/=M,A/=M,j/=M,T*k+E*A+D*j<0&&(T=-T,E=-E,D=-D);let N=Math.max(0,T*S[0]+E*S[1]+D*S[2]),P=S[0]+k,F=S[1]+A,I=S[2]+j,R=Math.hypot(P,F,I)||1;P/=R,F/=R,I/=R;let z=Math.max(0,T*P+E*F+D*I)**+x*b*255,B=v+y*N,V=e*28+24,H=t*28+24,U=n*28+24,W=(d[V]+d[H]+d[U])/3,G=(d[V+1]+d[H+1]+d[U+1])/3,K=(d[V+2]+d[H+2]+d[U+2])/3,q=(d[V+3]+d[H+3]+d[U+3])/765,J=f(W*B+z,G*B+z,K*B+z);L(s.opacity*q),o.beginPath(),o.moveTo(c.x[e],c.y[e]),o.lineTo(c.x[t],c.y[t]),o.lineTo(c.x[n],c.y[n]),o.closePath(),o.fillStyle=J,o.fill(),s.opacity>=1&&!s.transparent&&(o.strokeStyle=J,o.lineWidth=.75,o.stroke())}else if(s.kind===`points`&&j[i]===n){let e=s.perspective&&!l.orthographic?Math.max(.5,Math.min(2,l.distance/Math.max(c.w[p],1e-6))):1,t=s.style===2,n=Math.max(1,s.thinned??1),r=t?Math.sqrt(Math.sqrt(n)):1,i=Math.max(0,u[p*5+3])*h*e*r/2,g=Math.max(i,t?.75:.5),_=Math.min(1,i*i/(g*g)),v=p*20+16,y=u[p*5]-l.eye[0],b=u[p*5+1]-l.eye[1],x=u[p*5+2]-l.eye[2],S=Math.max(0,Math.min(1,(Math.hypot(y,b,x)-B)/(2*l.radius)))*.45,E=d[v],D=d[v+1],O=d[v+2],k=s.opacity*(d[v+3]/255)*_*Math.sqrt(n);s.additive?k*=1-S:(E+=(C-E)*S,D+=(w-D)*S,O+=(T-O)*S),L(Math.min(1,k));let A=t?m(E,D,O):null;if(A){let e=g*a;o.drawImage(A,c.x[p]-e,c.y[p]-e,e*2,e*2)}else o.fillStyle=f(E,D,O),g<1.5?o.fillRect(c.x[p]-g,c.y[p]-g,g*2,g*2):(o.beginPath(),o.arc(c.x[p],c.y[p],g,0,Math.PI*2),o.fill())}else if(s.kind===`lines`&&j[i]===r){let e=p*28+24,t=c.x.length/2;L(s.opacity*(d[e+3]/255)),o.strokeStyle=f(d[e],d[e+1],d[e+2]),o.lineWidth=Math.max(.5,s.width*h),o.beginPath(),o.moveTo(c.x[p],c.y[p]),o.lineTo(c.x[t+p],c.y[t+p]),o.stroke()}}o.globalAlpha=1,z(!1)};return{kind:`canvas2d`,canvas:i,resize(e,t){i.width=Math.max(1,e),i.height=Math.max(1,t)},render(e,t){h(e,t)},destroy(){l.clear(),p.clear(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,i.width,i.height)}}},u=(e,t)=>{let n=new Float32Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},d=(e,t,n,r)=>{let s=e.ownerDocument.createElement(`canvas`);s.width=i,s.height=i;let c=s.getContext(`2d`);if(!c||typeof c.createImageData!=`function`)return null;let l=c.createImageData(i,i);if(!l)return null;let u=i/2,d=u/a;for(let e=0;e<i;e++)for(let a=0;a<i;a++){let s=Math.hypot(a+.5-u,e+.5-u),[c,f]=o(s,d),p=(e*i+a)*4;l.data[p]=t+(255-t)*f,l.data[p+1]=n+(255-n)*f,l.data[p+2]=r+(255-r)*f,l.data[p+3]=s<u?c*255:0}return c.putImageData(l,0,0),s};exports.createCanvas2d3D=l,exports.glowProfile=o;
|
|
2
2
|
//# sourceMappingURL=canvas2d.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas2d.cjs","names":["drawOrder","require_render_types","CPU_POINT_BUDGET","TRIANGLE","POINT","SEGMENT","projectAll","x","count","y","z","w","i","o","stride","offset","px","data","py","pz","cw","m","iw","width","height","clamp255","v","createCanvas2d3D","ctx","canvas","styles","style","key","r","g","b","s","render","dpr","frame","ordered","items","ambient","diffuse","specular","shininess","L","fogR","fogG","fogB","totalPoints","item","pointStride","projected","floats","bytes","capacity","depth","kind","owner","element","n","raw","f32","k","p","idx","t","a","c","concat","bias","order","currentAlpha","alpha","value","near","u8","e","ax","ay","az","ux","uy","uz","vx","vy","vz","nx","ny","nz","len","ex","ey","ez","el","lambert","hx","hy","hz","hl","spec","light","ca","cb","cc","bl","ac","fill","scale","radius","wx","wy","wz","fog","half","out"],"sources":["../../../../../charts/src/engine/three-d/canvas2d.ts"],"sourcesContent":["// Canvas2D backend of the 3D charts: CPU projection and the painter's\n// algorithm (every triangle, dot and segment sorted back to front), flat\n// lighting per triangle. Point clouds are decimated to a fixed budget; the\n// chart also resamples the surfaces (`CPU_BUDGET`) for this backend.\n\nimport {\n drawOrder,\n type Frame3D,\n type Item3D,\n type Renderer3D,\n} from \"./render-types\";\n\n/** Largest number of dots drawn per frame (by stride over every point item) */\nexport const CPU_POINT_BUDGET = 40_000;\n\nconst TRIANGLE = 0;\nconst POINT = 1;\nconst SEGMENT = 2;\n\ninterface Projected {\n x: Float32Array;\n y: Float32Array;\n z: Float32Array;\n w: Float32Array;\n}\n\nconst projectAll = (\n m: Float32Array,\n data: Float32Array,\n stride: number,\n offset: number,\n count: number,\n width: number,\n height: number,\n): Projected => {\n const x = new Float32Array(count);\n const y = new Float32Array(count);\n const z = new Float32Array(count);\n const w = new Float32Array(count);\n for (let i = 0; i < count; i++) {\n const o = i * stride + offset;\n const px = data[o];\n const py = data[o + 1];\n const pz = data[o + 2];\n const cw = m[3] * px + m[7] * py + m[11] * pz + m[15];\n const iw = 1 / (cw > 1e-9 ? cw : 1e-9);\n x[i] = ((m[0] * px + m[4] * py + m[8] * pz + m[12]) * iw + 1) * 0.5 * width;\n y[i] =\n (1 - (m[1] * px + m[5] * py + m[9] * pz + m[13]) * iw) * 0.5 * height;\n z[i] = (m[2] * px + m[6] * py + m[10] * pz + m[14]) * iw;\n w[i] = cw;\n }\n return { x, y, z, w };\n};\n\nconst clamp255 = (v: number) => (v < 0 ? 0 : v > 255 ? 255 : Math.round(v));\n\nexport const createCanvas2d3D = (\n canvas: HTMLCanvasElement,\n): Renderer3D | null => {\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return null;\n const styles = new Map<number, string>();\n const style = (r: number, g: number, b: number) => {\n const key = (clamp255(r) << 16) | (clamp255(g) << 8) | clamp255(b);\n let s = styles.get(key);\n if (s === undefined) {\n s = `rgb(${key >> 16},${(key >> 8) & 255},${key & 255})`;\n if (styles.size > 4096) styles.clear();\n styles.set(key, s);\n }\n return s;\n };\n\n const render = (items: readonly Item3D[], frame: Frame3D) => {\n const { width, height } = canvas;\n const dpr = frame.dpr;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, width, height);\n const ordered = drawOrder(items);\n const m = frame.viewProj;\n const [ambient, diffuse, specular, shininess] = frame.lighting;\n const L = frame.light;\n const fogR = frame.fog[0] * 255;\n const fogG = frame.fog[1] * 255;\n const fogB = frame.fog[2] * 255;\n\n let totalPoints = 0;\n for (const item of ordered)\n if (item.kind === \"points\") totalPoints += item.count;\n const pointStride = Math.max(1, Math.ceil(totalPoints / CPU_POINT_BUDGET));\n\n // ---- collect the primitives\n const projected: (Projected | null)[] = [];\n // typed views of every item (floats and bytes of the same buffer)\n const floats: Float32Array[] = [];\n const bytes: Uint8Array[] = [];\n let capacity = 0;\n for (const item of ordered) {\n capacity +=\n item.kind === \"mesh\"\n ? item.indices.length / 3\n : item.kind === \"points\"\n ? Math.ceil(item.count / pointStride)\n : item.count;\n }\n const depth = new Float32Array(capacity);\n const kind = new Uint8Array(capacity);\n const owner = new Uint16Array(capacity);\n const element = new Uint32Array(capacity);\n let n = 0;\n ordered.forEach((item, k) => {\n const raw = item.kind === \"mesh\" ? item.vertices : item.data;\n floats.push(new Float32Array(raw));\n bytes.push(new Uint8Array(raw));\n if (item.kind === \"mesh\") {\n const f32 = floats[k]!;\n const p = projectAll(m, f32, 7, 0, item.vertexCount, width, height);\n projected.push(p);\n const idx = item.indices;\n for (let t = 0; t + 2 < idx.length; t += 3) {\n const a = idx[t];\n const b = idx[t + 1];\n const c = idx[t + 2];\n if (p.w[a] <= 0 || p.w[b] <= 0 || p.w[c] <= 0) continue;\n depth[n] = (p.z[a] + p.z[b] + p.z[c]) / 3;\n kind[n] = TRIANGLE;\n owner[n] = k;\n element[n] = t;\n n++;\n }\n } else if (item.kind === \"points\") {\n const f32 = floats[k]!;\n const p = projectAll(m, f32, 5, 0, item.count, width, height);\n projected.push(p);\n for (let i = 0; i < item.count; i += pointStride) {\n if (p.w[i] <= 0) continue;\n depth[n] = p.z[i];\n kind[n] = POINT;\n owner[n] = k;\n element[n] = i;\n n++;\n }\n } else {\n const f32 = floats[k]!;\n // both ends: projected as two interleaved point lists\n const a = projectAll(m, f32, 7, 0, item.count, width, height);\n const b = projectAll(m, f32, 7, 3, item.count, width, height);\n projected.push({\n x: concat(a.x, b.x),\n y: concat(a.y, b.y),\n z: concat(a.z, b.z),\n w: concat(a.w, b.w),\n });\n const bias = item.bias * 5;\n for (let i = 0; i < item.count; i++) {\n if (a.w[i] <= 0 || b.w[i] <= 0) continue;\n depth[n] = (a.z[i] + b.z[i]) / 2 - bias;\n kind[n] = SEGMENT;\n owner[n] = k;\n element[n] = i;\n n++;\n }\n }\n });\n const order = new Uint32Array(n);\n for (let i = 0; i < n; i++) order[i] = i;\n order.sort((a, b) => depth[b] - depth[a]);\n\n // ---- draw back to front\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n let currentAlpha = -1;\n const alpha = (value: number) => {\n if (value !== currentAlpha) {\n ctx.globalAlpha = value;\n currentAlpha = value;\n }\n };\n const near = frame.distance - frame.radius;\n for (let o = 0; o < n; o++) {\n const i = order[o];\n const item = ordered[owner[i]];\n const p = projected[owner[i]];\n const f32 = floats[owner[i]];\n const u8 = bytes[owner[i]];\n if (!item || !p || !f32 || !u8) continue;\n const e = element[i];\n if (item.kind === \"mesh\" && kind[i] === TRIANGLE) {\n const a = item.indices[e];\n const b = item.indices[e + 1];\n const c = item.indices[e + 2];\n // flat normal facing the camera\n const ax = f32[a * 7],\n ay = f32[a * 7 + 1],\n az = f32[a * 7 + 2];\n const ux = f32[b * 7] - ax,\n uy = f32[b * 7 + 1] - ay,\n uz = f32[b * 7 + 2] - az;\n const vx = f32[c * 7] - ax,\n vy = f32[c * 7 + 1] - ay,\n vz = f32[c * 7 + 2] - az;\n let nx = uy * vz - uz * vy;\n let ny = uz * vx - ux * vz;\n let nz = ux * vy - uy * vx;\n const len = Math.hypot(nx, ny, nz) || 1;\n nx /= len;\n ny /= len;\n nz /= len;\n let ex = frame.eye[0] - ax;\n let ey = frame.eye[1] - ay;\n let ez = frame.eye[2] - az;\n const el = Math.hypot(ex, ey, ez) || 1;\n ex /= el;\n ey /= el;\n ez /= el;\n if (nx * ex + ny * ey + nz * ez < 0) {\n nx = -nx;\n ny = -ny;\n nz = -nz;\n }\n const lambert = Math.max(0, nx * L[0] + ny * L[1] + nz * L[2]);\n let hx = L[0] + ex;\n let hy = L[1] + ey;\n let hz = L[2] + ez;\n const hl = Math.hypot(hx, hy, hz) || 1;\n hx /= hl;\n hy /= hl;\n hz /= hl;\n const spec =\n Math.pow(Math.max(0, nx * hx + ny * hy + nz * hz), shininess) *\n specular *\n 255;\n const light = ambient + diffuse * lambert;\n const ca = a * 28 + 24;\n const cb = b * 28 + 24;\n const cc = c * 28 + 24;\n const r = (u8[ca] + u8[cb] + u8[cc]) / 3;\n const g = (u8[ca + 1] + u8[cb + 1] + u8[cc + 1]) / 3;\n const bl = (u8[ca + 2] + u8[cb + 2] + u8[cc + 2]) / 3;\n const ac = (u8[ca + 3] + u8[cb + 3] + u8[cc + 3]) / 765;\n const fill = style(\n r * light + spec,\n g * light + spec,\n bl * light + spec,\n );\n alpha(item.opacity * ac);\n ctx.beginPath();\n ctx.moveTo(p.x[a], p.y[a]);\n ctx.lineTo(p.x[b], p.y[b]);\n ctx.lineTo(p.x[c], p.y[c]);\n ctx.closePath();\n ctx.fillStyle = fill;\n ctx.fill();\n if (item.opacity >= 1) {\n // hides the seams between neighbouring triangles\n ctx.strokeStyle = fill;\n ctx.lineWidth = 0.75;\n ctx.stroke();\n }\n } else if (item.kind === \"points\" && kind[i] === POINT) {\n const scale =\n item.perspective && !frame.orthographic\n ? Math.max(\n 0.5,\n Math.min(2, frame.distance / Math.max(p.w[e], 1e-6)),\n )\n : 1;\n const radius = Math.max(0.5, (f32[e * 5 + 3] * dpr * scale) / 2);\n const c = e * 20 + 16;\n const wx = f32[e * 5] - frame.eye[0];\n const wy = f32[e * 5 + 1] - frame.eye[1];\n const wz = f32[e * 5 + 2] - frame.eye[2];\n const fog =\n Math.max(\n 0,\n Math.min(1, (Math.hypot(wx, wy, wz) - near) / (2 * frame.radius)),\n ) * 0.45;\n const r = u8[c] + (fogR - u8[c]) * fog;\n const g = u8[c + 1] + (fogG - u8[c + 1]) * fog;\n const b = u8[c + 2] + (fogB - u8[c + 2]) * fog;\n alpha(item.opacity * (u8[c + 3] / 255));\n ctx.fillStyle = style(r, g, b);\n if (radius < 1.5) {\n ctx.fillRect(\n p.x[e] - radius,\n p.y[e] - radius,\n radius * 2,\n radius * 2,\n );\n } else {\n ctx.beginPath();\n ctx.arc(p.x[e], p.y[e], radius, 0, Math.PI * 2);\n ctx.fill();\n }\n } else if (item.kind === \"lines\" && kind[i] === SEGMENT) {\n const c = e * 28 + 24;\n const half = p.x.length / 2;\n alpha(item.opacity * (u8[c + 3] / 255));\n ctx.strokeStyle = style(u8[c], u8[c + 1], u8[c + 2]);\n ctx.lineWidth = Math.max(0.5, item.width * dpr);\n ctx.beginPath();\n ctx.moveTo(p.x[e], p.y[e]);\n ctx.lineTo(p.x[half + e], p.y[half + e]);\n ctx.stroke();\n }\n }\n ctx.globalAlpha = 1;\n };\n\n return {\n kind: \"canvas2d\",\n canvas,\n resize(width, height) {\n canvas.width = Math.max(1, width);\n canvas.height = Math.max(1, height);\n },\n render(items, frame) {\n render(items, frame);\n },\n destroy() {\n styles.clear();\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n },\n };\n};\n\nconst concat = (a: Float32Array, b: Float32Array) => {\n const out = new Float32Array(a.length + b.length);\n out.set(a, 0);\n out.set(b, a.length);\n return out;\n};\n"],"mappings":"sCAaA,IAAaE,EAAmB,IAE1BC,EAAW,EACXC,EAAQ,EACRC,EAAU,EASVC,GACJ,EACA,EACA,EACA,EACA,EACA,EACA,IACc,CACd,IAAMC,EAAI,IAAI,aAAaC,CAAK,EAC1BC,EAAI,IAAI,aAAaD,CAAK,EAC1BE,EAAI,IAAI,aAAaF,CAAK,EAC1BG,EAAI,IAAI,aAAaH,CAAK,EAChC,IAAK,IAAII,EAAI,EAAGA,EAAIJ,EAAO,IAAK,CAC9B,IAAMK,EAAID,EAAIE,EAASC,EACjBC,EAAKC,EAAKJ,GACVK,EAAKD,EAAKJ,EAAI,GACdM,EAAKF,EAAKJ,EAAI,GACdO,EAAKC,EAAE,GAAKL,EAAKK,EAAE,GAAKH,EAAKG,EAAE,IAAMF,EAAKE,EAAE,IAC5CC,EAAK,GAAKF,EAAK,KAAOA,EAAK,MACjC,EAAER,KAAOS,EAAE,GAAKL,EAAKK,EAAE,GAAKH,EAAKG,EAAE,GAAKF,EAAKE,EAAE,KAAOC,EAAK,GAAK,GAAMC,EACtE,EAAEX,IACC,GAAKS,EAAE,GAAKL,EAAKK,EAAE,GAAKH,EAAKG,EAAE,GAAKF,EAAKE,EAAE,KAAOC,GAAM,GAAME,EACjE,EAAEZ,IAAMS,EAAE,GAAKL,EAAKK,EAAE,GAAKH,EAAKG,EAAE,IAAMF,EAAKE,EAAE,KAAOC,EACtD,EAAEV,GAAKQ,CACT,CACA,MAAO,CAAE,IAAG,IAAG,IAAG,GAAE,CAC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core","r","d","q","projectAll","x","count","y","z","w","i","o","stride","offset","px","data","py","pz","cw","m","iw","width","height","clamp255","v","createCanvas2d3D","ctx","canvas","styles","style","key","g","b","s","sprites","sprite","makeSprite","render","dpr","frame","ordered","items","ambient","diffuse","specular","shininess","L","fogR","fogG","fogB","projected","floats","bytes","capacity","item","depth","kind","owner","element","n","raw","f32","k","p","idx","t","a","c","concat","bias","order","currentAlpha","alpha","value","lighter","composite","add","near","u8","e","ax","ay","az","ux","uy","uz","vx","vy","vz","nx","ny","nz","len","ex","ey","ez","el","lambert","hx","hy","hz","hl","spec","light","ca","cb","cc","bl","ac","fill","scale","glow","thinned","grow","radius","coverage","wx","wy","wz","fog","image","reach","half","out","pixels","center","white"],"sources":["../../../../../charts/src/engine/three-d/canvas2d.ts"],"sourcesContent":["// Canvas2D backend of the 3D charts: CPU projection and the painter's\n// algorithm (every triangle, dot and segment of every item sorted back to\n// front together: transparent meshes blend in the right order), flat\n// lighting per triangle. The chart thins the point clouds and resamples the\n// surfaces for this backend (`CPU_BUDGET`): what it gets is what is drawn,\n// and what can be hovered.\n\nimport {\n POINT_GLOW,\n drawOrder,\n type Frame3D,\n type Item3D,\n type Renderer3D,\n} from \"./render-types\";\n\nconst TRIANGLE = 0;\nconst POINT = 1;\nconst SEGMENT = 2;\n\n/** Side of the glow sprites (px); the halo reaches 2.2 × the core radius */\nconst SPRITE = 32;\nconst GLOW_REACH = 2.2;\n\n/**\n * Glow profile (as the GPU shaders): an anti-aliased core and a gaussian\n * halo; `d` and `r` in pixels. Returns the alpha and the whitening.\n */\nexport const glowProfile = (d: number, r: number): [number, number] => {\n const core = Math.max(0, Math.min(1, r * 0.6 + 0.5 - d));\n const q = d / r;\n return [core + (1 - core) * Math.exp(-1.2 * q * q), 0.2 * core];\n};\n\ninterface Projected {\n x: Float32Array;\n y: Float32Array;\n z: Float32Array;\n w: Float32Array;\n}\n\nconst projectAll = (\n m: Float32Array,\n data: Float32Array,\n stride: number,\n offset: number,\n count: number,\n width: number,\n height: number,\n): Projected => {\n const x = new Float32Array(count);\n const y = new Float32Array(count);\n const z = new Float32Array(count);\n const w = new Float32Array(count);\n for (let i = 0; i < count; i++) {\n const o = i * stride + offset;\n const px = data[o];\n const py = data[o + 1];\n const pz = data[o + 2];\n const cw = m[3] * px + m[7] * py + m[11] * pz + m[15];\n const iw = 1 / (cw > 1e-9 ? cw : 1e-9);\n x[i] = ((m[0] * px + m[4] * py + m[8] * pz + m[12]) * iw + 1) * 0.5 * width;\n y[i] =\n (1 - (m[1] * px + m[5] * py + m[9] * pz + m[13]) * iw) * 0.5 * height;\n z[i] = (m[2] * px + m[6] * py + m[10] * pz + m[14]) * iw;\n w[i] = cw;\n }\n return { x, y, z, w };\n};\n\nconst clamp255 = (v: number) => (v < 0 ? 0 : v > 255 ? 255 : Math.round(v));\n\nexport const createCanvas2d3D = (\n canvas: HTMLCanvasElement,\n): Renderer3D | null => {\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return null;\n const styles = new Map<number, string>();\n const style = (r: number, g: number, b: number) => {\n const key = (clamp255(r) << 16) | (clamp255(g) << 8) | clamp255(b);\n let s = styles.get(key);\n if (s === undefined) {\n s = `rgb(${key >> 16},${(key >> 8) & 255},${key & 255})`;\n if (styles.size > 4096) styles.clear();\n styles.set(key, s);\n }\n return s;\n };\n // glow sprites by color (4 bits per channel); null: no offscreen canvas\n const sprites = new Map<number, HTMLCanvasElement | null>();\n const sprite = (r: number, g: number, b: number) => {\n const key =\n ((clamp255(r) >> 4) << 8) |\n ((clamp255(g) >> 4) << 4) |\n (clamp255(b) >> 4);\n let s = sprites.get(key);\n if (s === undefined) {\n s = makeSprite(\n canvas,\n ((key >> 8) & 15) * 17,\n ((key >> 4) & 15) * 17,\n (key & 15) * 17,\n );\n sprites.set(key, s);\n }\n return s;\n };\n\n const render = (items: readonly Item3D[], frame: Frame3D) => {\n const { width, height } = canvas;\n const dpr = frame.dpr;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, width, height);\n const ordered = drawOrder(items);\n const m = frame.viewProj;\n const [ambient, diffuse, specular, shininess] = frame.lighting;\n const L = frame.light;\n const fogR = frame.fog[0] * 255;\n const fogG = frame.fog[1] * 255;\n const fogB = frame.fog[2] * 255;\n\n // ---- collect the primitives\n const projected: (Projected | null)[] = [];\n // typed views of every item (floats and bytes of the same buffer)\n const floats: Float32Array[] = [];\n const bytes: Uint8Array[] = [];\n let capacity = 0;\n for (const item of ordered) {\n capacity += item.kind === \"mesh\" ? item.indices.length / 3 : item.count;\n }\n const depth = new Float32Array(capacity);\n const kind = new Uint8Array(capacity);\n const owner = new Uint16Array(capacity);\n const element = new Uint32Array(capacity);\n let n = 0;\n ordered.forEach((item, k) => {\n const raw = item.kind === \"mesh\" ? item.vertices : item.data;\n floats.push(new Float32Array(raw));\n bytes.push(new Uint8Array(raw));\n if (item.kind === \"mesh\") {\n const f32 = floats[k]!;\n const p = projectAll(m, f32, 7, 0, item.vertexCount, width, height);\n projected.push(p);\n const idx = item.indices;\n for (let t = 0; t + 2 < idx.length; t += 3) {\n const a = idx[t];\n const b = idx[t + 1];\n const c = idx[t + 2];\n if (p.w[a] <= 0 || p.w[b] <= 0 || p.w[c] <= 0) continue;\n depth[n] = (p.z[a] + p.z[b] + p.z[c]) / 3;\n kind[n] = TRIANGLE;\n owner[n] = k;\n element[n] = t;\n n++;\n }\n } else if (item.kind === \"points\") {\n const f32 = floats[k]!;\n const p = projectAll(m, f32, 5, 0, item.count, width, height);\n projected.push(p);\n for (let i = 0; i < item.count; i++) {\n if (p.w[i] <= 0) continue;\n depth[n] = p.z[i];\n kind[n] = POINT;\n owner[n] = k;\n element[n] = i;\n n++;\n }\n } else {\n const f32 = floats[k]!;\n // both ends: projected as two interleaved point lists\n const a = projectAll(m, f32, 7, 0, item.count, width, height);\n const b = projectAll(m, f32, 7, 3, item.count, width, height);\n projected.push({\n x: concat(a.x, b.x),\n y: concat(a.y, b.y),\n z: concat(a.z, b.z),\n w: concat(a.w, b.w),\n });\n const bias = item.bias * 5;\n for (let i = 0; i < item.count; i++) {\n if (a.w[i] <= 0 || b.w[i] <= 0) continue;\n depth[n] = (a.z[i] + b.z[i]) / 2 - bias;\n kind[n] = SEGMENT;\n owner[n] = k;\n element[n] = i;\n n++;\n }\n }\n });\n const order = new Uint32Array(n);\n for (let i = 0; i < n; i++) order[i] = i;\n order.sort((a, b) => depth[b] - depth[a]);\n\n // ---- draw back to front\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n let currentAlpha = -1;\n const alpha = (value: number) => {\n if (value !== currentAlpha) {\n ctx.globalAlpha = value;\n currentAlpha = value;\n }\n };\n let lighter = false;\n const composite = (add: boolean) => {\n if (add !== lighter) {\n ctx.globalCompositeOperation = add ? \"lighter\" : \"source-over\";\n lighter = add;\n }\n };\n const near = frame.distance - frame.radius;\n for (let o = 0; o < n; o++) {\n const i = order[o];\n const item = ordered[owner[i]];\n const p = projected[owner[i]];\n const f32 = floats[owner[i]];\n const u8 = bytes[owner[i]];\n if (!item || !p || !f32 || !u8) continue;\n const e = element[i];\n composite(item.kind === \"points\" && !!item.additive);\n if (item.kind === \"mesh\" && kind[i] === TRIANGLE) {\n const a = item.indices[e];\n const b = item.indices[e + 1];\n const c = item.indices[e + 2];\n // flat normal facing the camera\n const ax = f32[a * 7],\n ay = f32[a * 7 + 1],\n az = f32[a * 7 + 2];\n const ux = f32[b * 7] - ax,\n uy = f32[b * 7 + 1] - ay,\n uz = f32[b * 7 + 2] - az;\n const vx = f32[c * 7] - ax,\n vy = f32[c * 7 + 1] - ay,\n vz = f32[c * 7 + 2] - az;\n let nx = uy * vz - uz * vy;\n let ny = uz * vx - ux * vz;\n let nz = ux * vy - uy * vx;\n const len = Math.hypot(nx, ny, nz) || 1;\n nx /= len;\n ny /= len;\n nz /= len;\n let ex = frame.eye[0] - ax;\n let ey = frame.eye[1] - ay;\n let ez = frame.eye[2] - az;\n const el = Math.hypot(ex, ey, ez) || 1;\n ex /= el;\n ey /= el;\n ez /= el;\n if (nx * ex + ny * ey + nz * ez < 0) {\n nx = -nx;\n ny = -ny;\n nz = -nz;\n }\n const lambert = Math.max(0, nx * L[0] + ny * L[1] + nz * L[2]);\n let hx = L[0] + ex;\n let hy = L[1] + ey;\n let hz = L[2] + ez;\n const hl = Math.hypot(hx, hy, hz) || 1;\n hx /= hl;\n hy /= hl;\n hz /= hl;\n const spec =\n Math.pow(Math.max(0, nx * hx + ny * hy + nz * hz), shininess) *\n specular *\n 255;\n const light = ambient + diffuse * lambert;\n const ca = a * 28 + 24;\n const cb = b * 28 + 24;\n const cc = c * 28 + 24;\n const r = (u8[ca] + u8[cb] + u8[cc]) / 3;\n const g = (u8[ca + 1] + u8[cb + 1] + u8[cc + 1]) / 3;\n const bl = (u8[ca + 2] + u8[cb + 2] + u8[cc + 2]) / 3;\n const ac = (u8[ca + 3] + u8[cb + 3] + u8[cc + 3]) / 765;\n const fill = style(\n r * light + spec,\n g * light + spec,\n bl * light + spec,\n );\n alpha(item.opacity * ac);\n ctx.beginPath();\n ctx.moveTo(p.x[a], p.y[a]);\n ctx.lineTo(p.x[b], p.y[b]);\n ctx.lineTo(p.x[c], p.y[c]);\n ctx.closePath();\n ctx.fillStyle = fill;\n ctx.fill();\n if (item.opacity >= 1 && !item.transparent) {\n // hides the seams between neighbouring triangles\n ctx.strokeStyle = fill;\n ctx.lineWidth = 0.75;\n ctx.stroke();\n }\n } else if (item.kind === \"points\" && kind[i] === POINT) {\n const scale =\n item.perspective && !frame.orthographic\n ? Math.max(\n 0.5,\n Math.min(2, frame.distance / Math.max(p.w[e], 1e-6)),\n )\n : 1;\n const glow = item.style === POINT_GLOW;\n // thinned clouds: denser (and, glowing, larger) dots\n const thinned = Math.max(1, item.thinned ?? 1);\n const grow = glow ? Math.sqrt(Math.sqrt(thinned)) : 1;\n const raw = (Math.max(0, f32[e * 5 + 3]) * dpr * scale * grow) / 2;\n const radius = Math.max(raw, glow ? 0.75 : 0.5);\n const coverage = Math.min(1, (raw * raw) / (radius * radius));\n const c = e * 20 + 16;\n const wx = f32[e * 5] - frame.eye[0];\n const wy = f32[e * 5 + 1] - frame.eye[1];\n const wz = f32[e * 5 + 2] - frame.eye[2];\n const fog =\n Math.max(\n 0,\n Math.min(1, (Math.hypot(wx, wy, wz) - near) / (2 * frame.radius)),\n ) * 0.45;\n let r = u8[c];\n let g = u8[c + 1];\n let b = u8[c + 2];\n let a =\n item.opacity * (u8[c + 3] / 255) * coverage * Math.sqrt(thinned);\n if (item.additive) {\n a *= 1 - fog;\n } else {\n r += (fogR - r) * fog;\n g += (fogG - g) * fog;\n b += (fogB - b) * fog;\n }\n alpha(Math.min(1, a));\n const image = glow ? sprite(r, g, b) : null;\n if (image) {\n const reach = radius * GLOW_REACH;\n ctx.drawImage(\n image,\n p.x[e] - reach,\n p.y[e] - reach,\n reach * 2,\n reach * 2,\n );\n } else {\n ctx.fillStyle = style(r, g, b);\n if (radius < 1.5) {\n ctx.fillRect(\n p.x[e] - radius,\n p.y[e] - radius,\n radius * 2,\n radius * 2,\n );\n } else {\n ctx.beginPath();\n ctx.arc(p.x[e], p.y[e], radius, 0, Math.PI * 2);\n ctx.fill();\n }\n }\n } else if (item.kind === \"lines\" && kind[i] === SEGMENT) {\n const c = e * 28 + 24;\n const half = p.x.length / 2;\n alpha(item.opacity * (u8[c + 3] / 255));\n ctx.strokeStyle = style(u8[c], u8[c + 1], u8[c + 2]);\n ctx.lineWidth = Math.max(0.5, item.width * dpr);\n ctx.beginPath();\n ctx.moveTo(p.x[e], p.y[e]);\n ctx.lineTo(p.x[half + e], p.y[half + e]);\n ctx.stroke();\n }\n }\n ctx.globalAlpha = 1;\n composite(false);\n };\n\n return {\n kind: \"canvas2d\",\n canvas,\n resize(width, height) {\n canvas.width = Math.max(1, width);\n canvas.height = Math.max(1, height);\n },\n render(items, frame) {\n render(items, frame);\n },\n destroy() {\n styles.clear();\n sprites.clear();\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n },\n };\n};\n\nconst concat = (a: Float32Array, b: Float32Array) => {\n const out = new Float32Array(a.length + b.length);\n out.set(a, 0);\n out.set(b, a.length);\n return out;\n};\n\n/** A glow sprite of a color (`SPRITE` px, the halo filling it), or null */\nconst makeSprite = (\n canvas: HTMLCanvasElement,\n r: number,\n g: number,\n b: number,\n): HTMLCanvasElement | null => {\n const image = canvas.ownerDocument.createElement(\"canvas\");\n image.width = SPRITE;\n image.height = SPRITE;\n const ctx = image.getContext(\"2d\");\n if (!ctx || typeof ctx.createImageData !== \"function\") return null;\n const pixels = ctx.createImageData(SPRITE, SPRITE) as ImageData | undefined;\n if (!pixels) return null;\n const center = SPRITE / 2;\n const radius = center / GLOW_REACH;\n for (let y = 0; y < SPRITE; y++) {\n for (let x = 0; x < SPRITE; x++) {\n const d = Math.hypot(x + 0.5 - center, y + 0.5 - center);\n const [a, white] = glowProfile(d, radius);\n const o = (y * SPRITE + x) * 4;\n pixels.data[o] = r + (255 - r) * white;\n pixels.data[o + 1] = g + (255 - g) * white;\n pixels.data[o + 2] = b + (255 - b) * white;\n pixels.data[o + 3] = d < center ? a * 255 : 0;\n }\n }\n ctx.putImageData(pixels, 0, 0);\n return image;\n};\n"],"mappings":"sCAeA,IAAME,EAAW,EACXC,EAAQ,EACRC,EAAU,EAGVC,EAAS,GACTC,EAAa,IAMNC,GAAe,EAAW,IAAgC,CACrE,IAAMC,EAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAGC,EAAI,GAAM,GAAMC,CAAC,CAAC,EACjDC,EAAID,EAAID,EACd,MAAO,CAACD,GAAQ,EAAIA,GAAQ,KAAK,IAAI,KAAOG,EAAIA,CAAC,EAAG,GAAMH,CAAI,CAChE,EASMI,GACJ,EACA,EACA,EACA,EACA,EACA,EACA,IACc,CACd,IAAMC,EAAI,IAAI,aAAaC,CAAK,EAC1BC,EAAI,IAAI,aAAaD,CAAK,EAC1BE,EAAI,IAAI,aAAaF,CAAK,EAC1BG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+1,7 @@
|
|
|
1
1
|
import { Renderer3D } from './render-types.cjs';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Glow profile (as the GPU shaders): an anti-aliased core and a gaussian
|
|
4
|
+
* halo; `d` and `r` in pixels. Returns the alpha and the whitening.
|
|
5
|
+
*/
|
|
6
|
+
export declare const glowProfile: (d: number, r: number) => [number, number];
|
|
4
7
|
export declare const createCanvas2d3D: (canvas: HTMLCanvasElement) => Renderer3D | null;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Renderer3D } from './render-types.js';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Glow profile (as the GPU shaders): an anti-aliased core and a gaussian
|
|
4
|
+
* halo; `d` and `r` in pixels. Returns the alpha and the whitening.
|
|
5
|
+
*/
|
|
6
|
+
export declare const glowProfile: (d: number, r: number) => [number, number];
|
|
4
7
|
export declare const createCanvas2d3D: (canvas: HTMLCanvasElement) => Renderer3D | null;
|