@primeui/chart-core 0.0.1-alpha.1 → 1.0.0-rc.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.md +35 -0
- package/README.md +12 -0
- package/dist/animations/index.d.mts +1 -1
- package/dist/animations/index.mjs +19 -18
- package/dist/{annotation.utils-Bm0lOO1o.d.mts → annotation.utils-D-7ijAWO.d.mts} +22 -1
- package/dist/cartesian/index.d.mts +3 -2
- package/dist/cartesian/index.mjs +96 -93
- package/dist/{chunk-WPFUV7K3.mjs → chunks/chunk-2LLTN7T4.mjs} +23 -14
- package/dist/{chunk-RO4N6YFS.mjs → chunks/chunk-2T226WJI.mjs} +31 -14
- package/dist/{chunk-3FFJEX4A.mjs → chunks/chunk-3QQLETCJ.mjs} +13 -12
- package/dist/{chunk-JWFBOPM6.mjs → chunks/chunk-4N2XIMAB.mjs} +2 -2
- package/dist/{chunk-LVMDQ4OJ.mjs → chunks/chunk-4S3FOFCN.mjs} +2 -2
- package/dist/{chunk-XTVE4P3L.mjs → chunks/chunk-56MASQS2.mjs} +6 -2
- package/dist/{chunk-DTWTCFRG.mjs → chunks/chunk-5EQSFUBA.mjs} +41 -13
- package/dist/{chunk-KQIFO5I3.mjs → chunks/chunk-5QSTMSPW.mjs} +15 -10
- package/dist/{chunk-NKUYIWAP.mjs → chunks/chunk-6LUIVTNV.mjs} +6 -6
- package/dist/chunks/chunk-6MAO6I3E.mjs +6 -0
- package/dist/{chunk-DN6AXQYZ.mjs → chunks/chunk-72M66Y2U.mjs} +46 -41
- package/dist/{chunk-WFVOQ2QZ.mjs → chunks/chunk-77K3DEKL.mjs} +2 -2
- package/dist/{chunk-4C6EVJ54.mjs → chunks/chunk-7I2SAKHL.mjs} +7 -44
- package/dist/{chunk-6HSEJLSR.mjs → chunks/chunk-7I2SNJ2X.mjs} +35 -18
- package/dist/{chunk-66T4MRC5.mjs → chunks/chunk-7IKKWWRT.mjs} +4 -6
- package/dist/{chunk-BKP26M4K.mjs → chunks/chunk-7LZWQVTL.mjs} +43 -24
- package/dist/{chunk-NHRK5KU2.mjs → chunks/chunk-A5YBHYIS.mjs} +25 -17
- package/dist/{chunk-ZT2Z7ERM.mjs → chunks/chunk-AC5EAWIP.mjs} +12 -9
- package/dist/{chunk-ZTL2FQEW.mjs → chunks/chunk-AETETRB4.mjs} +24 -9
- package/dist/{chunk-NPDZLYIF.mjs → chunks/chunk-AJ24XDEK.mjs} +2 -2
- package/dist/chunks/chunk-ARVMVGWS.mjs +40 -0
- package/dist/{chunk-3IYSJ2U7.mjs → chunks/chunk-AYEAEAOV.mjs} +10 -7
- package/dist/{chunk-M7B3JF43.mjs → chunks/chunk-AZPJMIZE.mjs} +4 -3
- package/dist/{chunk-O2X6FF45.mjs → chunks/chunk-BDCNBS6W.mjs} +194 -168
- package/dist/{chunk-55Y3WI6S.mjs → chunks/chunk-BR4PSSPU.mjs} +6 -6
- package/dist/{chunk-TA4MVAEX.mjs → chunks/chunk-CFA2SUBF.mjs} +32 -24
- package/dist/{chunk-WH3C3Y7P.mjs → chunks/chunk-CKQ4DNNJ.mjs} +7 -18
- package/dist/chunks/chunk-DIJFKY6H.mjs +21 -0
- package/dist/{chunk-AUF4CHDP.mjs → chunks/chunk-DJOHDKTP.mjs} +18 -11
- package/dist/{chunk-3Z62EUJN.mjs → chunks/chunk-DKWZKYHF.mjs} +5 -5
- package/dist/{chunk-Y3L3D4GQ.mjs → chunks/chunk-DORUY7GR.mjs} +69 -34
- package/dist/chunks/chunk-DWBJKYLH.mjs +238 -0
- package/dist/{chunk-XQQCGFYB.mjs → chunks/chunk-EQLCJTM4.mjs} +1 -1
- package/dist/{chunk-VGLSBZDN.mjs → chunks/chunk-F2E2QCZM.mjs} +1 -1
- package/dist/{chunk-BZN2QHGP.mjs → chunks/chunk-F6AGZQDA.mjs} +4 -72
- package/dist/{chunk-ILUWFYGY.mjs → chunks/chunk-FNMLVZOA.mjs} +8 -8
- package/dist/{chunk-SXHVDJGF.mjs → chunks/chunk-FQAFGPW6.mjs} +6 -6
- package/dist/{chunk-N3TIT3OH.mjs → chunks/chunk-FSPE3M5E.mjs} +66 -43
- package/dist/{chunk-KNDZP446.mjs → chunks/chunk-FSWYYRPX.mjs} +5 -5
- package/dist/{chunk-KP2TWD4Z.mjs → chunks/chunk-FWNWV3H7.mjs} +1 -1
- package/dist/{chunk-WCG35U6M.mjs → chunks/chunk-FYVMRQFF.mjs} +35 -27
- package/dist/chunks/chunk-G3DIMENH.mjs +63 -0
- package/dist/{chunk-QQBXUDM4.mjs → chunks/chunk-G3DYNMWT.mjs} +20 -16
- package/dist/{chunk-J65DBT4R.mjs → chunks/chunk-GA6YZQYT.mjs} +3 -3
- package/dist/chunks/chunk-GAQLLQUM.mjs +20 -0
- package/dist/{chunk-TAHCOZHF.mjs → chunks/chunk-GN7VQCCH.mjs} +27 -30
- package/dist/{chunk-R6Y3R7EW.mjs → chunks/chunk-GOOBVFFH.mjs} +1 -1
- package/dist/chunks/chunk-GSW5OBEG.mjs +233 -0
- package/dist/{chunk-22ST6YPP.mjs → chunks/chunk-GTX6MLTG.mjs} +9 -9
- package/dist/{chunk-XUAASRXW.mjs → chunks/chunk-GWHRTGGC.mjs} +35 -27
- package/dist/{chunk-TQ6S34QZ.mjs → chunks/chunk-GXCLRRE5.mjs} +6 -6
- package/dist/{chunk-DP2IZNN3.mjs → chunks/chunk-HHBFQ6AI.mjs} +4 -3
- package/dist/{chunk-3OZLP4I4.mjs → chunks/chunk-HWT6UEYE.mjs} +14 -10
- package/dist/{chunk-X7T34OLW.mjs → chunks/chunk-I25SSZE3.mjs} +3 -3
- package/dist/{chunk-OGJ6IIBW.mjs → chunks/chunk-IFJPDARC.mjs} +21 -9
- package/dist/{chunk-CINXJIRR.mjs → chunks/chunk-ISU27QL2.mjs} +66 -6
- package/dist/{chunk-OXTFAWSK.mjs → chunks/chunk-J2WHJ73Y.mjs} +7 -2
- package/dist/{chunk-VN7CKCSE.mjs → chunks/chunk-JS47MSB2.mjs} +9 -1
- package/dist/{chunk-WYLILAOO.mjs → chunks/chunk-K44SD67H.mjs} +16 -7
- package/dist/{chunk-RQ3CKQOX.mjs → chunks/chunk-K7AGQTVK.mjs} +63 -3
- package/dist/{chunk-VVI3OBPJ.mjs → chunks/chunk-KCSMOAZO.mjs} +7 -9
- package/dist/{chunk-ARRGOEFX.mjs → chunks/chunk-L6GXEQOO.mjs} +7 -7
- package/dist/{chunk-7QQ6ETB4.mjs → chunks/chunk-LBNP5PJA.mjs} +14 -12
- package/dist/{chunk-AHYIS6EB.mjs → chunks/chunk-LC2ZEZWP.mjs} +7 -7
- package/dist/{chunk-3WEMHXZI.mjs → chunks/chunk-LTQH3LQJ.mjs} +2 -8
- package/dist/{chunk-OHGCZZPZ.mjs → chunks/chunk-M5PZVFY5.mjs} +57 -29
- package/dist/{chunk-A6ZQZFL2.mjs → chunks/chunk-NUHW3U7G.mjs} +14 -11
- package/dist/{chunk-QWQ6HY4I.mjs → chunks/chunk-O4BTKF5R.mjs} +9 -8
- package/dist/{chunk-WY4AURRE.mjs → chunks/chunk-P2Q4DYOS.mjs} +240 -83
- package/dist/{chunk-KVDEROP6.mjs → chunks/chunk-P563L7WL.mjs} +1 -1
- package/dist/{chunk-SDBPQ5CF.mjs → chunks/chunk-PJLFNUOW.mjs} +45 -30
- package/dist/{chunk-MTGMXRNF.mjs → chunks/chunk-PSDRVQSK.mjs} +7 -7
- package/dist/{chunk-6STOLMCA.mjs → chunks/chunk-QCBESCLG.mjs} +13 -12
- package/dist/{chunk-PRDVPOZX.mjs → chunks/chunk-QIYJUZ7I.mjs} +7 -2
- package/dist/{chunk-UPRXABX5.mjs → chunks/chunk-RH3OQ2VX.mjs} +6 -6
- package/dist/{chunk-QS76E3TD.mjs → chunks/chunk-RI32WIDX.mjs} +2 -2
- package/dist/{chunk-OWW3K55O.mjs → chunks/chunk-RIAPS5AW.mjs} +49 -7
- package/dist/{chunk-ERVQB2VZ.mjs → chunks/chunk-RJ3ZOZTS.mjs} +4 -4
- package/dist/{chunk-WFTX4AQJ.mjs → chunks/chunk-RKNL7UWZ.mjs} +19 -7
- package/dist/chunks/chunk-RLS3GMJ6.mjs +8 -0
- package/dist/{chunk-WRULPWHD.mjs → chunks/chunk-RVTEIKW5.mjs} +5 -5
- package/dist/{chunk-PLSDU3C2.mjs → chunks/chunk-RXQ22JQS.mjs} +67 -39
- package/dist/{chunk-FHTC2YDB.mjs → chunks/chunk-SVASYTK5.mjs} +70 -5
- package/dist/{chunk-ARB5T6MP.mjs → chunks/chunk-SWVOBJLG.mjs} +3 -100
- package/dist/{chunk-JGOVWSKH.mjs → chunks/chunk-TW3KLJVO.mjs} +37 -12
- package/dist/{chunk-RBLZRT5K.mjs → chunks/chunk-UF2TPGQB.mjs} +103 -15
- package/dist/{chunk-X4D7FKUS.mjs → chunks/chunk-UZWWYKL7.mjs} +2 -2
- package/dist/{chunk-LKC7MZKK.mjs → chunks/chunk-XECVYJE2.mjs} +16 -8
- package/dist/chunks/chunk-XMSAUIVL.mjs +1 -0
- package/dist/{chunk-J4RI2C2G.mjs → chunks/chunk-XPZTRMU2.mjs} +6 -6
- package/dist/{chunk-BABQKA6K.mjs → chunks/chunk-XXJRGDKE.mjs} +3 -3
- package/dist/{chunk-SALTGZFR.mjs → chunks/chunk-YVDVKLPR.mjs} +10 -9
- package/dist/circular/arc/index.mjs +3 -3
- package/dist/circular/index.d.mts +1 -1
- package/dist/circular/index.mjs +14 -13
- package/dist/controllers/index.mjs +113 -110
- package/dist/{datalabel.utils-CkjGeB8S.d.mts → datalabel.utils-CNRKHy7j.d.mts} +10 -1
- package/dist/{decimation.utils-CcvJVhI4.d.mts → decimation.utils-C0xpslz_.d.mts} +33 -2
- package/dist/geometry-BVWJedvw.d.mts +53 -0
- package/dist/index.d.mts +16 -17
- package/dist/index.mjs +113 -110
- package/dist/luminance-TvUgaQ91.d.mts +57 -0
- package/dist/orchestrator/index.d.mts +2 -2
- package/dist/orchestrator/index.mjs +36 -33
- package/dist/plugins/index.mjs +1 -1
- package/dist/{property-animations-D433wXzz.d.mts → property-animations-CI0zyp6V.d.mts} +6 -20
- package/dist/radial/index.mjs +40 -37
- package/dist/renderers/axis/index.mjs +9 -8
- package/dist/renderers/index.d.mts +8 -9
- package/dist/renderers/index.mjs +78 -75
- package/dist/renderers/navigator/index.d.mts +1 -1
- package/dist/renderers/navigator/index.mjs +10 -8
- package/dist/{ring.utils-DXvrxMkU.d.mts → ring.utils-aHt9Nqum.d.mts} +2 -7
- package/dist/{scale-KFv30jqZ.d.mts → scale-CFkPlyUe.d.mts} +2 -2
- package/dist/{scales-Drf8AIhL.d.mts → scales-BZzjlR4U.d.mts} +15 -1
- package/dist/series/bar/canvas/index.mjs +11 -10
- package/dist/series/bar/controller/index.d.mts +17 -0
- package/dist/series/bar/controller/index.mjs +47 -44
- package/dist/series/bar/controller-canvas/index.mjs +47 -44
- package/dist/series/bar/controller-svg/index.mjs +47 -44
- package/dist/series/bar/index.d.mts +2 -2
- package/dist/series/bar/index.mjs +16 -13
- package/dist/series/bar/svg/index.mjs +14 -11
- package/dist/series/candlestick/canvas/index.mjs +8 -8
- package/dist/series/candlestick/controller/index.d.mts +2 -0
- package/dist/series/candlestick/controller/index.mjs +43 -40
- package/dist/series/candlestick/controller-canvas/index.mjs +43 -40
- package/dist/series/candlestick/controller-svg/index.mjs +43 -40
- package/dist/series/candlestick/index.mjs +11 -10
- package/dist/series/candlestick/svg/index.mjs +8 -8
- package/dist/series/heatmap/canvas/index.mjs +9 -9
- package/dist/series/heatmap/controller/index.d.mts +9 -0
- package/dist/series/heatmap/controller/index.mjs +26 -23
- package/dist/series/heatmap/controller-canvas/index.mjs +26 -23
- package/dist/series/heatmap/controller-svg/index.mjs +26 -23
- package/dist/series/heatmap/index.mjs +14 -13
- package/dist/series/heatmap/svg/index.mjs +11 -10
- package/dist/series/line/canvas/index.mjs +9 -9
- package/dist/series/line/controller/index.d.mts +7 -0
- package/dist/series/line/controller/index.mjs +51 -47
- package/dist/series/line/controller-canvas/index.mjs +53 -49
- package/dist/series/line/controller-svg/index.mjs +53 -49
- package/dist/series/line/index.d.mts +1 -1
- package/dist/series/line/index.mjs +17 -13
- package/dist/series/line/svg/index.mjs +12 -9
- package/dist/series/pie/canvas/index.d.mts +12 -4
- package/dist/series/pie/canvas/index.mjs +15 -10
- package/dist/series/pie/controller/index.mjs +113 -110
- package/dist/series/pie/controller-canvas/index.mjs +113 -110
- package/dist/series/pie/controller-svg/index.mjs +113 -110
- package/dist/series/pie/index.d.mts +3 -56
- package/dist/series/pie/index.mjs +11 -15
- package/dist/series/pie/svg/index.d.mts +18 -4
- package/dist/series/pie/svg/index.mjs +10 -11
- package/dist/series/polar/canvas/index.mjs +7 -7
- package/dist/series/polar/controller/index.d.mts +9 -0
- package/dist/series/polar/controller/index.mjs +49 -46
- package/dist/series/polar/controller-canvas/index.mjs +50 -47
- package/dist/series/polar/controller-svg/index.mjs +50 -47
- package/dist/series/polar/index.d.mts +1 -1
- package/dist/series/polar/index.mjs +19 -16
- package/dist/series/polar/svg/index.mjs +11 -8
- package/dist/series/radar/canvas/index.mjs +8 -8
- package/dist/series/radar/controller/index.d.mts +11 -0
- package/dist/series/radar/controller/index.mjs +46 -43
- package/dist/series/radar/controller-canvas/index.mjs +49 -46
- package/dist/series/radar/controller-svg/index.mjs +49 -46
- package/dist/series/radar/index.d.mts +3 -3
- package/dist/series/radar/index.mjs +16 -13
- package/dist/series/radar/svg/index.mjs +12 -9
- package/dist/series/scatter/canvas/index.mjs +13 -11
- package/dist/series/scatter/controller/index.mjs +48 -44
- package/dist/series/scatter/controller-canvas/index.mjs +50 -46
- package/dist/series/scatter/controller-svg/index.mjs +50 -46
- package/dist/series/scatter/index.d.mts +1 -1
- package/dist/series/scatter/index.mjs +18 -14
- package/dist/series/scatter/svg/index.mjs +16 -12
- package/dist/series/treemap/canvas/index.mjs +10 -10
- package/dist/series/treemap/controller/index.mjs +23 -20
- package/dist/series/treemap/controller-canvas/index.mjs +23 -20
- package/dist/series/treemap/controller-svg/index.mjs +23 -20
- package/dist/series/treemap/index.d.mts +17 -9
- package/dist/series/treemap/index.mjs +12 -12
- package/dist/series/treemap/svg/index.mjs +9 -9
- package/dist/{stacking-CChuAcLN.d.mts → stacking-Dz1OBhzm.d.mts} +1 -1
- package/dist/sync/index.mjs +6 -5
- package/dist/{tooltip.renderer-D5wpSlBa.d.mts → tooltip.renderer-C3z-UKm4.d.mts} +4 -4
- package/dist/utils/color/index.d.mts +11 -53
- package/dist/utils/color/index.mjs +4 -4
- package/dist/utils/data/index.d.mts +2 -2
- package/dist/utils/data/index.mjs +7 -7
- package/dist/utils/export/index.mjs +6 -6
- package/dist/utils/index.d.mts +7 -7
- package/dist/utils/index.mjs +32 -29
- package/dist/utils/interaction/index.d.mts +1 -31
- package/dist/utils/interaction/index.mjs +12 -9
- package/dist/utils/layout/index.mjs +10 -10
- package/dist/utils/math/index.d.mts +1 -1
- package/dist/utils/math/index.mjs +1 -1
- package/dist/utils/render/index.mjs +3 -3
- package/dist/utils/specialized/index.d.mts +1 -1
- package/dist/utils/specialized/index.mjs +13 -15
- package/dist/utils/text/index.d.mts +1 -1
- package/dist/utils/text/index.mjs +9 -8
- package/dist/utils/theme/index.d.mts +6 -6
- package/dist/utils/theme/index.mjs +5 -5
- package/dist/utils/zoom/index.mjs +3 -3
- package/package.json +5 -10
- package/LICENSE +0 -23
- package/dist/canvas-D4vigq47.d.mts +0 -34
- package/dist/chunk-2QRS4YQ5.mjs +0 -18
- package/dist/chunk-53HW45JB.mjs +0 -102
- package/dist/chunk-B4FTADAZ.mjs +0 -561
- package/dist/chunk-IXOWSEHO.mjs +0 -114
- package/dist/chunk-VWF57TS3.mjs +0 -62
- package/dist/chunk-XIHBK5D3.mjs +0 -68
- package/dist/renderers/circular/index.d.mts +0 -13
- package/dist/renderers/circular/index.mjs +0 -13
- package/dist/{chunk-WA3OVISZ.mjs → chunks/chunk-4KQZXAHZ.mjs} +0 -0
- package/dist/{chunk-CHW4RKY3.mjs → chunks/chunk-576P5DBH.mjs} +0 -0
- package/dist/{chunk-EDAKJLNA.mjs → chunks/chunk-5WFF272M.mjs} +0 -0
- package/dist/{chunk-ADKLH73T.mjs → chunks/chunk-6XZ6U7GL.mjs} +0 -0
- package/dist/{chunk-2QK2KOBN.mjs → chunks/chunk-AOTUNMVD.mjs} +0 -0
- package/dist/{chunk-AGU3NG6D.mjs → chunks/chunk-AWMO5TS3.mjs} +0 -0
- package/dist/{chunk-SSLTFJ3U.mjs → chunks/chunk-BF7RP4A3.mjs} +132 -132
- /package/dist/{chunk-BETFQBM2.mjs → chunks/chunk-FML3QEEI.mjs} +0 -0
- /package/dist/{chunk-FFMT6OCO.mjs → chunks/chunk-FRVJH7ZG.mjs} +0 -0
- /package/dist/{chunk-HDFGCN2F.mjs → chunks/chunk-HBTCRORW.mjs} +0 -0
- /package/dist/{chunk-7CMVDIOU.mjs → chunks/chunk-HXDLOOCS.mjs} +0 -0
- /package/dist/{chunk-5JCI2DEB.mjs → chunks/chunk-JQVX6XFW.mjs} +0 -0
- /package/dist/{chunk-C36VWQ7A.mjs → chunks/chunk-KMKULH54.mjs} +0 -0
- /package/dist/{chunk-Q6PPVIHU.mjs → chunks/chunk-MT3OLVZC.mjs} +0 -0
- /package/dist/{chunk-WS64BZXT.mjs → chunks/chunk-OWVSSQZ4.mjs} +0 -0
- /package/dist/{chunk-EAMUNLRU.mjs → chunks/chunk-P2LG7GDM.mjs} +0 -0
- /package/dist/{chunk-IEGLX7VL.mjs → chunks/chunk-PXUXZADY.mjs} +0 -0
- /package/dist/{chunk-SANZPAJ4.mjs → chunks/chunk-SFUDXJKO.mjs} +0 -0
- /package/dist/{chunk-ZQFK6CAE.mjs → chunks/chunk-SJNUJM54.mjs} +0 -0
- /package/dist/{chunk-AP3UYWYT.mjs → chunks/chunk-SPU6BO3B.mjs} +0 -0
- /package/dist/{chunk-YBJ56XJS.mjs → chunks/chunk-T2UAEMHY.mjs} +0 -0
- /package/dist/{chunk-JO7VACY2.mjs → chunks/chunk-VADXCPQ4.mjs} +0 -0
- /package/dist/{chunk-FRST55HY.mjs → chunks/chunk-ZZCVDIU5.mjs} +0 -0
package/dist/chunk-IXOWSEHO.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { computeSliceRenderStates } from './chunk-53HW45JB.mjs';
|
|
2
|
-
import { buildSvgArcPath, CLIP_PIXEL_MARGIN } from './chunk-LVMDQ4OJ.mjs';
|
|
3
|
-
import { formatPointDescription } from './chunk-OGJ6IIBW.mjs';
|
|
4
|
-
import { FIELD_DEFAULTS, batchResolveAccessor, isGradientColor, remapStopsForDonut, createSvgGradientFromColor } from './chunk-O2X6FF45.mjs';
|
|
5
|
-
import { createSvgGroup, createSvgDefs, setAttr, appendChild, svgClass, svgNode, createSvgPath, prependChild } from './chunk-SSLTFJ3U.mjs';
|
|
6
|
-
import { toRad } from './chunk-RQ3CKQOX.mjs';
|
|
7
|
-
|
|
8
|
-
// src/series/pie/svg/index.ts
|
|
9
|
-
function renderPieSvg(props, layout, context) {
|
|
10
|
-
const renderStates = computeSliceRenderStates(props, layout, context.theme);
|
|
11
|
-
const { slices: sliceStates, center, outerRadius, innerRadius, isFullCircle: fullCircle } = renderStates;
|
|
12
|
-
const borderJoinStyle = props.borderJoinStyle ?? "miter";
|
|
13
|
-
const borderAlign = props.borderAlign ?? "inner";
|
|
14
|
-
const group = createSvgGroup(`translate(${center.x}, ${center.y})`);
|
|
15
|
-
const defs = createSvgDefs();
|
|
16
|
-
let hasDefs = false;
|
|
17
|
-
const dsIdx = layout.datasetIndex;
|
|
18
|
-
const a11y = context.accessibility;
|
|
19
|
-
const a11yEnabled = !!(a11y?.enabled && layout.visibleSlices.length <= (a11y.pointDescriptionThreshold ?? 200));
|
|
20
|
-
const categoryAccessor = props.categoryField ?? props.labelField ?? FIELD_DEFAULTS.categoryField;
|
|
21
|
-
const a11yLabels = a11yEnabled && categoryAccessor ? batchResolveAccessor(categoryAccessor, props.data) : [];
|
|
22
|
-
const total = layout.visibleSlices.reduce((sum, s) => sum + s.value, 0);
|
|
23
|
-
for (const state of sliceStates) {
|
|
24
|
-
const { slice, dataIndex, effectBorderColor, effectBorderWidth, effectBorderDash, effectBorderDashOffset, userFill, isHovered, isInactive, offset, scale, arcConfig } = state;
|
|
25
|
-
const { dx, dy } = offset;
|
|
26
|
-
const colorClassN = `p-chart-color-${dataIndex % 10}`;
|
|
27
|
-
const parts = [];
|
|
28
|
-
if (dx !== 0 || dy !== 0) parts.push(`translate(${dx}, ${dy})`);
|
|
29
|
-
if (scale !== 1) parts.push(`scale(${scale})`);
|
|
30
|
-
const sliceGroup = createSvgGroup(parts.length > 0 ? parts.join(" ") : void 0);
|
|
31
|
-
setAttr(sliceGroup, "data-slice-index", dataIndex);
|
|
32
|
-
setAttr(sliceGroup, "data-index", dataIndex);
|
|
33
|
-
if (a11yEnabled) {
|
|
34
|
-
const label = a11yLabels[dataIndex] ?? `Slice ${dataIndex + 1}`;
|
|
35
|
-
const desc = formatPointDescription({ category: label, value: slice.value, seriesName: props.name ?? "Chart", index: dataIndex, total, percentage: slice.percentage }, a11y.pointDescriptionFormatter);
|
|
36
|
-
setAttr(sliceGroup, "role", "img");
|
|
37
|
-
setAttr(sliceGroup, "aria-label", desc);
|
|
38
|
-
}
|
|
39
|
-
const pathD = buildSvgArcPath(arcConfig, fullCircle);
|
|
40
|
-
let fill;
|
|
41
|
-
if (userFill && isGradientColor(userFill)) {
|
|
42
|
-
const gradientId = `${context.chartId}-pie-${dsIdx}-grad-${dataIndex}`;
|
|
43
|
-
const gradientColor = innerRadius > 0 && userFill.radialGradient ? { ...userFill, stops: remapStopsForDonut(userFill.stops, innerRadius / outerRadius) } : userFill;
|
|
44
|
-
const gradient = createSvgGradientFromColor(gradientColor, gradientId, { x: 0, y: 0 }, outerRadius);
|
|
45
|
-
appendChild(defs, gradient);
|
|
46
|
-
hasDefs = true;
|
|
47
|
-
fill = `url(#${gradientId})`;
|
|
48
|
-
} else if (typeof userFill === "string") {
|
|
49
|
-
fill = userFill;
|
|
50
|
-
}
|
|
51
|
-
const sliceCls = svgClass("p-chart-arc", `p-chart-series-${dataIndex}`, fill === void 0 && colorClassN, isHovered && "p-chart-point-hover", isInactive && "p-chart-point-inactive");
|
|
52
|
-
const pathAttrs = {
|
|
53
|
-
fill: fill ?? context.theme.series[dataIndex % context.theme.series.length],
|
|
54
|
-
"data-index": dataIndex,
|
|
55
|
-
class: sliceCls
|
|
56
|
-
};
|
|
57
|
-
const hasBorder = effectBorderWidth > 0 && effectBorderColor !== "transparent";
|
|
58
|
-
const PIXEL_MARGIN = CLIP_PIXEL_MARGIN;
|
|
59
|
-
const angleDelta = arcConfig.outerRadius > 0 ? PIXEL_MARGIN / arcConfig.outerRadius * (180 / Math.PI) : 0;
|
|
60
|
-
const clipId = `${context.chartId}-pie-${dsIdx}-clip-${dataIndex}`;
|
|
61
|
-
const clipPathNode = svgNode("clipPath", { id: clipId });
|
|
62
|
-
const expandedClipPath = buildSvgArcPath(
|
|
63
|
-
{
|
|
64
|
-
...arcConfig,
|
|
65
|
-
rotation: arcConfig.rotation - angleDelta,
|
|
66
|
-
endAngle: arcConfig.endAngle + angleDelta
|
|
67
|
-
},
|
|
68
|
-
fullCircle
|
|
69
|
-
);
|
|
70
|
-
const clipPathEl = createSvgPath(expandedClipPath, {});
|
|
71
|
-
appendChild(clipPathNode, clipPathEl);
|
|
72
|
-
appendChild(defs, clipPathNode);
|
|
73
|
-
hasDefs = true;
|
|
74
|
-
const fillPath = createSvgPath(pathD, { ...pathAttrs, "data-fill-path": "true" });
|
|
75
|
-
appendChild(sliceGroup, fillPath);
|
|
76
|
-
const strokeColor = hasBorder ? typeof effectBorderColor === "string" ? effectBorderColor : context.theme.borderColor : "transparent";
|
|
77
|
-
const strokeWidth = hasBorder ? borderAlign === "inner" ? effectBorderWidth * 2 : effectBorderWidth : 0;
|
|
78
|
-
const strokeAttrs = {
|
|
79
|
-
fill: "none",
|
|
80
|
-
stroke: strokeColor,
|
|
81
|
-
"stroke-width": strokeWidth,
|
|
82
|
-
"stroke-linejoin": borderJoinStyle,
|
|
83
|
-
"data-stroke-path": "true",
|
|
84
|
-
"data-clip-id": clipId
|
|
85
|
-
};
|
|
86
|
-
if (borderAlign === "inner") {
|
|
87
|
-
strokeAttrs["clip-path"] = `url(#${clipId})`;
|
|
88
|
-
}
|
|
89
|
-
if (hasBorder && effectBorderDash && effectBorderDash.length > 0) {
|
|
90
|
-
strokeAttrs["stroke-dasharray"] = effectBorderDash.join(" ");
|
|
91
|
-
if (effectBorderDashOffset > 0) {
|
|
92
|
-
strokeAttrs["stroke-dashoffset"] = effectBorderDashOffset;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const strokePath = createSvgPath(pathD, strokeAttrs);
|
|
96
|
-
appendChild(sliceGroup, strokePath);
|
|
97
|
-
const valueRadius = (outerRadius + innerRadius) / 2;
|
|
98
|
-
const midAngle = slice.rotation + (slice.endAngle - slice.rotation) / 2;
|
|
99
|
-
const contentX = Math.cos(toRad(midAngle)) * valueRadius;
|
|
100
|
-
const contentY = Math.sin(toRad(midAngle)) * valueRadius;
|
|
101
|
-
const contentSlot = createSvgGroup(`translate(${contentX}, ${contentY})`, {
|
|
102
|
-
class: "slice-content",
|
|
103
|
-
"data-content-index": dataIndex
|
|
104
|
-
});
|
|
105
|
-
appendChild(sliceGroup, contentSlot);
|
|
106
|
-
appendChild(group, sliceGroup);
|
|
107
|
-
}
|
|
108
|
-
if (hasDefs) {
|
|
109
|
-
prependChild(group, defs);
|
|
110
|
-
}
|
|
111
|
-
return group;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { renderPieSvg };
|
package/dist/chunk-VWF57TS3.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { computeSliceRenderStates } from './chunk-53HW45JB.mjs';
|
|
2
|
-
import { drawCanvasArc, CLIP_PIXEL_MARGIN } from './chunk-LVMDQ4OJ.mjs';
|
|
3
|
-
import { isGradientColor, remapStopsForDonut, createCanvasGradientFromColor } from './chunk-O2X6FF45.mjs';
|
|
4
|
-
import { withCanvasState } from './chunk-SSLTFJ3U.mjs';
|
|
5
|
-
|
|
6
|
-
// src/series/pie/canvas/index.ts
|
|
7
|
-
function renderPieCanvas(props, layout, ctx, context) {
|
|
8
|
-
const renderStates = computeSliceRenderStates(props, layout, context.theme);
|
|
9
|
-
const { slices: sliceStates, center, outerRadius, innerRadius, isFullCircle: fullCircle } = renderStates;
|
|
10
|
-
const borderJoinStyle = props.borderJoinStyle ?? "miter";
|
|
11
|
-
const borderAlign = props.borderAlign ?? "inner";
|
|
12
|
-
withCanvasState(ctx, () => {
|
|
13
|
-
for (const state of sliceStates) {
|
|
14
|
-
const { effectColor, effectBorderColor, effectBorderWidth, effectBorderDash, effectBorderDashOffset, opacity, offset, scale, arcConfig } = state;
|
|
15
|
-
const { dx, dy } = offset;
|
|
16
|
-
const cx = center.x + dx;
|
|
17
|
-
const cy = center.y + dy;
|
|
18
|
-
ctx.save();
|
|
19
|
-
if (scale !== 1) {
|
|
20
|
-
ctx.translate(cx, cy);
|
|
21
|
-
ctx.scale(scale, scale);
|
|
22
|
-
ctx.translate(-cx, -cy);
|
|
23
|
-
}
|
|
24
|
-
if (isGradientColor(effectColor)) {
|
|
25
|
-
const gradientColor = innerRadius > 0 && effectColor.radialGradient ? { ...effectColor, stops: remapStopsForDonut(effectColor.stops, innerRadius / outerRadius) } : effectColor;
|
|
26
|
-
ctx.fillStyle = createCanvasGradientFromColor(ctx, gradientColor, { x: cx, y: cy }, outerRadius);
|
|
27
|
-
} else {
|
|
28
|
-
ctx.fillStyle = effectColor;
|
|
29
|
-
}
|
|
30
|
-
ctx.globalAlpha = opacity;
|
|
31
|
-
drawCanvasArc(ctx, cx, cy, arcConfig, fullCircle);
|
|
32
|
-
ctx.fill();
|
|
33
|
-
if (effectBorderWidth > 0 && effectBorderColor !== "transparent") {
|
|
34
|
-
ctx.strokeStyle = typeof effectBorderColor === "string" ? effectBorderColor : context.theme.borderColor;
|
|
35
|
-
ctx.lineJoin = borderJoinStyle;
|
|
36
|
-
if (effectBorderDash && effectBorderDash.length > 0) {
|
|
37
|
-
ctx.setLineDash(effectBorderDash);
|
|
38
|
-
ctx.lineDashOffset = effectBorderDashOffset;
|
|
39
|
-
} else {
|
|
40
|
-
ctx.setLineDash([]);
|
|
41
|
-
}
|
|
42
|
-
if (borderAlign === "inner") {
|
|
43
|
-
ctx.save();
|
|
44
|
-
const _angleDeltaCanvas = arcConfig.outerRadius > 0 ? CLIP_PIXEL_MARGIN / arcConfig.outerRadius * (180 / Math.PI) : 0;
|
|
45
|
-
drawCanvasArc(ctx, cx, cy, { ...arcConfig, rotation: arcConfig.rotation - _angleDeltaCanvas, endAngle: arcConfig.endAngle + _angleDeltaCanvas }, fullCircle);
|
|
46
|
-
ctx.clip();
|
|
47
|
-
ctx.lineWidth = effectBorderWidth * 2;
|
|
48
|
-
drawCanvasArc(ctx, cx, cy, arcConfig, fullCircle);
|
|
49
|
-
ctx.stroke();
|
|
50
|
-
ctx.restore();
|
|
51
|
-
} else {
|
|
52
|
-
ctx.lineWidth = effectBorderWidth;
|
|
53
|
-
drawCanvasArc(ctx, cx, cy, arcConfig, fullCircle);
|
|
54
|
-
ctx.stroke();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
ctx.restore();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { renderPieCanvas };
|
package/dist/chunk-XIHBK5D3.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { renderTreemapCanvas } from './chunk-55Y3WI6S.mjs';
|
|
2
|
-
import { renderTreemapSvg } from './chunk-RO4N6YFS.mjs';
|
|
3
|
-
import { calculateTreemapLayout } from './chunk-VVI3OBPJ.mjs';
|
|
4
|
-
import { CHAR_WIDTH_RATIO } from './chunk-XTVE4P3L.mjs';
|
|
5
|
-
|
|
6
|
-
// src/series/treemap/geometry.ts
|
|
7
|
-
function hitTestTreemap(_x, _y, _props, layout) {
|
|
8
|
-
for (const cell of layout.cells) {
|
|
9
|
-
if (_x >= cell.x && _x <= cell.x + cell.width && _y >= cell.y && _y <= cell.y + cell.height) {
|
|
10
|
-
return cell.index;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/series/treemap/shared.ts
|
|
17
|
-
var LABEL_TIERS = [
|
|
18
|
-
{ minArea: 25e3, minWidth: 100, minHeight: 60, fontSize: 16, secondaryFontSize: 12, showSecondary: true },
|
|
19
|
-
{ minArea: 1e4, minWidth: 70, minHeight: 45, fontSize: 14, secondaryFontSize: 10, showSecondary: true },
|
|
20
|
-
{ minArea: 4e3, minWidth: 50, minHeight: 35, fontSize: 12, secondaryFontSize: 9, showSecondary: true },
|
|
21
|
-
{ minArea: 1500, minWidth: 38, minHeight: 26, fontSize: 10, secondaryFontSize: 8, showSecondary: true },
|
|
22
|
-
{ minArea: 600, minWidth: 28, minHeight: 20, fontSize: 9, secondaryFontSize: 0, showSecondary: false },
|
|
23
|
-
{ minArea: 250, minWidth: 22, minHeight: 14, fontSize: 8, secondaryFontSize: 0, showSecondary: false }
|
|
24
|
-
];
|
|
25
|
-
function getCellLabelInfo(cell, labelMinSize) {
|
|
26
|
-
const area = cell.width * cell.height;
|
|
27
|
-
const none = { fontSize: 0, secondaryFontSize: 0, showPrimary: false, showSecondary: false, cx: 0, cy: 0, primaryY: 0, secondaryY: 0 };
|
|
28
|
-
const minSize = labelMinSize ?? 30;
|
|
29
|
-
if (cell.width < minSize || cell.height < minSize) return none;
|
|
30
|
-
for (const tier of LABEL_TIERS) {
|
|
31
|
-
if (area >= tier.minArea && cell.width >= tier.minWidth && cell.height >= tier.minHeight) {
|
|
32
|
-
const primaryTextWidth = cell.label.length * CHAR_WIDTH_RATIO * tier.fontSize;
|
|
33
|
-
if (primaryTextWidth > cell.width - 8) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
let showSec = tier.showSecondary && !!cell.secondaryLabel;
|
|
37
|
-
if (showSec) {
|
|
38
|
-
const secTextWidth = (cell.secondaryLabel?.length ?? 0) * CHAR_WIDTH_RATIO * tier.secondaryFontSize;
|
|
39
|
-
if (secTextWidth > cell.width - 8) {
|
|
40
|
-
showSec = false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const cx = cell.x + cell.width / 2;
|
|
44
|
-
const cy = cell.y + cell.height / 2;
|
|
45
|
-
return {
|
|
46
|
-
fontSize: tier.fontSize,
|
|
47
|
-
secondaryFontSize: tier.secondaryFontSize,
|
|
48
|
-
showPrimary: true,
|
|
49
|
-
showSecondary: showSec,
|
|
50
|
-
cx,
|
|
51
|
-
cy,
|
|
52
|
-
primaryY: showSec ? cy - tier.fontSize * 0.4 : cy,
|
|
53
|
-
secondaryY: cy + tier.fontSize * 0.6
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/series/treemap/index.ts
|
|
61
|
-
var treemapRenderer = {
|
|
62
|
-
calculateLayout: calculateTreemapLayout,
|
|
63
|
-
renderSvg: (props, layout, context) => renderTreemapSvg(props, layout, context),
|
|
64
|
-
renderCanvas: (props, layout, ctx, context) => renderTreemapCanvas(props, layout, ctx, context),
|
|
65
|
-
hitTest: hitTestTreemap
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { getCellLabelInfo, hitTestTreemap, treemapRenderer };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { d as applyGradientBrightness, b as buildPieSvgChildren, r as renderCanvasCustomContent, a as renderCanvasDataLabels, e as restoreGradientBrightness, u as updatePieCustomContent, c as updateSvgSlices } from '../../canvas-D4vigq47.mjs';
|
|
2
|
-
import { RadialSliceState, SliceRenderInfo, SliceGeometry, SliceRenderContext } from '@primeui/chart-types';
|
|
3
|
-
|
|
4
|
-
/** Build a SliceRenderContext from animation state + render info */
|
|
5
|
-
declare function buildSliceRenderContext(slice: RadialSliceState, renderInfo: SliceRenderInfo, position: {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}, geo: SliceGeometry, chartCenter?: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}, fontFamily?: string): SliceRenderContext<unknown>;
|
|
12
|
-
|
|
13
|
-
export { buildSliceRenderContext };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { applyGradientBrightness, buildPieSvgChildren, buildSliceRenderContext, renderCanvasCustomContent, renderCanvasDataLabels, restoreGradientBrightness, updatePieCustomContent, updateSvgSlices } from '../../chunk-B4FTADAZ.mjs';
|
|
2
|
-
import '../../chunk-4C6EVJ54.mjs';
|
|
3
|
-
import '../../chunk-LVMDQ4OJ.mjs';
|
|
4
|
-
import '../../chunk-VGLSBZDN.mjs';
|
|
5
|
-
import '../../chunk-BZN2QHGP.mjs';
|
|
6
|
-
import '../../chunk-7CMVDIOU.mjs';
|
|
7
|
-
import '../../chunk-OXTFAWSK.mjs';
|
|
8
|
-
import '../../chunk-XTVE4P3L.mjs';
|
|
9
|
-
import '../../chunk-NKUYIWAP.mjs';
|
|
10
|
-
import '../../chunk-QS76E3TD.mjs';
|
|
11
|
-
import '../../chunk-O2X6FF45.mjs';
|
|
12
|
-
import '../../chunk-SSLTFJ3U.mjs';
|
|
13
|
-
import '../../chunk-RQ3CKQOX.mjs';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,135 @@
|
|
|
1
|
+
// src/utils/render/svg.utils.ts
|
|
2
|
+
function svgNode(tag, attributes, children) {
|
|
3
|
+
const attrs = {};
|
|
4
|
+
if (attributes) {
|
|
5
|
+
for (const k in attributes) {
|
|
6
|
+
const v = attributes[k];
|
|
7
|
+
if (v !== void 0) attrs[k] = String(v);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return { tag, attributes: attrs, children: children ? [...children] : [] };
|
|
11
|
+
}
|
|
12
|
+
function setAttr(node, key, value) {
|
|
13
|
+
node.attributes[key] = String(value);
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
function appendChild(parent, ...children) {
|
|
17
|
+
parent.children.push(...children);
|
|
18
|
+
return parent;
|
|
19
|
+
}
|
|
20
|
+
function prependChild(parent, child) {
|
|
21
|
+
parent.children.unshift(child);
|
|
22
|
+
return parent;
|
|
23
|
+
}
|
|
24
|
+
function addClass(node, cls) {
|
|
25
|
+
const existing = node.attributes["class"];
|
|
26
|
+
node.attributes["class"] = existing ? `${existing} ${cls}` : cls;
|
|
27
|
+
return node;
|
|
28
|
+
}
|
|
29
|
+
function svgClass(...parts) {
|
|
30
|
+
return parts.filter(Boolean).join(" ");
|
|
31
|
+
}
|
|
32
|
+
function createSvgGroup(transform, attributes) {
|
|
33
|
+
return svgNode("g", { ...attributes, ...transform ? { transform } : {} });
|
|
34
|
+
}
|
|
35
|
+
function createSvgPath(d, attributes) {
|
|
36
|
+
return svgNode("path", { d, ...attributes });
|
|
37
|
+
}
|
|
38
|
+
function createSvgText(x, y, content, attributes) {
|
|
39
|
+
const node = svgNode("text", { x, y, ...attributes });
|
|
40
|
+
if (content) node.children.push(content);
|
|
41
|
+
return node;
|
|
42
|
+
}
|
|
43
|
+
function createSvgRect(x, y, width, height, attributes) {
|
|
44
|
+
return svgNode("rect", {
|
|
45
|
+
x,
|
|
46
|
+
y,
|
|
47
|
+
width: Math.max(0, width),
|
|
48
|
+
height: Math.max(0, height),
|
|
49
|
+
...attributes
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function createSvgCircle(cx, cy, r, attributes) {
|
|
53
|
+
return svgNode("circle", { cx, cy, r, ...attributes });
|
|
54
|
+
}
|
|
55
|
+
function createSvgLine(x1, y1, x2, y2, attributes) {
|
|
56
|
+
return svgNode("line", { x1, y1, x2, y2, ...attributes });
|
|
57
|
+
}
|
|
58
|
+
function createSvgDefs() {
|
|
59
|
+
return svgNode("defs");
|
|
60
|
+
}
|
|
61
|
+
function createSvgLinearGradient(id, x1, y1, x2, y2, stops, options) {
|
|
62
|
+
const useAbsolute = options?.useAbsoluteCoords ?? false;
|
|
63
|
+
const gradient = svgNode("linearGradient", {
|
|
64
|
+
id,
|
|
65
|
+
x1: useAbsolute ? x1 : `${x1 * 100}%`,
|
|
66
|
+
y1: useAbsolute ? y1 : `${y1 * 100}%`,
|
|
67
|
+
x2: useAbsolute ? x2 : `${x2 * 100}%`,
|
|
68
|
+
y2: useAbsolute ? y2 : `${y2 * 100}%`,
|
|
69
|
+
...useAbsolute && { gradientUnits: "userSpaceOnUse" }
|
|
70
|
+
});
|
|
71
|
+
for (const { offset, color, opacity } of stops) {
|
|
72
|
+
gradient.children.push(
|
|
73
|
+
svgNode("stop", {
|
|
74
|
+
offset: `${offset * 100}%`,
|
|
75
|
+
"stop-color": color,
|
|
76
|
+
...opacity !== void 0 && { "stop-opacity": opacity }
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return gradient;
|
|
81
|
+
}
|
|
82
|
+
function createSvgRadialGradient(id, cx, cy, r, stops, options) {
|
|
83
|
+
const useAbsolute = options?.useAbsoluteCoords ?? false;
|
|
84
|
+
const gradient = svgNode("radialGradient", {
|
|
85
|
+
id,
|
|
86
|
+
cx: useAbsolute ? cx : `${cx * 100}%`,
|
|
87
|
+
cy: useAbsolute ? cy : `${cy * 100}%`,
|
|
88
|
+
r: useAbsolute ? r : `${r * 100}%`,
|
|
89
|
+
...useAbsolute && { gradientUnits: "userSpaceOnUse" }
|
|
90
|
+
});
|
|
91
|
+
for (const { offset, color, opacity } of stops) {
|
|
92
|
+
gradient.children.push(
|
|
93
|
+
svgNode("stop", {
|
|
94
|
+
offset: `${offset * 100}%`,
|
|
95
|
+
"stop-color": color,
|
|
96
|
+
...opacity !== void 0 && { "stop-opacity": opacity }
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return gradient;
|
|
101
|
+
}
|
|
102
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
103
|
+
var browserSvgElementFactory = {
|
|
104
|
+
createElement(tag) {
|
|
105
|
+
return document.createElementNS(SVG_NS, tag);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var activeSvgElementFactory = browserSvgElementFactory;
|
|
109
|
+
function setSvgElementFactory(factory) {
|
|
110
|
+
activeSvgElementFactory = factory ?? browserSvgElementFactory;
|
|
111
|
+
}
|
|
112
|
+
function createSvgElement(tag) {
|
|
113
|
+
return activeSvgElementFactory.createElement(tag);
|
|
114
|
+
}
|
|
115
|
+
function materializeSvgNode(node) {
|
|
116
|
+
const el = activeSvgElementFactory.createElement(node.tag);
|
|
117
|
+
for (const key in node.attributes) {
|
|
118
|
+
el.setAttribute(key, node.attributes[key]);
|
|
119
|
+
}
|
|
120
|
+
for (const child of node.children) {
|
|
121
|
+
if (typeof child === "string") {
|
|
122
|
+
el.textContent = child;
|
|
123
|
+
} else {
|
|
124
|
+
el.appendChild(materializeSvgNode(child));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return el;
|
|
128
|
+
}
|
|
129
|
+
function materializeSvgGroup(node) {
|
|
130
|
+
return materializeSvgNode(node);
|
|
131
|
+
}
|
|
132
|
+
|
|
1
133
|
// src/utils/color/parse.ts
|
|
2
134
|
function parseHexColor(hex) {
|
|
3
135
|
let h = hex.replace("#", "");
|
|
@@ -229,136 +361,4 @@ function createCanvasRadialGradient(ctx, cx, cy, innerRadius, outerRadius, stops
|
|
|
229
361
|
return gradient;
|
|
230
362
|
}
|
|
231
363
|
|
|
232
|
-
// src/utils/render/svg.utils.ts
|
|
233
|
-
function svgNode(tag, attributes, children) {
|
|
234
|
-
const attrs = {};
|
|
235
|
-
if (attributes) {
|
|
236
|
-
for (const k in attributes) {
|
|
237
|
-
const v = attributes[k];
|
|
238
|
-
if (v !== void 0) attrs[k] = String(v);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return { tag, attributes: attrs, children: children ? [...children] : [] };
|
|
242
|
-
}
|
|
243
|
-
function setAttr(node, key, value) {
|
|
244
|
-
node.attributes[key] = String(value);
|
|
245
|
-
return node;
|
|
246
|
-
}
|
|
247
|
-
function appendChild(parent, ...children) {
|
|
248
|
-
parent.children.push(...children);
|
|
249
|
-
return parent;
|
|
250
|
-
}
|
|
251
|
-
function prependChild(parent, child) {
|
|
252
|
-
parent.children.unshift(child);
|
|
253
|
-
return parent;
|
|
254
|
-
}
|
|
255
|
-
function addClass(node, cls) {
|
|
256
|
-
const existing = node.attributes["class"];
|
|
257
|
-
node.attributes["class"] = existing ? `${existing} ${cls}` : cls;
|
|
258
|
-
return node;
|
|
259
|
-
}
|
|
260
|
-
function svgClass(...parts) {
|
|
261
|
-
return parts.filter(Boolean).join(" ");
|
|
262
|
-
}
|
|
263
|
-
function createSvgGroup(transform, attributes) {
|
|
264
|
-
return svgNode("g", { ...attributes, ...transform ? { transform } : {} });
|
|
265
|
-
}
|
|
266
|
-
function createSvgPath(d, attributes) {
|
|
267
|
-
return svgNode("path", { d, ...attributes });
|
|
268
|
-
}
|
|
269
|
-
function createSvgText(x, y, content, attributes) {
|
|
270
|
-
const node = svgNode("text", { x, y, ...attributes });
|
|
271
|
-
if (content) node.children.push(content);
|
|
272
|
-
return node;
|
|
273
|
-
}
|
|
274
|
-
function createSvgRect(x, y, width, height, attributes) {
|
|
275
|
-
return svgNode("rect", {
|
|
276
|
-
x,
|
|
277
|
-
y,
|
|
278
|
-
width: Math.max(0, width),
|
|
279
|
-
height: Math.max(0, height),
|
|
280
|
-
...attributes
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
function createSvgCircle(cx, cy, r, attributes) {
|
|
284
|
-
return svgNode("circle", { cx, cy, r, ...attributes });
|
|
285
|
-
}
|
|
286
|
-
function createSvgLine(x1, y1, x2, y2, attributes) {
|
|
287
|
-
return svgNode("line", { x1, y1, x2, y2, ...attributes });
|
|
288
|
-
}
|
|
289
|
-
function createSvgDefs() {
|
|
290
|
-
return svgNode("defs");
|
|
291
|
-
}
|
|
292
|
-
function createSvgLinearGradient(id, x1, y1, x2, y2, stops, options) {
|
|
293
|
-
const useAbsolute = options?.useAbsoluteCoords ?? false;
|
|
294
|
-
const gradient = svgNode("linearGradient", {
|
|
295
|
-
id,
|
|
296
|
-
x1: useAbsolute ? x1 : `${x1 * 100}%`,
|
|
297
|
-
y1: useAbsolute ? y1 : `${y1 * 100}%`,
|
|
298
|
-
x2: useAbsolute ? x2 : `${x2 * 100}%`,
|
|
299
|
-
y2: useAbsolute ? y2 : `${y2 * 100}%`,
|
|
300
|
-
...useAbsolute && { gradientUnits: "userSpaceOnUse" }
|
|
301
|
-
});
|
|
302
|
-
for (const { offset, color, opacity } of stops) {
|
|
303
|
-
gradient.children.push(
|
|
304
|
-
svgNode("stop", {
|
|
305
|
-
offset: `${offset * 100}%`,
|
|
306
|
-
"stop-color": color,
|
|
307
|
-
...opacity !== void 0 && { "stop-opacity": opacity }
|
|
308
|
-
})
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
return gradient;
|
|
312
|
-
}
|
|
313
|
-
function createSvgRadialGradient(id, cx, cy, r, stops, options) {
|
|
314
|
-
const useAbsolute = options?.useAbsoluteCoords ?? false;
|
|
315
|
-
const gradient = svgNode("radialGradient", {
|
|
316
|
-
id,
|
|
317
|
-
cx: useAbsolute ? cx : `${cx * 100}%`,
|
|
318
|
-
cy: useAbsolute ? cy : `${cy * 100}%`,
|
|
319
|
-
r: useAbsolute ? r : `${r * 100}%`,
|
|
320
|
-
...useAbsolute && { gradientUnits: "userSpaceOnUse" }
|
|
321
|
-
});
|
|
322
|
-
for (const { offset, color, opacity } of stops) {
|
|
323
|
-
gradient.children.push(
|
|
324
|
-
svgNode("stop", {
|
|
325
|
-
offset: `${offset * 100}%`,
|
|
326
|
-
"stop-color": color,
|
|
327
|
-
...opacity !== void 0 && { "stop-opacity": opacity }
|
|
328
|
-
})
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
return gradient;
|
|
332
|
-
}
|
|
333
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
334
|
-
var browserSvgElementFactory = {
|
|
335
|
-
createElement(tag) {
|
|
336
|
-
return document.createElementNS(SVG_NS, tag);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
var activeSvgElementFactory = browserSvgElementFactory;
|
|
340
|
-
function setSvgElementFactory(factory) {
|
|
341
|
-
activeSvgElementFactory = factory ?? browserSvgElementFactory;
|
|
342
|
-
}
|
|
343
|
-
function createSvgElement(tag) {
|
|
344
|
-
return activeSvgElementFactory.createElement(tag);
|
|
345
|
-
}
|
|
346
|
-
function materializeSvgNode(node) {
|
|
347
|
-
const el = activeSvgElementFactory.createElement(node.tag);
|
|
348
|
-
for (const key in node.attributes) {
|
|
349
|
-
el.setAttribute(key, node.attributes[key]);
|
|
350
|
-
}
|
|
351
|
-
for (const child of node.children) {
|
|
352
|
-
if (typeof child === "string") {
|
|
353
|
-
el.textContent = child;
|
|
354
|
-
} else {
|
|
355
|
-
el.appendChild(materializeSvgNode(child));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return el;
|
|
359
|
-
}
|
|
360
|
-
function materializeSvgGroup(node) {
|
|
361
|
-
return materializeSvgNode(node);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
364
|
export { addClass, adjustBrightness, appendChild, brightenGradientStops, configureCanvasHiDPI, createCanvasLinearGradient, createCanvasRadialGradient, createSvgCircle, createSvgDefs, createSvgElement, createSvgGroup, createSvgLine, createSvgLinearGradient, createSvgPath, createSvgRadialGradient, createSvgRect, createSvgText, getDevicePixelRatio, hexToRgbString, hexToRgba, materializeSvgGroup, materializeSvgNode, parseColorToRGB, parseColorToRGBA, parseHexColor, prependChild, readCssNumber, setAttr, setColorParser, setSvgElementFactory, svgClass, svgNode, withCanvasState };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|