vue-data-ui 3.3.0 → 3.3.2
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/dist/{Arrow-CKLBHe3L.js → Arrow-DLi6NnGD.js} +1 -1
- package/dist/{BaseDraggableDialog-q3pgSDTz.js → BaseDraggableDialog-CVGErydD.js} +2 -2
- package/dist/{BaseIcon-CtqN7W_g.js → BaseIcon-eZbszQrv.js} +1 -1
- package/dist/{ColorPicker-Cr6rUDTP.js → ColorPicker-BoPM4Ejg.js} +2 -2
- package/dist/{DataTable-BeI6gYJX.js → DataTable-yAMEyP6y.js} +2 -2
- package/dist/{Legend-DsogCeTb.js → Legend-By4rru90.js} +2 -2
- package/dist/{NonSvgPenAndPaper-BDK_ucTG.js → NonSvgPenAndPaper-C7QqIewT.js} +3 -3
- package/dist/{PackageVersion-C9oklnuy.js → PackageVersion-r-Q1R3nV.js} +1 -1
- package/dist/{PenAndPaper-BxbYiPy4.js → PenAndPaper-Bo-lMUik.js} +3 -3
- package/dist/{Shape-DJG2zW7b.js → Shape-BceHSLHf.js} +1 -1
- package/dist/{Slicer-D6T4aUhr.js → Slicer-Znzt0gSE.js} +2 -2
- package/dist/{SparkTooltip-Cp0G9giW.js → SparkTooltip--YwqrrgZ.js} +1 -1
- package/dist/{Title-D17CJXko.js → Title-Camz1Lce.js} +1 -1
- package/dist/{Tooltip-CtVdvbZi.js → Tooltip-VOcQEHa4.js} +1 -1
- package/dist/{UserOptions-B3vCIe-u.js → UserOptions-CSja1SGU.js} +2 -2
- package/dist/components/arrow.js +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-accordion.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-annotator.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-icon.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-mini-loader.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-rating.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-smiley.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-heatmap.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy-canvas.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/{dom-to-png-BiyqJA3t.js → dom-to-png-DxyZSvDx.js} +1 -1
- package/dist/{img-6wPuVVtk.js → img-J2dLIr8Y.js} +1 -1
- package/dist/{lib-GIYcnm0E.js → lib-CEjkWSLj.js} +376 -374
- package/dist/{pdf-DjbHsnrb.js → pdf-anN8VbM7.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{useAutoSizeLabelsInsideViewbox-Csv3pVmh.js → useAutoSizeLabelsInsideViewbox-CovTrBjm.js} +1 -1
- package/dist/{useNestedProp-mxyyqd0B.js → useNestedProp-Ce3PwN8T.js} +1 -1
- package/dist/{usePrinter-DYRFiw7X.js → usePrinter-DJ1iH-F_.js} +2 -2
- package/dist/useResizeObserverEffect-DfnWps4W.js +109 -0
- package/dist/useSvgExport-DrjCWun4.js +750 -0
- package/dist/{vue-data-ui-DLU1snC3.js → vue-data-ui-BFdGl7rL.js} +64 -64
- package/dist/vue-data-ui.js +68 -68
- package/dist/{vue-ui-3d-bar-D6xoBrN6.js → vue-ui-3d-bar-kzlIaqHU.js} +7 -7
- package/dist/{vue-ui-accordion-Dch9YrCi.js → vue-ui-accordion-VTP418mC.js} +3 -3
- package/dist/{vue-ui-age-pyramid-D74mAaLA.js → vue-ui-age-pyramid-YFzQ15k1.js} +28 -35
- package/dist/{vue-ui-annotator-DwRwhrgB.js → vue-ui-annotator-CmwDyy9m.js} +7 -7
- package/dist/{vue-ui-bullet-D2qVUqWs.js → vue-ui-bullet-DdjpiM-T.js} +8 -8
- package/dist/{vue-ui-candlestick-C81k1_f9.js → vue-ui-candlestick-x9U5Ni0N.js} +31 -38
- package/dist/{vue-ui-carousel-table-DBIhnEj-.js → vue-ui-carousel-table-CRI_iPLn.js} +4 -4
- package/dist/{vue-ui-chestnut-CSM-_IWw.js → vue-ui-chestnut-YrEA5Gq3.js} +6 -6
- package/dist/{vue-ui-chord-BFW9nnNh.js → vue-ui-chord-D_2DdvpZ.js} +9 -9
- package/dist/{vue-ui-circle-pack-D6mTG5i0.js → vue-ui-circle-pack-xm9-OOAR.js} +7 -7
- package/dist/{vue-ui-cursor-BJmTAMpP.js → vue-ui-cursor-Dt8Zzw22.js} +2 -2
- package/dist/{vue-ui-dashboard-BdFLsK4u.js → vue-ui-dashboard-29ZuFoLn.js} +67 -67
- package/dist/{vue-ui-digits-DXum1rs6.js → vue-ui-digits-nKPRJ9Vz.js} +2 -2
- package/dist/{vue-ui-donut-CqefukGp.js → vue-ui-donut-BQptfVfE.js} +9 -9
- package/dist/{vue-ui-donut-evolution-DFIbK50s.js → vue-ui-donut-evolution-fiqngEFW.js} +76 -83
- package/dist/{vue-ui-dumbbell-DIo2ecGY.js → vue-ui-dumbbell-Cw45EBO0.js} +31 -38
- package/dist/{vue-ui-flow--kiGWaq4.js → vue-ui-flow-DPu9BjPy.js} +8 -8
- package/dist/{vue-ui-funnel-B8UHwj15.js → vue-ui-funnel-CtlDuNjO.js} +7 -7
- package/dist/{vue-ui-galaxy-eQZh_y3l.js → vue-ui-galaxy-BiVjoNHW.js} +8 -8
- package/dist/{vue-ui-gauge-DJ-E6L2T.js → vue-ui-gauge-CoM6Q3Nb.js} +8 -8
- package/dist/{vue-ui-gizmo-DFxlqPz7.js → vue-ui-gizmo-DXG8dS5u.js} +3 -3
- package/dist/{vue-ui-heatmap-CcAe5dDN.js → vue-ui-heatmap-D6n8AnCc.js} +194 -215
- package/dist/{vue-ui-history-plot-CgKvd7Jx.js → vue-ui-history-plot-C8WMHda_.js} +38 -45
- package/dist/{vue-ui-kpi-Ct2iyD49.js → vue-ui-kpi-Dphnwumo.js} +3 -3
- package/dist/{vue-ui-mini-loader-ByjcvXBB.js → vue-ui-mini-loader-DFk9GZ5V.js} +2 -2
- package/dist/{vue-ui-molecule-CGDBEAkX.js → vue-ui-molecule-DC4_vXt_.js} +6 -6
- package/dist/{vue-ui-mood-radar-D9GuK4cI.js → vue-ui-mood-radar-BgT5wMS0.js} +8 -8
- package/dist/{vue-ui-nested-donuts-CGKgOTX2.js → vue-ui-nested-donuts-D2gSqe1f.js} +8 -8
- package/dist/{vue-ui-onion-C5tE1Woz.js → vue-ui-onion-CEbv2ii4.js} +9 -9
- package/dist/{vue-ui-parallel-coordinate-plot-CVhD6IoH.js → vue-ui-parallel-coordinate-plot-budrvcwU.js} +38 -45
- package/dist/{vue-ui-quadrant-BGDCaOXv.js → vue-ui-quadrant-PpymeiXe.js} +9 -9
- package/dist/{vue-ui-quick-chart-CjXSB-2S.js → vue-ui-quick-chart-k6mjTD56.js} +207 -214
- package/dist/{vue-ui-radar-rhxkROX7.js → vue-ui-radar-C5NvYMnv.js} +9 -9
- package/dist/{vue-ui-rating-Bo9gSy-z.js → vue-ui-rating-eKlTJch9.js} +2 -2
- package/dist/{vue-ui-relation-circle-Qo8FKbL2.js → vue-ui-relation-circle-Df33aaUT.js} +8 -8
- package/dist/{vue-ui-ridgeline-ahOApbEC.js → vue-ui-ridgeline-BTw-37RS.js} +38 -45
- package/dist/{vue-ui-rings-DFAVaEBs.js → vue-ui-rings-C_s9xOtZ.js} +9 -9
- package/dist/{vue-ui-scatter-zjlWyvVd.js → vue-ui-scatter-Jd8bQ0S5.js} +9 -9
- package/dist/{vue-ui-skeleton-CKfOnyd_.js → vue-ui-skeleton-Ce7H57o7.js} +3 -3
- package/dist/{vue-ui-smiley-CY7UiJ9C.js → vue-ui-smiley-C4mhT7ZV.js} +2 -2
- package/dist/{vue-ui-spark-trend-DwNYP97M.js → vue-ui-spark-trend-DQy4iSO7.js} +3 -3
- package/dist/{vue-ui-sparkbar-BkdcYrmg.js → vue-ui-sparkbar-CUFTHql0.js} +3 -3
- package/dist/{vue-ui-sparkgauge-C6Kq_OGV.js → vue-ui-sparkgauge-CcykuBps.js} +3 -3
- package/dist/{vue-ui-sparkhistogram-CjB33yXB.js → vue-ui-sparkhistogram-CyGvYpYn.js} +4 -4
- package/dist/{vue-ui-sparkline-DcH4yIEd.js → vue-ui-sparkline-CLWJM6hA.js} +3 -3
- package/dist/{vue-ui-sparkstackbar-MKr2u_pO.js → vue-ui-sparkstackbar-Cln1pduE.js} +3 -3
- package/dist/{vue-ui-stackbar-DKV-exfd.js → vue-ui-stackbar-DIUil9DO.js} +31 -46
- package/dist/{vue-ui-strip-plot-ncTrDlNC.js → vue-ui-strip-plot-C4U0fT5D.js} +106 -113
- package/dist/{vue-ui-table-BdT3lGuv.js → vue-ui-table-DpdP3PDq.js} +5 -5
- package/dist/{vue-ui-table-heatmap-D929cWB0.js → vue-ui-table-heatmap-J29d8nds.js} +5 -5
- package/dist/{vue-ui-table-sparkline-CkZ_ygR1.js → vue-ui-table-sparkline-Chf5YY4A.js} +4 -4
- package/dist/{vue-ui-thermometer-CjBLR6H9.js → vue-ui-thermometer-D6RmaNE6.js} +8 -8
- package/dist/{vue-ui-timer-Bs7eMmiC.js → vue-ui-timer-C5E1kJRt.js} +5 -5
- package/dist/{vue-ui-tiremarks-nGOZKRcz.js → vue-ui-tiremarks-D0erVBnj.js} +7 -7
- package/dist/{vue-ui-treemap-SQ2f5wbN.js → vue-ui-treemap-K8FYxuYz.js} +10 -10
- package/dist/{vue-ui-vertical-bar-Hh9gAN5j.js → vue-ui-vertical-bar-BA3OY8Sh.js} +10 -10
- package/dist/{vue-ui-waffle-C7moVBln.js → vue-ui-waffle-CgLgPuro.js} +9 -9
- package/dist/{vue-ui-wheel-KrGLMCqW.js → vue-ui-wheel-C_cOUhCs.js} +7 -7
- package/dist/{vue-ui-word-cloud-BQSu6kiR.js → vue-ui-word-cloud-uvHNOIpN.js} +7 -7
- package/dist/{vue-ui-world-DdoMFJcV.js → vue-ui-world-DmeNMwpX.js} +7 -7
- package/dist/{vue-ui-xy-canvas-oUXISeU8.js → vue-ui-xy-canvas-BQKR36bd.js} +10 -10
- package/dist/{vue-ui-xy-B2fjTYMJ.js → vue-ui-xy-tWE4H5ij.js} +278 -285
- package/package.json +1 -1
- package/dist/useSvgExport-B7-Vrjtu.js +0 -732
- package/dist/useTimeLabelCollider-CIsgDrl9.js +0 -78
|
@@ -1,732 +0,0 @@
|
|
|
1
|
-
import { isRef as zt, ref as St, onMounted as Lt, watch as Pt, nextTick as Rt, unref as Vt } from "vue";
|
|
2
|
-
const Z = "http://www.w3.org/2000/svg", xt = "http://www.w3.org/1999/xlink", Tt = 'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif';
|
|
3
|
-
let At = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
function mt(M) {
|
|
5
|
-
let N = At.get(M);
|
|
6
|
-
return N || (N = getComputedStyle(M), At.set(M, N)), N;
|
|
7
|
-
}
|
|
8
|
-
function Ct() {
|
|
9
|
-
At = /* @__PURE__ */ new WeakMap();
|
|
10
|
-
}
|
|
11
|
-
function V(M) {
|
|
12
|
-
return document.createElementNS(Z, M);
|
|
13
|
-
}
|
|
14
|
-
function yt(M) {
|
|
15
|
-
return `${M}, ${Tt}`;
|
|
16
|
-
}
|
|
17
|
-
function Ht({
|
|
18
|
-
svg: M,
|
|
19
|
-
// ref
|
|
20
|
-
title: N,
|
|
21
|
-
// computed
|
|
22
|
-
legend: _,
|
|
23
|
-
// computed
|
|
24
|
-
legendItems: Q,
|
|
25
|
-
// computed
|
|
26
|
-
backgroundColor: tt,
|
|
27
|
-
// computed
|
|
28
|
-
stretchTitle: G = !1,
|
|
29
|
-
// bool (when rotateX is applied on the svg like in VueUiWheel, title transform style needs to be compensated)
|
|
30
|
-
titleEmbedded: rt = !1
|
|
31
|
-
// when title is already part of the svg (VueUiChestnut)
|
|
32
|
-
}) {
|
|
33
|
-
const ot = zt(M) ? M : St(M), J = St(!1), T = [
|
|
34
|
-
"fill",
|
|
35
|
-
"fill-opacity",
|
|
36
|
-
"stroke",
|
|
37
|
-
"stroke-width",
|
|
38
|
-
"stroke-opacity",
|
|
39
|
-
"opacity",
|
|
40
|
-
"color",
|
|
41
|
-
"stroke-linecap",
|
|
42
|
-
"stroke-linejoin",
|
|
43
|
-
"stroke-miterlimit",
|
|
44
|
-
"stroke-dasharray",
|
|
45
|
-
"stroke-dashoffset",
|
|
46
|
-
"font-family",
|
|
47
|
-
"font-size",
|
|
48
|
-
"font-style",
|
|
49
|
-
"font-weight",
|
|
50
|
-
"font-variant",
|
|
51
|
-
"letter-spacing",
|
|
52
|
-
"word-spacing",
|
|
53
|
-
"text-anchor",
|
|
54
|
-
"dominant-baseline",
|
|
55
|
-
"shape-rendering",
|
|
56
|
-
"vector-effect",
|
|
57
|
-
"paint-order",
|
|
58
|
-
"mix-blend-mode",
|
|
59
|
-
"isolation",
|
|
60
|
-
"filter",
|
|
61
|
-
"clip-path",
|
|
62
|
-
"mask",
|
|
63
|
-
"transform",
|
|
64
|
-
"transform-origin",
|
|
65
|
-
"visibility",
|
|
66
|
-
"display"
|
|
67
|
-
], x = /* @__PURE__ */ new Set(["font-family"]);
|
|
68
|
-
async function g({ timeoutMs: n = 4e3, log: s = "warn" } = {}) {
|
|
69
|
-
if (typeof window > "u" || typeof document > "u")
|
|
70
|
-
return console.warn("SVG export only works in the browser."), null;
|
|
71
|
-
const c = performance.now() + n, u = () => {
|
|
72
|
-
const A = Vt(ot);
|
|
73
|
-
return A && document.contains(A) ? A : null;
|
|
74
|
-
};
|
|
75
|
-
let a = u();
|
|
76
|
-
if (a)
|
|
77
|
-
return a;
|
|
78
|
-
let t = !1;
|
|
79
|
-
const m = (A) => {
|
|
80
|
-
if (!t && A)
|
|
81
|
-
try {
|
|
82
|
-
A.disconnect();
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
t = !0;
|
|
86
|
-
};
|
|
87
|
-
let w;
|
|
88
|
-
const v = new Promise((A) => {
|
|
89
|
-
try {
|
|
90
|
-
w = new MutationObserver(() => {
|
|
91
|
-
const k = u();
|
|
92
|
-
k && (m(w), A(k));
|
|
93
|
-
}), w.observe(document.documentElement, { childList: !0, subtree: !0 });
|
|
94
|
-
} catch {
|
|
95
|
-
A(null);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
for (; performance.now() < c; ) {
|
|
99
|
-
const A = await Promise.race([
|
|
100
|
-
v,
|
|
101
|
-
new Promise((k) => requestAnimationFrame(k))
|
|
102
|
-
]);
|
|
103
|
-
if (await Rt(), a = u() || A, a)
|
|
104
|
-
return m(w), a;
|
|
105
|
-
}
|
|
106
|
-
return m(w), console.warn("SVG element not found or not mounted (timed out)."), null;
|
|
107
|
-
}
|
|
108
|
-
Lt(async () => {
|
|
109
|
-
try {
|
|
110
|
-
await g(), J.value = !0;
|
|
111
|
-
} catch {
|
|
112
|
-
J.value = !1;
|
|
113
|
-
}
|
|
114
|
-
}), Pt(ot, async () => {
|
|
115
|
-
try {
|
|
116
|
-
await g(), J.value = !0;
|
|
117
|
-
} catch {
|
|
118
|
-
J.value = !1;
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const $ = /* @__PURE__ */ new Map();
|
|
122
|
-
function F(n) {
|
|
123
|
-
if ($.has(n))
|
|
124
|
-
return $.get(n);
|
|
125
|
-
const s = V("svg");
|
|
126
|
-
s.setAttribute("width", "0"), s.setAttribute("height", "0"), s.style.position = "absolute", s.style.left = "-99999px", s.style.top = "-99999px";
|
|
127
|
-
const c = V(n);
|
|
128
|
-
s.appendChild(c), document.body.appendChild(s);
|
|
129
|
-
const u = window.getComputedStyle(c), a = {};
|
|
130
|
-
for (const t of T)
|
|
131
|
-
a[t] = u.getPropertyValue(t);
|
|
132
|
-
return document.body.removeChild(s), $.set(n, a), a;
|
|
133
|
-
}
|
|
134
|
-
function O(n) {
|
|
135
|
-
const s = mt(n), c = F(n.tagName.toLowerCase()), u = [];
|
|
136
|
-
for (const a of T) {
|
|
137
|
-
let t = s.getPropertyValue(a) || "";
|
|
138
|
-
const m = c[a] || "";
|
|
139
|
-
if (x.has(a)) {
|
|
140
|
-
a === "font-family" && t && (t = yt(t)), t && u.push(`${a}:${t};`);
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
t && t !== m && u.push(`${a}:${t};`);
|
|
144
|
-
}
|
|
145
|
-
return u.join("");
|
|
146
|
-
}
|
|
147
|
-
function L(n, s) {
|
|
148
|
-
n.getAttribute("width") && s.setAttribute("width", n.getAttribute("width")), n.getAttribute("height") && s.setAttribute("height", n.getAttribute("height")), n.getAttribute("viewBox") && s.setAttribute("viewBox", n.getAttribute("viewBox"));
|
|
149
|
-
const c = [n, ...Array.from(n.querySelectorAll("*"))], u = [s, ...Array.from(s.querySelectorAll("*"))];
|
|
150
|
-
for (let a = 0; a < c.length; a += 1) {
|
|
151
|
-
const t = c[a], m = u[a], w = O(t);
|
|
152
|
-
w && m.setAttribute("style", w), ["fill", "stroke", "filter", "clip-path", "mask"].forEach((v) => {
|
|
153
|
-
const A = t.getAttribute(v);
|
|
154
|
-
A && m.setAttribute(v, A);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function W(n) {
|
|
159
|
-
const s = n.getAttribute("viewBox");
|
|
160
|
-
if (!s)
|
|
161
|
-
return null;
|
|
162
|
-
const [c, u, a, t] = s.split(/\s+|,/).map(Number);
|
|
163
|
-
return [c, u, a, t].some((m) => Number.isNaN(m)) ? null : { minX: c, minY: u, width: a, height: t };
|
|
164
|
-
}
|
|
165
|
-
function st(n) {
|
|
166
|
-
n.getAttribute("xmlns") || n.setAttribute("xmlns", Z), n.getAttribute("xmlns:xlink") || n.setAttribute("xmlns:xlink", xt), n.getAttribute("xml:space") || n.setAttribute("xml:space", "preserve");
|
|
167
|
-
}
|
|
168
|
-
function et(n) {
|
|
169
|
-
const s = document.createElement("div");
|
|
170
|
-
return s.style.position = "absolute", s.style.left = "-99999px", s.style.top = "-99999px", s.style.width = "0", s.style.height = "0", document.body.appendChild(s), s.appendChild(n), s;
|
|
171
|
-
}
|
|
172
|
-
function j(n) {
|
|
173
|
-
try {
|
|
174
|
-
n.remove();
|
|
175
|
-
} catch {
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function ct(n, s, c, u, a) {
|
|
179
|
-
if (!N.value || !N.value.text)
|
|
180
|
-
return 0;
|
|
181
|
-
const t = {
|
|
182
|
-
text: N.value.text || "",
|
|
183
|
-
color: N.value.color || "#111",
|
|
184
|
-
fontSize: N.value.fontSize || 20,
|
|
185
|
-
bold: !!N.value.bold,
|
|
186
|
-
textAlign: (N.value?.textAlign || "center").toLowerCase(),
|
|
187
|
-
paddingLeft: N.value.paddingLeft ?? 0,
|
|
188
|
-
paddingRight: N.value.paddingRight ?? 0,
|
|
189
|
-
subtitle: N.value.subtitle || null
|
|
190
|
-
}, m = V("g");
|
|
191
|
-
m.setAttribute("id", "__vdu_export_title"), n.appendChild(m);
|
|
192
|
-
const w = c + t.paddingLeft, v = c + s - (t.paddingRight || 0), A = c + s / 2;
|
|
193
|
-
let k = "start", B = w;
|
|
194
|
-
t.textAlign === "center" ? (k = "middle", B = A) : t.textAlign === "right" && (k = "end", B = v);
|
|
195
|
-
const E = u, U = Math.round(t.fontSize * 0.4), R = V("text");
|
|
196
|
-
R.setAttribute("x", String(B)), R.setAttribute("y", String(E + t.fontSize)), R.setAttribute("text-anchor", k), R.setAttribute("dominant-baseline", "ideographic"), R.setAttribute("style", `font-family:${a}; font-size:${t.fontSize}px; font-weight:${t.bold ? "700" : "400"}; fill:${t.color}; ${G ? "transform: scale(0.65, 1); transform-origin: center;" : ""}`), R.textContent = t.text, m.appendChild(R);
|
|
197
|
-
let q = t.fontSize;
|
|
198
|
-
if (t.subtitle && t.subtitle.text) {
|
|
199
|
-
const Y = {
|
|
200
|
-
color: t.subtitle.color || "#666",
|
|
201
|
-
text: t.subtitle.text,
|
|
202
|
-
fontSize: t.subtitle.fontSize || Math.max(12, Math.round(t.fontSize * 0.8)),
|
|
203
|
-
bold: !!t.subtitle.bold
|
|
204
|
-
}, r = V("text");
|
|
205
|
-
r.setAttribute("x", String(B)), r.setAttribute("y", String(E + t.fontSize + U + Y.fontSize)), r.setAttribute("text-anchor", k), r.setAttribute("dominant-baseline", "ideographic"), r.setAttribute("style", `font-family:${a}; font-size:${Y.fontSize}px; font-weight:${Y.bold ? "600" : "400"}; fill:${Y.color}; ${G ? "transform: scale(0.65, 1); transform-origin: center;" : ""}`), r.textContent = Y.text, m.appendChild(r), q += U + Y.fontSize;
|
|
206
|
-
}
|
|
207
|
-
return q + Math.round(t.fontSize * 0.4);
|
|
208
|
-
}
|
|
209
|
-
function ut(n, s, c, u, a) {
|
|
210
|
-
if (!_.value || !_.value.show || !Array.isArray(Q.value) || !Q.value.length)
|
|
211
|
-
return 0;
|
|
212
|
-
const t = {
|
|
213
|
-
bold: !!_.value.bold,
|
|
214
|
-
backgroundColor: _.value.backgroundColor || "transparent",
|
|
215
|
-
color: _.value.color || "#111",
|
|
216
|
-
fontSize: _.value.fontSize || 14,
|
|
217
|
-
paddingX: 14,
|
|
218
|
-
paddingY: 10,
|
|
219
|
-
itemGapX: 18,
|
|
220
|
-
itemGapY: 12,
|
|
221
|
-
markerSize: Math.max(8, Math.round((_.value.fontSize || 14) * 0.9)),
|
|
222
|
-
markerTextGap: 8,
|
|
223
|
-
lineHeight: Math.round((_.value.fontSize || 14) * 1.2),
|
|
224
|
-
maxWidth: s
|
|
225
|
-
}, m = V("g");
|
|
226
|
-
m.setAttribute("id", "__vdu_export_legend"), m.setAttribute("transform", `translate(${c}, ${u})`), n.appendChild(m);
|
|
227
|
-
const w = V("rect");
|
|
228
|
-
w.setAttribute("rx", "6"), w.setAttribute("ry", "6"), w.setAttribute("fill", t.backgroundColor), m.appendChild(w);
|
|
229
|
-
const v = V("g");
|
|
230
|
-
m.appendChild(v);
|
|
231
|
-
const A = V("text");
|
|
232
|
-
A.setAttribute("x", "0"), A.setAttribute("y", "0"), A.setAttribute("style", `font-family:${a}; font-size:${t.fontSize}px; font-weight:${t.bold ? "600" : "400"}; opacity:0;`), v.appendChild(A);
|
|
233
|
-
const k = (o) => (A.textContent = o || "", A.getComputedTextLength()), B = Math.max(1, t.maxWidth - t.paddingX * 2);
|
|
234
|
-
function E(o, l) {
|
|
235
|
-
const d = String(o || "").split(/\s+/).filter(Boolean), y = [];
|
|
236
|
-
if (!d.length)
|
|
237
|
-
return [""];
|
|
238
|
-
let p = d.shift();
|
|
239
|
-
for (; d.length; ) {
|
|
240
|
-
const S = `${p} ${d[0]}`;
|
|
241
|
-
if (k(S) <= l)
|
|
242
|
-
p = S, d.shift();
|
|
243
|
-
else if (k(p) > l && p.length > 1) {
|
|
244
|
-
let C = "";
|
|
245
|
-
for (const H of p) {
|
|
246
|
-
const I = C + H;
|
|
247
|
-
if (k(I) <= l)
|
|
248
|
-
C = I;
|
|
249
|
-
else break;
|
|
250
|
-
}
|
|
251
|
-
const z = p.slice(C.length);
|
|
252
|
-
y.push(C), p = z.length ? z : d.shift() || "";
|
|
253
|
-
} else
|
|
254
|
-
y.push(p), p = d.shift() || "";
|
|
255
|
-
}
|
|
256
|
-
p && y.push(p);
|
|
257
|
-
const b = y[y.length - 1] || "";
|
|
258
|
-
if (k(b) > l && b.length > 1) {
|
|
259
|
-
let S = "";
|
|
260
|
-
for (const z of b) {
|
|
261
|
-
const H = S + z;
|
|
262
|
-
if (k(H) <= l)
|
|
263
|
-
S = H;
|
|
264
|
-
else break;
|
|
265
|
-
}
|
|
266
|
-
const C = b.slice(S.length);
|
|
267
|
-
y[y.length - 1] = S, C && y.push(C);
|
|
268
|
-
}
|
|
269
|
-
return y;
|
|
270
|
-
}
|
|
271
|
-
const U = Math.PI / 180;
|
|
272
|
-
function R(o, l, d, y, p = -90) {
|
|
273
|
-
const b = p * U;
|
|
274
|
-
let S = "";
|
|
275
|
-
for (let C = 0; C < d; C += 1) {
|
|
276
|
-
const z = b + C * 2 * Math.PI / d, H = o + Math.cos(z) * y, I = l + Math.sin(z) * y;
|
|
277
|
-
S += (C === 0 ? "M" : "L") + H + "," + I;
|
|
278
|
-
}
|
|
279
|
-
return S + "Z";
|
|
280
|
-
}
|
|
281
|
-
function q(o, l, d = 5, y, p) {
|
|
282
|
-
const b = -90 * U;
|
|
283
|
-
let S = "";
|
|
284
|
-
for (let C = 0; C < d * 2; C += 1) {
|
|
285
|
-
const z = C % 2 === 0 ? y : p, H = b + C * Math.PI / d, I = o + Math.cos(H) * z, D = l + Math.sin(H) * z;
|
|
286
|
-
S += (C === 0 ? "M" : "L") + I + "," + D;
|
|
287
|
-
}
|
|
288
|
-
return S + "Z";
|
|
289
|
-
}
|
|
290
|
-
const Y = Q.value.map((o) => {
|
|
291
|
-
const l = Math.max(1, B - (t.markerSize + t.markerTextGap)), d = E(o.name || "", l), y = Math.max(...d.map(k), 0), p = t.markerSize + t.markerTextGap + y, b = Math.max(t.markerSize, d.length * t.lineHeight);
|
|
292
|
-
return {
|
|
293
|
-
...o,
|
|
294
|
-
lines: d,
|
|
295
|
-
itemW: p,
|
|
296
|
-
itemH: b
|
|
297
|
-
};
|
|
298
|
-
}), r = [];
|
|
299
|
-
let i = {
|
|
300
|
-
items: [],
|
|
301
|
-
width: 0,
|
|
302
|
-
height: 0
|
|
303
|
-
};
|
|
304
|
-
for (const o of Y) {
|
|
305
|
-
const l = (i.items.length ? t.itemGapX : 0) + o.itemW;
|
|
306
|
-
i.items.length && i.width + l > B ? (r.push(i), i = {
|
|
307
|
-
items: [o],
|
|
308
|
-
width: o.itemW,
|
|
309
|
-
height: o.itemH
|
|
310
|
-
}) : (i.items.push(o), i.width += l, i.height = Math.max(i.height, o.itemH));
|
|
311
|
-
}
|
|
312
|
-
i.items.length && r.push(i);
|
|
313
|
-
let e = t.paddingY;
|
|
314
|
-
for (const o of r) {
|
|
315
|
-
let d = Math.max(t.paddingX, (t.maxWidth - o.width) / 2);
|
|
316
|
-
for (let y = 0; y < o.items.length; y += 1) {
|
|
317
|
-
const p = o.items[y], b = d + t.markerSize / 2, S = e + o.height / 2.5, C = t.markerSize / 2, z = String(p.shape || "rect").toLowerCase();
|
|
318
|
-
if (z === "circle") {
|
|
319
|
-
const f = V("circle");
|
|
320
|
-
f.setAttribute("cx", String(b)), f.setAttribute("cy", String(S)), f.setAttribute("r", String(C * 0.8)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
321
|
-
} else if (z === "rect" || z === "square") {
|
|
322
|
-
const f = V("path");
|
|
323
|
-
f.setAttribute("d", R(b, S, 4, C, -45)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
324
|
-
} else if (z === "diamond") {
|
|
325
|
-
const f = V("path");
|
|
326
|
-
f.setAttribute("d", R(b, S, 4, C, 45)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
327
|
-
} else if (z === "triangle") {
|
|
328
|
-
const f = V("path");
|
|
329
|
-
f.setAttribute("d", R(b, S, 3, C, -90)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
330
|
-
} else if (z === "pentagon") {
|
|
331
|
-
const f = V("path");
|
|
332
|
-
f.setAttribute("d", R(b, S, 5, C, -90)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
333
|
-
} else if (z === "hexagon") {
|
|
334
|
-
const f = V("path");
|
|
335
|
-
f.setAttribute("d", R(b, S, 6, C, 0)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
336
|
-
} else if (z === "star") {
|
|
337
|
-
const f = V("path"), K = C, dt = C * 0.5;
|
|
338
|
-
f.setAttribute("d", q(b, S, 5, K, dt)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
339
|
-
} else {
|
|
340
|
-
const f = V("rect");
|
|
341
|
-
f.setAttribute("x", String(d)), f.setAttribute("y", String(e + (o.height - t.markerSize) / 2)), f.setAttribute("width", String(t.markerSize)), f.setAttribute("height", String(t.markerSize)), f.setAttribute("fill", p.color || "#000"), v.appendChild(f);
|
|
342
|
-
}
|
|
343
|
-
const H = d + t.markerSize + t.markerTextGap, I = e + (o.height - p.lines.length * t.lineHeight) / 2 + t.fontSize, D = V("text");
|
|
344
|
-
D.setAttribute("x", String(H)), D.setAttribute("y", String(I)), D.setAttribute("style", `font-family:${a}; font-size:${t.fontSize}px; font-weight:${t.bold ? "600" : "400"}; fill:${t.color};`), D.setAttribute("dominant-baseline", "ideographic");
|
|
345
|
-
let pt = !0;
|
|
346
|
-
for (const f of p.lines) {
|
|
347
|
-
const K = V("tspan");
|
|
348
|
-
pt || K.setAttribute("dy", String(t.lineHeight)), K.setAttribute("x", String(H)), K.textContent = f, D.appendChild(K), pt = !1;
|
|
349
|
-
}
|
|
350
|
-
v.appendChild(D), d += p.itemW + (y < o.items.length - 1 ? t.itemGapX : 0);
|
|
351
|
-
}
|
|
352
|
-
e += o.height + t.itemGapY;
|
|
353
|
-
}
|
|
354
|
-
r.length && (e -= t.itemGapY);
|
|
355
|
-
const h = e + t.paddingY;
|
|
356
|
-
return w.setAttribute("x", "0"), w.setAttribute("y", "0"), w.setAttribute("width", String(t.maxWidth)), w.setAttribute("height", String(h)), A.remove(), h + Math.round(t.fontSize * 0.4);
|
|
357
|
-
}
|
|
358
|
-
function P(n) {
|
|
359
|
-
const s = n.cloneNode(!0);
|
|
360
|
-
return s.querySelectorAll("script").forEach((c) => c.remove()), L(n, s), st(s), s;
|
|
361
|
-
}
|
|
362
|
-
function ft(n) {
|
|
363
|
-
const s = Array.from(n.childNodes).filter((a) => a.nodeType === 1 && a.nodeName.toLowerCase() === "defs"), c = Array.from(n.childNodes).filter((a) => !(a.nodeType === 1 && a.nodeName.toLowerCase() === "defs")), u = document.createElementNS(Z, "g");
|
|
364
|
-
u.setAttribute("id", "__vdu_export_content");
|
|
365
|
-
for (const a of c) u.appendChild(a);
|
|
366
|
-
for (const a of s) n.appendChild(a);
|
|
367
|
-
return n.appendChild(u), u;
|
|
368
|
-
}
|
|
369
|
-
function X(n, s) {
|
|
370
|
-
s <= 0 || n.setAttribute("transform", `translate(0, ${s})`);
|
|
371
|
-
}
|
|
372
|
-
function nt(n, s) {
|
|
373
|
-
if (s <= 0) return;
|
|
374
|
-
const c = W(n), u = n.getAttribute("height");
|
|
375
|
-
if (c)
|
|
376
|
-
n.setAttribute("viewBox", `${c.minX} ${c.minY} ${c.width} ${c.height + s}`), u && n.setAttribute("height", String(Number(u) + s));
|
|
377
|
-
else if (u)
|
|
378
|
-
n.setAttribute("height", String(Number(u) + s));
|
|
379
|
-
else {
|
|
380
|
-
const a = n.getBBox();
|
|
381
|
-
n.setAttribute("viewBox", `0 0 ${Math.max(1, a.width)} ${Math.max(1, a.height + s)}`);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
function it(n) {
|
|
385
|
-
const s = W(n);
|
|
386
|
-
if (s)
|
|
387
|
-
return s.width;
|
|
388
|
-
const c = Number(n.getAttribute("width"));
|
|
389
|
-
return !Number.isNaN(c) && c > 0 ? c : n.getBBox().width || 0;
|
|
390
|
-
}
|
|
391
|
-
function gt(n) {
|
|
392
|
-
const s = W(n);
|
|
393
|
-
if (s) return s.height;
|
|
394
|
-
const c = Number(n.getAttribute("height"));
|
|
395
|
-
return !Number.isNaN(c) && c > 0 ? c : n.getBBox().height || 0;
|
|
396
|
-
}
|
|
397
|
-
async function at(n) {
|
|
398
|
-
const s = et(n);
|
|
399
|
-
Ct();
|
|
400
|
-
try {
|
|
401
|
-
if (document.fonts?.ready)
|
|
402
|
-
try {
|
|
403
|
-
await Promise.race([document.fonts.ready, new Promise((U) => setTimeout(U, 4e3))]);
|
|
404
|
-
} catch {
|
|
405
|
-
}
|
|
406
|
-
const c = ft(n), u = W(n), a = u ? u.minX : 0, t = u ? u.minY : 0, m = Math.max(1, it(n)), w = Math.max(1, gt(n)), v = yt(mt(n).getPropertyValue("font-family") || "");
|
|
407
|
-
let k = (rt ? null : ct(n, m, a, t, v)) ?? 0;
|
|
408
|
-
const B = _ && _.value && _.value.position ? String(_.value.position).toLowerCase() : "top";
|
|
409
|
-
_ && _.value && _.value.show && B === "top" && (k += ut(n, m, a, t + k, v)), X(c, k);
|
|
410
|
-
let E = 0;
|
|
411
|
-
_ && _.value && _.value.show && B === "bottom" && (E += ut(n, m, a, t + k + w, v)), nt(n, k + E), n.style.backgroundColor = tt.value ?? "#FFF", await Bt(n, { mode: "raster" }), Wt(n, N.value.text ? -6 : -48);
|
|
412
|
-
} finally {
|
|
413
|
-
j(s), Ct();
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
async function lt() {
|
|
417
|
-
const n = await g(), s = P(n);
|
|
418
|
-
await at(s);
|
|
419
|
-
const u = `<?xml version="1.0" standalone="no"?>
|
|
420
|
-
${new XMLSerializer().serializeToString(s)}`, a = new Blob([u], { type: "image/svg+xml;charset=utf-8" }), t = URL.createObjectURL(a), m = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`;
|
|
421
|
-
return { blob: a, url: t, text: u, dataUrl: m };
|
|
422
|
-
}
|
|
423
|
-
async function ht(n) {
|
|
424
|
-
const { url: s } = await lt(), c = n || N.value?.text || "chart", u = document.createElement("a");
|
|
425
|
-
u.href = s, u.download = c.endsWith(".svg") ? c : `${c}.svg`, document.body.appendChild(u), u.click(), document.body.removeChild(u), URL.revokeObjectURL(s);
|
|
426
|
-
}
|
|
427
|
-
return { ready: J, getSvg: lt, exportSvg: ht };
|
|
428
|
-
}
|
|
429
|
-
function Wt(M, N = -50) {
|
|
430
|
-
if (!N) return;
|
|
431
|
-
const _ = M.getAttribute("viewBox"), Q = (T) => {
|
|
432
|
-
if (!T) return;
|
|
433
|
-
const x = M.getAttribute("height");
|
|
434
|
-
if (!x) return;
|
|
435
|
-
const g = /^(\d+(\.\d+)?)(px)?$/.exec(x.trim());
|
|
436
|
-
if (!g) return;
|
|
437
|
-
const $ = parseFloat(g[1]) || 0, F = Math.max(1, $ + T);
|
|
438
|
-
M.setAttribute("height", String(F));
|
|
439
|
-
};
|
|
440
|
-
if (_) {
|
|
441
|
-
const T = _.trim().split(/\s+|,/).map(Number);
|
|
442
|
-
if (T.length !== 4 || T.some((st) => !Number.isFinite(st))) return;
|
|
443
|
-
const [x, g, $, F] = T, O = g + N, L = -N, W = Math.max(1, F + L);
|
|
444
|
-
M.setAttribute("viewBox", `${x} ${O} ${$} ${W}`), Q(L);
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
let tt = Number(M.getAttribute("width")), G = Number(M.getAttribute("height"));
|
|
448
|
-
if (!(tt > 0 && G > 0)) {
|
|
449
|
-
const T = M.getBBox();
|
|
450
|
-
tt = Math.max(1, T.width || 1), G = Math.max(1, T.height || 1);
|
|
451
|
-
}
|
|
452
|
-
const rt = N, ot = -N, J = Math.max(1, G + ot);
|
|
453
|
-
M.setAttribute("viewBox", `0 ${rt} ${tt} ${J}`), function() {
|
|
454
|
-
const x = M.getAttribute("height");
|
|
455
|
-
if (!x) return;
|
|
456
|
-
const g = /^(\d+(\.\d+)?)(px)?$/.exec(x.trim());
|
|
457
|
-
if (!g) return;
|
|
458
|
-
const $ = parseFloat(g[1]) || 0, F = Math.max(1, $ + ot);
|
|
459
|
-
M.setAttribute("height", String(F));
|
|
460
|
-
}();
|
|
461
|
-
}
|
|
462
|
-
async function Bt(M, { mode: N = "raster" } = {}) {
|
|
463
|
-
const _ = Array.from(M.querySelectorAll("foreignObject"));
|
|
464
|
-
if (!_.length) return { converted: 0, rasterized: 0, skipped: 0, errors: 0 };
|
|
465
|
-
let Q = 0, tt = 0, G = 0, rt = 0;
|
|
466
|
-
const ot = (x) => ["div", "p", "span", "strong", "em", "b", "i", "br"].includes(x), J = (x) => {
|
|
467
|
-
try {
|
|
468
|
-
const g = x.firstElementChild;
|
|
469
|
-
if (!g) return !1;
|
|
470
|
-
const $ = [g];
|
|
471
|
-
for (; $.length; ) {
|
|
472
|
-
const F = $.pop();
|
|
473
|
-
if (F.nodeType === 3)
|
|
474
|
-
continue;
|
|
475
|
-
if (F.nodeType !== 1)
|
|
476
|
-
return !1;
|
|
477
|
-
const O = (F.tagName || "").toLowerCase();
|
|
478
|
-
if (!ot(O) || F.querySelector?.("img,svg,canvas,video,foreignObject"))
|
|
479
|
-
return !1;
|
|
480
|
-
for (const L of Array.from(F.childNodes))
|
|
481
|
-
$.push(L);
|
|
482
|
-
}
|
|
483
|
-
return !0;
|
|
484
|
-
} catch {
|
|
485
|
-
return !1;
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
function T(x) {
|
|
489
|
-
try {
|
|
490
|
-
const g = x.firstElementChild;
|
|
491
|
-
if (!g) return null;
|
|
492
|
-
const $ = (r, i = 0) => Number.isFinite(+r) ? +r : i, F = $(x.getAttribute("x"), 0), O = $(x.getAttribute("y"), 0);
|
|
493
|
-
let L = $(x.getAttribute("width"), NaN);
|
|
494
|
-
if (!Number.isFinite(L) || L <= 0) {
|
|
495
|
-
const r = x.getBBox?.();
|
|
496
|
-
L = Math.max(1, $(r?.width, 0));
|
|
497
|
-
}
|
|
498
|
-
const W = (r, i) => {
|
|
499
|
-
if (!r) return Math.round(i * 1.2);
|
|
500
|
-
const e = r.trim().toLowerCase();
|
|
501
|
-
if (e === "normal") return Math.round(i * 1.2);
|
|
502
|
-
if (e.endsWith("px")) return parseFloat(e) || Math.round(i * 1.2);
|
|
503
|
-
if (e.endsWith("%")) return parseFloat(e) / 100 * i || Math.round(i * 1.2);
|
|
504
|
-
if (e.endsWith("em")) return (parseFloat(e) || 1) * i;
|
|
505
|
-
if (e.endsWith("rem")) {
|
|
506
|
-
const o = parseFloat(getComputedStyle(document.documentElement).fontSize) || i;
|
|
507
|
-
return (parseFloat(e) || 1) * o;
|
|
508
|
-
}
|
|
509
|
-
const h = Number(e);
|
|
510
|
-
return Number.isFinite(h) ? h * i : Math.round(i * 1.2);
|
|
511
|
-
}, st = (r) => {
|
|
512
|
-
const i = (h) => {
|
|
513
|
-
const o = (h || "").trim().toLowerCase();
|
|
514
|
-
if (o.endsWith("px")) return parseFloat(o) || 0;
|
|
515
|
-
if (o.endsWith("rem")) {
|
|
516
|
-
const d = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
517
|
-
return (parseFloat(o) || 0) * d;
|
|
518
|
-
}
|
|
519
|
-
if (o.endsWith("em")) {
|
|
520
|
-
const d = parseFloat(getComputedStyle(document.body).fontSize) || 16;
|
|
521
|
-
return (parseFloat(o) || 0) * d;
|
|
522
|
-
}
|
|
523
|
-
const l = Number(o);
|
|
524
|
-
return Number.isFinite(l) ? l : 0;
|
|
525
|
-
}, e = (r || "").split(/\s+/).map(i).filter(Number.isFinite);
|
|
526
|
-
return e.length ? e.length === 1 ? [e[0], e[0], e[0], e[0]] : e.length === 2 ? [e[0], e[1], e[0], e[1]] : e.length === 3 ? [e[0], e[1], e[2], e[1]] : [e[0], e[1], e[2], e[3]] : [0, 0, 0, 0];
|
|
527
|
-
}, et = (r, i) => {
|
|
528
|
-
const e = mt(r);
|
|
529
|
-
let h = e.getPropertyValue("font-family") || i?.ff || "system-ui";
|
|
530
|
-
h = yt(h);
|
|
531
|
-
let o = parseFloat(e.getPropertyValue("font-size"));
|
|
532
|
-
Number.isFinite(o) || (o = i?.fs || 14);
|
|
533
|
-
const l = e.getPropertyValue("font-weight") || i?.fw || "400", d = e.getPropertyValue("font-style") || i?.fsty || "normal", y = e.getPropertyValue("font-stretch") || i?.fstc || "normal", p = e.getPropertyValue("letter-spacing") || i?.lsp || "normal", b = e.getPropertyValue("word-spacing") || i?.wsp || "0px", S = e.getPropertyValue("font-kerning") || i?.kern || "auto", C = e.getPropertyValue("font-variant-ligatures") || i?.liga || "normal", z = e.getPropertyValue("text-transform") || i?.ttfm || "none", H = e.getPropertyValue("color") || i?.fill || "#000", I = e.getPropertyValue("line-height"), D = !I || I.trim().toLowerCase() === "normal" ? i?.lh ?? Math.round(o * 1.2) : W(I, o), pt = (e.getPropertyValue("text-align") || i?.ta || "start").trim().toLowerCase();
|
|
534
|
-
let f = parseFloat(e.getPropertyValue("padding-top")) || 0, K = parseFloat(e.getPropertyValue("padding-right")) || 0, dt = parseFloat(e.getPropertyValue("padding-bottom")) || 0, bt = parseFloat(e.getPropertyValue("padding-left")) || 0;
|
|
535
|
-
const wt = e.getPropertyValue("padding");
|
|
536
|
-
if (wt && f === 0 && K === 0 && dt === 0 && bt === 0) {
|
|
537
|
-
const [vt, kt, _t, Ft] = st(wt);
|
|
538
|
-
f = vt, K = kt, dt = _t, bt = Ft;
|
|
539
|
-
}
|
|
540
|
-
const Mt = parseFloat(e.getPropertyValue("border-left-width")) || 0, Nt = parseFloat(e.getPropertyValue("border-right-width")) || 0, $t = e.getPropertyValue("box-sizing") || "content-box";
|
|
541
|
-
return { ff: h, fs: o, fw: l, fsty: d, fstc: y, lsp: p, wsp: b, kern: S, liga: C, ttfm: z, fill: H, lh: D, ta: pt, padL: bt, padR: K, padT: f, padB: dt, bL: Mt, bR: Nt, box: $t };
|
|
542
|
-
}, j = (r) => /^(div|p|section|article|ul|ol|li|h[1-6])$/.test(r), ct = { __para__: !0 }, ut = { __br__: !0 }, P = [], ft = et(g), X = (r, i, e) => {
|
|
543
|
-
if (r.nodeType === 3) {
|
|
544
|
-
const d = (r.nodeValue || "").replace(/\s+/g, " ").trim();
|
|
545
|
-
d && P.push({ text: d, style: i, path: e.slice() });
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
if (r.nodeType !== 1) return;
|
|
549
|
-
const h = r.tagName.toLowerCase();
|
|
550
|
-
if (h === "br") {
|
|
551
|
-
P.push({ ...ut, path: e.slice() });
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
const o = et(r, i);
|
|
555
|
-
e.push(r);
|
|
556
|
-
for (const l of Array.from(r.childNodes)) X(l, o, e);
|
|
557
|
-
e.pop(), j(h) && P.push({ ...ct, path: e.slice() });
|
|
558
|
-
};
|
|
559
|
-
for (X(g, ft, [g]); P.length && (P.at(-1).__para__ || P.at(-1).__br__); ) P.pop();
|
|
560
|
-
if (!P.length) return null;
|
|
561
|
-
const nt = P.filter((r) => !r.__para__ && !r.__br__), it = (() => {
|
|
562
|
-
if (!nt.length) return [g];
|
|
563
|
-
const r = nt.map((h) => h.path), i = Math.min(...r.map((h) => h.length));
|
|
564
|
-
let e = 0;
|
|
565
|
-
for (; e < i; ) {
|
|
566
|
-
const h = r[0][e];
|
|
567
|
-
if (r.every((o) => o[e] === h)) e += 1;
|
|
568
|
-
else break;
|
|
569
|
-
}
|
|
570
|
-
return r[0].slice(0, Math.max(1, e));
|
|
571
|
-
})(), gt = it[it.length - 1] || g, at = et(gt);
|
|
572
|
-
let lt = 0, ht = 0, n = 0;
|
|
573
|
-
for (const r of it) {
|
|
574
|
-
const i = et(r);
|
|
575
|
-
lt += i.padL, ht += i.padR, n += i.padT;
|
|
576
|
-
}
|
|
577
|
-
const s = [Math.max(1, L - lt - ht)];
|
|
578
|
-
for (const r of it)
|
|
579
|
-
try {
|
|
580
|
-
const i = mt(r);
|
|
581
|
-
if (r.clientWidth && r.clientWidth > 0) {
|
|
582
|
-
const o = parseFloat(i.paddingLeft) || 0, l = parseFloat(i.paddingRight) || 0, d = Math.max(1, r.clientWidth - o - l);
|
|
583
|
-
s.push(d);
|
|
584
|
-
}
|
|
585
|
-
const e = i.width, h = parseFloat(e);
|
|
586
|
-
if (Number.isFinite(h) && h > 0) {
|
|
587
|
-
const o = i.boxSizing || i.getPropertyValue("box-sizing") || "content-box", l = parseFloat(i.paddingLeft) || 0, d = parseFloat(i.paddingRight) || 0, y = parseFloat(i.borderLeftWidth) || 0, p = parseFloat(i.borderRightWidth) || 0, b = o === "border-box" ? Math.max(1, h - l - d - y - p) : Math.max(1, h);
|
|
588
|
-
s.push(b);
|
|
589
|
-
}
|
|
590
|
-
} catch {
|
|
591
|
-
}
|
|
592
|
-
let c = Math.floor(Math.min(...s.filter(Number.isFinite))) - 1;
|
|
593
|
-
c > 0 || (c = 1);
|
|
594
|
-
let u = "start", a = F + lt;
|
|
595
|
-
at.ta === "center" ? (u = "middle", a = F + lt + c / 2) : (at.ta === "right" || at.ta === "end") && (u = "end", a = F + (L - ht));
|
|
596
|
-
const t = x.ownerSVGElement || x.closest("svg"), m = document.createElementNS(Z, "text");
|
|
597
|
-
m.setAttribute("x", String(a)), m.setAttribute("y", String(O + n)), m.setAttribute("text-anchor", u), m.setAttribute("dominant-baseline", "text-before-edge"), m.setAttribute("xml:space", "preserve");
|
|
598
|
-
const w = document.createElementNS(Z, "text");
|
|
599
|
-
w.setAttribute("x", "0"), w.setAttribute("y", "0"), w.setAttribute("opacity", "0"), (t || x).appendChild(w);
|
|
600
|
-
const v = (r) => `font-family:${r.ff}; font-size:${r.fs}px; font-weight:${r.fw}; font-style:${r.fsty}; font-stretch:${r.fstc}; letter-spacing:${r.lsp}; word-spacing:${r.wsp}; font-kerning:${r.kern}; font-variant-ligatures:${r.liga}; text-transform:${r.ttfm};`, A = (r, i) => (w.textContent = r || "", w.setAttribute("style", v(i)), w.getComputedTextLength()), k = (r) => A(" ", r), B = [];
|
|
601
|
-
let E = [], U = 0;
|
|
602
|
-
const R = () => {
|
|
603
|
-
E.length && B.push({ segs: E.slice() }), E = [], U = 0;
|
|
604
|
-
}, q = (r, i, e) => {
|
|
605
|
-
let h = A(r, i);
|
|
606
|
-
if (e) {
|
|
607
|
-
const o = k(i);
|
|
608
|
-
h += o, E.push({ text: " ", ...i, w: o, isSpace: !0 });
|
|
609
|
-
}
|
|
610
|
-
E.push({ text: r, ...i, w: h }), U += h;
|
|
611
|
-
}, Y = (r, i, e) => {
|
|
612
|
-
let h = "";
|
|
613
|
-
for (const o of r) {
|
|
614
|
-
const l = h + o;
|
|
615
|
-
if (A(l, i) <= e) h = l;
|
|
616
|
-
else break;
|
|
617
|
-
}
|
|
618
|
-
return h || r[0] || "";
|
|
619
|
-
};
|
|
620
|
-
for (const r of P) {
|
|
621
|
-
if (r.__para__ || r.__br__) {
|
|
622
|
-
R();
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
const i = r.style, e = r.text.split(/(\s+)/).filter((l) => l.length > 0), h = (l, d) => {
|
|
626
|
-
if (!l) return;
|
|
627
|
-
const y = Math.max(1, c), p = A(l, i) + (d ? k(i) : 0);
|
|
628
|
-
if (E.length === 0)
|
|
629
|
-
if (p <= y)
|
|
630
|
-
q(l, i, !1);
|
|
631
|
-
else {
|
|
632
|
-
let b = l;
|
|
633
|
-
for (; b; ) {
|
|
634
|
-
const S = Y(b, i, y);
|
|
635
|
-
q(S, i, !1), b = b.slice(S.length), b && R();
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
else if (U + p <= y)
|
|
639
|
-
q(l, i, d);
|
|
640
|
-
else if (R(), A(l, i) <= y)
|
|
641
|
-
q(l, i, !1);
|
|
642
|
-
else {
|
|
643
|
-
let b = l;
|
|
644
|
-
for (; b; ) {
|
|
645
|
-
const S = Y(b, i, y);
|
|
646
|
-
q(S, i, !1), b = b.slice(S.length), b && R();
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
let o = !1;
|
|
651
|
-
for (const l of e) {
|
|
652
|
-
if (/^\s+$/.test(l)) {
|
|
653
|
-
o = !0;
|
|
654
|
-
continue;
|
|
655
|
-
}
|
|
656
|
-
h(l, o), o = !1;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
R();
|
|
660
|
-
for (let r = 0; r < B.length; r += 1) {
|
|
661
|
-
const i = B[r].segs, e = Math.max(...i.map((o) => o.fs || at.fs), at.fs);
|
|
662
|
-
let h = !0;
|
|
663
|
-
for (const o of i) {
|
|
664
|
-
const l = document.createElementNS(Z, "tspan");
|
|
665
|
-
h && (l.setAttribute("x", String(a)), r > 0 && l.setAttribute("dy", String(e)), h = !1), l.setAttribute("style", `${v(o)} fill:${o.fill};`), l.textContent = o.text, m.appendChild(l);
|
|
666
|
-
}
|
|
667
|
-
if (!i.length && r > 0) {
|
|
668
|
-
const o = document.createElementNS(Z, "tspan");
|
|
669
|
-
o.setAttribute("x", String(a)), o.setAttribute("dy", String(e)), o.textContent = "", m.appendChild(o);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
try {
|
|
673
|
-
w.remove();
|
|
674
|
-
} catch {
|
|
675
|
-
}
|
|
676
|
-
return m;
|
|
677
|
-
} catch {
|
|
678
|
-
return null;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
for (const x of _)
|
|
682
|
-
try {
|
|
683
|
-
if (x.hasAttribute("data-no-svg-export")) {
|
|
684
|
-
x.remove(), G += 1;
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
if (J(x)) {
|
|
688
|
-
const g = T(x);
|
|
689
|
-
if (g) {
|
|
690
|
-
x.parentNode.replaceChild(g, x), Q += 1;
|
|
691
|
-
continue;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
G += 1;
|
|
695
|
-
} catch {
|
|
696
|
-
rt += 1;
|
|
697
|
-
}
|
|
698
|
-
if (N === "raster") {
|
|
699
|
-
const x = Array.from(M.querySelectorAll("foreignObject"));
|
|
700
|
-
for (const g of x)
|
|
701
|
-
try {
|
|
702
|
-
if (g.hasAttribute("data-no-svg-export")) {
|
|
703
|
-
g.remove(), G += 1;
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
await new Promise((nt) => requestAnimationFrame(nt));
|
|
707
|
-
const $ = g.getBBox(), F = Math.max(1, Math.ceil($.width)), O = Math.max(1, Math.ceil($.height));
|
|
708
|
-
if (!F || !O) {
|
|
709
|
-
G += 1;
|
|
710
|
-
continue;
|
|
711
|
-
}
|
|
712
|
-
const L = document.createElementNS(Z, "svg");
|
|
713
|
-
L.setAttribute("xmlns", Z), L.setAttribute("xmlns:xlink", xt), L.setAttribute("width", String(F)), L.setAttribute("height", String(O)), L.setAttribute("viewBox", `0 0 ${F} ${O}`);
|
|
714
|
-
const W = g.cloneNode(!0);
|
|
715
|
-
W.setAttribute("x", "0"), W.setAttribute("y", "0"), W.setAttribute("width", String(F)), W.setAttribute("height", String(O)), L.appendChild(W);
|
|
716
|
-
const st = new XMLSerializer().serializeToString(L), et = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(st), j = document.createElement("canvas"), ct = 2;
|
|
717
|
-
j.width = Math.max(1, Math.floor(F * ct)), j.height = Math.max(1, Math.floor(O * ct));
|
|
718
|
-
const ut = j.getContext("2d"), P = new Image();
|
|
719
|
-
P.decoding = "sync", P.crossOrigin = "anonymous", await new Promise((nt, it) => {
|
|
720
|
-
P.onload = nt, P.onerror = it, P.src = et;
|
|
721
|
-
}), ut.drawImage(P, 0, 0, j.width, j.height);
|
|
722
|
-
const ft = j.toDataURL("image/png"), X = document.createElementNS(Z, "image");
|
|
723
|
-
X.setAttributeNS(xt, "href", ft), X.setAttribute("href", ft), X.setAttribute("x", g.getAttribute("x") || String($.x)), X.setAttribute("y", g.getAttribute("y") || String($.y)), X.setAttribute("width", g.getAttribute("width") || String($.width)), X.setAttribute("height", g.getAttribute("height") || String($.height)), g.parentNode.replaceChild(X, g), tt += 1;
|
|
724
|
-
} catch {
|
|
725
|
-
rt += 1;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return { converted: Q, rasterized: tt, skipped: G, errors: rt };
|
|
729
|
-
}
|
|
730
|
-
export {
|
|
731
|
-
Ht as u
|
|
732
|
-
};
|