@primeui/chart-core 0.0.1-alpha.1
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/LICENSE +23 -0
- package/README.md +1 -0
- package/dist/animations/index.d.mts +136 -0
- package/dist/animations/index.mjs +18 -0
- package/dist/annotation.utils-Bm0lOO1o.d.mts +290 -0
- package/dist/borderRadius.utils-Cz73LLR_.d.mts +54 -0
- package/dist/canvas-D4vigq47.d.mts +34 -0
- package/dist/canvas.utils-D2WHi2gL.d.mts +167 -0
- package/dist/cartesian/index.d.mts +94 -0
- package/dist/cartesian/index.mjs +93 -0
- package/dist/chunk-22ST6YPP.mjs +304 -0
- package/dist/chunk-2QK2KOBN.mjs +10 -0
- package/dist/chunk-2QRS4YQ5.mjs +18 -0
- package/dist/chunk-3FFJEX4A.mjs +261 -0
- package/dist/chunk-3IYSJ2U7.mjs +567 -0
- package/dist/chunk-3OZLP4I4.mjs +190 -0
- package/dist/chunk-3WEMHXZI.mjs +198 -0
- package/dist/chunk-3Z62EUJN.mjs +138 -0
- package/dist/chunk-4C6EVJ54.mjs +362 -0
- package/dist/chunk-53HW45JB.mjs +102 -0
- package/dist/chunk-55Y3WI6S.mjs +186 -0
- package/dist/chunk-5JCI2DEB.mjs +97 -0
- package/dist/chunk-66T4MRC5.mjs +113 -0
- package/dist/chunk-6HSEJLSR.mjs +376 -0
- package/dist/chunk-6STOLMCA.mjs +187 -0
- package/dist/chunk-7CMVDIOU.mjs +54 -0
- package/dist/chunk-7QQ6ETB4.mjs +228 -0
- package/dist/chunk-A6ZQZFL2.mjs +272 -0
- package/dist/chunk-ADKLH73T.mjs +1 -0
- package/dist/chunk-AGU3NG6D.mjs +22 -0
- package/dist/chunk-AHYIS6EB.mjs +230 -0
- package/dist/chunk-AP3UYWYT.mjs +4 -0
- package/dist/chunk-ARB5T6MP.mjs +326 -0
- package/dist/chunk-ARRGOEFX.mjs +585 -0
- package/dist/chunk-AUF4CHDP.mjs +422 -0
- package/dist/chunk-B4FTADAZ.mjs +561 -0
- package/dist/chunk-BABQKA6K.mjs +339 -0
- package/dist/chunk-BETFQBM2.mjs +197 -0
- package/dist/chunk-BKP26M4K.mjs +413 -0
- package/dist/chunk-BZN2QHGP.mjs +200 -0
- package/dist/chunk-C36VWQ7A.mjs +86 -0
- package/dist/chunk-CHW4RKY3.mjs +16 -0
- package/dist/chunk-CINXJIRR.mjs +120 -0
- package/dist/chunk-DN6AXQYZ.mjs +667 -0
- package/dist/chunk-DP2IZNN3.mjs +92 -0
- package/dist/chunk-DTWTCFRG.mjs +119 -0
- package/dist/chunk-EAMUNLRU.mjs +172 -0
- package/dist/chunk-EDAKJLNA.mjs +17 -0
- package/dist/chunk-ERVQB2VZ.mjs +59 -0
- package/dist/chunk-FFMT6OCO.mjs +92 -0
- package/dist/chunk-FHTC2YDB.mjs +102 -0
- package/dist/chunk-FRST55HY.mjs +16 -0
- package/dist/chunk-HDFGCN2F.mjs +132 -0
- package/dist/chunk-IEGLX7VL.mjs +42 -0
- package/dist/chunk-ILUWFYGY.mjs +220 -0
- package/dist/chunk-IXOWSEHO.mjs +114 -0
- package/dist/chunk-J4RI2C2G.mjs +172 -0
- package/dist/chunk-J65DBT4R.mjs +13 -0
- package/dist/chunk-JGOVWSKH.mjs +179 -0
- package/dist/chunk-JO7VACY2.mjs +25 -0
- package/dist/chunk-JWFBOPM6.mjs +122 -0
- package/dist/chunk-KNDZP446.mjs +895 -0
- package/dist/chunk-KP2TWD4Z.mjs +90 -0
- package/dist/chunk-KQIFO5I3.mjs +225 -0
- package/dist/chunk-KVDEROP6.mjs +59 -0
- package/dist/chunk-LKC7MZKK.mjs +87 -0
- package/dist/chunk-LVMDQ4OJ.mjs +305 -0
- package/dist/chunk-M7B3JF43.mjs +90 -0
- package/dist/chunk-MTGMXRNF.mjs +136 -0
- package/dist/chunk-N3TIT3OH.mjs +1040 -0
- package/dist/chunk-NHRK5KU2.mjs +890 -0
- package/dist/chunk-NKUYIWAP.mjs +243 -0
- package/dist/chunk-NPDZLYIF.mjs +238 -0
- package/dist/chunk-O2X6FF45.mjs +499 -0
- package/dist/chunk-OGJ6IIBW.mjs +176 -0
- package/dist/chunk-OHGCZZPZ.mjs +403 -0
- package/dist/chunk-OWW3K55O.mjs +351 -0
- package/dist/chunk-OXTFAWSK.mjs +60 -0
- package/dist/chunk-PLSDU3C2.mjs +890 -0
- package/dist/chunk-PRDVPOZX.mjs +223 -0
- package/dist/chunk-Q6PPVIHU.mjs +21 -0
- package/dist/chunk-QQBXUDM4.mjs +885 -0
- package/dist/chunk-QS76E3TD.mjs +111 -0
- package/dist/chunk-QWQ6HY4I.mjs +209 -0
- package/dist/chunk-R6Y3R7EW.mjs +135 -0
- package/dist/chunk-RBLZRT5K.mjs +190 -0
- package/dist/chunk-RO4N6YFS.mjs +167 -0
- package/dist/chunk-RQ3CKQOX.mjs +984 -0
- package/dist/chunk-SALTGZFR.mjs +208 -0
- package/dist/chunk-SANZPAJ4.mjs +14 -0
- package/dist/chunk-SDBPQ5CF.mjs +624 -0
- package/dist/chunk-SSLTFJ3U.mjs +364 -0
- package/dist/chunk-SXHVDJGF.mjs +77 -0
- package/dist/chunk-TA4MVAEX.mjs +243 -0
- package/dist/chunk-TAHCOZHF.mjs +1772 -0
- package/dist/chunk-TQ6S34QZ.mjs +152 -0
- package/dist/chunk-UPRXABX5.mjs +90 -0
- package/dist/chunk-VGLSBZDN.mjs +71 -0
- package/dist/chunk-VN7CKCSE.mjs +364 -0
- package/dist/chunk-VVI3OBPJ.mjs +524 -0
- package/dist/chunk-VWF57TS3.mjs +62 -0
- package/dist/chunk-WA3OVISZ.mjs +179 -0
- package/dist/chunk-WCG35U6M.mjs +964 -0
- package/dist/chunk-WFTX4AQJ.mjs +194 -0
- package/dist/chunk-WFVOQ2QZ.mjs +18 -0
- package/dist/chunk-WH3C3Y7P.mjs +149 -0
- package/dist/chunk-WPFUV7K3.mjs +488 -0
- package/dist/chunk-WRULPWHD.mjs +492 -0
- package/dist/chunk-WS64BZXT.mjs +1 -0
- package/dist/chunk-WY4AURRE.mjs +2419 -0
- package/dist/chunk-WYLILAOO.mjs +167 -0
- package/dist/chunk-X4D7FKUS.mjs +62 -0
- package/dist/chunk-X7T34OLW.mjs +139 -0
- package/dist/chunk-XIHBK5D3.mjs +68 -0
- package/dist/chunk-XQQCGFYB.mjs +50 -0
- package/dist/chunk-XTVE4P3L.mjs +214 -0
- package/dist/chunk-XUAASRXW.mjs +579 -0
- package/dist/chunk-Y3L3D4GQ.mjs +685 -0
- package/dist/chunk-YBJ56XJS.mjs +132 -0
- package/dist/chunk-ZQFK6CAE.mjs +1 -0
- package/dist/chunk-ZT2Z7ERM.mjs +874 -0
- package/dist/chunk-ZTL2FQEW.mjs +714 -0
- package/dist/circular/arc/index.d.mts +8 -0
- package/dist/circular/arc/index.mjs +3 -0
- package/dist/circular/index.d.mts +44 -0
- package/dist/circular/index.mjs +13 -0
- package/dist/collect.utils-DiKB4ciO.d.mts +12 -0
- package/dist/computeChartState-BTVIqwyO.d.mts +304 -0
- package/dist/controller-BJE1AZ3q.d.mts +82 -0
- package/dist/controller-BoNigQJr.d.mts +63 -0
- package/dist/controllers/index.d.mts +16 -0
- package/dist/controllers/index.mjs +110 -0
- package/dist/datalabel.utils-CkjGeB8S.d.mts +122 -0
- package/dist/decimation.utils-CcvJVhI4.d.mts +244 -0
- package/dist/geometry-DUUQJXVM.d.mts +60 -0
- package/dist/index-DseIZa1j.d.mts +167 -0
- package/dist/index.d.mts +88 -0
- package/dist/index.mjs +110 -0
- package/dist/orchestrator/index.d.mts +264 -0
- package/dist/orchestrator/index.mjs +33 -0
- package/dist/plugins/index.d.mts +18 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/property-animations-D433wXzz.d.mts +580 -0
- package/dist/property-store-NORUWFND.d.mts +17 -0
- package/dist/radial/index.d.mts +14 -0
- package/dist/radial/index.mjs +37 -0
- package/dist/renderers/axis/index.d.mts +39 -0
- package/dist/renderers/axis/index.mjs +8 -0
- package/dist/renderers/circular/index.d.mts +13 -0
- package/dist/renderers/circular/index.mjs +13 -0
- package/dist/renderers/index.d.mts +83 -0
- package/dist/renderers/index.mjs +75 -0
- package/dist/renderers/navigator/index.d.mts +103 -0
- package/dist/renderers/navigator/index.mjs +8 -0
- package/dist/resize.utils-D_2qm6rv.d.mts +142 -0
- package/dist/ring.utils-DXvrxMkU.d.mts +138 -0
- package/dist/scale-KFv30jqZ.d.mts +307 -0
- package/dist/scales-Drf8AIhL.d.mts +75 -0
- package/dist/series/bar/canvas/index.d.mts +8 -0
- package/dist/series/bar/canvas/index.mjs +10 -0
- package/dist/series/bar/controller/index.d.mts +105 -0
- package/dist/series/bar/controller/index.mjs +44 -0
- package/dist/series/bar/controller-canvas/index.d.mts +7 -0
- package/dist/series/bar/controller-canvas/index.mjs +49 -0
- package/dist/series/bar/controller-svg/index.d.mts +7 -0
- package/dist/series/bar/controller-svg/index.mjs +49 -0
- package/dist/series/bar/index.d.mts +60 -0
- package/dist/series/bar/index.mjs +13 -0
- package/dist/series/bar/svg/index.d.mts +8 -0
- package/dist/series/bar/svg/index.mjs +11 -0
- package/dist/series/candlestick/canvas/index.d.mts +8 -0
- package/dist/series/candlestick/canvas/index.mjs +8 -0
- package/dist/series/candlestick/controller/index.d.mts +123 -0
- package/dist/series/candlestick/controller/index.mjs +40 -0
- package/dist/series/candlestick/controller-canvas/index.d.mts +7 -0
- package/dist/series/candlestick/controller-canvas/index.mjs +45 -0
- package/dist/series/candlestick/controller-svg/index.d.mts +7 -0
- package/dist/series/candlestick/controller-svg/index.mjs +45 -0
- package/dist/series/candlestick/index.d.mts +11 -0
- package/dist/series/candlestick/index.mjs +10 -0
- package/dist/series/candlestick/svg/index.d.mts +8 -0
- package/dist/series/candlestick/svg/index.mjs +8 -0
- package/dist/series/heatmap/canvas/index.d.mts +16 -0
- package/dist/series/heatmap/canvas/index.mjs +9 -0
- package/dist/series/heatmap/controller/index.d.mts +110 -0
- package/dist/series/heatmap/controller/index.mjs +23 -0
- package/dist/series/heatmap/controller-canvas/index.d.mts +7 -0
- package/dist/series/heatmap/controller-canvas/index.mjs +28 -0
- package/dist/series/heatmap/controller-svg/index.d.mts +7 -0
- package/dist/series/heatmap/controller-svg/index.mjs +28 -0
- package/dist/series/heatmap/index.d.mts +34 -0
- package/dist/series/heatmap/index.mjs +13 -0
- package/dist/series/heatmap/svg/index.d.mts +15 -0
- package/dist/series/heatmap/svg/index.mjs +10 -0
- package/dist/series/line/canvas/index.d.mts +6 -0
- package/dist/series/line/canvas/index.mjs +9 -0
- package/dist/series/line/controller/index.d.mts +111 -0
- package/dist/series/line/controller/index.mjs +47 -0
- package/dist/series/line/controller-canvas/index.d.mts +7 -0
- package/dist/series/line/controller-canvas/index.mjs +54 -0
- package/dist/series/line/controller-svg/index.d.mts +7 -0
- package/dist/series/line/controller-svg/index.mjs +54 -0
- package/dist/series/line/index.d.mts +49 -0
- package/dist/series/line/index.mjs +13 -0
- package/dist/series/line/svg/index.d.mts +6 -0
- package/dist/series/line/svg/index.mjs +9 -0
- package/dist/series/pie/canvas/index.d.mts +8 -0
- package/dist/series/pie/canvas/index.mjs +10 -0
- package/dist/series/pie/controller/index.d.mts +174 -0
- package/dist/series/pie/controller/index.mjs +110 -0
- package/dist/series/pie/controller-canvas/index.d.mts +8 -0
- package/dist/series/pie/controller-canvas/index.mjs +119 -0
- package/dist/series/pie/controller-svg/index.d.mts +8 -0
- package/dist/series/pie/controller-svg/index.mjs +118 -0
- package/dist/series/pie/index.d.mts +59 -0
- package/dist/series/pie/index.mjs +15 -0
- package/dist/series/pie/svg/index.d.mts +6 -0
- package/dist/series/pie/svg/index.mjs +11 -0
- package/dist/series/polar/canvas/index.d.mts +6 -0
- package/dist/series/polar/canvas/index.mjs +7 -0
- package/dist/series/polar/controller/index.d.mts +102 -0
- package/dist/series/polar/controller/index.mjs +46 -0
- package/dist/series/polar/controller-canvas/index.d.mts +8 -0
- package/dist/series/polar/controller-canvas/index.mjs +52 -0
- package/dist/series/polar/controller-svg/index.d.mts +8 -0
- package/dist/series/polar/controller-svg/index.mjs +52 -0
- package/dist/series/polar/index.d.mts +25 -0
- package/dist/series/polar/index.mjs +16 -0
- package/dist/series/polar/svg/index.d.mts +10 -0
- package/dist/series/polar/svg/index.mjs +8 -0
- package/dist/series/radar/canvas/index.d.mts +6 -0
- package/dist/series/radar/canvas/index.mjs +8 -0
- package/dist/series/radar/controller/index.d.mts +121 -0
- package/dist/series/radar/controller/index.mjs +43 -0
- package/dist/series/radar/controller-canvas/index.d.mts +8 -0
- package/dist/series/radar/controller-canvas/index.mjs +51 -0
- package/dist/series/radar/controller-svg/index.d.mts +8 -0
- package/dist/series/radar/controller-svg/index.mjs +51 -0
- package/dist/series/radar/index.d.mts +40 -0
- package/dist/series/radar/index.mjs +13 -0
- package/dist/series/radar/svg/index.d.mts +12 -0
- package/dist/series/radar/svg/index.mjs +9 -0
- package/dist/series/scatter/canvas/index.d.mts +8 -0
- package/dist/series/scatter/canvas/index.mjs +11 -0
- package/dist/series/scatter/controller/index.d.mts +124 -0
- package/dist/series/scatter/controller/index.mjs +44 -0
- package/dist/series/scatter/controller-canvas/index.d.mts +7 -0
- package/dist/series/scatter/controller-canvas/index.mjs +51 -0
- package/dist/series/scatter/controller-svg/index.d.mts +7 -0
- package/dist/series/scatter/controller-svg/index.mjs +51 -0
- package/dist/series/scatter/index.d.mts +25 -0
- package/dist/series/scatter/index.mjs +14 -0
- package/dist/series/scatter/svg/index.d.mts +8 -0
- package/dist/series/scatter/svg/index.mjs +12 -0
- package/dist/series/treemap/canvas/index.d.mts +50 -0
- package/dist/series/treemap/canvas/index.mjs +10 -0
- package/dist/series/treemap/controller/index.d.mts +130 -0
- package/dist/series/treemap/controller/index.mjs +20 -0
- package/dist/series/treemap/controller-canvas/index.d.mts +7 -0
- package/dist/series/treemap/controller-canvas/index.mjs +25 -0
- package/dist/series/treemap/controller-svg/index.d.mts +7 -0
- package/dist/series/treemap/controller-svg/index.mjs +25 -0
- package/dist/series/treemap/index.d.mts +15 -0
- package/dist/series/treemap/index.mjs +12 -0
- package/dist/series/treemap/svg/index.d.mts +15 -0
- package/dist/series/treemap/svg/index.mjs +9 -0
- package/dist/slices-DtewiwJx.d.mts +72 -0
- package/dist/spatialIndex.utils-B_GJkotZ.d.mts +5 -0
- package/dist/squarify.utils-B9CQBpa1.d.mts +50 -0
- package/dist/stacking-CChuAcLN.d.mts +319 -0
- package/dist/streaming.utils-DH-g1gNP.d.mts +49 -0
- package/dist/sync/index.d.mts +130 -0
- package/dist/sync/index.mjs +5 -0
- package/dist/tooltip.renderer-D5wpSlBa.d.mts +210 -0
- package/dist/utils/color/index.d.mts +58 -0
- package/dist/utils/color/index.mjs +4 -0
- package/dist/utils/data/index.d.mts +180 -0
- package/dist/utils/data/index.mjs +7 -0
- package/dist/utils/export/index.d.mts +14 -0
- package/dist/utils/export/index.mjs +6 -0
- package/dist/utils/index.d.mts +49 -0
- package/dist/utils/index.mjs +29 -0
- package/dist/utils/interaction/index.d.mts +255 -0
- package/dist/utils/interaction/index.mjs +9 -0
- package/dist/utils/layout/index.d.mts +3 -0
- package/dist/utils/layout/index.mjs +10 -0
- package/dist/utils/math/index.d.mts +162 -0
- package/dist/utils/math/index.mjs +1 -0
- package/dist/utils/render/index.d.mts +19 -0
- package/dist/utils/render/index.mjs +3 -0
- package/dist/utils/specialized/index.d.mts +37 -0
- package/dist/utils/specialized/index.mjs +66 -0
- package/dist/utils/text/index.d.mts +39 -0
- package/dist/utils/text/index.mjs +8 -0
- package/dist/utils/theme/index.d.mts +295 -0
- package/dist/utils/theme/index.mjs +5 -0
- package/dist/utils/zoom/index.d.mts +90 -0
- package/dist/utils/zoom/index.mjs +3 -0
- package/package.json +56 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { TextMeasurer, BoxArea, TitleRenderConfig, SvgNode, DataLabelConfig, GlobalFont } from '@primeui/chart-types';
|
|
2
|
+
|
|
3
|
+
/** Average character width as a fraction of font size (bold proportional ~0.65) */
|
|
4
|
+
declare const CHAR_WIDTH_RATIO = 0.65;
|
|
5
|
+
type TextAnchor = 'start' | 'middle' | 'end';
|
|
6
|
+
/** Get X position for title based on alignment */
|
|
7
|
+
declare function getTitleX(titleArea: BoxArea, align: 'left' | 'center' | 'right'): number;
|
|
8
|
+
/** Get Y position for title (vertically centered) */
|
|
9
|
+
declare function getTitleY(titleArea: BoxArea): number;
|
|
10
|
+
/** Convert alignment to SVG text-anchor value */
|
|
11
|
+
declare function getTitleAnchor(align: 'left' | 'center' | 'right'): TextAnchor;
|
|
12
|
+
/** Render title on canvas — alphabetic baseline + rounded final Y matches createSvgTitle */
|
|
13
|
+
declare function renderCanvasTitle(ctx: CanvasRenderingContext2D, titleArea: BoxArea | undefined, config: TitleRenderConfig, textColor: string): void;
|
|
14
|
+
/** Create SVG title element */
|
|
15
|
+
declare function createSvgTitle(titleArea: BoxArea | undefined, config: TitleRenderConfig): SvgNode | null;
|
|
16
|
+
/**
|
|
17
|
+
* Override the text measurement implementation.
|
|
18
|
+
* Call this before any chart rendering to inject a custom measurer
|
|
19
|
+
* (e.g., for SSR, Web Workers, or testing with predictable widths).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // SSR: use approximate character-width estimation
|
|
24
|
+
* setTextMeasurer({
|
|
25
|
+
* measureWidth: (text, fontSize) => text.length * fontSize * 0.55
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Testing: predictable widths
|
|
29
|
+
* setTextMeasurer({
|
|
30
|
+
* measureWidth: (text, fontSize) => text.length * fontSize * 0.6
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Reset to default browser measurer
|
|
34
|
+
* setTextMeasurer(null);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare function setTextMeasurer(measurer: TextMeasurer | null): void;
|
|
38
|
+
/**
|
|
39
|
+
* Measures the width of text with the given font.
|
|
40
|
+
* Results are cached with LRU eviction to avoid repeated operations.
|
|
41
|
+
* Uses the active TextMeasurer (browser canvas by default, injectable).
|
|
42
|
+
*/
|
|
43
|
+
declare function measureTextWidth(text: string, fontSize: number, fontWeight?: string, fontFamily?: string): number;
|
|
44
|
+
/**
|
|
45
|
+
* Measures text dimensions including width and approximate height
|
|
46
|
+
*/
|
|
47
|
+
declare function measureText(text: string, fontSize: number, fontFamily?: string): {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Returns the font's em-box ascent and descent relative to the alphabetic baseline.
|
|
53
|
+
* These values match Canvas `fontBoundingBoxAscent` / `fontBoundingBoxDescent`, which
|
|
54
|
+
* are the same offsets Canvas uses when `textBaseline = 'top'` or `'middle'`.
|
|
55
|
+
*
|
|
56
|
+
* Used to compute pixel-exact `dy` offsets for SVG text so it renders at the same
|
|
57
|
+
* position as Canvas text rendered with `textBaseline = 'top'` or `'middle'`.
|
|
58
|
+
*
|
|
59
|
+
* Falls back to font-size ratio estimates if the Canvas API isn't available or
|
|
60
|
+
* `fontBoundingBoxAscent` is unsupported.
|
|
61
|
+
*/
|
|
62
|
+
declare function measureFontMetrics(fontSize: number, fontFamily: string, fontWeight?: string): {
|
|
63
|
+
topToAlpha: number;
|
|
64
|
+
midToAlpha: number;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Wraps text to fit within a maximum width
|
|
68
|
+
* Returns an array of lines
|
|
69
|
+
*
|
|
70
|
+
* Rules:
|
|
71
|
+
* - Only wraps at word boundaries (spaces)
|
|
72
|
+
* - Never breaks individual words, even if they exceed maxWidth
|
|
73
|
+
* - Single words are returned as-is regardless of width
|
|
74
|
+
*/
|
|
75
|
+
declare function wrapText(text: string, maxWidth: number, fontSize: number, fontFamily?: string, fontWeight?: string): string[];
|
|
76
|
+
/**
|
|
77
|
+
* Calculates the total height of wrapped text
|
|
78
|
+
*/
|
|
79
|
+
declare function calculateWrappedTextHeight(lines: string[], fontSize: number, lineHeightMultiplier?: number): number;
|
|
80
|
+
/**
|
|
81
|
+
* Calculates the maximum width among wrapped lines
|
|
82
|
+
*/
|
|
83
|
+
declare function calculateWrappedTextWidth(lines: string[], fontSize: number, fontFamily?: string, fontWeight?: string): number;
|
|
84
|
+
/**
|
|
85
|
+
* Cleanup function for SSR or test environments.
|
|
86
|
+
* Releases the cached canvas context to allow garbage collection.
|
|
87
|
+
*/
|
|
88
|
+
declare function cleanupMeasureContext(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Clears the text width cache.
|
|
91
|
+
* Useful when font loading completes or for testing.
|
|
92
|
+
*/
|
|
93
|
+
declare function clearTextWidthCache(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Format a numeric value compactly for display on chart axes, grids, and labels.
|
|
96
|
+
* When a locale is provided, uses `Intl.NumberFormat` with compact notation
|
|
97
|
+
* for locale-aware suffixes (e.g. "12K" in English, "12.000" in German).
|
|
98
|
+
* Without locale, falls back to manual formatting.
|
|
99
|
+
*/
|
|
100
|
+
declare function formatCompactValue(v: number, locale?: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* Convert SVG text-anchor value to Canvas textAlign.
|
|
103
|
+
* SVG uses 'start' | 'middle' | 'end', Canvas uses 'left' | 'center' | 'right'.
|
|
104
|
+
*/
|
|
105
|
+
declare function svgAnchorToCanvasAlign(anchor: string): CanvasTextAlign;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Normalize data label props to a consistent configuration object.
|
|
109
|
+
* Shared by both Canvas and SVG renderers across all frameworks.
|
|
110
|
+
*
|
|
111
|
+
* Framework wrappers may extend the returned config with framework-specific
|
|
112
|
+
* fields (e.g., React adds `render?: (ctx) => ReactNode`).
|
|
113
|
+
*
|
|
114
|
+
* @param props - Raw data labels props from the DataLabels component
|
|
115
|
+
* @param adaptiveFontSize - Responsive system's adaptive font size (used when user hasn't set explicit fontSize)
|
|
116
|
+
* @param adaptiveRotation - Responsive system's adaptive rotation (used when user hasn't set explicit rotation)
|
|
117
|
+
* @returns Normalized configuration with defaults applied
|
|
118
|
+
*/
|
|
119
|
+
declare function normalizeDataLabelConfig(props: Record<string, unknown> | undefined, adaptiveFontSize?: number, adaptiveRotation?: number, globalFont?: GlobalFont): DataLabelConfig | null;
|
|
120
|
+
declare function formatDataLabelText(value: number, percentage: number, display: DataLabelConfig['display'], formatter?: DataLabelConfig['formatter'], label?: string): string | null;
|
|
121
|
+
|
|
122
|
+
export { CHAR_WIDTH_RATIO as C, formatDataLabelText as a, calculateWrappedTextWidth as b, calculateWrappedTextHeight as c, cleanupMeasureContext as d, clearTextWidthCache as e, formatCompactValue as f, createSvgTitle as g, getTitleAnchor as h, getTitleX as i, getTitleY as j, measureTextWidth as k, svgAnchorToCanvasAlign as l, measureText as m, normalizeDataLabelConfig as n, measureFontMetrics as o, renderCanvasTitle as r, setTextMeasurer as s, wrapText as w };
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { ExportMenuItem, ExportItemAction, ExportMenuProps, DrilldownState, DrilldownTree, DrilldownBreadcrumb, DrilldownNode, ScatterDecimationEntry, ScatterDecimationConfig, ZoomRange, DecimationConfig } from '@primeui/chart-types';
|
|
2
|
+
import { DatasetRegistration } from '@primeui/chart-types/context';
|
|
3
|
+
|
|
4
|
+
declare const EXPORT_MENU_CONSTANTS: {
|
|
5
|
+
/** Button size in pixels */
|
|
6
|
+
readonly BUTTON_SIZE: 36;
|
|
7
|
+
/** Button padding */
|
|
8
|
+
readonly BUTTON_PADDING: 8;
|
|
9
|
+
/** Menu width */
|
|
10
|
+
readonly MENU_WIDTH: 180;
|
|
11
|
+
/** Menu item height */
|
|
12
|
+
readonly MENU_ITEM_HEIGHT: 32;
|
|
13
|
+
/** Separator height */
|
|
14
|
+
readonly SEPARATOR_HEIGHT: 1;
|
|
15
|
+
/** Menu border radius */
|
|
16
|
+
readonly BORDER_RADIUS: 4;
|
|
17
|
+
/** Z-index for menu overlay */
|
|
18
|
+
readonly Z_INDEX: 1000;
|
|
19
|
+
};
|
|
20
|
+
declare const DEFAULT_EXPORT_MENU_ITEMS: ExportMenuItem[];
|
|
21
|
+
declare const DEFAULT_EXPORT_MENU_PROPS: Required<Omit<ExportMenuProps, 'menuItems'>> & {
|
|
22
|
+
menuItems: ExportMenuItem[];
|
|
23
|
+
};
|
|
24
|
+
declare const EXPORT_MENU_LABELS: Record<Exclude<ExportMenuItem, 'separator'>, string>;
|
|
25
|
+
/** SVG path data for hamburger menu icon */
|
|
26
|
+
declare const HAMBURGER_ICON_PATH = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z";
|
|
27
|
+
/**
|
|
28
|
+
* Merge user props with defaults
|
|
29
|
+
*/
|
|
30
|
+
declare function resolveExportMenuProps(props: ExportMenuProps): typeof DEFAULT_EXPORT_MENU_PROPS;
|
|
31
|
+
/**
|
|
32
|
+
* Check if menu item is a separator
|
|
33
|
+
*/
|
|
34
|
+
declare function isExportMenuSeparator(item: ExportMenuItem): item is 'separator';
|
|
35
|
+
/**
|
|
36
|
+
* Filter menu items based on renderer type.
|
|
37
|
+
* All formats work for both renderers — canvas SVG export composites layers
|
|
38
|
+
* into a PNG embedded inside an SVG wrapper (same approach as amCharts).
|
|
39
|
+
* Only cleans up orphaned separators.
|
|
40
|
+
*/
|
|
41
|
+
declare function filterExportMenuItems(items: ExportMenuItem[]): ExportMenuItem[];
|
|
42
|
+
/**
|
|
43
|
+
* Estimate menu height from its item list. The menu has fixed inline styles,
|
|
44
|
+
* so this is deterministic — avoids a DOM measure round-trip.
|
|
45
|
+
*/
|
|
46
|
+
declare function estimateExportMenuHeight(items: ExportMenuItem[]): number;
|
|
47
|
+
interface ExportMenuPlacementInput {
|
|
48
|
+
align: 'left' | 'right';
|
|
49
|
+
verticalAlign: 'top' | 'bottom';
|
|
50
|
+
/** Horizontal offset as configured on the button (can be negative) */
|
|
51
|
+
x: number;
|
|
52
|
+
/** Vertical offset as configured on the button (can be negative) */
|
|
53
|
+
y: number;
|
|
54
|
+
buttonSize: number;
|
|
55
|
+
menuWidth: number;
|
|
56
|
+
menuHeight: number;
|
|
57
|
+
chartWidth: number;
|
|
58
|
+
chartHeight: number;
|
|
59
|
+
/** Space between button and menu. Default 4. */
|
|
60
|
+
gap?: number;
|
|
61
|
+
}
|
|
62
|
+
interface ExportMenuPlacement {
|
|
63
|
+
left?: number;
|
|
64
|
+
right?: number;
|
|
65
|
+
top?: number;
|
|
66
|
+
bottom?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolve menu placement, flipping to the opposite edge when the default
|
|
70
|
+
* position would overflow the chart container. Mirrors Highcharts'
|
|
71
|
+
* algorithm: horizontal flips freely; vertical only flips when the button
|
|
72
|
+
* is not top-aligned (top buttons have no room above to flip into).
|
|
73
|
+
*/
|
|
74
|
+
declare function resolveExportMenuPlacement(input: ExportMenuPlacementInput): ExportMenuPlacement;
|
|
75
|
+
/**
|
|
76
|
+
* Get export action for menu item
|
|
77
|
+
*/
|
|
78
|
+
declare function getExportAction(item: Exclude<ExportMenuItem, 'separator'>): ExportItemAction;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Build a drilldown tree from flat data with id/parent field accessors.
|
|
82
|
+
*
|
|
83
|
+
* Works for any chart type — the tree represents the drill hierarchy,
|
|
84
|
+
* not a specific visual layout.
|
|
85
|
+
*
|
|
86
|
+
* @param data - Flat array of data items
|
|
87
|
+
* @param idField - Field name for the node's unique ID
|
|
88
|
+
* @param parentField - Field name for the parent reference
|
|
89
|
+
* @param valueField - Field name for the numeric value (for aggregate computation)
|
|
90
|
+
*/
|
|
91
|
+
declare function buildDrilldownTree<T>(data: T[], idField: string, parentField: string, valueField: string): DrilldownTree<T>;
|
|
92
|
+
/**
|
|
93
|
+
* Get direct children of a node. Returns root nodes if parentId is null.
|
|
94
|
+
*/
|
|
95
|
+
declare function getChildren<T>(tree: DrilldownTree<T>, parentId: string | null): DrilldownNode<T>[];
|
|
96
|
+
/**
|
|
97
|
+
* Get the ancestor path from root to the given node (inclusive).
|
|
98
|
+
*/
|
|
99
|
+
declare function getAncestorPath<T>(tree: DrilldownTree<T>, nodeId: string, categoryField?: string): DrilldownBreadcrumb[];
|
|
100
|
+
/**
|
|
101
|
+
* Check if a node has children (is drillable).
|
|
102
|
+
*/
|
|
103
|
+
declare function isParentNode<T>(tree: DrilldownTree<T>, nodeId: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get all leaf descendants of a node.
|
|
106
|
+
*/
|
|
107
|
+
declare function getLeaves<T>(node: DrilldownNode<T>): DrilldownNode<T>[];
|
|
108
|
+
/**
|
|
109
|
+
* Create the initial drilldown state (at root level).
|
|
110
|
+
*
|
|
111
|
+
* @param rootLabel - Label for the root breadcrumb (e.g. "All", "S&P 500")
|
|
112
|
+
*/
|
|
113
|
+
declare function createDrilldownState(rootLabel?: string): DrilldownState;
|
|
114
|
+
/**
|
|
115
|
+
* Drill into a node. Returns a new state with the node as current.
|
|
116
|
+
*/
|
|
117
|
+
declare function drillInto<T>(state: DrilldownState, tree: DrilldownTree<T>, nodeId: string, categoryField?: string): DrilldownState;
|
|
118
|
+
/**
|
|
119
|
+
* Drill up one level. Returns a new state at the parent level.
|
|
120
|
+
*/
|
|
121
|
+
declare function drillUp(state: DrilldownState): DrilldownState;
|
|
122
|
+
/**
|
|
123
|
+
* Drill to a specific level in the breadcrumb path.
|
|
124
|
+
*/
|
|
125
|
+
declare function drillToLevel(state: DrilldownState, index: number): DrilldownState;
|
|
126
|
+
/**
|
|
127
|
+
* Drill back to root level.
|
|
128
|
+
*/
|
|
129
|
+
declare function drillToRoot(state: DrilldownState): DrilldownState;
|
|
130
|
+
/**
|
|
131
|
+
* Returns true if any dataset in the map has drilldown explicitly enabled
|
|
132
|
+
* with the required hierarchy fields (nodeId + parent).
|
|
133
|
+
* Currently only treemap supports drilldown.
|
|
134
|
+
*/
|
|
135
|
+
declare function isDrilldownEnabled(datasets: Map<string, DatasetRegistration>): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Returns the root breadcrumb label from the first drilldown-enabled treemap dataset.
|
|
138
|
+
* Falls back to 'All' if no explicit rootLabel is set.
|
|
139
|
+
*/
|
|
140
|
+
declare function getDrilldownRootLabel(datasets: Map<string, DatasetRegistration>): string;
|
|
141
|
+
type TreemapLayoutProps = {
|
|
142
|
+
nodeId?: string;
|
|
143
|
+
parentField?: string;
|
|
144
|
+
data?: unknown[];
|
|
145
|
+
categoryField?: string;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Walk the flat data of the first treemap layout to build the ancestor path
|
|
149
|
+
* between `currentParentId` and `nodeId` (exclusive on both ends).
|
|
150
|
+
*
|
|
151
|
+
* Used by both React and Vue `useTreemapRenderer` when the user clicks into
|
|
152
|
+
* a nested node so the breadcrumb can be updated with any intermediate parents.
|
|
153
|
+
*/
|
|
154
|
+
declare function buildAncestorChain(nodeId: string, layouts: Map<string, {
|
|
155
|
+
props: TreemapLayoutProps;
|
|
156
|
+
}>, currentParentId: string | null): {
|
|
157
|
+
id: string;
|
|
158
|
+
label: string;
|
|
159
|
+
}[];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Largest Triangle Three Buckets (LTTB) downsampling algorithm.
|
|
163
|
+
*
|
|
164
|
+
* For each bucket, selects the point forming the largest triangle area
|
|
165
|
+
* with the previously selected point and the average of the next bucket.
|
|
166
|
+
* Always preserves the first and last data points.
|
|
167
|
+
*
|
|
168
|
+
* Time complexity: O(n) single pass.
|
|
169
|
+
* Reference: Sveinn Steinarsson, "Downsampling Time Series for Visual Representation"
|
|
170
|
+
*
|
|
171
|
+
* @param yValues - Primary values array (Y coordinates)
|
|
172
|
+
* @param targetCount - Desired number of output points
|
|
173
|
+
* @param xValues - Optional X coordinates (defaults to indices 0..n-1 for equidistant data)
|
|
174
|
+
* @returns Array of indices into the original array to keep
|
|
175
|
+
*/
|
|
176
|
+
declare function decimateLTTB(yValues: readonly number[], targetCount: number, xValues?: readonly number[]): number[];
|
|
177
|
+
/**
|
|
178
|
+
* Min-Max decimation algorithm.
|
|
179
|
+
*
|
|
180
|
+
* For each bucket, keeps both the minimum and maximum value points,
|
|
181
|
+
* preserving exact peaks and valleys. Returns up to 2 × targetCount
|
|
182
|
+
* indices (deduplicated), sorted in ascending order.
|
|
183
|
+
*
|
|
184
|
+
* Time complexity: O(n) single pass.
|
|
185
|
+
*
|
|
186
|
+
* @param yValues - Primary values array
|
|
187
|
+
* @param targetCount - Target number of buckets (output has up to 2× this many points)
|
|
188
|
+
* @returns Array of indices into the original array to keep, sorted ascending
|
|
189
|
+
*/
|
|
190
|
+
declare function decimateMinMax(yValues: readonly number[], targetCount: number): number[];
|
|
191
|
+
/**
|
|
192
|
+
* Mini-batch k-means clustering for 2D scatter data.
|
|
193
|
+
*
|
|
194
|
+
* Unlike LTTB and min-max (which are 1D algorithms for ordered sequences),
|
|
195
|
+
* k-means preserves the 2D density distribution of scatter data by replacing
|
|
196
|
+
* clusters of nearby points with their centroid positions.
|
|
197
|
+
*
|
|
198
|
+
* Mini-batch variant: samples random batches per iteration for O(batchSize*k)
|
|
199
|
+
* per step instead of O(n*k), making it feasible for 100K+ point datasets.
|
|
200
|
+
*
|
|
201
|
+
* @param xValues - X coordinates
|
|
202
|
+
* @param yValues - Y coordinates
|
|
203
|
+
* @param targetCount - Number of output centroids (k)
|
|
204
|
+
* @returns Array of {x, y} centroid positions
|
|
205
|
+
*/
|
|
206
|
+
declare function decimateKMeans(xValues: readonly number[], yValues: readonly number[], targetCount: number): {
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
}[];
|
|
210
|
+
/**
|
|
211
|
+
* Decimate (downsample) a dataset using the configured algorithm.
|
|
212
|
+
*
|
|
213
|
+
* Short-circuits if the data length is at or below the threshold,
|
|
214
|
+
* returning all indices unchanged. Safe to call unconditionally
|
|
215
|
+
* in the pipeline without an outer length check.
|
|
216
|
+
*
|
|
217
|
+
* @param yValues - Primary values array (Y coordinates)
|
|
218
|
+
* @param config - Decimation configuration (algorithm, threshold, samples)
|
|
219
|
+
* @param xValues - Optional X coordinates (used by LTTB for non-equidistant data)
|
|
220
|
+
* @returns Array of original indices to keep
|
|
221
|
+
*/
|
|
222
|
+
declare function decimate(yValues: readonly number[], config: DecimationConfig, xValues?: readonly number[]): number[];
|
|
223
|
+
/**
|
|
224
|
+
* Viewport-aware scatter decimation with k-means clustering.
|
|
225
|
+
*
|
|
226
|
+
* Stateful: maintains a cache keyed by original data reference to avoid
|
|
227
|
+
* k-means speckle from random centroid re-initialization on each call.
|
|
228
|
+
*
|
|
229
|
+
* Flow per dataset:
|
|
230
|
+
* 1. If data length <= threshold and no zoom, pass through unchanged
|
|
231
|
+
* 2. Viewport filter: keep only points in the visible zoom window
|
|
232
|
+
* 3. If filtered count <= samples, use filtered data (full detail on zoom-in)
|
|
233
|
+
* 4. Otherwise run k-means on the visible subset (cached by viewport key)
|
|
234
|
+
*/
|
|
235
|
+
declare class ScatterDecimator {
|
|
236
|
+
private cache;
|
|
237
|
+
/**
|
|
238
|
+
* Apply viewport-aware decimation to scatter datasets.
|
|
239
|
+
* Returns a new array with the same shape as `datasets`, with `props.data` replaced where decimated.
|
|
240
|
+
*/
|
|
241
|
+
apply<T extends ScatterDecimationEntry>(datasets: readonly T[], config: ScatterDecimationConfig, zoomX?: ZoomRange | null, zoomY?: ZoomRange | null): T[];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export { resolveExportMenuProps as A, DEFAULT_EXPORT_MENU_ITEMS as D, EXPORT_MENU_CONSTANTS as E, HAMBURGER_ICON_PATH as H, ScatterDecimator as S, DEFAULT_EXPORT_MENU_PROPS as a, EXPORT_MENU_LABELS as b, type ExportMenuPlacement as c, type ExportMenuPlacementInput as d, buildAncestorChain as e, buildDrilldownTree as f, createDrilldownState as g, decimate as h, decimateKMeans as i, decimateLTTB as j, decimateMinMax as k, drillInto as l, drillToLevel as m, drillToRoot as n, drillUp as o, estimateExportMenuHeight as p, filterExportMenuItems as q, getAncestorPath as r, getChildren as s, getDrilldownRootLabel as t, getExportAction as u, getLeaves as v, isDrilldownEnabled as w, isExportMenuSeparator as x, isParentNode as y, resolveExportMenuPlacement as z };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ArcBoundingBox } from '@primeui/chart-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Snap a coordinate to the nearest half-pixel boundary for crisp 1px lines.
|
|
5
|
+
*
|
|
6
|
+
* Both SVG and Canvas stroke centered on the coordinate — a 1px stroke at y=100
|
|
7
|
+
* paints from y=99.5 to y=100.5, spanning two rows and producing a blurry line.
|
|
8
|
+
* Snapping to y=100.5 makes the stroke fill exactly one pixel row (100–101).
|
|
9
|
+
*
|
|
10
|
+
* Only applies when strokeWidth is an odd integer. Even-width strokes already
|
|
11
|
+
* align to pixel boundaries without adjustment.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The coordinate to snap
|
|
14
|
+
* @param strokeWidth - The line width (default: 1)
|
|
15
|
+
* @returns The snapped coordinate
|
|
16
|
+
*/
|
|
17
|
+
declare function crisp(value: number, strokeWidth?: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Convert degrees to radians
|
|
20
|
+
*/
|
|
21
|
+
declare const toRad: (degrees: number) => number;
|
|
22
|
+
/**
|
|
23
|
+
* Calculate x coordinate for given angle and radius
|
|
24
|
+
*/
|
|
25
|
+
declare const xCalc: (angle: number, radius: number) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Calculate y coordinate for given angle and radius
|
|
28
|
+
*/
|
|
29
|
+
declare const yCalc: (angle: number, radius: number) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate a point on a circle given center, angle (degrees), and radius
|
|
32
|
+
*/
|
|
33
|
+
declare const pointOnCircle: (cx: number, cy: number, angle: number, radius: number) => {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Normalize an angle to the range [0, 360)
|
|
39
|
+
*/
|
|
40
|
+
declare const normalizeAngle: (angle: number) => number;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize an angle relative to a rotation baseline.
|
|
43
|
+
* Returns angle in range [rotation, rotation + 360)
|
|
44
|
+
*
|
|
45
|
+
* @param angle - The angle to normalize (degrees)
|
|
46
|
+
* @param rotation - The baseline rotation (degrees)
|
|
47
|
+
*/
|
|
48
|
+
declare const normalizeAngleRelativeTo: (angle: number, rotation: number) => number;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate the bounding box of an arc (partial pie/donut)
|
|
51
|
+
* @param cx - Center x coordinate
|
|
52
|
+
* @param cy - Center y coordinate
|
|
53
|
+
* @param radius - Radius of the arc
|
|
54
|
+
* @param startAngle - Start angle in degrees (rotation)
|
|
55
|
+
* @param sweepAngle - Sweep angle in degrees
|
|
56
|
+
* @returns Bounding box with minX, maxX, minY, maxY and center offset
|
|
57
|
+
*/
|
|
58
|
+
declare const calculateArcBoundingBox: (cx: number, cy: number, radius: number, startAngle: number, sweepAngle: number) => ArcBoundingBox;
|
|
59
|
+
|
|
60
|
+
export { calculateArcBoundingBox as a, normalizeAngleRelativeTo as b, crisp as c, normalizeAngle as n, pointOnCircle as p, toRad as t, xCalc as x, yCalc as y };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { XAxisProps, YAxisProps, SeriesType, CartesianLayoutInput, HoverConfig, CartesianLayoutData, KeyboardNavState, DatasetRegistration, KeyboardNavigationConfig, DrilldownStateSnapshot, DrilldownBreadcrumb } from '@primeui/chart-types';
|
|
2
|
+
import './series/bar/controller/index.mjs';
|
|
3
|
+
import { C as ComputeChartStateInputs, a as ComputedChartState } from './computeChartState-BTVIqwyO.mjs';
|
|
4
|
+
import './series/candlestick/controller/index.mjs';
|
|
5
|
+
import './series/heatmap/controller/index.mjs';
|
|
6
|
+
import './series/line/controller/index.mjs';
|
|
7
|
+
import './series/pie/controller/index.mjs';
|
|
8
|
+
import './series/polar/controller/index.mjs';
|
|
9
|
+
import './series/radar/controller/index.mjs';
|
|
10
|
+
import './series/scatter/controller/index.mjs';
|
|
11
|
+
import './series/treemap/controller/index.mjs';
|
|
12
|
+
|
|
13
|
+
interface AxisRegistrationControllerOptions {
|
|
14
|
+
id: string;
|
|
15
|
+
axis: 'x' | 'y';
|
|
16
|
+
registerX: (id: string, props: XAxisProps) => void;
|
|
17
|
+
unregisterX: (id: string) => void;
|
|
18
|
+
updateX: (id: string, props: XAxisProps) => void;
|
|
19
|
+
registerY: (id: string, props: YAxisProps) => void;
|
|
20
|
+
unregisterY: (id: string) => void;
|
|
21
|
+
updateY: (id: string, props: YAxisProps) => void;
|
|
22
|
+
}
|
|
23
|
+
declare class AxisRegistrationController {
|
|
24
|
+
private stableProps;
|
|
25
|
+
private readonly options;
|
|
26
|
+
constructor(options: AxisRegistrationControllerOptions);
|
|
27
|
+
mount(props: XAxisProps | YAxisProps): void;
|
|
28
|
+
update(props: XAxisProps | YAxisProps): void;
|
|
29
|
+
unmount(): void;
|
|
30
|
+
forceRefresh(props: XAxisProps | YAxisProps): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DatasetExtras {
|
|
34
|
+
stackId?: string;
|
|
35
|
+
rangeId?: string;
|
|
36
|
+
order?: number;
|
|
37
|
+
}
|
|
38
|
+
interface DatasetRegistrationControllerOptions<T extends Record<string, unknown>> {
|
|
39
|
+
id: string;
|
|
40
|
+
type: SeriesType;
|
|
41
|
+
typeResolver?: (props: T) => SeriesType;
|
|
42
|
+
register: (id: string, type: SeriesType, props: Record<string, unknown>) => void;
|
|
43
|
+
unregister: (id: string) => void;
|
|
44
|
+
update: (id: string, props: Record<string, unknown>) => void;
|
|
45
|
+
}
|
|
46
|
+
declare class DatasetRegistrationController<T extends Record<string, unknown>> {
|
|
47
|
+
private stableProps;
|
|
48
|
+
private prevType;
|
|
49
|
+
private readonly options;
|
|
50
|
+
constructor(options: DatasetRegistrationControllerOptions<T>);
|
|
51
|
+
mount(props: T, extras?: DatasetExtras): void;
|
|
52
|
+
update(props: T, extras?: DatasetExtras): void;
|
|
53
|
+
unmount(): void;
|
|
54
|
+
forceRefresh(props: T, extras?: DatasetExtras): void;
|
|
55
|
+
private resolveType;
|
|
56
|
+
private mergeProps;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type CartesianLayoutControllerInput = Omit<CartesianLayoutInput, 'hoverConfig'> & {
|
|
60
|
+
hoverConfig?: HoverConfig;
|
|
61
|
+
};
|
|
62
|
+
declare class CartesianLayoutController {
|
|
63
|
+
private _lastVisibleLayouts;
|
|
64
|
+
private _prevInputs;
|
|
65
|
+
private _prevResult;
|
|
66
|
+
/**
|
|
67
|
+
* Compute cartesian layout with built-in memoization.
|
|
68
|
+
* Skips recomputation when layout-affecting inputs are reference-equal to the
|
|
69
|
+
* previous call — `hover` is intentionally excluded so pointer movement
|
|
70
|
+
* does not trigger an expensive full layout pass.
|
|
71
|
+
*/
|
|
72
|
+
compute(input: CartesianLayoutControllerInput): CartesianLayoutData | null;
|
|
73
|
+
destroy(): void;
|
|
74
|
+
private _inputsEqual;
|
|
75
|
+
private _inputsEqualExceptTheme;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ResponsiveDimensionsOptions {
|
|
79
|
+
debounceWithRAF?: boolean;
|
|
80
|
+
debounceDelay?: number;
|
|
81
|
+
aspectRatio?: number;
|
|
82
|
+
maxDimensions?: boolean;
|
|
83
|
+
maxWidth?: number;
|
|
84
|
+
maxHeight?: number;
|
|
85
|
+
}
|
|
86
|
+
declare class ResponsiveDimensionsController {
|
|
87
|
+
private _observer;
|
|
88
|
+
private _debouncer;
|
|
89
|
+
private _options;
|
|
90
|
+
/** Called with processed dimensions whenever the container resizes. */
|
|
91
|
+
onDimensionsChange: ((width: number, height: number) => void) | null;
|
|
92
|
+
/**
|
|
93
|
+
* Attach to a container element. Performs an initial synchronous measurement
|
|
94
|
+
* and begins observing resizes. Call detach() before re-attaching.
|
|
95
|
+
*/
|
|
96
|
+
attach(containerEl: HTMLElement, options: ResponsiveDimensionsOptions): void;
|
|
97
|
+
detach(): void;
|
|
98
|
+
destroy(): void;
|
|
99
|
+
private _process;
|
|
100
|
+
private _emit;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare class ChartStateController {
|
|
104
|
+
private _prevInputs;
|
|
105
|
+
private _prevResult;
|
|
106
|
+
/**
|
|
107
|
+
* Compute chart state with built-in memoization.
|
|
108
|
+
* - Inputs reference-equal to the previous call → return the cached result.
|
|
109
|
+
* - Only `theme` changed → reuse the cached (theme-independent) geometry and
|
|
110
|
+
* recompute ONLY the theme-dependent style/legend fields (SPREAD-CLONE,
|
|
111
|
+
* never mutating the cached result).
|
|
112
|
+
* - Otherwise → full `computeChartState`.
|
|
113
|
+
*/
|
|
114
|
+
compute(inputs: ComputeChartStateInputs): ComputedChartState;
|
|
115
|
+
destroy(): void;
|
|
116
|
+
private _inputsEqual;
|
|
117
|
+
private _inputsEqualExceptTheme;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
declare class KeyboardNavigationController {
|
|
121
|
+
private _state;
|
|
122
|
+
private _lastFocusedIndexMap;
|
|
123
|
+
/** Called when navigation moves to a point. */
|
|
124
|
+
onNavigate: ((datasetId: string, index: number, announcement: string) => void) | null;
|
|
125
|
+
/** Called when navigation resets (mouse move, Escape, or disabled). */
|
|
126
|
+
onReset: (() => void) | null;
|
|
127
|
+
get state(): KeyboardNavState;
|
|
128
|
+
/**
|
|
129
|
+
* Process a keydown event. Returns true if the key was handled (caller should preventDefault).
|
|
130
|
+
*/
|
|
131
|
+
handleKeyDown(key: string, datasets: Map<string, DatasetRegistration>, visibility: Map<string, boolean>, config?: KeyboardNavigationConfig): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Activate navigation from a focus event (keyboard Tab into the chart) rather than
|
|
134
|
+
* a key press, so the focus indicator + screen-reader announcement appear immediately
|
|
135
|
+
* on focus instead of waiting for the first arrow key. No-op when already active or
|
|
136
|
+
* there is nothing navigable. Navigates to the remembered point of the first dataset
|
|
137
|
+
* when `rememberPointFocus` is set, otherwise its first point. Fires `onNavigate`
|
|
138
|
+
* exactly like an arrow key.
|
|
139
|
+
*
|
|
140
|
+
* @returns true if navigation was activated.
|
|
141
|
+
*/
|
|
142
|
+
activate(datasets: Map<string, DatasetRegistration>, visibility: Map<string, boolean>, config?: KeyboardNavigationConfig): boolean;
|
|
143
|
+
/** Call on mousemove — resets active keyboard nav. */
|
|
144
|
+
handleMouseMove(): void;
|
|
145
|
+
reset(): void;
|
|
146
|
+
destroy(): void;
|
|
147
|
+
private _applyAction;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class DrilldownStateController {
|
|
151
|
+
private snapshot;
|
|
152
|
+
private subscribers;
|
|
153
|
+
/** Stable getter — same reference until state actually changes (required for useSyncExternalStore). */
|
|
154
|
+
getSnapshot: () => DrilldownStateSnapshot;
|
|
155
|
+
subscribe: (fn: () => void) => (() => void);
|
|
156
|
+
/**
|
|
157
|
+
* Sync controller to the current dataset map. Called whenever datasets change.
|
|
158
|
+
* Recomputes `enabled` and the root breadcrumb label without touching the rest
|
|
159
|
+
* of the path.
|
|
160
|
+
*/
|
|
161
|
+
setDatasets(datasets: Map<string, DatasetRegistration>): void;
|
|
162
|
+
drillInto: (nodeId: string, label: string, ancestors?: DrilldownBreadcrumb[]) => void;
|
|
163
|
+
drillToLevel: (index: number) => void;
|
|
164
|
+
private commit;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { AxisRegistrationController as A, CartesianLayoutController as C, type DatasetExtras as D, KeyboardNavigationController as K, ResponsiveDimensionsController as R, type AxisRegistrationControllerOptions as a, type CartesianLayoutControllerInput as b, ChartStateController as c, DatasetRegistrationController as d, type DatasetRegistrationControllerOptions as e, DrilldownStateController as f, type ResponsiveDimensionsOptions as g };
|