minerva-design 1.3.0 → 1.4.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 +13630 -4757
- package/dist/angular/fesm2022/minerva-angular.mjs +6872 -172
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +2240 -0
- package/dist/charts/canvas.d.cts +7 -2
- package/dist/charts/canvas.d.ts +7 -2
- package/dist/charts/core.cjs +1 -1
- package/dist/charts/core.d.cts +7 -4
- package/dist/charts/core.d.ts +7 -4
- package/dist/charts/core.js +19 -8
- package/dist/charts/engine/axis.cjs +1 -1
- package/dist/charts/engine/axis.cjs.map +1 -1
- package/dist/charts/engine/axis.js +6 -6
- 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.d.cts +11 -1
- package/dist/charts/engine/canvas.d.ts +11 -1
- package/dist/charts/engine/canvas.js +118 -68
- 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.d.cts +1 -1
- package/dist/charts/engine/chart.d.ts +1 -1
- package/dist/charts/engine/chart.js +307 -285
- 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.js +2 -2
- package/dist/charts/engine/color.js.map +1 -1
- package/dist/charts/engine/controller.cjs +1 -1
- package/dist/charts/engine/controller.cjs.map +1 -1
- package/dist/charts/engine/controller.d.cts +12 -3
- package/dist/charts/engine/controller.d.ts +12 -3
- package/dist/charts/engine/controller.js +359 -299
- 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 +6 -0
- package/dist/charts/engine/data.d.ts +6 -0
- package/dist/charts/engine/data.js +63 -49
- package/dist/charts/engine/data.js.map +1 -1
- package/dist/charts/engine/format.cjs +1 -1
- package/dist/charts/engine/format.cjs.map +1 -1
- package/dist/charts/engine/format.d.cts +21 -6
- package/dist/charts/engine/format.d.ts +21 -6
- package/dist/charts/engine/format.js +46 -21
- package/dist/charts/engine/format.js.map +1 -1
- package/dist/charts/engine/items.cjs +1 -1
- package/dist/charts/engine/items.cjs.map +1 -1
- package/dist/charts/engine/items.js +211 -54
- package/dist/charts/engine/items.js.map +1 -1
- package/dist/charts/engine/labels.cjs +2 -0
- package/dist/charts/engine/labels.cjs.map +1 -0
- package/dist/charts/engine/labels.d.cts +13 -0
- package/dist/charts/engine/labels.d.ts +13 -0
- package/dist/charts/engine/labels.js +74 -0
- package/dist/charts/engine/labels.js.map +1 -0
- package/dist/charts/engine/layout.cjs +1 -1
- package/dist/charts/engine/layout.cjs.map +1 -1
- package/dist/charts/engine/layout.d.cts +34 -2
- package/dist/charts/engine/layout.d.ts +34 -2
- package/dist/charts/engine/layout.js +53 -12
- package/dist/charts/engine/layout.js.map +1 -1
- package/dist/charts/engine/locale.cjs +2 -0
- package/dist/charts/engine/locale.cjs.map +1 -0
- package/dist/charts/engine/locale.d.cts +33 -0
- package/dist/charts/engine/locale.d.ts +33 -0
- package/dist/charts/engine/locale.js +68 -0
- package/dist/charts/engine/locale.js.map +1 -0
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.d.cts +39 -1
- package/dist/charts/engine/model.d.ts +39 -1
- package/dist/charts/engine/model.js +212 -105
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/orderbook/book.cjs +2 -0
- package/dist/charts/engine/orderbook/book.cjs.map +1 -0
- package/dist/charts/engine/orderbook/book.d.cts +28 -0
- package/dist/charts/engine/orderbook/book.d.ts +28 -0
- package/dist/charts/engine/orderbook/book.js +134 -0
- package/dist/charts/engine/orderbook/book.js.map +1 -0
- package/dist/charts/engine/orderbook/depth.cjs +2 -0
- package/dist/charts/engine/orderbook/depth.cjs.map +1 -0
- package/dist/charts/engine/orderbook/depth.d.cts +7 -0
- package/dist/charts/engine/orderbook/depth.d.ts +7 -0
- package/dist/charts/engine/orderbook/depth.js +413 -0
- package/dist/charts/engine/orderbook/depth.js.map +1 -0
- package/dist/charts/engine/orderbook/format.cjs +2 -0
- package/dist/charts/engine/orderbook/format.cjs.map +1 -0
- package/dist/charts/engine/orderbook/format.d.cts +48 -0
- package/dist/charts/engine/orderbook/format.d.ts +48 -0
- package/dist/charts/engine/orderbook/format.js +65 -0
- package/dist/charts/engine/orderbook/format.js.map +1 -0
- package/dist/charts/engine/orderbook/heatmap.cjs +2 -0
- package/dist/charts/engine/orderbook/heatmap.cjs.map +1 -0
- package/dist/charts/engine/orderbook/heatmap.d.cts +9 -0
- package/dist/charts/engine/orderbook/heatmap.d.ts +9 -0
- package/dist/charts/engine/orderbook/heatmap.js +703 -0
- package/dist/charts/engine/orderbook/heatmap.js.map +1 -0
- package/dist/charts/engine/orderbook/host.cjs +2 -0
- package/dist/charts/engine/orderbook/host.cjs.map +1 -0
- package/dist/charts/engine/orderbook/host.d.cts +50 -0
- package/dist/charts/engine/orderbook/host.d.ts +50 -0
- package/dist/charts/engine/orderbook/host.js +161 -0
- package/dist/charts/engine/orderbook/host.js.map +1 -0
- package/dist/charts/engine/orderbook/index.cjs +1 -0
- package/dist/charts/engine/orderbook/index.d.cts +6 -0
- package/dist/charts/engine/orderbook/index.d.ts +6 -0
- package/dist/charts/engine/orderbook/index.js +6 -0
- package/dist/charts/engine/orderbook/ladder.cjs +2 -0
- package/dist/charts/engine/orderbook/ladder.cjs.map +1 -0
- package/dist/charts/engine/orderbook/ladder.d.cts +6 -0
- package/dist/charts/engine/orderbook/ladder.d.ts +6 -0
- package/dist/charts/engine/orderbook/ladder.js +341 -0
- package/dist/charts/engine/orderbook/ladder.js.map +1 -0
- package/dist/charts/engine/orderbook/tape.cjs +2 -0
- package/dist/charts/engine/orderbook/tape.cjs.map +1 -0
- package/dist/charts/engine/orderbook/tape.d.cts +6 -0
- package/dist/charts/engine/orderbook/tape.d.ts +6 -0
- package/dist/charts/engine/orderbook/tape.js +450 -0
- package/dist/charts/engine/orderbook/tape.js.map +1 -0
- package/dist/charts/engine/orderbook/types.d.cts +735 -0
- package/dist/charts/engine/orderbook/types.d.ts +735 -0
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +18 -2
- package/dist/charts/engine/overlay.d.ts +18 -2
- package/dist/charts/engine/overlay.js +132 -96
- 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 +249 -1
- package/dist/charts/engine/presets.d.ts +249 -1
- package/dist/charts/engine/presets.js +367 -29
- 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.js +18 -15
- package/dist/charts/engine/renderers/detect.js.map +1 -1
- package/dist/charts/engine/renderers/gl.cjs +2 -0
- package/dist/charts/engine/renderers/gl.cjs.map +1 -0
- package/dist/charts/engine/renderers/gl.d.cts +21 -0
- package/dist/charts/engine/renderers/gl.d.ts +21 -0
- package/dist/charts/engine/renderers/gl.js +56 -0
- package/dist/charts/engine/renderers/gl.js.map +1 -0
- package/dist/charts/engine/renderers/shaders.cjs +143 -1
- package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
- package/dist/charts/engine/renderers/shaders.d.cts +16 -0
- package/dist/charts/engine/renderers/shaders.d.ts +16 -0
- package/dist/charts/engine/renderers/shaders.js +139 -1
- package/dist/charts/engine/renderers/shaders.js.map +1 -1
- package/dist/charts/engine/renderers/webgl.cjs +2 -0
- package/dist/charts/engine/renderers/webgl.cjs.map +1 -0
- package/dist/charts/engine/renderers/webgl.d.cts +4 -0
- package/dist/charts/engine/renderers/webgl.d.ts +4 -0
- package/dist/charts/engine/renderers/webgl.js +133 -0
- package/dist/charts/engine/renderers/webgl.js.map +1 -0
- package/dist/charts/engine/renderers/webgl2.cjs +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgl2.d.cts +0 -1
- package/dist/charts/engine/renderers/webgl2.d.ts +0 -1
- package/dist/charts/engine/renderers/webgl2.js +59 -108
- package/dist/charts/engine/renderers/webgl2.js.map +1 -1
- package/dist/charts/engine/scale.cjs +1 -1
- package/dist/charts/engine/scale.cjs.map +1 -1
- package/dist/charts/engine/scale.js +1 -1
- package/dist/charts/engine/scale.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 +14 -4
- package/dist/charts/engine/scene.d.ts +14 -4
- package/dist/charts/engine/scene.js +292 -163
- package/dist/charts/engine/scene.js.map +1 -1
- package/dist/charts/engine/shapes/bullet.cjs +2 -0
- package/dist/charts/engine/shapes/bullet.cjs.map +1 -0
- package/dist/charts/engine/shapes/bullet.d.cts +6 -0
- package/dist/charts/engine/shapes/bullet.d.ts +6 -0
- package/dist/charts/engine/shapes/bullet.js +255 -0
- package/dist/charts/engine/shapes/bullet.js.map +1 -0
- package/dist/charts/engine/shapes/calendar.cjs +2 -0
- package/dist/charts/engine/shapes/calendar.cjs.map +1 -0
- package/dist/charts/engine/shapes/calendar.d.cts +38 -0
- package/dist/charts/engine/shapes/calendar.d.ts +38 -0
- package/dist/charts/engine/shapes/calendar.js +369 -0
- package/dist/charts/engine/shapes/calendar.js.map +1 -0
- package/dist/charts/engine/shapes/canvas.cjs +1 -1
- package/dist/charts/engine/shapes/canvas.cjs.map +1 -1
- package/dist/charts/engine/shapes/canvas.d.cts +7 -0
- package/dist/charts/engine/shapes/canvas.d.ts +7 -0
- package/dist/charts/engine/shapes/canvas.js +22 -13
- package/dist/charts/engine/shapes/canvas.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.d.cts +3 -2
- package/dist/charts/engine/shapes/chart.d.ts +3 -2
- package/dist/charts/engine/shapes/chart.js +45 -26
- package/dist/charts/engine/shapes/chart.js.map +1 -1
- 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 +3 -1
- package/dist/charts/engine/shapes/draw.d.ts +3 -1
- package/dist/charts/engine/shapes/draw.js +31 -18
- package/dist/charts/engine/shapes/draw.js.map +1 -1
- package/dist/charts/engine/shapes/funnel.cjs +1 -1
- package/dist/charts/engine/shapes/funnel.cjs.map +1 -1
- package/dist/charts/engine/shapes/funnel.js +3 -3
- package/dist/charts/engine/shapes/funnel.js.map +1 -1
- package/dist/charts/engine/shapes/gauge.cjs +1 -1
- package/dist/charts/engine/shapes/gauge.cjs.map +1 -1
- package/dist/charts/engine/shapes/gauge.js +132 -95
- package/dist/charts/engine/shapes/gauge.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 +29 -8
- package/dist/charts/engine/shapes/hit.js.map +1 -1
- package/dist/charts/engine/shapes/index.d.cts +4 -1
- package/dist/charts/engine/shapes/index.d.ts +4 -1
- package/dist/charts/engine/shapes/labels.cjs +2 -0
- package/dist/charts/engine/shapes/labels.cjs.map +1 -0
- package/dist/charts/engine/shapes/labels.d.cts +14 -0
- package/dist/charts/engine/shapes/labels.d.ts +14 -0
- package/dist/charts/engine/shapes/labels.js +146 -0
- package/dist/charts/engine/shapes/labels.js.map +1 -0
- 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 +8 -3
- package/dist/charts/engine/shapes/layout.d.ts +8 -3
- package/dist/charts/engine/shapes/layout.js +200 -113
- package/dist/charts/engine/shapes/layout.js.map +1 -1
- package/dist/charts/engine/shapes/pie.cjs +1 -1
- package/dist/charts/engine/shapes/pie.cjs.map +1 -1
- package/dist/charts/engine/shapes/pie.js +2 -2
- package/dist/charts/engine/shapes/pie.js.map +1 -1
- package/dist/charts/engine/shapes/radar.cjs +1 -1
- package/dist/charts/engine/shapes/radar.cjs.map +1 -1
- package/dist/charts/engine/shapes/radar.d.cts +2 -2
- package/dist/charts/engine/shapes/radar.d.ts +2 -2
- package/dist/charts/engine/shapes/radar.js +50 -49
- package/dist/charts/engine/shapes/radar.js.map +1 -1
- package/dist/charts/engine/shapes/radialBar.cjs +2 -0
- package/dist/charts/engine/shapes/radialBar.cjs.map +1 -0
- package/dist/charts/engine/shapes/radialBar.d.cts +8 -0
- package/dist/charts/engine/shapes/radialBar.d.ts +8 -0
- package/dist/charts/engine/shapes/radialBar.js +155 -0
- package/dist/charts/engine/shapes/radialBar.js.map +1 -0
- package/dist/charts/engine/shapes/runtime.cjs +1 -1
- package/dist/charts/engine/shapes/runtime.cjs.map +1 -1
- package/dist/charts/engine/shapes/runtime.d.cts +9 -2
- package/dist/charts/engine/shapes/runtime.d.ts +9 -2
- package/dist/charts/engine/shapes/runtime.js +61 -51
- package/dist/charts/engine/shapes/runtime.js.map +1 -1
- package/dist/charts/engine/shapes/sankey.cjs +2 -0
- package/dist/charts/engine/shapes/sankey.cjs.map +1 -0
- package/dist/charts/engine/shapes/sankey.d.cts +29 -0
- package/dist/charts/engine/shapes/sankey.d.ts +29 -0
- package/dist/charts/engine/shapes/sankey.js +372 -0
- package/dist/charts/engine/shapes/sankey.js.map +1 -0
- 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 +62 -8
- package/dist/charts/engine/shapes/scene.d.ts +62 -8
- package/dist/charts/engine/shapes/scene.js +33 -31
- package/dist/charts/engine/shapes/scene.js.map +1 -1
- package/dist/charts/engine/shapes/sunburst.cjs +2 -0
- package/dist/charts/engine/shapes/sunburst.cjs.map +1 -0
- package/dist/charts/engine/shapes/sunburst.d.cts +6 -0
- package/dist/charts/engine/shapes/sunburst.d.ts +6 -0
- package/dist/charts/engine/shapes/sunburst.js +261 -0
- package/dist/charts/engine/shapes/sunburst.js.map +1 -0
- package/dist/charts/engine/shapes/treemap.cjs +1 -1
- package/dist/charts/engine/shapes/treemap.cjs.map +1 -1
- package/dist/charts/engine/shapes/treemap.js +2 -2
- package/dist/charts/engine/shapes/treemap.js.map +1 -1
- package/dist/charts/engine/shapes/types.d.cts +439 -12
- package/dist/charts/engine/shapes/types.d.ts +439 -12
- package/dist/charts/engine/three-d/canvas2d.cjs +2 -0
- package/dist/charts/engine/three-d/canvas2d.cjs.map +1 -0
- package/dist/charts/engine/three-d/canvas2d.d.cts +4 -0
- package/dist/charts/engine/three-d/canvas2d.d.ts +4 -0
- package/dist/charts/engine/three-d/canvas2d.js +104 -0
- package/dist/charts/engine/three-d/canvas2d.js.map +1 -0
- package/dist/charts/engine/three-d/chart.cjs +2 -0
- package/dist/charts/engine/three-d/chart.cjs.map +1 -0
- package/dist/charts/engine/three-d/chart.d.cts +15 -0
- package/dist/charts/engine/three-d/chart.d.ts +15 -0
- package/dist/charts/engine/three-d/chart.js +621 -0
- package/dist/charts/engine/three-d/chart.js.map +1 -0
- package/dist/charts/engine/three-d/colormap.cjs +2 -0
- package/dist/charts/engine/three-d/colormap.cjs.map +1 -0
- package/dist/charts/engine/three-d/colormap.d.cts +16 -0
- package/dist/charts/engine/three-d/colormap.d.ts +16 -0
- package/dist/charts/engine/three-d/colormap.js +166 -0
- package/dist/charts/engine/three-d/colormap.js.map +1 -0
- package/dist/charts/engine/three-d/contours.cjs +2 -0
- package/dist/charts/engine/three-d/contours.cjs.map +1 -0
- package/dist/charts/engine/three-d/contours.d.cts +7 -0
- package/dist/charts/engine/three-d/contours.d.ts +7 -0
- package/dist/charts/engine/three-d/contours.js +47 -0
- package/dist/charts/engine/three-d/contours.js.map +1 -0
- package/dist/charts/engine/three-d/detect.cjs +2 -0
- package/dist/charts/engine/three-d/detect.cjs.map +1 -0
- package/dist/charts/engine/three-d/detect.d.cts +11 -0
- package/dist/charts/engine/three-d/detect.d.ts +11 -0
- package/dist/charts/engine/three-d/detect.js +35 -0
- package/dist/charts/engine/three-d/detect.js.map +1 -0
- package/dist/charts/engine/three-d/dom.cjs +2 -0
- package/dist/charts/engine/three-d/dom.cjs.map +1 -0
- package/dist/charts/engine/three-d/dom.d.cts +21 -0
- package/dist/charts/engine/three-d/dom.d.ts +21 -0
- package/dist/charts/engine/three-d/dom.js +98 -0
- package/dist/charts/engine/three-d/dom.js.map +1 -0
- package/dist/charts/engine/three-d/geometry.cjs +2 -0
- package/dist/charts/engine/three-d/geometry.cjs.map +1 -0
- package/dist/charts/engine/three-d/geometry.d.cts +76 -0
- package/dist/charts/engine/three-d/geometry.d.ts +76 -0
- package/dist/charts/engine/three-d/geometry.js +529 -0
- package/dist/charts/engine/three-d/geometry.js.map +1 -0
- package/dist/charts/engine/three-d/hover.cjs +2 -0
- package/dist/charts/engine/three-d/hover.cjs.map +1 -0
- package/dist/charts/engine/three-d/hover.d.cts +25 -0
- package/dist/charts/engine/three-d/hover.d.ts +25 -0
- package/dist/charts/engine/three-d/hover.js +131 -0
- package/dist/charts/engine/three-d/hover.js.map +1 -0
- package/dist/charts/engine/three-d/index.cjs +1 -0
- package/dist/charts/engine/three-d/index.d.cts +2 -0
- package/dist/charts/engine/three-d/index.d.ts +2 -0
- package/dist/charts/engine/three-d/index.js +2 -0
- package/dist/charts/engine/three-d/labels.cjs +2 -0
- package/dist/charts/engine/three-d/labels.cjs.map +1 -0
- package/dist/charts/engine/three-d/labels.d.cts +23 -0
- package/dist/charts/engine/three-d/labels.d.ts +23 -0
- package/dist/charts/engine/three-d/labels.js +136 -0
- package/dist/charts/engine/three-d/labels.js.map +1 -0
- package/dist/charts/engine/three-d/math.cjs +2 -0
- package/dist/charts/engine/three-d/math.cjs.map +1 -0
- package/dist/charts/engine/three-d/math.d.cts +84 -0
- package/dist/charts/engine/three-d/math.d.ts +84 -0
- package/dist/charts/engine/three-d/math.js +150 -0
- package/dist/charts/engine/three-d/math.js.map +1 -0
- package/dist/charts/engine/three-d/model.cjs +2 -0
- package/dist/charts/engine/three-d/model.cjs.map +1 -0
- package/dist/charts/engine/three-d/model.d.cts +130 -0
- package/dist/charts/engine/three-d/model.d.ts +130 -0
- package/dist/charts/engine/three-d/model.js +277 -0
- package/dist/charts/engine/three-d/model.js.map +1 -0
- package/dist/charts/engine/three-d/overlay.cjs +2 -0
- package/dist/charts/engine/three-d/overlay.cjs.map +1 -0
- package/dist/charts/engine/three-d/overlay.d.cts +72 -0
- package/dist/charts/engine/three-d/overlay.d.ts +72 -0
- package/dist/charts/engine/three-d/overlay.js +197 -0
- package/dist/charts/engine/three-d/overlay.js.map +1 -0
- package/dist/charts/engine/three-d/pick.cjs +2 -0
- package/dist/charts/engine/three-d/pick.cjs.map +1 -0
- package/dist/charts/engine/three-d/pick.d.cts +52 -0
- package/dist/charts/engine/three-d/pick.d.ts +52 -0
- package/dist/charts/engine/three-d/pick.js +220 -0
- package/dist/charts/engine/three-d/pick.js.map +1 -0
- package/dist/charts/engine/three-d/render-types.cjs +2 -0
- package/dist/charts/engine/three-d/render-types.cjs.map +1 -0
- package/dist/charts/engine/three-d/render-types.d.cts +82 -0
- package/dist/charts/engine/three-d/render-types.d.ts +82 -0
- package/dist/charts/engine/three-d/render-types.js +13 -0
- package/dist/charts/engine/three-d/render-types.js.map +1 -0
- package/dist/charts/engine/three-d/shaders.cjs +276 -0
- package/dist/charts/engine/three-d/shaders.cjs.map +1 -0
- package/dist/charts/engine/three-d/shaders.d.cts +26 -0
- package/dist/charts/engine/three-d/shaders.d.ts +26 -0
- package/dist/charts/engine/three-d/shaders.js +191 -0
- package/dist/charts/engine/three-d/shaders.js.map +1 -0
- package/dist/charts/engine/three-d/sort.cjs +2 -0
- package/dist/charts/engine/three-d/sort.cjs.map +1 -0
- package/dist/charts/engine/three-d/sort.d.cts +18 -0
- package/dist/charts/engine/three-d/sort.d.ts +18 -0
- package/dist/charts/engine/three-d/sort.js +71 -0
- package/dist/charts/engine/three-d/sort.js.map +1 -0
- package/dist/charts/engine/three-d/types.d.cts +588 -0
- package/dist/charts/engine/three-d/types.d.ts +588 -0
- package/dist/charts/engine/three-d/webgl.cjs +2 -0
- package/dist/charts/engine/three-d/webgl.cjs.map +1 -0
- package/dist/charts/engine/three-d/webgl.d.cts +10 -0
- package/dist/charts/engine/three-d/webgl.d.ts +10 -0
- package/dist/charts/engine/three-d/webgl.js +130 -0
- package/dist/charts/engine/three-d/webgl.js.map +1 -0
- package/dist/charts/engine/three-d/webgpu.cjs +2 -0
- package/dist/charts/engine/three-d/webgpu.cjs.map +1 -0
- package/dist/charts/engine/three-d/webgpu.d.cts +5 -0
- package/dist/charts/engine/three-d/webgpu.d.ts +5 -0
- package/dist/charts/engine/three-d/webgpu.js +249 -0
- package/dist/charts/engine/three-d/webgpu.js.map +1 -0
- package/dist/charts/engine/time.cjs +1 -1
- package/dist/charts/engine/time.cjs.map +1 -1
- package/dist/charts/engine/time.d.cts +13 -4
- package/dist/charts/engine/time.d.ts +13 -4
- package/dist/charts/engine/time.js +156 -91
- package/dist/charts/engine/time.js.map +1 -1
- package/dist/charts/engine/trading/chart.cjs +2 -0
- package/dist/charts/engine/trading/chart.cjs.map +1 -0
- package/dist/charts/engine/trading/chart.d.cts +3 -0
- package/dist/charts/engine/trading/chart.d.ts +3 -0
- package/dist/charts/engine/trading/chart.js +1507 -0
- package/dist/charts/engine/trading/chart.js.map +1 -0
- package/dist/charts/engine/trading/drawings.cjs +2 -0
- package/dist/charts/engine/trading/drawings.cjs.map +1 -0
- package/dist/charts/engine/trading/drawings.d.cts +57 -0
- package/dist/charts/engine/trading/drawings.d.ts +57 -0
- package/dist/charts/engine/trading/drawings.js +160 -0
- package/dist/charts/engine/trading/drawings.js.map +1 -0
- package/dist/charts/engine/trading/format.cjs +2 -0
- package/dist/charts/engine/trading/format.cjs.map +1 -0
- package/dist/charts/engine/trading/format.d.cts +60 -0
- package/dist/charts/engine/trading/format.d.ts +60 -0
- package/dist/charts/engine/trading/format.js +131 -0
- package/dist/charts/engine/trading/format.js.map +1 -0
- package/dist/charts/engine/trading/geometry.cjs +2 -0
- package/dist/charts/engine/trading/geometry.cjs.map +1 -0
- package/dist/charts/engine/trading/geometry.d.cts +55 -0
- package/dist/charts/engine/trading/geometry.d.ts +55 -0
- package/dist/charts/engine/trading/geometry.js +131 -0
- package/dist/charts/engine/trading/geometry.js.map +1 -0
- package/dist/charts/engine/trading/index.cjs +1 -0
- package/dist/charts/engine/trading/index.d.cts +3 -0
- package/dist/charts/engine/trading/index.d.ts +3 -0
- package/dist/charts/engine/trading/index.js +3 -0
- package/dist/charts/engine/trading/indicators.cjs +2 -0
- package/dist/charts/engine/trading/indicators.cjs.map +1 -0
- package/dist/charts/engine/trading/indicators.d.cts +105 -0
- package/dist/charts/engine/trading/indicators.d.ts +105 -0
- package/dist/charts/engine/trading/indicators.js +268 -0
- package/dist/charts/engine/trading/indicators.js.map +1 -0
- package/dist/charts/engine/trading/labels.cjs +2 -0
- package/dist/charts/engine/trading/labels.cjs.map +1 -0
- package/dist/charts/engine/trading/labels.d.cts +7 -0
- package/dist/charts/engine/trading/labels.d.ts +7 -0
- package/dist/charts/engine/trading/labels.js +91 -0
- package/dist/charts/engine/trading/labels.js.map +1 -0
- package/dist/charts/engine/trading/scale.cjs +2 -0
- package/dist/charts/engine/trading/scale.cjs.map +1 -0
- package/dist/charts/engine/trading/scale.d.cts +46 -0
- package/dist/charts/engine/trading/scale.d.ts +46 -0
- package/dist/charts/engine/trading/scale.js +100 -0
- package/dist/charts/engine/trading/scale.js.map +1 -0
- package/dist/charts/engine/trading/store.cjs +2 -0
- package/dist/charts/engine/trading/store.cjs.map +1 -0
- package/dist/charts/engine/trading/store.d.cts +62 -0
- package/dist/charts/engine/trading/store.d.ts +62 -0
- package/dist/charts/engine/trading/store.js +129 -0
- package/dist/charts/engine/trading/store.js.map +1 -0
- package/dist/charts/engine/trading/studies.cjs +2 -0
- package/dist/charts/engine/trading/studies.cjs.map +1 -0
- package/dist/charts/engine/trading/studies.d.cts +52 -0
- package/dist/charts/engine/trading/studies.d.ts +52 -0
- package/dist/charts/engine/trading/studies.js +254 -0
- package/dist/charts/engine/trading/studies.js.map +1 -0
- package/dist/charts/engine/trading/types.d.cts +656 -0
- package/dist/charts/engine/trading/types.d.ts +656 -0
- package/dist/charts/engine/types.d.cts +165 -14
- package/dist/charts/engine/types.d.ts +165 -14
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.d.cts +7 -4
- package/dist/charts/index.d.ts +7 -4
- package/dist/charts/index.js +22 -11
- package/dist/charts/react/Chart.cjs +1 -1
- package/dist/charts/react/Chart.cjs.map +1 -1
- package/dist/charts/react/Chart.d.cts +4 -4
- package/dist/charts/react/Chart.d.ts +4 -4
- package/dist/charts/react/Chart.js +5 -1
- package/dist/charts/react/Chart.js.map +1 -1
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.d.cts +39 -1
- package/dist/charts/react/charts.d.ts +39 -1
- package/dist/charts/react/charts.js +303 -131
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/orderbook.cjs +2 -0
- package/dist/charts/react/orderbook.cjs.map +1 -0
- package/dist/charts/react/orderbook.d.cts +142 -0
- package/dist/charts/react/orderbook.d.ts +142 -0
- package/dist/charts/react/orderbook.js +182 -0
- package/dist/charts/react/orderbook.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 +291 -9
- package/dist/charts/react/shapes.d.ts +291 -9
- package/dist/charts/react/shapes.js +280 -93
- package/dist/charts/react/shapes.js.map +1 -1
- package/dist/charts/react/three-d.cjs +2 -0
- package/dist/charts/react/three-d.cjs.map +1 -0
- package/dist/charts/react/three-d.d.cts +151 -0
- package/dist/charts/react/three-d.d.ts +151 -0
- package/dist/charts/react/three-d.js +154 -0
- package/dist/charts/react/three-d.js.map +1 -0
- package/dist/charts/react/trading.cjs +2 -0
- package/dist/charts/react/trading.cjs.map +1 -0
- package/dist/charts/react/trading.d.cts +93 -0
- package/dist/charts/react/trading.d.ts +93 -0
- package/dist/charts/react/trading.js +95 -0
- package/dist/charts/react/trading.js.map +1 -0
- package/dist/charts/react/types.d.cts +132 -8
- package/dist/charts/react/types.d.ts +132 -8
- 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 +9 -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 +6 -6
- package/dist/native/charts/src/engine/axis.js.map +1 -1
- package/dist/native/charts/src/engine/controller.cjs +1 -1
- package/dist/native/charts/src/engine/controller.cjs.map +1 -1
- package/dist/native/charts/src/engine/controller.js +352 -292
- 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 +63 -49
- 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 +46 -21
- package/dist/native/charts/src/engine/format.js.map +1 -1
- package/dist/native/charts/src/engine/labels.cjs +2 -0
- package/dist/native/charts/src/engine/labels.cjs.map +1 -0
- package/dist/native/charts/src/engine/labels.js +74 -0
- package/dist/native/charts/src/engine/labels.js.map +1 -0
- 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 +53 -12
- package/dist/native/charts/src/engine/layout.js.map +1 -1
- package/dist/native/charts/src/engine/locale.cjs +2 -0
- package/dist/native/charts/src/engine/locale.cjs.map +1 -0
- package/dist/native/charts/src/engine/locale.js +60 -0
- package/dist/native/charts/src/engine/locale.js.map +1 -0
- 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 +223 -116
- package/dist/native/charts/src/engine/model.js.map +1 -1
- package/dist/native/charts/src/engine/overlay.cjs +1 -1
- package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
- package/dist/native/charts/src/engine/overlay.js +46 -23
- 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 +448 -33
- package/dist/native/charts/src/engine/presets.js.map +1 -1
- package/dist/native/charts/src/engine/scale.cjs +1 -1
- package/dist/native/charts/src/engine/scale.cjs.map +1 -1
- package/dist/native/charts/src/engine/scale.js +1 -1
- package/dist/native/charts/src/engine/scale.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 +296 -167
- package/dist/native/charts/src/engine/scene.js.map +1 -1
- package/dist/native/charts/src/engine/shapes/bullet.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/bullet.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/bullet.js +255 -0
- package/dist/native/charts/src/engine/shapes/bullet.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/calendar.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/calendar.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/calendar.js +364 -0
- package/dist/native/charts/src/engine/shapes/calendar.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/canvas.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/canvas.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/canvas.js +168 -0
- package/dist/native/charts/src/engine/shapes/canvas.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/draw.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/draw.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/draw.js +165 -0
- package/dist/native/charts/src/engine/shapes/draw.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/funnel.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/funnel.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/funnel.js +149 -0
- package/dist/native/charts/src/engine/shapes/funnel.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/gauge.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/gauge.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/gauge.js +210 -0
- package/dist/native/charts/src/engine/shapes/gauge.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/hit.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/hit.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/hit.js +106 -0
- package/dist/native/charts/src/engine/shapes/hit.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/labels.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/labels.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/labels.js +146 -0
- package/dist/native/charts/src/engine/shapes/labels.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/layout.cjs +3 -0
- package/dist/native/charts/src/engine/shapes/layout.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/layout.js +331 -0
- package/dist/native/charts/src/engine/shapes/layout.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/pie.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/pie.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/pie.js +302 -0
- package/dist/native/charts/src/engine/shapes/pie.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/radar.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/radar.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/radar.js +198 -0
- package/dist/native/charts/src/engine/shapes/radar.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/radialBar.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/radialBar.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/radialBar.js +155 -0
- package/dist/native/charts/src/engine/shapes/radialBar.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/runtime.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/runtime.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/runtime.js +107 -0
- package/dist/native/charts/src/engine/shapes/runtime.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/sankey.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/sankey.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/sankey.js +372 -0
- package/dist/native/charts/src/engine/shapes/sankey.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/scene.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/scene.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/scene.js +125 -0
- package/dist/native/charts/src/engine/shapes/scene.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/sunburst.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/sunburst.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/sunburst.js +261 -0
- package/dist/native/charts/src/engine/shapes/sunburst.js.map +1 -0
- package/dist/native/charts/src/engine/shapes/treemap.cjs +2 -0
- package/dist/native/charts/src/engine/shapes/treemap.cjs.map +1 -0
- package/dist/native/charts/src/engine/shapes/treemap.js +213 -0
- package/dist/native/charts/src/engine/shapes/treemap.js.map +1 -0
- package/dist/native/charts/src/engine/time.cjs +1 -1
- package/dist/native/charts/src/engine/time.cjs.map +1 -1
- package/dist/native/charts/src/engine/time.js +156 -91
- package/dist/native/charts/src/engine/time.js.map +1 -1
- package/dist/native/components/Chart/ChartBase.cjs +1 -1
- package/dist/native/components/Chart/ChartBase.cjs.map +1 -1
- package/dist/native/components/Chart/ChartBase.d.cts +1 -1
- package/dist/native/components/Chart/ChartBase.d.ts +1 -1
- package/dist/native/components/Chart/ChartBase.js +110 -107
- package/dist/native/components/Chart/ChartBase.js.map +1 -1
- package/dist/native/components/Chart/charts.cjs +1 -1
- package/dist/native/components/Chart/charts.cjs.map +1 -1
- package/dist/native/components/Chart/charts.d.cts +6 -1
- package/dist/native/components/Chart/charts.d.ts +6 -1
- package/dist/native/components/Chart/charts.js +53 -29
- package/dist/native/components/Chart/charts.js.map +1 -1
- package/dist/native/components/Chart/index.cjs +1 -1
- package/dist/native/components/Chart/index.d.cts +1 -1
- package/dist/native/components/Chart/index.d.ts +1 -1
- package/dist/native/components/Chart/index.js +2 -2
- 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 +234 -217
- package/dist/native/components/Chart/scene.js.map +1 -1
- package/dist/native/components/Chart/types.d.cts +26 -3
- package/dist/native/components/Chart/types.d.ts +26 -3
- package/dist/native/components/Charts/charts.cjs +2 -0
- package/dist/native/components/Charts/charts.cjs.map +1 -0
- package/dist/native/components/Charts/charts.d.cts +41 -0
- package/dist/native/components/Charts/charts.d.ts +41 -0
- package/dist/native/components/Charts/charts.js +338 -0
- package/dist/native/components/Charts/charts.js.map +1 -0
- package/dist/native/components/Charts/index.cjs +1 -0
- package/dist/native/components/Charts/index.d.cts +2 -0
- package/dist/native/components/Charts/index.d.ts +2 -0
- package/dist/native/components/Charts/index.js +2 -0
- package/dist/native/components/Charts/types.d.cts +144 -0
- package/dist/native/components/Charts/types.d.ts +144 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.cjs +2 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.cjs.map +1 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.d.cts +24 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.d.ts +24 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.js +271 -0
- package/dist/native/components/ShapeChart/ShapeChartBase.js.map +1 -0
- package/dist/native/components/ShapeChart/charts.cjs +2 -0
- package/dist/native/components/ShapeChart/charts.cjs.map +1 -0
- package/dist/native/components/ShapeChart/charts.d.cts +38 -0
- package/dist/native/components/ShapeChart/charts.d.ts +38 -0
- package/dist/native/components/ShapeChart/charts.js +387 -0
- package/dist/native/components/ShapeChart/charts.js.map +1 -0
- package/dist/native/components/ShapeChart/draw.cjs +2 -0
- package/dist/native/components/ShapeChart/draw.cjs.map +1 -0
- package/dist/native/components/ShapeChart/draw.d.cts +4 -0
- package/dist/native/components/ShapeChart/draw.d.ts +4 -0
- package/dist/native/components/ShapeChart/draw.js +104 -0
- package/dist/native/components/ShapeChart/draw.js.map +1 -0
- package/dist/native/components/ShapeChart/geometry.cjs +2 -0
- package/dist/native/components/ShapeChart/geometry.cjs.map +1 -0
- package/dist/native/components/ShapeChart/geometry.d.cts +71 -0
- package/dist/native/components/ShapeChart/geometry.d.ts +71 -0
- package/dist/native/components/ShapeChart/geometry.js +602 -0
- package/dist/native/components/ShapeChart/geometry.js.map +1 -0
- package/dist/native/components/ShapeChart/index.cjs +1 -0
- package/dist/native/components/ShapeChart/index.d.cts +2 -0
- package/dist/native/components/ShapeChart/index.d.ts +2 -0
- package/dist/native/components/ShapeChart/index.js +2 -0
- package/dist/native/components/ShapeChart/recorder.cjs +2 -0
- package/dist/native/components/ShapeChart/recorder.cjs.map +1 -0
- package/dist/native/components/ShapeChart/recorder.d.cts +106 -0
- package/dist/native/components/ShapeChart/recorder.d.ts +106 -0
- package/dist/native/components/ShapeChart/recorder.js +574 -0
- package/dist/native/components/ShapeChart/recorder.js.map +1 -0
- package/dist/native/components/ShapeChart/types.d.cts +509 -0
- package/dist/native/components/ShapeChart/types.d.ts +509 -0
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.d.cts +2 -0
- package/dist/native/index.d.ts +2 -0
- package/dist/native/index.js +14 -10
- package/dist/native/manifest.d.cts +6 -4
- package/dist/native/manifest.d.ts +6 -4
- package/dist/native/source/components/Chart/ChartBase.tsx +8 -1
- package/dist/native/source/components/Chart/charts.tsx +42 -6
- package/dist/native/source/components/Chart/index.ts +1 -0
- package/dist/native/source/components/Chart/scene.tsx +154 -84
- package/dist/native/source/components/Chart/types.ts +31 -1
- package/dist/native/source/components/Charts/charts.tsx +493 -0
- package/dist/native/source/components/Charts/index.ts +14 -0
- package/dist/native/source/components/Charts/types.ts +207 -0
- package/dist/native/source/components/ShapeChart/ShapeChartBase.tsx +484 -0
- package/dist/native/source/components/ShapeChart/charts.tsx +605 -0
- package/dist/native/source/components/ShapeChart/draw.tsx +170 -0
- package/dist/native/source/components/ShapeChart/geometry.ts +1185 -0
- package/dist/native/source/components/ShapeChart/index.ts +15 -0
- package/dist/native/source/components/ShapeChart/recorder.ts +830 -0
- package/dist/native/source/components/ShapeChart/types.ts +564 -0
- package/dist/native/source/index.ts +2 -0
- package/dist/native/source/manifest.ts +30 -4
- package/dist/taro/charts.d.ts +209 -4
- package/dist/taro/index.d.ts +1 -0
- package/dist/taro/index.js +7517 -1856
- package/dist/taro/manifest.d.ts +1 -0
- package/dist/taro/shape-charts.d.ts +537 -0
- package/dist/uni/AreaChart.vue +68 -0
- package/dist/uni/AreaChart.vue.d.ts +120 -0
- package/dist/uni/Badge.vue.d.ts +1 -1
- package/dist/uni/BoxPlotChart.vue +66 -0
- package/dist/uni/BoxPlotChart.vue.d.ts +102 -0
- package/dist/uni/BubbleChart.vue +68 -0
- package/dist/uni/BubbleChart.vue.d.ts +106 -0
- package/dist/uni/BulletChart.vue +86 -0
- package/dist/uni/BulletChart.vue.d.ts +110 -0
- package/dist/uni/CalendarHeatmap.vue +92 -0
- package/dist/uni/CalendarHeatmap.vue.d.ts +129 -0
- package/dist/uni/CandlestickChart.vue +66 -0
- package/dist/uni/CandlestickChart.vue.d.ts +100 -0
- package/dist/uni/DonutChart.vue +72 -0
- package/dist/uni/DonutChart.vue.d.ts +114 -0
- package/dist/uni/FunnelChart.vue +67 -0
- package/dist/uni/FunnelChart.vue.d.ts +104 -0
- package/dist/uni/GanttChart.vue +67 -0
- package/dist/uni/GanttChart.vue.d.ts +123 -0
- package/dist/uni/GaugeChart.vue +77 -0
- package/dist/uni/GaugeChart.vue.d.ts +123 -0
- package/dist/uni/HeatmapChart.vue +66 -0
- package/dist/uni/HeatmapChart.vue.d.ts +114 -0
- package/dist/uni/HistogramChart.vue +66 -0
- package/dist/uni/HistogramChart.vue.d.ts +121 -0
- package/dist/uni/HorizontalBarChart.vue +68 -0
- package/dist/uni/HorizontalBarChart.vue.d.ts +127 -0
- package/dist/uni/Input.vue.d.ts +1 -1
- package/dist/uni/MixedChart.vue +68 -0
- package/dist/uni/MixedChart.vue.d.ts +106 -0
- package/dist/uni/NumberInput.vue.d.ts +1 -1
- package/dist/uni/PieChart.vue +72 -0
- package/dist/uni/PieChart.vue.d.ts +114 -0
- package/dist/uni/RadarChart.vue +67 -0
- package/dist/uni/RadarChart.vue.d.ts +110 -0
- package/dist/uni/RadialBarChart.vue +90 -0
- package/dist/uni/RadialBarChart.vue.d.ts +132 -0
- package/dist/uni/RangeAreaChart.vue +68 -0
- package/dist/uni/RangeAreaChart.vue.d.ts +102 -0
- package/dist/uni/ResponsiveGrid.vue.d.ts +1 -1
- package/dist/uni/SankeyChart.vue +88 -0
- package/dist/uni/SankeyChart.vue.d.ts +121 -0
- package/dist/uni/ShapeChart.vue +73 -0
- package/dist/uni/ShapeChart.vue.d.ts +54 -0
- package/dist/uni/Sparkline.vue +58 -0
- package/dist/uni/Sparkline.vue.d.ts +77 -0
- package/dist/uni/SunburstChart.vue +90 -0
- package/dist/uni/SunburstChart.vue.d.ts +114 -0
- package/dist/uni/Textarea.vue.d.ts +1 -1
- package/dist/uni/TimePicker.vue.d.ts +1 -1
- package/dist/uni/TreemapChart.vue +65 -0
- package/dist/uni/TreemapChart.vue.d.ts +100 -0
- package/dist/uni/WaterfallChart.vue +66 -0
- package/dist/uni/WaterfallChart.vue.d.ts +125 -0
- package/dist/uni/chart-types.d.ts +216 -2
- package/dist/uni/chart-types.js +174 -0
- package/dist/uni/charts-canvas.js +8 -3
- package/dist/uni/index.d.ts +26 -1
- package/dist/uni/index.js +26 -1
- package/dist/uni/manifest.d.ts +272 -0
- package/dist/uni/manifest.js +387 -0
- package/dist/uni/named-chart-options.d.ts +88 -0
- package/dist/uni/named-chart-options.js +156 -0
- package/dist/uni/shape-chart-canvas.d.ts +51 -0
- package/dist/uni/shape-chart-canvas.js +342 -0
- package/dist/uni/shape-chart-types.d.ts +381 -0
- package/dist/uni/shape-chart-types.js +261 -0
- package/dist/vue/components/Chart/AreaChart.vue.d.ts +124 -0
- package/dist/vue/components/Chart/AreaChart.vue.js +7 -0
- package/dist/vue/components/Chart/AreaChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/AreaChart.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/vue/components/Chart/AreaChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Bar3DChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/Bar3DChart.vue.js +7 -0
- package/dist/vue/components/Chart/Bar3DChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/Bar3DChart.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/vue/components/Chart/Bar3DChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/BarChart.vue.d.ts +123 -0
- package/dist/vue/components/Chart/BarChart.vue.js +7 -0
- package/dist/vue/components/Chart/BarChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/BarChart.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/vue/components/Chart/BarChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue.d.ts +112 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue.js +7 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/BubbleChart.vue.d.ts +106 -0
- package/dist/vue/components/Chart/BubbleChart.vue.js +7 -0
- package/dist/vue/components/Chart/BubbleChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/BubbleChart.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/vue/components/Chart/BubbleChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/BulletChart.vue.d.ts +117 -0
- package/dist/vue/components/Chart/BulletChart.vue.js +7 -0
- package/dist/vue/components/Chart/BulletChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/BulletChart.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/vue/components/Chart/BulletChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue.d.ts +144 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue.js +7 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue.js.map +1 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/vue/components/Chart/CalendarHeatmap.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/CandlestickChart.vue.d.ts +94 -0
- package/dist/vue/components/Chart/CandlestickChart.vue.js +7 -0
- package/dist/vue/components/Chart/CandlestickChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/CandlestickChart.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/vue/components/Chart/CandlestickChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Chart.vue.d.ts +103 -0
- package/dist/vue/components/Chart/Chart.vue.js +7 -0
- package/dist/vue/components/Chart/Chart.vue.js.map +1 -0
- package/dist/vue/components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/vue/components/Chart/Chart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/DepthChart.vue.d.ts +139 -0
- package/dist/vue/components/Chart/DepthChart.vue.js +7 -0
- package/dist/vue/components/Chart/DepthChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/DepthChart.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/vue/components/Chart/DepthChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/DonutChart.vue.d.ts +104 -0
- package/dist/vue/components/Chart/DonutChart.vue.js +7 -0
- package/dist/vue/components/Chart/DonutChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/DonutChart.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/vue/components/Chart/DonutChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/FunnelChart.vue.d.ts +105 -0
- package/dist/vue/components/Chart/FunnelChart.vue.js +7 -0
- package/dist/vue/components/Chart/FunnelChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/FunnelChart.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/vue/components/Chart/FunnelChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/GanttChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/GanttChart.vue.js +7 -0
- package/dist/vue/components/Chart/GanttChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/GaugeChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/GaugeChart.vue.js +7 -0
- package/dist/vue/components/Chart/GaugeChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/GaugeChart.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/vue/components/Chart/GaugeChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/HeatmapChart.vue.d.ts +125 -0
- package/dist/vue/components/Chart/HeatmapChart.vue.js +7 -0
- package/dist/vue/components/Chart/HeatmapChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/HistogramChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/HistogramChart.vue.js +7 -0
- package/dist/vue/components/Chart/HistogramChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/HistogramChart.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/vue/components/Chart/HistogramChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/HorizontalBarChart.vue.d.ts +121 -0
- package/dist/vue/components/Chart/HorizontalBarChart.vue.js +7 -0
- package/dist/vue/components/Chart/HorizontalBarChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/HorizontalBarChart.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/vue/components/Chart/HorizontalBarChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Line3DChart.vue.d.ts +121 -0
- package/dist/vue/components/Chart/Line3DChart.vue.js +7 -0
- package/dist/vue/components/Chart/Line3DChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/Line3DChart.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/vue/components/Chart/Line3DChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/LineChart.vue.d.ts +125 -0
- package/dist/vue/components/Chart/LineChart.vue.js +7 -0
- package/dist/vue/components/Chart/LineChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/LineChart.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/vue/components/Chart/LineChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/MixedChart.vue.d.ts +103 -0
- package/dist/vue/components/Chart/MixedChart.vue.js +7 -0
- package/dist/vue/components/Chart/MixedChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/MixedChart.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/vue/components/Chart/MixedChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/OrderBook.vue.d.ts +125 -0
- package/dist/vue/components/Chart/OrderBook.vue.js +7 -0
- package/dist/vue/components/Chart/OrderBook.vue.js.map +1 -0
- package/dist/vue/components/Chart/OrderBook.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/vue/components/Chart/OrderBook.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/OrderBookHeatmap.vue.d.ts +128 -0
- package/dist/vue/components/Chart/OrderBookHeatmap.vue.js +7 -0
- package/dist/vue/components/Chart/OrderBookHeatmap.vue.js.map +1 -0
- package/dist/vue/components/Chart/OrderBookHeatmap.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/vue/components/Chart/OrderBookHeatmap.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/PieChart.vue.d.ts +104 -0
- package/dist/vue/components/Chart/PieChart.vue.js +7 -0
- package/dist/vue/components/Chart/PieChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/PieChart.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/vue/components/Chart/PieChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/QuadrantChart.vue.d.ts +186 -0
- package/dist/vue/components/Chart/QuadrantChart.vue.js +7 -0
- package/dist/vue/components/Chart/QuadrantChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/QuadrantChart.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/vue/components/Chart/QuadrantChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/RadarChart.vue.d.ts +111 -0
- package/dist/vue/components/Chart/RadarChart.vue.js +7 -0
- package/dist/vue/components/Chart/RadarChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/RadarChart.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/vue/components/Chart/RadarChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/RadialBarChart.vue.d.ts +147 -0
- package/dist/vue/components/Chart/RadialBarChart.vue.js +7 -0
- package/dist/vue/components/Chart/RadialBarChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/RadialBarChart.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/vue/components/Chart/RadialBarChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/RangeAreaChart.vue.d.ts +106 -0
- package/dist/vue/components/Chart/RangeAreaChart.vue.js +7 -0
- package/dist/vue/components/Chart/RangeAreaChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/RangeAreaChart.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/vue/components/Chart/RangeAreaChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/SankeyChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/SankeyChart.vue.js +7 -0
- package/dist/vue/components/Chart/SankeyChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/SankeyChart.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/vue/components/Chart/SankeyChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue.d.ts +121 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue.js +7 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/vue/components/Chart/Scatter3DChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/ScatterChart.vue.d.ts +94 -0
- package/dist/vue/components/Chart/ScatterChart.vue.js +7 -0
- package/dist/vue/components/Chart/ScatterChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/ScatterChart.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/vue/components/Chart/ScatterChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/ShapeChart.vue.d.ts +39 -0
- package/dist/vue/components/Chart/ShapeChart.vue.js +7 -0
- package/dist/vue/components/Chart/ShapeChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/ShapeChart.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/vue/components/Chart/ShapeChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Sparkline.vue.d.ts +90 -0
- package/dist/vue/components/Chart/Sparkline.vue.js +7 -0
- package/dist/vue/components/Chart/Sparkline.vue.js.map +1 -0
- package/dist/vue/components/Chart/Sparkline.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/vue/components/Chart/Sparkline.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/SunburstChart.vue.d.ts +123 -0
- package/dist/vue/components/Chart/SunburstChart.vue.js +7 -0
- package/dist/vue/components/Chart/SunburstChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/SunburstChart.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/vue/components/Chart/SunburstChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/Surface3DChart.vue.d.ts +143 -0
- package/dist/vue/components/Chart/Surface3DChart.vue.js +7 -0
- package/dist/vue/components/Chart/Surface3DChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/Surface3DChart.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/vue/components/Chart/Surface3DChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/TimeAndSales.vue.d.ts +114 -0
- package/dist/vue/components/Chart/TimeAndSales.vue.js +7 -0
- package/dist/vue/components/Chart/TimeAndSales.vue.js.map +1 -0
- package/dist/vue/components/Chart/TimeAndSales.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/vue/components/Chart/TimeAndSales.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/TradingChart.vue.d.ts +160 -0
- package/dist/vue/components/Chart/TradingChart.vue.js +7 -0
- package/dist/vue/components/Chart/TradingChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/TreemapChart.vue.d.ts +97 -0
- package/dist/vue/components/Chart/TreemapChart.vue.js +7 -0
- package/dist/vue/components/Chart/TreemapChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/TreemapChart.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/vue/components/Chart/TreemapChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/WaterfallChart.vue.d.ts +132 -0
- package/dist/vue/components/Chart/WaterfallChart.vue.js +7 -0
- package/dist/vue/components/Chart/WaterfallChart.vue.js.map +1 -0
- package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/Chart/cartesian.d.ts +47 -0
- package/dist/vue/components/Chart/cartesian.js +56 -0
- package/dist/vue/components/Chart/cartesian.js.map +1 -0
- package/dist/vue/components/Chart/engine.d.ts +35 -0
- package/dist/vue/components/Chart/engine.js +35 -0
- package/dist/vue/components/Chart/engine.js.map +1 -0
- package/dist/vue/components/Chart/index.d.ts +41 -0
- package/dist/vue/components/Chart/index.js +40 -0
- package/dist/vue/components/Chart/orderbook.d.ts +359 -0
- package/dist/vue/components/Chart/orderbook.js +126 -0
- package/dist/vue/components/Chart/orderbook.js.map +1 -0
- package/dist/vue/components/Chart/props.d.ts +188 -0
- package/dist/vue/components/Chart/props.js +92 -0
- package/dist/vue/components/Chart/props.js.map +1 -0
- package/dist/vue/components/Chart/shape.d.ts +41 -0
- package/dist/vue/components/Chart/shape.js +42 -0
- package/dist/vue/components/Chart/shape.js.map +1 -0
- package/dist/vue/components/Chart/three-d.d.ts +106 -0
- package/dist/vue/components/Chart/three-d.js +88 -0
- package/dist/vue/components/Chart/three-d.js.map +1 -0
- package/dist/vue/components/Chart/trading.d.ts +105 -0
- package/dist/vue/components/Chart/trading.js +55 -0
- package/dist/vue/components/Chart/trading.js.map +1 -0
- package/dist/vue/components/Chart/types.d.ts +137 -0
- package/dist/vue/global.d.ts +38 -0
- package/dist/vue/groups/charts.d.ts +1 -0
- package/dist/vue/groups/charts.js +87 -0
- package/dist/vue/groups/charts.js.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +63 -23
- package/dist/vue/plugin.js +12 -10
- package/dist/vue/plugin.js.map +1 -1
- package/dist/weapp/area-chart/index.js +1 -0
- package/dist/weapp/area-chart/index.json +1 -0
- package/dist/weapp/area-chart/index.wxml +1 -0
- package/dist/weapp/area-chart/index.wxss +1 -0
- package/dist/weapp/box-plot-chart/index.js +1 -0
- package/dist/weapp/box-plot-chart/index.json +1 -0
- package/dist/weapp/box-plot-chart/index.wxml +1 -0
- package/dist/weapp/box-plot-chart/index.wxss +1 -0
- package/dist/weapp/bubble-chart/index.js +1 -0
- package/dist/weapp/bubble-chart/index.json +1 -0
- package/dist/weapp/bubble-chart/index.wxml +1 -0
- package/dist/weapp/bubble-chart/index.wxss +1 -0
- package/dist/weapp/bullet-chart/index.js +1 -0
- package/dist/weapp/bullet-chart/index.json +1 -0
- package/dist/weapp/bullet-chart/index.wxml +1 -0
- package/dist/weapp/bullet-chart/index.wxss +1 -0
- package/dist/weapp/calendar-heatmap/index.js +1 -0
- package/dist/weapp/calendar-heatmap/index.json +1 -0
- package/dist/weapp/calendar-heatmap/index.wxml +1 -0
- package/dist/weapp/calendar-heatmap/index.wxss +1 -0
- package/dist/weapp/candlestick-chart/index.js +1 -0
- package/dist/weapp/candlestick-chart/index.json +1 -0
- package/dist/weapp/candlestick-chart/index.wxml +1 -0
- package/dist/weapp/candlestick-chart/index.wxss +1 -0
- package/dist/weapp/charts/canvas.js +11436 -0
- package/dist/weapp/charts/core.d.ts +2 -0
- package/dist/weapp/charts/core.js +41 -0
- package/dist/weapp/controls.js +1433 -4478
- package/dist/weapp/donut-chart/index.js +1 -0
- package/dist/weapp/donut-chart/index.json +1 -0
- package/dist/weapp/donut-chart/index.wxml +1 -0
- package/dist/weapp/donut-chart/index.wxss +1 -0
- package/dist/weapp/funnel-chart/index.js +1 -0
- package/dist/weapp/funnel-chart/index.json +1 -0
- package/dist/weapp/funnel-chart/index.wxml +1 -0
- package/dist/weapp/funnel-chart/index.wxss +1 -0
- package/dist/weapp/gantt-chart/index.js +1 -0
- package/dist/weapp/gantt-chart/index.json +1 -0
- package/dist/weapp/gantt-chart/index.wxml +1 -0
- package/dist/weapp/gantt-chart/index.wxss +1 -0
- package/dist/weapp/gauge-chart/index.js +1 -0
- package/dist/weapp/gauge-chart/index.json +1 -0
- package/dist/weapp/gauge-chart/index.wxml +1 -0
- package/dist/weapp/gauge-chart/index.wxss +1 -0
- package/dist/weapp/heatmap-chart/index.js +1 -0
- package/dist/weapp/heatmap-chart/index.json +1 -0
- package/dist/weapp/heatmap-chart/index.wxml +1 -0
- package/dist/weapp/heatmap-chart/index.wxss +1 -0
- package/dist/weapp/histogram-chart/index.js +1 -0
- package/dist/weapp/histogram-chart/index.json +1 -0
- package/dist/weapp/histogram-chart/index.wxml +1 -0
- package/dist/weapp/histogram-chart/index.wxss +1 -0
- package/dist/weapp/horizontal-bar-chart/index.js +1 -0
- package/dist/weapp/horizontal-bar-chart/index.json +1 -0
- package/dist/weapp/horizontal-bar-chart/index.wxml +1 -0
- package/dist/weapp/horizontal-bar-chart/index.wxss +1 -0
- package/dist/weapp/mixed-chart/index.js +1 -0
- package/dist/weapp/mixed-chart/index.json +1 -0
- package/dist/weapp/mixed-chart/index.wxml +1 -0
- package/dist/weapp/mixed-chart/index.wxss +1 -0
- package/dist/weapp/pie-chart/index.js +1 -0
- package/dist/weapp/pie-chart/index.json +1 -0
- package/dist/weapp/pie-chart/index.wxml +1 -0
- package/dist/weapp/pie-chart/index.wxss +1 -0
- package/dist/weapp/radar-chart/index.js +1 -0
- package/dist/weapp/radar-chart/index.json +1 -0
- package/dist/weapp/radar-chart/index.wxml +1 -0
- package/dist/weapp/radar-chart/index.wxss +1 -0
- package/dist/weapp/radial-bar-chart/index.js +1 -0
- package/dist/weapp/radial-bar-chart/index.json +1 -0
- package/dist/weapp/radial-bar-chart/index.wxml +1 -0
- package/dist/weapp/radial-bar-chart/index.wxss +1 -0
- package/dist/weapp/range-area-chart/index.js +1 -0
- package/dist/weapp/range-area-chart/index.json +1 -0
- package/dist/weapp/range-area-chart/index.wxml +1 -0
- package/dist/weapp/range-area-chart/index.wxss +1 -0
- package/dist/weapp/sankey-chart/index.js +1 -0
- package/dist/weapp/sankey-chart/index.json +1 -0
- package/dist/weapp/sankey-chart/index.wxml +1 -0
- package/dist/weapp/sankey-chart/index.wxss +1 -0
- package/dist/weapp/shape-chart/index.js +1 -0
- package/dist/weapp/shape-chart/index.json +1 -0
- package/dist/weapp/shape-chart/index.wxml +1 -0
- package/dist/weapp/shape-chart/index.wxss +1 -0
- package/dist/weapp/sparkline/index.js +1 -0
- package/dist/weapp/sparkline/index.json +1 -0
- package/dist/weapp/sparkline/index.wxml +1 -0
- package/dist/weapp/sparkline/index.wxss +1 -0
- package/dist/weapp/sunburst-chart/index.js +1 -0
- package/dist/weapp/sunburst-chart/index.json +1 -0
- package/dist/weapp/sunburst-chart/index.wxml +1 -0
- package/dist/weapp/sunburst-chart/index.wxss +1 -0
- package/dist/weapp/treemap-chart/index.js +1 -0
- package/dist/weapp/treemap-chart/index.json +1 -0
- package/dist/weapp/treemap-chart/index.wxml +1 -0
- package/dist/weapp/treemap-chart/index.wxss +1 -0
- package/dist/weapp/types.d.ts +466 -0
- package/dist/weapp/waterfall-chart/index.js +1 -0
- package/dist/weapp/waterfall-chart/index.json +1 -0
- package/dist/weapp/waterfall-chart/index.wxml +1 -0
- package/dist/weapp/waterfall-chart/index.wxss +1 -0
- package/dist/web-components/components/chart/chart.d.ts +58 -0
- package/dist/web-components/components/chart/chart.js +55 -0
- package/dist/web-components/components/chart/chart.js.map +1 -0
- package/dist/web-components/components/chart/charts.d.ts +252 -0
- package/dist/web-components/components/chart/charts.js +201 -0
- package/dist/web-components/components/chart/charts.js.map +1 -0
- package/dist/web-components/components/chart/engine-element.d.ts +53 -0
- package/dist/web-components/components/chart/engine-element.js +77 -0
- package/dist/web-components/components/chart/engine-element.js.map +1 -0
- package/dist/web-components/components/chart/extended.d.ts +224 -0
- package/dist/web-components/components/chart/extended.js +183 -0
- package/dist/web-components/components/chart/extended.js.map +1 -0
- package/dist/web-components/components/chart/series.d.ts +7 -0
- package/dist/web-components/components/chart/series.js +14 -0
- package/dist/web-components/components/chart/series.js.map +1 -0
- package/dist/web-components/components/chart/shape-chart.d.ts +199 -0
- package/dist/web-components/components/chart/shape-chart.js +161 -0
- package/dist/web-components/components/chart/shape-chart.js.map +1 -0
- package/dist/web-components/components/chart/shapes-extended.d.ts +162 -0
- package/dist/web-components/components/chart/shapes-extended.js +156 -0
- package/dist/web-components/components/chart/shapes-extended.js.map +1 -0
- package/dist/web-components/components/chart-3d/chart-3d.d.ts +111 -0
- package/dist/web-components/components/chart-3d/chart-3d.js +97 -0
- package/dist/web-components/components/chart-3d/chart-3d.js.map +1 -0
- package/dist/web-components/components/order-book/order-book.d.ts +165 -0
- package/dist/web-components/components/order-book/order-book.js +174 -0
- package/dist/web-components/components/order-book/order-book.js.map +1 -0
- package/dist/web-components/components/trading-chart/trading-chart.d.ts +96 -0
- package/dist/web-components/components/trading-chart/trading-chart.js +96 -0
- package/dist/web-components/components/trading-chart/trading-chart.js.map +1 -0
- package/dist/web-components/elements/chart-3d.d.ts +2 -0
- package/dist/web-components/elements/chart-3d.js +13 -0
- package/dist/web-components/elements/chart-3d.js.map +1 -0
- package/dist/web-components/elements/chart.d.ts +7 -0
- package/dist/web-components/elements/chart.js +43 -0
- package/dist/web-components/elements/chart.js.map +1 -0
- package/dist/web-components/elements/order-book.d.ts +2 -0
- package/dist/web-components/elements/order-book.js +13 -0
- package/dist/web-components/elements/order-book.js.map +1 -0
- package/dist/web-components/elements/trading-chart.d.ts +2 -0
- package/dist/web-components/elements/trading-chart.js +8 -0
- package/dist/web-components/elements/trading-chart.js.map +1 -0
- package/dist/web-components/html-custom-data.json +1192 -29
- package/dist/web-components/types/react.d.ts +435 -0
- package/dist/web-components/types/solid.d.ts +321 -0
- package/dist/web-components/types/svelte.d.ts +321 -0
- package/dist/web-components/types/vue.d.ts +359 -0
- package/package.json +113 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TradingDrawing, TradingDrawingTool, TradingLineStyle } from './types.js';
|
|
2
|
+
/** Converts between anchors and the pixels of the price pane */
|
|
3
|
+
export interface DrawingMapper {
|
|
4
|
+
/** x (CSS px) of a logical bar index */
|
|
5
|
+
x(index: number): number;
|
|
6
|
+
/** y (CSS px) of a price */
|
|
7
|
+
y(price: number): number;
|
|
8
|
+
/** Logical index of a time (extrapolated outside the bars) */
|
|
9
|
+
index(time: number): number;
|
|
10
|
+
/** Plot rectangle of the price pane */
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
}
|
|
16
|
+
export interface Point {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
/** Fibonacci retracement levels */
|
|
21
|
+
export declare const FIB_LEVELS: number[];
|
|
22
|
+
/** Number of anchors of a tool */
|
|
23
|
+
export declare const anchorCount: (tool: Exclude<TradingDrawingTool, "cursor">) => 2 | 1;
|
|
24
|
+
export declare const screenPoints: (drawing: TradingDrawing, m: DrawingMapper) => Point[];
|
|
25
|
+
/** Part of a drawing under the pointer */
|
|
26
|
+
export type DrawingHit = {
|
|
27
|
+
part: "handle";
|
|
28
|
+
index: number;
|
|
29
|
+
} | {
|
|
30
|
+
part: "body";
|
|
31
|
+
};
|
|
32
|
+
export declare const hitDrawing: (drawing: TradingDrawing, m: DrawingMapper, p: Point, tolerance?: number) => DrawingHit | null;
|
|
33
|
+
export declare const setDash: (ctx: CanvasRenderingContext2D, style: TradingLineStyle | undefined, width: number) => void;
|
|
34
|
+
/** Values and helpers the painter needs from the chart */
|
|
35
|
+
export interface DrawingPaintContext {
|
|
36
|
+
/** Resolved CSS color of a drawing */
|
|
37
|
+
color: string;
|
|
38
|
+
/** Text color on the plot */
|
|
39
|
+
text: string;
|
|
40
|
+
/** Background of the plot (handles) */
|
|
41
|
+
background: string;
|
|
42
|
+
/** Up / down colors (measure) */
|
|
43
|
+
up: string;
|
|
44
|
+
down: string;
|
|
45
|
+
font: string;
|
|
46
|
+
formatPrice(price: number): string;
|
|
47
|
+
formatPercent(value: number): string;
|
|
48
|
+
/** `"24 bars, 2d 4h"` */
|
|
49
|
+
formatSpan(bars: number, ms: number): string;
|
|
50
|
+
/** Readable text color on a fill */
|
|
51
|
+
textOn(fill: string): string;
|
|
52
|
+
}
|
|
53
|
+
/** Paints a drawing (the context is clipped to the price pane) */
|
|
54
|
+
export declare const paintDrawing: (ctx: CanvasRenderingContext2D, drawing: TradingDrawing, m: DrawingMapper, c: DrawingPaintContext, state: {
|
|
55
|
+
selected: boolean;
|
|
56
|
+
hovered: boolean;
|
|
57
|
+
}) => void;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
//#region src/engine/trading/drawings.ts
|
|
2
|
+
var e = [
|
|
3
|
+
0,
|
|
4
|
+
.236,
|
|
5
|
+
.382,
|
|
6
|
+
.5,
|
|
7
|
+
.618,
|
|
8
|
+
.786,
|
|
9
|
+
1
|
|
10
|
+
], t = [
|
|
11
|
+
"#787b86",
|
|
12
|
+
"#f23645",
|
|
13
|
+
"#ff9800",
|
|
14
|
+
"#4caf50",
|
|
15
|
+
"#089981",
|
|
16
|
+
"#2962ff",
|
|
17
|
+
"#787b86"
|
|
18
|
+
], n = (e) => e === "horizontalLine" || e === "verticalLine" ? 1 : 2, r = (e, t) => e.points.map((e) => ({
|
|
19
|
+
x: t.x(t.index(e.time)),
|
|
20
|
+
y: t.y(e.price)
|
|
21
|
+
})), i = (e, t, n, r, i) => {
|
|
22
|
+
let a = n.x - t.x, o = n.y - t.y, s = a * a + o * o;
|
|
23
|
+
if (s === 0) return Math.hypot(e.x - t.x, e.y - t.y);
|
|
24
|
+
let c = ((e.x - t.x) * a + (e.y - t.y) * o) / s;
|
|
25
|
+
return r || (c = Math.max(0, c)), i || (c = Math.min(1, c)), Math.hypot(e.x - (t.x + c * a), e.y - (t.y + c * o));
|
|
26
|
+
}, a = (t, n, a, o = 6) => {
|
|
27
|
+
let s = r(t, n);
|
|
28
|
+
for (let e = 0; e < s.length; e++) {
|
|
29
|
+
let t = s[e];
|
|
30
|
+
if (Math.hypot(t.x - a.x, t.y - a.y) <= o + 2) return {
|
|
31
|
+
part: "handle",
|
|
32
|
+
index: e
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
let [c, l] = s;
|
|
36
|
+
if (!c) return null;
|
|
37
|
+
let u = (e) => e <= o ? { part: "body" } : null;
|
|
38
|
+
switch (t.type) {
|
|
39
|
+
case "horizontalLine": return u(Math.abs(a.y - c.y));
|
|
40
|
+
case "verticalLine": return u(Math.abs(a.x - c.x));
|
|
41
|
+
case "trendLine": return l ? u(i(a, c, l, !1, !1)) : null;
|
|
42
|
+
case "ray": return l ? u(i(a, c, l, !1, !0)) : null;
|
|
43
|
+
case "extendedLine": return l ? u(i(a, c, l, !0, !0)) : null;
|
|
44
|
+
case "fibRetracement": {
|
|
45
|
+
if (!l) return null;
|
|
46
|
+
let t = Math.min(c.x, l.x), n = Math.max(c.x, l.x);
|
|
47
|
+
if (a.x < t - o || a.x > n + o) return null;
|
|
48
|
+
for (let t of e) {
|
|
49
|
+
let e = l.y + (c.y - l.y) * t;
|
|
50
|
+
if (Math.abs(a.y - e) <= o) return { part: "body" };
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
if (!l) return null;
|
|
56
|
+
let e = Math.min(c.x, l.x) - o, t = Math.max(c.x, l.x) + o, n = Math.min(c.y, l.y) - o, r = Math.max(c.y, l.y) + o;
|
|
57
|
+
return a.x >= e && a.x <= t && a.y >= n && a.y <= r ? { part: "body" } : null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, o = (e, t, n) => {
|
|
61
|
+
t === "dashed" ? e.setLineDash([6, 4]) : t === "dotted" ? e.setLineDash([Math.max(1, n), 3]) : e.setLineDash([]);
|
|
62
|
+
}, s = (e, t, n) => {
|
|
63
|
+
let r = t.x - e.x, i = t.y - e.y, a = Math.hypot(r, i);
|
|
64
|
+
if (!a) return t;
|
|
65
|
+
let o = (Math.abs(n.right - n.left) + Math.abs(n.bottom - n.top)) * 4;
|
|
66
|
+
return {
|
|
67
|
+
x: e.x + r / a * o,
|
|
68
|
+
y: e.y + i / a * o
|
|
69
|
+
};
|
|
70
|
+
}, c = (e, t, n, r, i, a) => {
|
|
71
|
+
e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(t, n, r, i, a) : e.rect(t, n, r, i);
|
|
72
|
+
}, l = (e, t, n, i, a) => {
|
|
73
|
+
let c = r(t, n), [l, f] = c;
|
|
74
|
+
if (!l) return;
|
|
75
|
+
let p = (t.lineWidth ?? 1.5) + (a.hovered ? .5 : 0);
|
|
76
|
+
e.save(), e.lineWidth = p, e.strokeStyle = i.color, e.fillStyle = i.color, e.font = i.font, o(e, t.lineStyle, p);
|
|
77
|
+
let m = (t, n) => {
|
|
78
|
+
e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke();
|
|
79
|
+
};
|
|
80
|
+
switch (t.type) {
|
|
81
|
+
case "horizontalLine":
|
|
82
|
+
m({
|
|
83
|
+
x: n.left,
|
|
84
|
+
y: l.y
|
|
85
|
+
}, {
|
|
86
|
+
x: n.right,
|
|
87
|
+
y: l.y
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
case "verticalLine":
|
|
91
|
+
m({
|
|
92
|
+
x: l.x,
|
|
93
|
+
y: n.top
|
|
94
|
+
}, {
|
|
95
|
+
x: l.x,
|
|
96
|
+
y: n.bottom
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
case "trendLine":
|
|
100
|
+
f && m(l, f);
|
|
101
|
+
break;
|
|
102
|
+
case "ray":
|
|
103
|
+
f && m(l, s(l, f, n));
|
|
104
|
+
break;
|
|
105
|
+
case "extendedLine":
|
|
106
|
+
f && m(s(f, l, n), s(l, f, n));
|
|
107
|
+
break;
|
|
108
|
+
case "rectangle":
|
|
109
|
+
if (f) {
|
|
110
|
+
let t = Math.min(l.x, f.x), n = Math.min(l.y, f.y), r = Math.abs(f.x - l.x), i = Math.abs(f.y - l.y);
|
|
111
|
+
e.globalAlpha = .12, e.fillRect(t, n, r, i), e.globalAlpha = 1, e.strokeRect(t, n, r, i);
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case "fibRetracement":
|
|
115
|
+
f && u(e, t, l, f, i);
|
|
116
|
+
break;
|
|
117
|
+
case "measure": f && d(e, t, l, f, n, i);
|
|
118
|
+
}
|
|
119
|
+
if (a.selected || a.hovered) {
|
|
120
|
+
e.setLineDash([]), e.lineWidth = 1.5;
|
|
121
|
+
for (let t of c) e.beginPath(), e.arc(t.x, t.y, a.selected ? 4.5 : 3.5, 0, Math.PI * 2), e.fillStyle = i.background, e.fill(), e.strokeStyle = i.color, e.stroke();
|
|
122
|
+
}
|
|
123
|
+
e.restore();
|
|
124
|
+
}, u = (n, r, i, a, o) => {
|
|
125
|
+
let s = Math.min(i.x, a.x), c = Math.max(i.x, a.x), l = r.points[0]?.price ?? 0, u = r.points[1]?.price ?? 0, d = e.map((e) => a.y + (i.y - a.y) * e);
|
|
126
|
+
for (let i = 0; i + 1 < e.length; i++) n.globalAlpha = .08, n.fillStyle = r.color ? o.color : t[i + 1], n.fillRect(s, Math.min(d[i], d[i + 1]), c - s, Math.abs(d[i + 1] - d[i]));
|
|
127
|
+
n.globalAlpha = 1, n.textBaseline = "bottom", n.textAlign = "left", e.forEach((e, i) => {
|
|
128
|
+
let a = Math.round(d[i]) + .5, f = r.color ? o.color : t[i];
|
|
129
|
+
n.strokeStyle = f, n.fillStyle = f, n.beginPath(), n.moveTo(s, a), n.lineTo(c, a), n.stroke();
|
|
130
|
+
let p = u + (l - u) * e;
|
|
131
|
+
n.fillText(`${e} (${o.formatPrice(p)})`, s + 4, a - 2);
|
|
132
|
+
}), n.setLineDash([4, 4]), n.strokeStyle = o.color, n.globalAlpha = .6, n.beginPath(), n.moveTo(i.x, i.y), n.lineTo(a.x, a.y), n.stroke(), n.globalAlpha = 1;
|
|
133
|
+
}, d = (e, t, n, r, i, a) => {
|
|
134
|
+
let [o, s] = t.points, l = s.price >= o.price, u = t.color ? a.color : l ? a.up : a.down, d = Math.min(n.x, r.x), f = Math.max(n.x, r.x), p = Math.min(n.y, r.y), m = Math.max(n.y, r.y);
|
|
135
|
+
e.setLineDash([]), e.fillStyle = u, e.globalAlpha = .14, e.fillRect(d, p, f - d, m - p), e.globalAlpha = 1, e.strokeStyle = u, e.lineWidth = 1;
|
|
136
|
+
let h = Math.round((d + f) / 2) + .5, g = Math.round((p + m) / 2) + .5, _ = (t, n) => {
|
|
137
|
+
e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke();
|
|
138
|
+
let r = Math.atan2(n.y - t.y, n.x - t.x);
|
|
139
|
+
e.beginPath(), e.moveTo(n.x, n.y), e.lineTo(n.x - 6 * Math.cos(r - .5), n.y - 6 * Math.sin(r - .5)), e.lineTo(n.x - 6 * Math.cos(r + .5), n.y - 6 * Math.sin(r + .5)), e.closePath(), e.fill();
|
|
140
|
+
};
|
|
141
|
+
m - p > 10 && _({
|
|
142
|
+
x: h,
|
|
143
|
+
y: l ? m : p
|
|
144
|
+
}, {
|
|
145
|
+
x: h,
|
|
146
|
+
y: l ? p : m
|
|
147
|
+
}), f - d > 10 && _({
|
|
148
|
+
x: n.x < r.x ? d : f,
|
|
149
|
+
y: g
|
|
150
|
+
}, {
|
|
151
|
+
x: n.x < r.x ? f : d,
|
|
152
|
+
y: g
|
|
153
|
+
});
|
|
154
|
+
let v = s.price - o.price, y = o.price ? v / o.price * 100 : NaN, b = Math.round(i.index(s.time) - i.index(o.time)), x = [`${v >= 0 ? "+" : "−"}${a.formatPrice(Math.abs(v))} (${a.formatPercent(y)})`, a.formatSpan(b, s.time - o.time)], S = x.map((t) => e.measureText(t).width), C = Math.max(...S) + 16, w = (d + f) / 2 - C / 2, T = l ? p - 38 - 6 : m + 6;
|
|
155
|
+
c(e, w, T, C, 38, 4), e.fillStyle = u, e.fill(), e.fillStyle = a.textOn(u), e.textAlign = "center", e.textBaseline = "middle", e.fillText(x[0], w + C / 2, T + 11), e.fillText(x[1], w + C / 2, T + 27);
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
export { e as FIB_LEVELS, n as anchorCount, a as hitDrawing, l as paintDrawing, r as screenPoints, o as setDash };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=drawings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawings.js","names":["FIB_LEVELS","FIB_COLORS","anchorCount","tool","screenPoints","drawing","m","p","distanceToSegment","dx","b","a","dy","len2","t","extendStart","extendEnd","hitDrawing","pts","i","q","tolerance","near","d","x0","x1","level","y","y0","y1","setDash","style","ctx","width","extend","len","k","roundRect","x","w","h","r","paintDrawing","state","c","line","paintFib","paintMeasure","p1","p2","ys","color","price","rising","midX","midY","arrow","from","to","angle","change","percent","bars","lines","widths","lx","ly"],"sources":["../../../../../charts/src/engine/trading/drawings.ts"],"sourcesContent":["// Drawings of the price pane: geometry in CSS pixels, hit tests and\n// Canvas2D painting. Anchors are stored as (time, price) so drawings stay\n// on their bars when the chart scrolls, zooms or receives new bars.\n\nimport type {\n TradingDrawing,\n TradingDrawingPoint,\n TradingDrawingTool,\n TradingLineStyle,\n} from \"./types\";\n\n/** Converts between anchors and the pixels of the price pane */\nexport interface DrawingMapper {\n /** x (CSS px) of a logical bar index */\n x(index: number): number;\n /** y (CSS px) of a price */\n y(price: number): number;\n /** Logical index of a time (extrapolated outside the bars) */\n index(time: number): number;\n /** Plot rectangle of the price pane */\n left: number;\n right: number;\n top: number;\n bottom: number;\n}\n\nexport interface Point {\n x: number;\n y: number;\n}\n\n/** Fibonacci retracement levels */\nexport const FIB_LEVELS = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1];\nconst FIB_COLORS = [\n \"#787b86\",\n \"#f23645\",\n \"#ff9800\",\n \"#4caf50\",\n \"#089981\",\n \"#2962ff\",\n \"#787b86\",\n];\n\n/** Number of anchors of a tool */\nexport const anchorCount = (tool: Exclude<TradingDrawingTool, \"cursor\">) =>\n tool === \"horizontalLine\" || tool === \"verticalLine\" ? 1 : 2;\n\nexport const screenPoints = (\n drawing: TradingDrawing,\n m: DrawingMapper,\n): Point[] =>\n drawing.points.map((p) => ({ x: m.x(m.index(p.time)), y: m.y(p.price) }));\n\nconst distanceToSegment = (\n p: Point,\n a: Point,\n b: Point,\n extendStart: boolean,\n extendEnd: boolean,\n) => {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const len2 = dx * dx + dy * dy;\n if (len2 === 0) return Math.hypot(p.x - a.x, p.y - a.y);\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2;\n if (!extendStart) t = Math.max(0, t);\n if (!extendEnd) t = Math.min(1, t);\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\n};\n\n/** Part of a drawing under the pointer */\nexport type DrawingHit = { part: \"handle\"; index: number } | { part: \"body\" };\n\nexport const hitDrawing = (\n drawing: TradingDrawing,\n m: DrawingMapper,\n p: Point,\n tolerance = 6,\n): DrawingHit | null => {\n const pts = screenPoints(drawing, m);\n for (let i = 0; i < pts.length; i++) {\n const q = pts[i];\n if (Math.hypot(q.x - p.x, q.y - p.y) <= tolerance + 2)\n return { part: \"handle\", index: i };\n }\n const [a, b] = pts;\n if (!a) return null;\n const near = (d: number) =>\n d <= tolerance ? { part: \"body\" as const } : null;\n switch (drawing.type) {\n case \"horizontalLine\":\n return near(Math.abs(p.y - a.y));\n case \"verticalLine\":\n return near(Math.abs(p.x - a.x));\n case \"trendLine\":\n return b ? near(distanceToSegment(p, a, b, false, false)) : null;\n case \"ray\":\n return b ? near(distanceToSegment(p, a, b, false, true)) : null;\n case \"extendedLine\":\n return b ? near(distanceToSegment(p, a, b, true, true)) : null;\n case \"fibRetracement\": {\n if (!b) return null;\n const x0 = Math.min(a.x, b.x);\n const x1 = Math.max(a.x, b.x);\n if (p.x < x0 - tolerance || p.x > x1 + tolerance) return null;\n for (const level of FIB_LEVELS) {\n const y = b.y + (a.y - b.y) * level;\n if (Math.abs(p.y - y) <= tolerance) return { part: \"body\" };\n }\n return null;\n }\n default: {\n // rectangle, measure: inside or on the outline\n if (!b) return null;\n const x0 = Math.min(a.x, b.x) - tolerance;\n const x1 = Math.max(a.x, b.x) + tolerance;\n const y0 = Math.min(a.y, b.y) - tolerance;\n const y1 = Math.max(a.y, b.y) + tolerance;\n return p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1\n ? { part: \"body\" }\n : null;\n }\n }\n};\n\nexport const setDash = (\n ctx: CanvasRenderingContext2D,\n style: TradingLineStyle | undefined,\n width: number,\n) => {\n if (style === \"dashed\") ctx.setLineDash([6, 4]);\n else if (style === \"dotted\") ctx.setLineDash([Math.max(1, width), 3]);\n else ctx.setLineDash([]);\n};\n\n/** Values and helpers the painter needs from the chart */\nexport interface DrawingPaintContext {\n /** Resolved CSS color of a drawing */\n color: string;\n /** Text color on the plot */\n text: string;\n /** Background of the plot (handles) */\n background: string;\n /** Up / down colors (measure) */\n up: string;\n down: string;\n font: string;\n formatPrice(price: number): string;\n formatPercent(value: number): string;\n /** `\"24 bars, 2d 4h\"` */\n formatSpan(bars: number, ms: number): string;\n /** Readable text color on a fill */\n textOn(fill: string): string;\n}\n\n/** Point at the end of a line through `a` and `b`, far past the plot */\nconst extend = (a: Point, b: Point, m: DrawingMapper): Point => {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const len = Math.hypot(dx, dy);\n if (!len) return b;\n const k = (Math.abs(m.right - m.left) + Math.abs(m.bottom - m.top)) * 4;\n return { x: a.x + (dx / len) * k, y: a.y + (dy / len) * k };\n};\n\nconst roundRect = (\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n) => {\n ctx.beginPath();\n if (typeof ctx.roundRect === \"function\") ctx.roundRect(x, y, w, h, r);\n else ctx.rect(x, y, w, h);\n};\n\n/** Paints a drawing (the context is clipped to the price pane) */\nexport const paintDrawing = (\n ctx: CanvasRenderingContext2D,\n drawing: TradingDrawing,\n m: DrawingMapper,\n c: DrawingPaintContext,\n state: { selected: boolean; hovered: boolean },\n): void => {\n const pts = screenPoints(drawing, m);\n const [a, b] = pts;\n if (!a) return;\n const width = (drawing.lineWidth ?? 1.5) + (state.hovered ? 0.5 : 0);\n ctx.save();\n ctx.lineWidth = width;\n ctx.strokeStyle = c.color;\n ctx.fillStyle = c.color;\n ctx.font = c.font;\n setDash(ctx, drawing.lineStyle, width);\n const line = (p: Point, q: Point) => {\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n ctx.lineTo(q.x, q.y);\n ctx.stroke();\n };\n switch (drawing.type) {\n case \"horizontalLine\":\n line({ x: m.left, y: a.y }, { x: m.right, y: a.y });\n break;\n case \"verticalLine\":\n line({ x: a.x, y: m.top }, { x: a.x, y: m.bottom });\n break;\n case \"trendLine\":\n if (b) line(a, b);\n break;\n case \"ray\":\n if (b) line(a, extend(a, b, m));\n break;\n case \"extendedLine\":\n if (b) line(extend(b, a, m), extend(a, b, m));\n break;\n case \"rectangle\":\n if (b) {\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n const w = Math.abs(b.x - a.x);\n const h = Math.abs(b.y - a.y);\n ctx.globalAlpha = 0.12;\n ctx.fillRect(x, y, w, h);\n ctx.globalAlpha = 1;\n ctx.strokeRect(x, y, w, h);\n }\n break;\n case \"fibRetracement\":\n if (b) paintFib(ctx, drawing, a, b, c);\n break;\n case \"measure\":\n if (b) paintMeasure(ctx, drawing, a, b, m, c);\n break;\n }\n if (state.selected || state.hovered) {\n ctx.setLineDash([]);\n ctx.lineWidth = 1.5;\n for (const p of pts) {\n ctx.beginPath();\n ctx.arc(p.x, p.y, state.selected ? 4.5 : 3.5, 0, Math.PI * 2);\n ctx.fillStyle = c.background;\n ctx.fill();\n ctx.strokeStyle = c.color;\n ctx.stroke();\n }\n }\n ctx.restore();\n};\n\nconst paintFib = (\n ctx: CanvasRenderingContext2D,\n drawing: TradingDrawing,\n a: Point,\n b: Point,\n c: DrawingPaintContext,\n) => {\n const x0 = Math.min(a.x, b.x);\n const x1 = Math.max(a.x, b.x);\n const p1 = drawing.points[0]?.price ?? 0;\n const p2 = drawing.points[1]?.price ?? 0;\n const ys = FIB_LEVELS.map((level) => b.y + (a.y - b.y) * level);\n // bands between levels\n for (let i = 0; i + 1 < FIB_LEVELS.length; i++) {\n ctx.globalAlpha = 0.08;\n ctx.fillStyle = drawing.color ? c.color : FIB_COLORS[i + 1];\n ctx.fillRect(\n x0,\n Math.min(ys[i], ys[i + 1]),\n x1 - x0,\n Math.abs(ys[i + 1] - ys[i]),\n );\n }\n ctx.globalAlpha = 1;\n ctx.textBaseline = \"bottom\";\n ctx.textAlign = \"left\";\n FIB_LEVELS.forEach((level, i) => {\n const y = Math.round(ys[i]) + 0.5;\n const color = drawing.color ? c.color : FIB_COLORS[i];\n ctx.strokeStyle = color;\n ctx.fillStyle = color;\n ctx.beginPath();\n ctx.moveTo(x0, y);\n ctx.lineTo(x1, y);\n ctx.stroke();\n const price = p2 + (p1 - p2) * level;\n ctx.fillText(`${level} (${c.formatPrice(price)})`, x0 + 4, y - 2);\n });\n // the trend line between the anchors\n ctx.setLineDash([4, 4]);\n ctx.strokeStyle = c.color;\n ctx.globalAlpha = 0.6;\n ctx.beginPath();\n ctx.moveTo(a.x, a.y);\n ctx.lineTo(b.x, b.y);\n ctx.stroke();\n ctx.globalAlpha = 1;\n};\n\nconst paintMeasure = (\n ctx: CanvasRenderingContext2D,\n drawing: TradingDrawing,\n a: Point,\n b: Point,\n m: DrawingMapper,\n c: DrawingPaintContext,\n) => {\n const [p1, p2] = drawing.points as [TradingDrawingPoint, TradingDrawingPoint];\n const rising = p2.price >= p1.price;\n const color = drawing.color ? c.color : rising ? c.up : c.down;\n const x0 = Math.min(a.x, b.x);\n const x1 = Math.max(a.x, b.x);\n const y0 = Math.min(a.y, b.y);\n const y1 = Math.max(a.y, b.y);\n ctx.setLineDash([]);\n ctx.fillStyle = color;\n ctx.globalAlpha = 0.14;\n ctx.fillRect(x0, y0, x1 - x0, y1 - y0);\n ctx.globalAlpha = 1;\n ctx.strokeStyle = color;\n ctx.lineWidth = 1;\n // arrows across the box\n const midX = Math.round((x0 + x1) / 2) + 0.5;\n const midY = Math.round((y0 + y1) / 2) + 0.5;\n const arrow = (from: Point, to: Point) => {\n ctx.beginPath();\n ctx.moveTo(from.x, from.y);\n ctx.lineTo(to.x, to.y);\n ctx.stroke();\n const angle = Math.atan2(to.y - from.y, to.x - from.x);\n ctx.beginPath();\n ctx.moveTo(to.x, to.y);\n ctx.lineTo(\n to.x - 6 * Math.cos(angle - 0.5),\n to.y - 6 * Math.sin(angle - 0.5),\n );\n ctx.lineTo(\n to.x - 6 * Math.cos(angle + 0.5),\n to.y - 6 * Math.sin(angle + 0.5),\n );\n ctx.closePath();\n ctx.fill();\n };\n if (y1 - y0 > 10)\n arrow({ x: midX, y: rising ? y1 : y0 }, { x: midX, y: rising ? y0 : y1 });\n if (x1 - x0 > 10)\n arrow(\n { x: a.x < b.x ? x0 : x1, y: midY },\n { x: a.x < b.x ? x1 : x0, y: midY },\n );\n // label\n const change = p2.price - p1.price;\n const percent = p1.price ? (change / p1.price) * 100 : NaN;\n const bars = Math.round(m.index(p2.time) - m.index(p1.time));\n const lines = [\n `${change >= 0 ? \"+\" : \"−\"}${c.formatPrice(Math.abs(change))} (${c.formatPercent(percent)})`,\n c.formatSpan(bars, p2.time - p1.time),\n ];\n const widths = lines.map((t) => ctx.measureText(t).width);\n const w = Math.max(...widths) + 16;\n const h = 38;\n const lx = (x0 + x1) / 2 - w / 2;\n const below = !rising;\n const ly = below ? y1 + 6 : y0 - h - 6;\n roundRect(ctx, lx, ly, w, h, 4);\n ctx.fillStyle = color;\n ctx.fill();\n ctx.fillStyle = c.textOn(color);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(lines[0], lx + w / 2, ly + 11);\n ctx.fillText(lines[1], lx + w / 2, ly + 27);\n};\n"],"mappings":";AAgCA,IAAaA,IAAa;CAAC;CAAG;CAAO;CAAO;CAAK;CAAO;CAAO;AAAC,GAC1DC,IAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAGaC,KAAe,MAC1BC,MAAS,oBAAoBA,MAAS,iBAAiB,IAAI,GAEhDC,KACX,GACA,MAEAC,EAAQ,OAAO,KAAK,OAAO;CAAE,GAAGC,EAAE,EAAEA,EAAE,MAAMC,EAAE,IA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C,CAAC,KAAK,GAClDO,IAAI,KAAK,IAAI,GAAGyB,CAAM,IAAI,IAE1BC,KAAMzC,IAAKC,KAAM,IAAIc,IAAI,GAEzB2B,IADSb,IACazB,IAAK,KAAI,IAAlBC,IAAK;CAQxB,AAPAQ,EAAUL,GAAKiC,GAAIC,GAAI3B,GAAG,IAAG,CAAC,GAC9B,EAAI,YAAYY,GAChBnB,EAAI,KAAK,GACT,EAAI,YAAYY,EAAE,OAAOO,CAAK,GAC9B,EAAI,YAAY,UAChB,EAAI,eAAe,UACnBnB,EAAI,SAAS+B,EAAM,IAAIE,IAAK1B,IAAI,GAAG2B,IAAK,EAAE,GAC1ClC,EAAI,SAAS+B,EAAM,IAAIE,IAAK1B,IAAI,GAAG2B,IAAK,EAAE;AAC5C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../locale.cjs");var t=6e4,n=36e5,r=864e5,i=(t,n)=>e.numberFormat(e.resolveLocale(t),n),a=(e,t,n)=>{let r=0,i=Math.max(0,n-300,t);for(let t=i;t<n;t++){let n=Math.abs(e[t]);if(Number.isFinite(n))for(;r<8;){let e=n*10**r;if(Math.abs(e-Math.round(e))<1e-8*Math.max(1,e))break;r++}}return r},o=(e,t)=>{let n=Math.max(0,Math.min(12,Math.round(e))),r=i(t,{minimumFractionDigits:n,maximumFractionDigits:n});return e=>Number.isFinite(e)?r.format(e):`–`},s=(t,n)=>{if(!Number.isFinite(t))return`–`;let r=i(n,{maximumFractionDigits:2}),a=Math.abs(t);for(let[i,o]of e.compactUnits(n))if(a>=i*.999995)return`${r.format(t/i)}${o}`;return r.format(t)},c=(e,t,n=2)=>{if(!Number.isFinite(e))return`–`;let r=i(t,{minimumFractionDigits:n,maximumFractionDigits:n}).format(Math.abs(e));return`${Math.abs(e)<.5*10**-n?``:e>0?`+`:`−`}${r}%`},l=(e,t,n)=>Number.isFinite(e)?i(n,{minimumFractionDigits:t,maximumFractionDigits:t}).format(e):`–`,u=new Map,d=(t,n)=>{let r=`${t??``}|${JSON.stringify(n)}`,i=u.get(r);if(!i){let a={...n,timeZone:`UTC`};try{i=new Intl.DateTimeFormat(e.resolveLocale(t),a)}catch{i=new Intl.DateTimeFormat(`en`,a)}u.set(r,i)}return i},f=(e,t)=>t??-new Date(Number.isFinite(e)?e:0).getTimezoneOffset(),p=(e,n)=>e+f(e,n)*t,m=(e,r)=>{if(!Number.isFinite(e))return 70;let i=new Date(e),a=new Date(r);if(i.getUTCFullYear()!==a.getUTCFullYear())return 70;if(i.getUTCMonth()!==a.getUTCMonth())return 60;if(i.getUTCDate()!==a.getUTCDate())return 50;let o=[[12*n,46],[6*n,45],[3*n,44],[n,43],[30*t,34],[15*t,33],[5*t,32],[t,31],[3e4,24],[15e3,23],[5e3,22],[1e3,21]];for(let[t,n]of o)if(Math.floor(e/t)!==Math.floor(r/t))return n;return 10},h=(e,t,n,r)=>t>=70?d(n,{year:`numeric`}).format(e):t>=60?d(n,{month:`short`}).format(e):t>=50?r?d(n,{month:`short`,day:`numeric`}).format(e):d(n,{day:`numeric`}).format(e):t>=30?d(n,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e):d(n,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e),g=(e,t)=>{let n=e.map((e,t)=>t).sort((t,n)=>e[n].weight-e[t].weight||t-n),r=[],i=[];for(let a of n){let n=e[a],o=0,s=r.length;for(;o<s;){let e=o+s>>>1;r[e]<n.x?o=e+1:s=e}let c=o>0?r[o-1]:-1/0,l=o<r.length?r[o]:1/0;n.x-c<t||l-n.x<t||(r.splice(o,0,n.x),i.push(n))}return i.sort((e,t)=>e.x-t.x)},_=(e,t,n)=>{let r={weekday:`short`,year:`numeric`,month:`short`,day:`numeric`};return t>=864e5?d(n,r).format(e):d(n,{...r,hour:`2-digit`,minute:`2-digit`,...t<6e4?{second:`2-digit`}:{},hourCycle:`h23`}).format(e)},v=(e,t={days:`{count}d`,hours:`{count}h`})=>{let n=Math.max(0,Math.floor(e/1e3)),r=e=>String(e).padStart(2,`0`);if(n>=86400){let e=String(Math.floor(n/86400)),i=r(Math.floor(n%86400/3600));return`${t.days.replace(`{count}`,e)} ${t.hours.replace(`{count}`,i)}`}return n>=3600?`${r(Math.floor(n/3600))}:${r(Math.floor(n%3600/60))}:${r(n%60)}`:`${r(Math.floor(n/60))}:${r(n%60)}`},y=(e,t)=>{let n=[];for(let r=Math.max(1,t-64);r<t;r++){let t=e[r]-e[r-1];t>0&&Number.isFinite(t)&&n.push(t)}return n.length?(n.sort((e,t)=>e-t),n[Math.floor(n.length*.25)]):r};exports.DAY=r,exports.HOUR=n,exports.MINUTE=t,exports.boundaryWeight=m,exports.dateFormat=d,exports.detectPrecision=a,exports.formatCountdown=v,exports.formatCrosshairTime=_,exports.formatFixed=l,exports.formatPercent=c,exports.formatVolume=s,exports.inferTimeframe=y,exports.offsetAt=f,exports.pickTicks=g,exports.priceFormatter=o,exports.shiftTime=p,exports.tickText=h;
|
|
2
|
+
//# sourceMappingURL=format.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.cjs","names":["sharedNumberFormat","resolveLocale","compactUnits","require_locale","MINUTE","HOUR","DAY","numberFormat","locale","options","detectPrecision","decimals","start","to","from","i","v","values","scaled","priceFormatter","p","precision","format","value","formatVolume","abs","unit","suffix","formatPercent","text","formatFixed","dateFormats","dateFormat","key","full","offsetAt","utcOffset","time","shiftTime","boundaryWeight","prev","a","b","steps","weight","tickText","intraday","pickTicks","order","candidates","kept","result","c","lo","hi","mid","left","right","minGap","formatCrosshairTime","date","timeframeMs","shifted","formatCountdown","s","ms","pad","days","hours","units","inferTimeframe","gaps","n","d"],"sources":["../../../../../charts/src/engine/trading/format.ts"],"sourcesContent":["// Formatting of prices, volumes and times, and the labels of the time axis.\n// `locale` is resolved by the caller (`resolveLocale`) on hot paths.\n\nimport {\n compactUnits,\n numberFormat as sharedNumberFormat,\n resolveLocale,\n} from \"../locale\";\n\nexport const MINUTE = 60_000;\nexport const HOUR = 3_600_000;\nexport const DAY = 86_400_000;\n\nconst numberFormat = (\n locale: string | undefined,\n options: Intl.NumberFormatOptions,\n): Intl.NumberFormat => sharedNumberFormat(resolveLocale(locale), options);\n\n/** Decimals needed by the prices (0-8), detected from a sample of them */\nexport const detectPrecision = (\n values: ArrayLike<number>,\n from: number,\n to: number,\n): number => {\n let decimals = 0;\n const start = Math.max(0, to - 300, from);\n for (let i = start; i < to; i++) {\n const v = Math.abs(values[i]);\n if (!Number.isFinite(v)) continue;\n while (decimals < 8) {\n const scaled = v * 10 ** decimals;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-8 * Math.max(1, scaled))\n break;\n decimals++;\n }\n }\n return decimals;\n};\n\n/** Price formatter: fixed decimals, grouped digits of `locale` */\nexport const priceFormatter = (\n precision: number,\n locale: string | undefined,\n): ((value: number) => string) => {\n const p = Math.max(0, Math.min(12, Math.round(precision)));\n const format = numberFormat(locale, {\n minimumFractionDigits: p,\n maximumFractionDigits: p,\n });\n return (value) => (Number.isFinite(value) ? format.format(value) : \"–\");\n};\n\n/** `12345678` -> `12.35M` (`1234.57万` in Chinese and Japanese) */\nexport const formatVolume = (value: number, locale?: string): string => {\n if (!Number.isFinite(value)) return \"–\";\n const format = numberFormat(locale, { maximumFractionDigits: 2 });\n const abs = Math.abs(value);\n for (const [unit, suffix] of compactUnits(locale)) {\n // 999,999 shows as 1M, not 1,000k\n if (abs >= unit * 0.999995)\n return `${format.format(value / unit)}${suffix}`;\n }\n return format.format(value);\n};\n\n/** `+1.25%` */\nexport const formatPercent = (\n value: number,\n locale?: string,\n decimals = 2,\n): string => {\n if (!Number.isFinite(value)) return \"–\";\n const text = numberFormat(locale, {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(Math.abs(value));\n const zero = Math.abs(value) < 0.5 * 10 ** -decimals;\n return `${zero ? \"\" : value > 0 ? \"+\" : \"−\"}${text}%`;\n};\n\n/** Any value with `decimals` decimals (indicator panes) */\nexport const formatFixed = (\n value: number,\n decimals: number,\n locale?: string,\n): string =>\n Number.isFinite(value)\n ? numberFormat(locale, {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(value)\n : \"–\";\n\n// ------------------------------------------------------------------ times\n\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/** Formats shifted times with the UTC getters (the offset is applied before) */\nexport const dateFormat = (\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat => {\n const key = `${locale ?? \"\"}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n const full = { ...options, timeZone: \"UTC\" };\n try {\n format = new Intl.DateTimeFormat(resolveLocale(locale), full);\n } catch {\n format = new Intl.DateTimeFormat(\"en\", full);\n }\n dateFormats.set(key, format);\n }\n return format;\n};\n\n/** Offset of the displayed time from UTC, in minutes, at `time` */\nexport const offsetAt = (time: number, utcOffset: number | undefined) =>\n utcOffset ?? -new Date(Number.isFinite(time) ? time : 0).getTimezoneOffset();\n\n/** Time shifted so that the UTC getters read the displayed time */\nexport const shiftTime = (time: number, utcOffset: number | undefined) =>\n time + offsetAt(time, utcOffset) * MINUTE;\n\n/**\n * Weight of the boundary between two consecutive (shifted) bar times: the\n * largest calendar unit that changes (year 70, month 60, day 50, hours\n * 43-46, minutes 31-34, seconds 21-24, 10 otherwise)\n */\nexport const boundaryWeight = (prev: number, time: number): number => {\n if (!Number.isFinite(prev)) return 70;\n const a = new Date(prev);\n const b = new Date(time);\n if (a.getUTCFullYear() !== b.getUTCFullYear()) return 70;\n if (a.getUTCMonth() !== b.getUTCMonth()) return 60;\n if (a.getUTCDate() !== b.getUTCDate()) return 50;\n const steps: readonly [number, number][] = [\n [12 * HOUR, 46],\n [6 * HOUR, 45],\n [3 * HOUR, 44],\n [HOUR, 43],\n [30 * MINUTE, 34],\n [15 * MINUTE, 33],\n [5 * MINUTE, 32],\n [MINUTE, 31],\n [30_000, 24],\n [15_000, 23],\n [5_000, 22],\n [1_000, 21],\n ];\n for (const [unit, weight] of steps) {\n if (Math.floor(prev / unit) !== Math.floor(time / unit)) return weight;\n }\n return 10;\n};\n\n/** A label of the time axis */\nexport interface TimeTick {\n /** x in CSS pixels */\n x: number;\n text: string;\n /** Larger unit (new day of an intraday chart, new month / year) */\n bold: boolean;\n}\n\n/** Text of a tick of weight `weight` at the shifted time `time` */\nexport const tickText = (\n time: number,\n weight: number,\n locale: string | undefined,\n intraday: boolean,\n): string => {\n if (weight >= 70) return dateFormat(locale, { year: \"numeric\" }).format(time);\n if (weight >= 60) return dateFormat(locale, { month: \"short\" }).format(time);\n if (weight >= 50) {\n return intraday\n ? dateFormat(locale, { month: \"short\", day: \"numeric\" }).format(time)\n : dateFormat(locale, { day: \"numeric\" }).format(time);\n }\n if (weight >= 30)\n return dateFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hourCycle: \"h23\",\n }).format(time);\n return dateFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hourCycle: \"h23\",\n }).format(time);\n};\n\n/**\n * Picks the time labels: candidates by decreasing weight, each kept when\n * no kept label is closer than `minGap` pixels\n */\nexport const pickTicks = (\n candidates: readonly { x: number; weight: number; time: number }[],\n minGap: number,\n): { x: number; weight: number; time: number }[] => {\n const order = candidates\n .map((_, i) => i)\n .sort((a, b) => candidates[b].weight - candidates[a].weight || a - b);\n const kept: number[] = [];\n const result: { x: number; weight: number; time: number }[] = [];\n for (const i of order) {\n const c = candidates[i];\n // binary search of the kept x positions\n let lo = 0;\n let hi = kept.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (kept[mid] < c.x) lo = mid + 1;\n else hi = mid;\n }\n const left = lo > 0 ? kept[lo - 1] : -Infinity;\n const right = lo < kept.length ? kept[lo] : Infinity;\n if (c.x - left < minGap || right - c.x < minGap) continue;\n kept.splice(lo, 0, c.x);\n result.push(c);\n }\n return result.sort((a, b) => a.x - b.x);\n};\n\n/** Full time of the crosshair label (`Tue 12 Mar '24 14:35`) */\nexport const formatCrosshairTime = (\n shifted: number,\n timeframeMs: number,\n locale: string | undefined,\n): string => {\n const date: Intl.DateTimeFormatOptions = {\n weekday: \"short\",\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n };\n if (timeframeMs >= DAY) return dateFormat(locale, date).format(shifted);\n return dateFormat(locale, {\n ...date,\n hour: \"2-digit\",\n minute: \"2-digit\",\n ...(timeframeMs < MINUTE ? { second: \"2-digit\" } : {}),\n hourCycle: \"h23\",\n }).format(shifted);\n};\n\n/**\n * Time left before a bar closes: `42`, `04:59`, `03:04:59`, `2d 04h` (the\n * day and hour templates replace `{count}`)\n */\nexport const formatCountdown = (\n ms: number,\n units: { days: string; hours: string } = {\n days: \"{count}d\",\n hours: \"{count}h\",\n },\n): string => {\n const s = Math.max(0, Math.floor(ms / 1000));\n const pad = (v: number) => String(v).padStart(2, \"0\");\n if (s >= 86_400) {\n const days = String(Math.floor(s / 86_400));\n const hours = pad(Math.floor((s % 86_400) / 3600));\n return `${units.days.replace(\"{count}\", days)} ${units.hours.replace(\"{count}\", hours)}`;\n }\n if (s >= 3600)\n return `${pad(Math.floor(s / 3600))}:${pad(Math.floor((s % 3600) / 60))}:${pad(s % 60)}`;\n return `${pad(Math.floor(s / 60))}:${pad(s % 60)}`;\n};\n\n/** Typical duration between bars: the median of the last gaps */\nexport const inferTimeframe = (time: ArrayLike<number>, n: number): number => {\n const gaps: number[] = [];\n for (let i = Math.max(1, n - 64); i < n; i++) {\n const d = time[i] - time[i - 1];\n if (d > 0 && Number.isFinite(d)) gaps.push(d);\n }\n if (!gaps.length) return DAY;\n gaps.sort((a, b) => a - b);\n // the smallest frequent gap: weekends and nights make larger ones\n return gaps[Math.floor(gaps.length * 0.25)];\n};\n"],"mappings":"iCASA,IAAaI,EAAS,IACTC,EAAO,KACPC,EAAM,MAEbC,GACJ,EACA,IACsBP,EAAAA,aAAmBC,EAAAA,cAAcO,CAAM,EAAGC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AAM,KAAK,QAAQ,UAAWF,CAAI,EAAE,GAAGE,EAAM,MAAM,QAAQ,UAAWD,CAAK,GACvF,CAGA,OAFIJ,GAAK,KACA,GAAGE,EAAI,KAAK,MAAMF,EAAI,IAAI,CAAC,EAAE,GAAGE,EAAI,KAAK,MAAOF,EAAI,KAAQ,EAAE,CAAC,EAAE,GAAGE,EAAIF,EAAI,EAAE,IAChF,GAAGE,EAAI,KAAK,MAAMF,EAAI,EAAE,CAAC,EAAE,GAAGE,EAAIF,EAAI,EAAE,GACjD,EAGaM,GAAkB,EAAyB,IAAsB,CAC5E,IAAMC,EAAiB,CAAC,EACxB,IAAK,IAAIxD,EAAI,KAAK,IAAI,EAAGyD,EAAI,EAAE,EAAGzD,EAAIyD,EAAG,IAAK,CAC5C,IAAMC,EAAIpC,EAAKtB,GAAKsB,EAAKtB,EAAI,GACzB0D,EAAI,GAAK,OAAO,SAASA,CAAC,GAAGF,EAAK,KAAKE,CAAC,CAC9C,CAIA,OAHKF,EAAK,QACVA,EAAK,MAAM,EAAG,IAAM9B,EAAIC,CAAC,EAElB6B,EAAK,KAAK,MAAMA,EAAK,OAAS,GAAI,IAHhBjE,CAI3B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const MINUTE = 60000;
|
|
2
|
+
export declare const HOUR = 3600000;
|
|
3
|
+
export declare const DAY = 86400000;
|
|
4
|
+
/** Decimals needed by the prices (0-8), detected from a sample of them */
|
|
5
|
+
export declare const detectPrecision: (values: ArrayLike<number>, from: number, to: number) => number;
|
|
6
|
+
/** Price formatter: fixed decimals, grouped digits of `locale` */
|
|
7
|
+
export declare const priceFormatter: (precision: number, locale: string | undefined) => ((value: number) => string);
|
|
8
|
+
/** `12345678` -> `12.35M` (`1234.57万` in Chinese and Japanese) */
|
|
9
|
+
export declare const formatVolume: (value: number, locale?: string) => string;
|
|
10
|
+
/** `+1.25%` */
|
|
11
|
+
export declare const formatPercent: (value: number, locale?: string, decimals?: number) => string;
|
|
12
|
+
/** Any value with `decimals` decimals (indicator panes) */
|
|
13
|
+
export declare const formatFixed: (value: number, decimals: number, locale?: string) => string;
|
|
14
|
+
/** Formats shifted times with the UTC getters (the offset is applied before) */
|
|
15
|
+
export declare const dateFormat: (locale: string | undefined, options: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
16
|
+
/** Offset of the displayed time from UTC, in minutes, at `time` */
|
|
17
|
+
export declare const offsetAt: (time: number, utcOffset: number | undefined) => number;
|
|
18
|
+
/** Time shifted so that the UTC getters read the displayed time */
|
|
19
|
+
export declare const shiftTime: (time: number, utcOffset: number | undefined) => number;
|
|
20
|
+
/**
|
|
21
|
+
* Weight of the boundary between two consecutive (shifted) bar times: the
|
|
22
|
+
* largest calendar unit that changes (year 70, month 60, day 50, hours
|
|
23
|
+
* 43-46, minutes 31-34, seconds 21-24, 10 otherwise)
|
|
24
|
+
*/
|
|
25
|
+
export declare const boundaryWeight: (prev: number, time: number) => number;
|
|
26
|
+
/** A label of the time axis */
|
|
27
|
+
export interface TimeTick {
|
|
28
|
+
/** x in CSS pixels */
|
|
29
|
+
x: number;
|
|
30
|
+
text: string;
|
|
31
|
+
/** Larger unit (new day of an intraday chart, new month / year) */
|
|
32
|
+
bold: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Text of a tick of weight `weight` at the shifted time `time` */
|
|
35
|
+
export declare const tickText: (time: number, weight: number, locale: string | undefined, intraday: boolean) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Picks the time labels: candidates by decreasing weight, each kept when
|
|
38
|
+
* no kept label is closer than `minGap` pixels
|
|
39
|
+
*/
|
|
40
|
+
export declare const pickTicks: (candidates: readonly {
|
|
41
|
+
x: number;
|
|
42
|
+
weight: number;
|
|
43
|
+
time: number;
|
|
44
|
+
}[], minGap: number) => {
|
|
45
|
+
x: number;
|
|
46
|
+
weight: number;
|
|
47
|
+
time: number;
|
|
48
|
+
}[];
|
|
49
|
+
/** Full time of the crosshair label (`Tue 12 Mar '24 14:35`) */
|
|
50
|
+
export declare const formatCrosshairTime: (shifted: number, timeframeMs: number, locale: string | undefined) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Time left before a bar closes: `42`, `04:59`, `03:04:59`, `2d 04h` (the
|
|
53
|
+
* day and hour templates replace `{count}`)
|
|
54
|
+
*/
|
|
55
|
+
export declare const formatCountdown: (ms: number, units?: {
|
|
56
|
+
days: string;
|
|
57
|
+
hours: string;
|
|
58
|
+
}) => string;
|
|
59
|
+
/** Typical duration between bars: the median of the last gaps */
|
|
60
|
+
export declare const inferTimeframe: (time: ArrayLike<number>, n: number) => number;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const MINUTE = 60000;
|
|
2
|
+
export declare const HOUR = 3600000;
|
|
3
|
+
export declare const DAY = 86400000;
|
|
4
|
+
/** Decimals needed by the prices (0-8), detected from a sample of them */
|
|
5
|
+
export declare const detectPrecision: (values: ArrayLike<number>, from: number, to: number) => number;
|
|
6
|
+
/** Price formatter: fixed decimals, grouped digits of `locale` */
|
|
7
|
+
export declare const priceFormatter: (precision: number, locale: string | undefined) => ((value: number) => string);
|
|
8
|
+
/** `12345678` -> `12.35M` (`1234.57万` in Chinese and Japanese) */
|
|
9
|
+
export declare const formatVolume: (value: number, locale?: string) => string;
|
|
10
|
+
/** `+1.25%` */
|
|
11
|
+
export declare const formatPercent: (value: number, locale?: string, decimals?: number) => string;
|
|
12
|
+
/** Any value with `decimals` decimals (indicator panes) */
|
|
13
|
+
export declare const formatFixed: (value: number, decimals: number, locale?: string) => string;
|
|
14
|
+
/** Formats shifted times with the UTC getters (the offset is applied before) */
|
|
15
|
+
export declare const dateFormat: (locale: string | undefined, options: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
16
|
+
/** Offset of the displayed time from UTC, in minutes, at `time` */
|
|
17
|
+
export declare const offsetAt: (time: number, utcOffset: number | undefined) => number;
|
|
18
|
+
/** Time shifted so that the UTC getters read the displayed time */
|
|
19
|
+
export declare const shiftTime: (time: number, utcOffset: number | undefined) => number;
|
|
20
|
+
/**
|
|
21
|
+
* Weight of the boundary between two consecutive (shifted) bar times: the
|
|
22
|
+
* largest calendar unit that changes (year 70, month 60, day 50, hours
|
|
23
|
+
* 43-46, minutes 31-34, seconds 21-24, 10 otherwise)
|
|
24
|
+
*/
|
|
25
|
+
export declare const boundaryWeight: (prev: number, time: number) => number;
|
|
26
|
+
/** A label of the time axis */
|
|
27
|
+
export interface TimeTick {
|
|
28
|
+
/** x in CSS pixels */
|
|
29
|
+
x: number;
|
|
30
|
+
text: string;
|
|
31
|
+
/** Larger unit (new day of an intraday chart, new month / year) */
|
|
32
|
+
bold: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Text of a tick of weight `weight` at the shifted time `time` */
|
|
35
|
+
export declare const tickText: (time: number, weight: number, locale: string | undefined, intraday: boolean) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Picks the time labels: candidates by decreasing weight, each kept when
|
|
38
|
+
* no kept label is closer than `minGap` pixels
|
|
39
|
+
*/
|
|
40
|
+
export declare const pickTicks: (candidates: readonly {
|
|
41
|
+
x: number;
|
|
42
|
+
weight: number;
|
|
43
|
+
time: number;
|
|
44
|
+
}[], minGap: number) => {
|
|
45
|
+
x: number;
|
|
46
|
+
weight: number;
|
|
47
|
+
time: number;
|
|
48
|
+
}[];
|
|
49
|
+
/** Full time of the crosshair label (`Tue 12 Mar '24 14:35`) */
|
|
50
|
+
export declare const formatCrosshairTime: (shifted: number, timeframeMs: number, locale: string | undefined) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Time left before a bar closes: `42`, `04:59`, `03:04:59`, `2d 04h` (the
|
|
53
|
+
* day and hour templates replace `{count}`)
|
|
54
|
+
*/
|
|
55
|
+
export declare const formatCountdown: (ms: number, units?: {
|
|
56
|
+
days: string;
|
|
57
|
+
hours: string;
|
|
58
|
+
}) => string;
|
|
59
|
+
/** Typical duration between bars: the median of the last gaps */
|
|
60
|
+
export declare const inferTimeframe: (time: ArrayLike<number>, n: number) => number;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { compactUnits as e, numberFormat as t, resolveLocale as n } from "../locale.js";
|
|
2
|
+
//#region src/engine/trading/format.ts
|
|
3
|
+
var r = 6e4, i = 36e5, a = 864e5, o = (e, r) => t(n(e), r), s = (e, t, n) => {
|
|
4
|
+
let r = 0, i = Math.max(0, n - 300, t);
|
|
5
|
+
for (let t = i; t < n; t++) {
|
|
6
|
+
let n = Math.abs(e[t]);
|
|
7
|
+
if (Number.isFinite(n)) for (; r < 8;) {
|
|
8
|
+
let e = n * 10 ** r;
|
|
9
|
+
if (Math.abs(e - Math.round(e)) < 1e-8 * Math.max(1, e)) break;
|
|
10
|
+
r++;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return r;
|
|
14
|
+
}, c = (e, t) => {
|
|
15
|
+
let n = Math.max(0, Math.min(12, Math.round(e))), r = o(t, {
|
|
16
|
+
minimumFractionDigits: n,
|
|
17
|
+
maximumFractionDigits: n
|
|
18
|
+
});
|
|
19
|
+
return (e) => Number.isFinite(e) ? r.format(e) : "–";
|
|
20
|
+
}, l = (t, n) => {
|
|
21
|
+
if (!Number.isFinite(t)) return "–";
|
|
22
|
+
let r = o(n, { maximumFractionDigits: 2 }), i = Math.abs(t);
|
|
23
|
+
for (let [a, o] of e(n)) if (i >= a * .999995) return `${r.format(t / a)}${o}`;
|
|
24
|
+
return r.format(t);
|
|
25
|
+
}, u = (e, t, n = 2) => {
|
|
26
|
+
if (!Number.isFinite(e)) return "–";
|
|
27
|
+
let r = o(t, {
|
|
28
|
+
minimumFractionDigits: n,
|
|
29
|
+
maximumFractionDigits: n
|
|
30
|
+
}).format(Math.abs(e));
|
|
31
|
+
return `${Math.abs(e) < .5 * 10 ** -n ? "" : e > 0 ? "+" : "−"}${r}%`;
|
|
32
|
+
}, d = (e, t, n) => Number.isFinite(e) ? o(n, {
|
|
33
|
+
minimumFractionDigits: t,
|
|
34
|
+
maximumFractionDigits: t
|
|
35
|
+
}).format(e) : "–", f = /* @__PURE__ */ new Map(), p = (e, t) => {
|
|
36
|
+
let r = `${e ?? ""}|${JSON.stringify(t)}`, i = f.get(r);
|
|
37
|
+
if (!i) {
|
|
38
|
+
let a = {
|
|
39
|
+
...t,
|
|
40
|
+
timeZone: "UTC"
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
i = new Intl.DateTimeFormat(n(e), a);
|
|
44
|
+
} catch {
|
|
45
|
+
i = new Intl.DateTimeFormat("en", a);
|
|
46
|
+
}
|
|
47
|
+
f.set(r, i);
|
|
48
|
+
}
|
|
49
|
+
return i;
|
|
50
|
+
}, m = (e, t) => t ?? -new Date(Number.isFinite(e) ? e : 0).getTimezoneOffset(), h = (e, t) => e + m(e, t) * r, g = (e, t) => {
|
|
51
|
+
if (!Number.isFinite(e)) return 70;
|
|
52
|
+
let n = new Date(e), a = new Date(t);
|
|
53
|
+
if (n.getUTCFullYear() !== a.getUTCFullYear()) return 70;
|
|
54
|
+
if (n.getUTCMonth() !== a.getUTCMonth()) return 60;
|
|
55
|
+
if (n.getUTCDate() !== a.getUTCDate()) return 50;
|
|
56
|
+
let o = [
|
|
57
|
+
[12 * i, 46],
|
|
58
|
+
[6 * i, 45],
|
|
59
|
+
[3 * i, 44],
|
|
60
|
+
[i, 43],
|
|
61
|
+
[30 * r, 34],
|
|
62
|
+
[15 * r, 33],
|
|
63
|
+
[5 * r, 32],
|
|
64
|
+
[r, 31],
|
|
65
|
+
[3e4, 24],
|
|
66
|
+
[15e3, 23],
|
|
67
|
+
[5e3, 22],
|
|
68
|
+
[1e3, 21]
|
|
69
|
+
];
|
|
70
|
+
for (let [n, r] of o) if (Math.floor(e / n) !== Math.floor(t / n)) return r;
|
|
71
|
+
return 10;
|
|
72
|
+
}, _ = (e, t, n, r) => t >= 70 ? p(n, { year: "numeric" }).format(e) : t >= 60 ? p(n, { month: "short" }).format(e) : t >= 50 ? r ? p(n, {
|
|
73
|
+
month: "short",
|
|
74
|
+
day: "numeric"
|
|
75
|
+
}).format(e) : p(n, { day: "numeric" }).format(e) : t >= 30 ? p(n, {
|
|
76
|
+
hour: "2-digit",
|
|
77
|
+
minute: "2-digit",
|
|
78
|
+
hourCycle: "h23"
|
|
79
|
+
}).format(e) : p(n, {
|
|
80
|
+
hour: "2-digit",
|
|
81
|
+
minute: "2-digit",
|
|
82
|
+
second: "2-digit",
|
|
83
|
+
hourCycle: "h23"
|
|
84
|
+
}).format(e), v = (e, t) => {
|
|
85
|
+
let n = e.map((e, t) => t).sort((t, n) => e[n].weight - e[t].weight || t - n), r = [], i = [];
|
|
86
|
+
for (let a of n) {
|
|
87
|
+
let n = e[a], o = 0, s = r.length;
|
|
88
|
+
for (; o < s;) {
|
|
89
|
+
let e = o + s >>> 1;
|
|
90
|
+
r[e] < n.x ? o = e + 1 : s = e;
|
|
91
|
+
}
|
|
92
|
+
let c = o > 0 ? r[o - 1] : -Infinity, l = o < r.length ? r[o] : Infinity;
|
|
93
|
+
n.x - c < t || l - n.x < t || (r.splice(o, 0, n.x), i.push(n));
|
|
94
|
+
}
|
|
95
|
+
return i.sort((e, t) => e.x - t.x);
|
|
96
|
+
}, y = (e, t, n) => {
|
|
97
|
+
let r = {
|
|
98
|
+
weekday: "short",
|
|
99
|
+
year: "numeric",
|
|
100
|
+
month: "short",
|
|
101
|
+
day: "numeric"
|
|
102
|
+
};
|
|
103
|
+
return t >= 864e5 ? p(n, r).format(e) : p(n, {
|
|
104
|
+
...r,
|
|
105
|
+
hour: "2-digit",
|
|
106
|
+
minute: "2-digit",
|
|
107
|
+
...t < 6e4 ? { second: "2-digit" } : {},
|
|
108
|
+
hourCycle: "h23"
|
|
109
|
+
}).format(e);
|
|
110
|
+
}, b = (e, t = {
|
|
111
|
+
days: "{count}d",
|
|
112
|
+
hours: "{count}h"
|
|
113
|
+
}) => {
|
|
114
|
+
let n = Math.max(0, Math.floor(e / 1e3)), r = (e) => String(e).padStart(2, "0");
|
|
115
|
+
if (n >= 86400) {
|
|
116
|
+
let e = String(Math.floor(n / 86400)), i = r(Math.floor(n % 86400 / 3600));
|
|
117
|
+
return `${t.days.replace("{count}", e)} ${t.hours.replace("{count}", i)}`;
|
|
118
|
+
}
|
|
119
|
+
return n >= 3600 ? `${r(Math.floor(n / 3600))}:${r(Math.floor(n % 3600 / 60))}:${r(n % 60)}` : `${r(Math.floor(n / 60))}:${r(n % 60)}`;
|
|
120
|
+
}, x = (e, t) => {
|
|
121
|
+
let n = [];
|
|
122
|
+
for (let r = Math.max(1, t - 64); r < t; r++) {
|
|
123
|
+
let t = e[r] - e[r - 1];
|
|
124
|
+
t > 0 && Number.isFinite(t) && n.push(t);
|
|
125
|
+
}
|
|
126
|
+
return n.length ? (n.sort((e, t) => e - t), n[Math.floor(n.length * .25)]) : a;
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { a as DAY, i as HOUR, r as MINUTE, g as boundaryWeight, p as dateFormat, s as detectPrecision, b as formatCountdown, y as formatCrosshairTime, d as formatFixed, u as formatPercent, l as formatVolume, x as inferTimeframe, m as offsetAt, v as pickTicks, c as priceFormatter, h as shiftTime, _ as tickText };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":["sharedNumberFormat","numberFormat$1","MINUTE","HOUR","DAY","numberFormat","resolveLocale","locale","options","detectPrecision","decimals","start","to","from","i","v","values","scaled","priceFormatter","p","precision","format","value","formatVolume","abs","unit","suffix","compactUnits","formatPercent","text","formatFixed","dateFormats","dateFormat","key","full","offsetAt","utcOffset","time","shiftTime","boundaryWeight","prev","a","b","steps","weight","tickText","intraday","pickTicks","order","candidates","kept","result","c","lo","hi","mid","left","right","minGap","formatCrosshairTime","date","timeframeMs","shifted","formatCountdown","s","ms","pad","days","hours","units","inferTimeframe","gaps","n","d"],"sources":["../../../../../charts/src/engine/trading/format.ts"],"sourcesContent":["// Formatting of prices, volumes and times, and the labels of the time axis.\n// `locale` is resolved by the caller (`resolveLocale`) on hot paths.\n\nimport {\n compactUnits,\n numberFormat as sharedNumberFormat,\n resolveLocale,\n} from \"../locale\";\n\nexport const MINUTE = 60_000;\nexport const HOUR = 3_600_000;\nexport const DAY = 86_400_000;\n\nconst numberFormat = (\n locale: string | undefined,\n options: Intl.NumberFormatOptions,\n): Intl.NumberFormat => sharedNumberFormat(resolveLocale(locale), options);\n\n/** Decimals needed by the prices (0-8), detected from a sample of them */\nexport const detectPrecision = (\n values: ArrayLike<number>,\n from: number,\n to: number,\n): number => {\n let decimals = 0;\n const start = Math.max(0, to - 300, from);\n for (let i = start; i < to; i++) {\n const v = Math.abs(values[i]);\n if (!Number.isFinite(v)) continue;\n while (decimals < 8) {\n const scaled = v * 10 ** decimals;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-8 * Math.max(1, scaled))\n break;\n decimals++;\n }\n }\n return decimals;\n};\n\n/** Price formatter: fixed decimals, grouped digits of `locale` */\nexport const priceFormatter = (\n precision: number,\n locale: string | undefined,\n): ((value: number) => string) => {\n const p = Math.max(0, Math.min(12, Math.round(precision)));\n const format = numberFormat(locale, {\n minimumFractionDigits: p,\n maximumFractionDigits: p,\n });\n return (value) => (Number.isFinite(value) ? format.format(value) : \"–\");\n};\n\n/** `12345678` -> `12.35M` (`1234.57万` in Chinese and Japanese) */\nexport const formatVolume = (value: number, locale?: string): string => {\n if (!Number.isFinite(value)) return \"–\";\n const format = numberFormat(locale, { maximumFractionDigits: 2 });\n const abs = Math.abs(value);\n for (const [unit, suffix] of compactUnits(locale)) {\n // 999,999 shows as 1M, not 1,000k\n if (abs >= unit * 0.999995)\n return `${format.format(value / unit)}${suffix}`;\n }\n return format.format(value);\n};\n\n/** `+1.25%` */\nexport const formatPercent = (\n value: number,\n locale?: string,\n decimals = 2,\n): string => {\n if (!Number.isFinite(value)) return \"–\";\n const text = numberFormat(locale, {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(Math.abs(value));\n const zero = Math.abs(value) < 0.5 * 10 ** -decimals;\n return `${zero ? \"\" : value > 0 ? \"+\" : \"−\"}${text}%`;\n};\n\n/** Any value with `decimals` decimals (indicator panes) */\nexport const formatFixed = (\n value: number,\n decimals: number,\n locale?: string,\n): string =>\n Number.isFinite(value)\n ? numberFormat(locale, {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(value)\n : \"–\";\n\n// ------------------------------------------------------------------ times\n\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/** Formats shifted times with the UTC getters (the offset is applied before) */\nexport const dateFormat = (\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat => {\n const key = `${locale ?? \"\"}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n const full = { ...options, timeZone: \"UTC\" };\n try {\n format = new Intl.DateTimeFormat(resolveLocale(locale), full);\n } catch {\n format = new Intl.DateTimeFormat(\"en\", full);\n }\n dateFormats.set(key, format);\n }\n return format;\n};\n\n/** Offset of the displayed time from UTC, in minutes, at `time` */\nexport const offsetAt = (time: number, utcOffset: number | undefined) =>\n utcOffset ?? -new Date(Number.isFinite(time) ? time : 0).getTimezoneOffset();\n\n/** Time shifted so that the UTC getters read the displayed time */\nexport const shiftTime = (time: number, utcOffset: number | undefined) =>\n time + offsetAt(time, utcOffset) * MINUTE;\n\n/**\n * Weight of the boundary between two consecutive (shifted) bar times: the\n * largest calendar unit that changes (year 70, month 60, day 50, hours\n * 43-46, minutes 31-34, seconds 21-24, 10 otherwise)\n */\nexport const boundaryWeight = (prev: number, time: number): number => {\n if (!Number.isFinite(prev)) return 70;\n const a = new Date(prev);\n const b = new Date(time);\n if (a.getUTCFullYear() !== b.getUTCFullYear()) return 70;\n if (a.getUTCMonth() !== b.getUTCMonth()) return 60;\n if (a.getUTCDate() !== b.getUTCDate()) return 50;\n const steps: readonly [number, number][] = [\n [12 * HOUR, 46],\n [6 * HOUR, 45],\n [3 * HOUR, 44],\n [HOUR, 43],\n [30 * MINUTE, 34],\n [15 * MINUTE, 33],\n [5 * MINUTE, 32],\n [MINUTE, 31],\n [30_000, 24],\n [15_000, 23],\n [5_000, 22],\n [1_000, 21],\n ];\n for (const [unit, weight] of steps) {\n if (Math.floor(prev / unit) !== Math.floor(time / unit)) return weight;\n }\n return 10;\n};\n\n/** A label of the time axis */\nexport interface TimeTick {\n /** x in CSS pixels */\n x: number;\n text: string;\n /** Larger unit (new day of an intraday chart, new month / year) */\n bold: boolean;\n}\n\n/** Text of a tick of weight `weight` at the shifted time `time` */\nexport const tickText = (\n time: number,\n weight: number,\n locale: string | undefined,\n intraday: boolean,\n): string => {\n if (weight >= 70) return dateFormat(locale, { year: \"numeric\" }).format(time);\n if (weight >= 60) return dateFormat(locale, { month: \"short\" }).format(time);\n if (weight >= 50) {\n return intraday\n ? dateFormat(locale, { month: \"short\", day: \"numeric\" }).format(time)\n : dateFormat(locale, { day: \"numeric\" }).format(time);\n }\n if (weight >= 30)\n return dateFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hourCycle: \"h23\",\n }).format(time);\n return dateFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hourCycle: \"h23\",\n }).format(time);\n};\n\n/**\n * Picks the time labels: candidates by decreasing weight, each kept when\n * no kept label is closer than `minGap` pixels\n */\nexport const pickTicks = (\n candidates: readonly { x: number; weight: number; time: number }[],\n minGap: number,\n): { x: number; weight: number; time: number }[] => {\n const order = candidates\n .map((_, i) => i)\n .sort((a, b) => candidates[b].weight - candidates[a].weight || a - b);\n const kept: number[] = [];\n const result: { x: number; weight: number; time: number }[] = [];\n for (const i of order) {\n const c = candidates[i];\n // binary search of the kept x positions\n let lo = 0;\n let hi = kept.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (kept[mid] < c.x) lo = mid + 1;\n else hi = mid;\n }\n const left = lo > 0 ? kept[lo - 1] : -Infinity;\n const right = lo < kept.length ? kept[lo] : Infinity;\n if (c.x - left < minGap || right - c.x < minGap) continue;\n kept.splice(lo, 0, c.x);\n result.push(c);\n }\n return result.sort((a, b) => a.x - b.x);\n};\n\n/** Full time of the crosshair label (`Tue 12 Mar '24 14:35`) */\nexport const formatCrosshairTime = (\n shifted: number,\n timeframeMs: number,\n locale: string | undefined,\n): string => {\n const date: Intl.DateTimeFormatOptions = {\n weekday: \"short\",\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n };\n if (timeframeMs >= DAY) return dateFormat(locale, date).format(shifted);\n return dateFormat(locale, {\n ...date,\n hour: \"2-digit\",\n minute: \"2-digit\",\n ...(timeframeMs < MINUTE ? { second: \"2-digit\" } : {}),\n hourCycle: \"h23\",\n }).format(shifted);\n};\n\n/**\n * Time left before a bar closes: `42`, `04:59`, `03:04:59`, `2d 04h` (the\n * day and hour templates replace `{count}`)\n */\nexport const formatCountdown = (\n ms: number,\n units: { days: string; hours: string } = {\n days: \"{count}d\",\n hours: \"{count}h\",\n },\n): string => {\n const s = Math.max(0, Math.floor(ms / 1000));\n const pad = (v: number) => String(v).padStart(2, \"0\");\n if (s >= 86_400) {\n const days = String(Math.floor(s / 86_400));\n const hours = pad(Math.floor((s % 86_400) / 3600));\n return `${units.days.replace(\"{count}\", days)} ${units.hours.replace(\"{count}\", hours)}`;\n }\n if (s >= 3600)\n return `${pad(Math.floor(s / 3600))}:${pad(Math.floor((s % 3600) / 60))}:${pad(s % 60)}`;\n return `${pad(Math.floor(s / 60))}:${pad(s % 60)}`;\n};\n\n/** Typical duration between bars: the median of the last gaps */\nexport const inferTimeframe = (time: ArrayLike<number>, n: number): number => {\n const gaps: number[] = [];\n for (let i = Math.max(1, n - 64); i < n; i++) {\n const d = time[i] - time[i - 1];\n if (d > 0 && Number.isFinite(d)) gaps.push(d);\n }\n if (!gaps.length) return DAY;\n gaps.sort((a, b) => a - b);\n // the smallest frequent gap: weekends and nights make larger ones\n return gaps[Math.floor(gaps.length * 0.25)];\n};\n"],"mappings":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K,MAAMH,IAAI,KAAM,CAAC,GACpCI,IAAQF,EAAI,KAAK,MAAOF,IAAI,QAAU,IAAI,CAAC;EACjD,OAAO,GAAGK,EAAM,KAAK,QAAQ,WAAWF,CAAI,EAAE,GAAGE,EAAM,MAAM,QAAQ,WAAWD,CAAK;CACvF;CAGA,OAFIJ,KAAK,OACA,GAAGE,EAAI,KAAK,MAAMF,IAAI,IAAI,CAAC,EAAE,GAAGE,EAAI,KAAK,MAAOF,IAAI,OAAQ,EAAE,CAAC,EAAE,GAAGE,EAAIF,IAAI,EAAE,MAChF,GAAGE,EAAI,KAAK,MAAMF,IAAI,EAAE,CAAC,EAAE,GAAGE,EAAIF,IAAI,EAAE;AACjD,GAGaM,KAAkB,GAAyB,MAAsB;CAC5E,IAAMC,IAAiB,CAAC;CACxB,KAAK,IAAIzD,IAAI,KAAK,IAAI,GAAG0D,IAAI,EAAE,GAAG1D,IAAI0D,GAAG,KAAK;EAC5C,IAAMC,IAAIpC,EAAKvB,KAAKuB,EAAKvB,IAAI;EAC7B,AAAI2D,IAAI,KAAK,OAAO,SAASA,CAAC,KAAGF,EAAK,KAAKE,CAAC;CAC9C;CAIA,OAHKF,EAAK,UACVA,EAAK,MAAM,GAAG,MAAM9B,IAAIC,CAAC,GAElB6B,EAAK,KAAK,MAAMA,EAAK,SAAS,GAAI,MAHhBnE;AAI3B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../renderers/types.cjs");var t=class{constructor(){this.f=new Float32Array(256),this.u=new Uint32Array(this.f.buffer),this.count=0}push(e,t,n,r){if((this.count+1)*4>this.f.length){let e=new Float32Array(this.f.length*2);e.set(this.f),this.f=e,this.u=new Uint32Array(e.buffer)}let i=this.count*4;this.f[i]=e,this.f[i+1]=t,this.f[i+2]=n,this.u[i+3]=r,this.count++}item(e,t,n,r=0,i=0){return{kind:`bar`,key:e,version:t,color:[1,1,1,1],instances:this.f.buffer.slice(0,this.count*16),count:this.count,halfWidth:n,radius:i,inset:0,minHalf:r,sorted:!1}}},n=class{constructor(e,t){this.top=e,this.bottom=t,this.p=new Float32Array(512),this.count=0,this.px=NaN,this.py=NaN,this.open=!1}write(e,t){if((this.count+1)*2>this.p.length){let e=new Float32Array(this.p.length*2);e.set(this.p),this.p=e}this.p[this.count*2]=e,this.p[this.count*2+1]=t,this.count++}gap(){this.count&&this.p[this.count*2-1]<1e37&&this.write(e.GAP,e.GAP)}break(){this.open&&this.gap(),this.open=!1,this.px=this.py=NaN}push(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)){this.break();return}let{top:n,bottom:r}=this;if(!Number.isFinite(this.px)){t>=n&&t<=r&&(this.gap(),this.write(e,t),this.open=!0),this.px=e,this.py=t;return}let i=this.px,a=this.py;this.px=e,this.py=t;let o=0,s=1,c=t-a;if(c===0)(a<n||a>r)&&(o=2);else{let e=(n-a)/c,t=(r-a)/c;o=Math.max(o,Math.min(e,t)),s=Math.min(s,Math.max(e,t))}if(o>s){this.open&&this.gap(),this.open=!1;return}(!this.open||o>0)&&(this.gap(),this.write(i+(e-i)*o,a+c*o)),this.write(i+(e-i)*s,a+c*s),this.open=s>=1,this.open||this.gap()}item(e,t,n,r){return{kind:`line`,key:e,version:t,color:n,points:this.p.slice(0,this.count*2),count:this.count,width:r,sorted:!1}}},r=class{constructor(e,t){this.top=e,this.bottom=t,this.p=new Float32Array(768),this.count=0}push(t,n,r){if((this.count+1)*3>this.p.length){let e=new Float32Array(this.p.length*2);e.set(this.p),this.p=e}let i=this.count*3,a=Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(r),o=e=>Math.min(this.bottom,Math.max(this.top,e));this.p[i]=a?t:e.GAP,this.p[i+1]=a?o(n):e.GAP,this.p[i+2]=a?o(r):e.GAP,this.count++}item(e,t,n,r){return{kind:`area`,key:e,version:t,color:n,points:this.p.slice(0,this.count*3),count:this.count,opacity:r,sorted:!1}}},i=(e,t)=>{let n=Math.max(1,Math.round(t)),r=Math.round(e*.72);r>e-1&&(r=Math.floor(e-1)),r<n&&(r=n),(r-n)%2&&--r;let i=n%2==1;return{wick:n,body:r,snap:e=>i?Math.floor(e)+.5:Math.round(e)}},a=(e,t,n,r)=>{let i=Math.min(e,t),a=Math.max(e,t);return!Number.isFinite(i)||!Number.isFinite(a)||a<n||i>r?null:(i=Math.max(n,i),a=Math.min(r,a),[i,a])},o=(e,t,n=1)=>{let r=Math.round(Math.min(e,t)),i=Math.round(Math.max(e,t));return i-r<n&&(i=r+n),[r,i]};exports.AreaBuffer=r,exports.BarBuffer=t,exports.LineBuffer=n,exports.candleMetrics=i,exports.clampRange=a,exports.pixelRange=o;
|
|
2
|
+
//# sourceMappingURL=geometry.cjs.map
|