vue-data-ui 2.12.8-beta.2 → 2.12.8-beta.4
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/README.md +21 -0
- package/dist/{Arrow-HbfibAF0.js → Arrow-XoY1VXNf.js} +1 -1
- package/dist/{BaseDraggableDialog-DGrErCX-.js → BaseDraggableDialog-CXe0WfN-.js} +2 -2
- package/dist/{BaseIcon-j0c6lJUs.js → BaseIcon-d4dmqhkb.js} +1 -1
- package/dist/{ColorPicker-DitXXl-H.js → ColorPicker-B3v0IhDO.js} +2 -2
- package/dist/{DataTable-CsoAI95B.js → DataTable-CmbjnjRg.js} +2 -2
- package/dist/{Legend-ZW-PFcHg.js → Legend-YPYnzTBz.js} +2 -2
- package/dist/{NonSvgPenAndPaper-DJTUaQ94.js → NonSvgPenAndPaper-SD-bH_GI.js} +3 -3
- package/dist/{PackageVersion-DCAZ9Z7V.js → PackageVersion-OcbP0WH2.js} +1 -1
- package/dist/{PenAndPaper-B9RP4oFj.js → PenAndPaper-BgPXmpGI.js} +3 -3
- package/dist/{Shape-BBbhObHC.js → Shape-WvXjwML_.js} +1 -1
- package/dist/{Slicer-Vh74fjdf.js → Slicer-CaMHCF_p.js} +2 -2
- package/dist/{SparkTooltip-CG-HMbX2.js → SparkTooltip-BTLad6y3.js} +1 -1
- package/dist/{Title-Dx8ctnVy.js → Title-CJcZXNtK.js} +1 -1
- package/dist/{Tooltip-COHlzpZI.js → Tooltip-dXp8FaUj.js} +1 -1
- package/dist/{UserOptions-CGn3YdRV.js → UserOptions-Cs7JW3dK.js} +154 -138
- package/dist/dom-to-png-DGfv21rX.js +247 -0
- package/dist/img-fdViJw1e.js +20 -0
- package/dist/{index-CbcpITE_.js → index-BzQ0j5xI.js} +190 -128
- package/dist/{pdf-Cy09nTjn.js → pdf-Bj65uPK-.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.cts +60 -1
- package/dist/types/vue-data-ui.d.ts +60 -1
- package/dist/{useNestedProp-y56W8I7J.js → useNestedProp-DqpZEE3h.js} +1 -1
- package/dist/{usePrinter-u-gQiRNz.js → usePrinter-CpG5jh_z.js} +2 -2
- package/dist/{vue-data-ui-DGmMT-Yp.js → vue-data-ui-CeIncf6V.js} +63 -63
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-Du4TkjPV.js → vue-ui-3d-bar-fAJK0nIB.js} +175 -174
- package/dist/{vue-ui-accordion-BkA7rtwr.js → vue-ui-accordion-bpaEpjqI.js} +3 -3
- package/dist/{vue-ui-age-pyramid-bw7gLRlR.js → vue-ui-age-pyramid-D5w5EqmV.js} +200 -199
- package/dist/{vue-ui-annotator-C-_zXB7H.js → vue-ui-annotator-CSGemK-O.js} +2 -2
- package/dist/{vue-ui-bullet-BRnz7E8e.js → vue-ui-bullet-FPBahjOr.js} +9 -8
- package/dist/{vue-ui-candlestick-9cPPnO0t.js → vue-ui-candlestick-BpP9MQC2.js} +115 -114
- package/dist/{vue-ui-carousel-table-BJuSGbk2.js → vue-ui-carousel-table-lpdLFAfT.js} +80 -79
- package/dist/{vue-ui-chestnut-D2dnrdHT.js → vue-ui-chestnut-D5um0tmC.js} +453 -452
- package/dist/{vue-ui-chord-Rvygj27H.js → vue-ui-chord-CgrXXOgv.js} +43 -42
- package/dist/{vue-ui-circle-pack-BR79EDAC.js → vue-ui-circle-pack-Jk-Yd8T_.js} +143 -142
- package/dist/{vue-ui-cursor-K11x9TYc.js → vue-ui-cursor-BjmAMjTd.js} +2 -2
- package/dist/{vue-ui-dashboard-BgxqXwqN.js → vue-ui-dashboard-CQ0B1DMq.js} +62 -62
- package/dist/{vue-ui-digits-D7StMUym.js → vue-ui-digits-B3h4BufU.js} +2 -2
- package/dist/{vue-ui-donut-CyOg8kph.js → vue-ui-donut-DcjJqRof.js} +151 -150
- package/dist/{vue-ui-donut-evolution-CVhQaMNQ.js → vue-ui-donut-evolution-DmSbXlMu.js} +111 -110
- package/dist/{vue-ui-dumbbell-C7Wex4VO.js → vue-ui-dumbbell-BLcmTUd_.js} +54 -53
- package/dist/{vue-ui-flow-DFNdP-V9.js → vue-ui-flow-BmIGl6DC.js} +14 -13
- package/dist/{vue-ui-funnel-DqWcZVvF.js → vue-ui-funnel-BJfxaSQC.js} +75 -74
- package/dist/{vue-ui-galaxy-BhPbJqYr.js → vue-ui-galaxy-Cpnr2YW-.js} +84 -83
- package/dist/{vue-ui-gauge-sP6YPTJH.js → vue-ui-gauge-BhPFNziU.js} +33 -32
- package/dist/{vue-ui-gizmo-B4fq_bGX.js → vue-ui-gizmo-B2wA-kmz.js} +3 -3
- package/dist/{vue-ui-heatmap-CpNjtuyD.js → vue-ui-heatmap-CpwNMx3i.js} +222 -221
- package/dist/{vue-ui-history-plot-CtgTg4fG.js → vue-ui-history-plot-DpxHqDZw.js} +234 -233
- package/dist/{vue-ui-kpi-CN2AE1VF.js → vue-ui-kpi-CvqXwiiE.js} +3 -3
- package/dist/{vue-ui-mini-loader-CYt8LlhO.js → vue-ui-mini-loader-DIjSfc7L.js} +2 -2
- package/dist/{vue-ui-molecule-D3kexAu_.js → vue-ui-molecule-3-vg0Re6.js} +44 -43
- package/dist/{vue-ui-mood-radar-hHqR8eS7.js → vue-ui-mood-radar-B7W7wGkW.js} +76 -75
- package/dist/{vue-ui-nested-donuts-DXwaOA_n.js → vue-ui-nested-donuts-ByoeDL-3.js} +53 -52
- package/dist/{vue-ui-onion-C7R2R5tf.js → vue-ui-onion-CNVwf4QX.js} +72 -71
- package/dist/{vue-ui-parallel-coordinate-plot-Dh772r8W.js → vue-ui-parallel-coordinate-plot-C0KJrBX8.js} +13 -12
- package/dist/{vue-ui-quadrant-jrOesLSU.js → vue-ui-quadrant-C-wPn5l5.js} +13 -12
- package/dist/{vue-ui-quick-chart-CtLnhGZA.js → vue-ui-quick-chart-SV-m_FhA.js} +8 -7
- package/dist/{vue-ui-radar-BikYRjfw.js → vue-ui-radar-DqOzvLUy.js} +283 -282
- package/dist/{vue-ui-rating-DUYbT-Ve.js → vue-ui-rating-CsZXcINB.js} +2 -2
- package/dist/{vue-ui-relation-circle-CjnDrflp.js → vue-ui-relation-circle-B0zxq02O.js} +75 -74
- package/dist/{vue-ui-ridgeline-o7-RpeJx.js → vue-ui-ridgeline-CykFyAin.js} +102 -101
- package/dist/{vue-ui-rings-Dinj5ws1.js → vue-ui-rings-DoJwXgd3.js} +110 -109
- package/dist/{vue-ui-scatter-CODAsxBq.js → vue-ui-scatter-BTT3BYrI.js} +166 -165
- package/dist/{vue-ui-skeleton-miKWlCAi.js → vue-ui-skeleton-CavMQlAm.js} +3 -3
- package/dist/{vue-ui-smiley-DwqlNm1O.js → vue-ui-smiley-DdT6TBz8.js} +2 -2
- package/dist/{vue-ui-spark-trend-BjL35phT.js → vue-ui-spark-trend-D9q63V2-.js} +3 -3
- package/dist/{vue-ui-sparkbar-2o2ZLL50.js → vue-ui-sparkbar-DCS_f__b.js} +3 -3
- package/dist/{vue-ui-sparkgauge-CMlBpOcc.js → vue-ui-sparkgauge-CGDjBHjo.js} +3 -3
- package/dist/{vue-ui-sparkhistogram-C7Ue-aaI.js → vue-ui-sparkhistogram-Ctpm0106.js} +4 -4
- package/dist/{vue-ui-sparkline-w29yzdZG.js → vue-ui-sparkline-BVyjNK_A.js} +3 -3
- package/dist/{vue-ui-sparkstackbar-DbIxY7W3.js → vue-ui-sparkstackbar-BsNDucJO.js} +3 -3
- package/dist/{vue-ui-stackbar-CWqpeYW-.js → vue-ui-stackbar-DuGcJQ6F.js} +39 -38
- package/dist/{vue-ui-strip-plot-DyjQVaDX.js → vue-ui-strip-plot-C6vbloAI.js} +82 -81
- package/dist/{vue-ui-table-Bx82XIlz.js → vue-ui-table-Bb6pNaIM.js} +3 -3
- package/dist/{vue-ui-table-heatmap-RvSyx9L6.js → vue-ui-table-heatmap-_ypWL_z2.js} +77 -76
- package/dist/{vue-ui-table-sparkline-DebvtEV3.js → vue-ui-table-sparkline-_pPedR_D.js} +74 -73
- package/dist/{vue-ui-thermometer-yPKRIlqA.js → vue-ui-thermometer-CmLnTIU7.js} +22 -21
- package/dist/{vue-ui-timer-C15nOU7T.js → vue-ui-timer-CpAJT80M.js} +5 -5
- package/dist/{vue-ui-tiremarks-C2G8HtiX.js → vue-ui-tiremarks-DXgmJClr.js} +38 -37
- package/dist/{vue-ui-treemap-cFhw0xSg.js → vue-ui-treemap-Ci2Yi9Gh.js} +109 -108
- package/dist/{vue-ui-vertical-bar-dWiOw4sV.js → vue-ui-vertical-bar-pn_EqFmU.js} +82 -81
- package/dist/{vue-ui-waffle-Uldnmn6D.js → vue-ui-waffle-vqh1kEDT.js} +33 -32
- package/dist/{vue-ui-wheel-Cz79iDLO.js → vue-ui-wheel-BCcK6wwZ.js} +8 -7
- package/dist/{vue-ui-word-cloud-BGeHV6hS.js → vue-ui-word-cloud-Bu8Giu0b.js} +110 -109
- package/dist/{vue-ui-world-D1Dy-4mh.js → vue-ui-world-CzRlg19V.js} +57 -56
- package/dist/{vue-ui-xy-BA7xWU7_.js → vue-ui-xy-0gHPOOwZ.js} +982 -856
- package/dist/{vue-ui-xy-canvas-B2kkKb64.js → vue-ui-xy-canvas-DuAgXbBB.js} +41 -40
- package/package.json +1 -1
- package/dist/dom-to-png-BjSUS-jY.js +0 -243
- package/dist/img-DWfzRJdv.js +0 -19
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { X as x } from "./index-BzQ0j5xI.js";
|
|
2
|
+
async function F(n) {
|
|
3
|
+
const i = n.querySelectorAll("img"), s = Array.from(i).map((t) => new Promise((o) => {
|
|
4
|
+
if (!t.src || t.src.startsWith("data:")) return o();
|
|
5
|
+
if (t.complete && t.naturalWidth !== 0) {
|
|
6
|
+
try {
|
|
7
|
+
const e = document.createElement("canvas");
|
|
8
|
+
e.width = t.naturalWidth, e.height = t.naturalHeight, e.getContext("2d").drawImage(t, 0, 0), t.src = e.toDataURL();
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
return o();
|
|
12
|
+
}
|
|
13
|
+
const c = new window.Image();
|
|
14
|
+
c.crossOrigin = "anonymous", c.onload = function() {
|
|
15
|
+
try {
|
|
16
|
+
const e = document.createElement("canvas");
|
|
17
|
+
e.width = c.naturalWidth, e.height = c.naturalHeight, e.getContext("2d").drawImage(c, 0, 0), t.src = e.toDataURL();
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
o();
|
|
21
|
+
}, c.onerror = function() {
|
|
22
|
+
o();
|
|
23
|
+
}, c.src = t.src;
|
|
24
|
+
}));
|
|
25
|
+
await Promise.all(s);
|
|
26
|
+
}
|
|
27
|
+
function E(n) {
|
|
28
|
+
n.querySelectorAll("[data-dom-to-png-ignore]").forEach((s) => {
|
|
29
|
+
s.remove();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function v(n, i, s) {
|
|
33
|
+
const t = window.getComputedStyle(i), o = i.getBoundingClientRect(), c = t.display.includes("flex");
|
|
34
|
+
let e = {}, a = n.getAttribute("style");
|
|
35
|
+
typeof a != "string" && (a = ""), a.split(";").forEach((l) => {
|
|
36
|
+
if (typeof l == "string" && l.trim()) {
|
|
37
|
+
const [f, d] = l.split(":");
|
|
38
|
+
f && d !== void 0 && (e[f.trim()] = d.trim());
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
for (let l = 0; l < t.length; l += 1) {
|
|
42
|
+
const f = t[l], d = t.getPropertyValue(f);
|
|
43
|
+
e[f] = d;
|
|
44
|
+
}
|
|
45
|
+
e.color = t.color, e["background-color"] = t.backgroundColor;
|
|
46
|
+
let r = t.fontFamily || s || "";
|
|
47
|
+
(!r || r.trim() === "" || r === "inherit" || r === "initial" || r.toLowerCase().startsWith("system-ui") || r.toLowerCase() === "sans-serif" || r.toLowerCase() === "serif" || r.toLowerCase() === "monospace") && (r = "Helvetica, Arial, sans-serif"), e["font-family"] = r, e["font-size"] = t.fontSize, e["font-weight"] = t.fontWeight, (c || t.display.includes("grid") || ["inline-block", "absolute", "fixed"].includes(t.position)) && (o.width > 0 && (e.width = o.width + "px"), o.height > 0 && (e.height = o.height + "px")), c && t.flexWrap === "nowrap" && (e["white-space"] = "nowrap"), ["box-sizing", "padding", "margin", "border"].forEach((l) => {
|
|
48
|
+
e[l] = t.getPropertyValue(l);
|
|
49
|
+
}), e.overflow = "visible", e["overflow-x"] = "visible", e["overflow-y"] = "visible";
|
|
50
|
+
let u = "";
|
|
51
|
+
for (const l in e)
|
|
52
|
+
u += `${l}:${e[l]};`;
|
|
53
|
+
n.setAttribute("style", u);
|
|
54
|
+
const m = n.children || [], p = i.children || [];
|
|
55
|
+
for (let l = 0; l < m.length; l++)
|
|
56
|
+
m[l].nodeType === 1 && p[l] && v(m[l], p[l], r);
|
|
57
|
+
}
|
|
58
|
+
function $(n, i) {
|
|
59
|
+
n.querySelectorAll("text").forEach((t) => {
|
|
60
|
+
t.setAttribute("font-family", i), t.style.fontFamily = i;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function W(n) {
|
|
64
|
+
const i = new TextEncoder().encode(n);
|
|
65
|
+
let s = "";
|
|
66
|
+
return i.forEach((t) => s += String.fromCharCode(t)), btoa(s);
|
|
67
|
+
}
|
|
68
|
+
function P(n, i, s) {
|
|
69
|
+
let o = new XMLSerializer().serializeToString(n);
|
|
70
|
+
o.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/) || (o = o.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"'));
|
|
71
|
+
const c = window.btoa(unescape(encodeURIComponent(o))), e = new window.Image();
|
|
72
|
+
return e.src = `data:image/svg+xml;base64,${c}`, new Promise((a, r) => {
|
|
73
|
+
e.onload = function() {
|
|
74
|
+
const u = document.createElement("canvas");
|
|
75
|
+
u.width = i, u.height = s, u.getContext("2d").drawImage(e, 0, 0, i, s), a(u.toDataURL("image/png", 1));
|
|
76
|
+
}, e.onerror = (u) => r(u);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function R(n) {
|
|
80
|
+
if (n.nodeType !== 1) return;
|
|
81
|
+
const i = window.getComputedStyle(n);
|
|
82
|
+
let s = "";
|
|
83
|
+
for (let t = 0; t < i.length; t++) {
|
|
84
|
+
const o = i[t];
|
|
85
|
+
s += `${o}:${i.getPropertyValue(o)};`;
|
|
86
|
+
}
|
|
87
|
+
n.setAttribute("style", s);
|
|
88
|
+
for (let t = 0; t < n.children.length; t++)
|
|
89
|
+
R(n.children[t]);
|
|
90
|
+
}
|
|
91
|
+
function z() {
|
|
92
|
+
const n = [];
|
|
93
|
+
for (const i of document.styleSheets)
|
|
94
|
+
try {
|
|
95
|
+
const s = i.cssRules;
|
|
96
|
+
if (!s) continue;
|
|
97
|
+
for (const t of s)
|
|
98
|
+
(typeof CSSFontFaceRule < "u" && t instanceof CSSFontFaceRule || t.cssText.trim().startsWith("@font-face")) && n.push(t.cssText);
|
|
99
|
+
} catch {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
return n;
|
|
103
|
+
}
|
|
104
|
+
function M(n) {
|
|
105
|
+
const i = z();
|
|
106
|
+
if (!i.length) return;
|
|
107
|
+
const s = document.createElement("style");
|
|
108
|
+
s.setAttribute("type", "text/css"), s.textContent = i.join(`
|
|
109
|
+
`);
|
|
110
|
+
const t = n.querySelector("defs") || document.createElementNS(x, "defs");
|
|
111
|
+
t.appendChild(s), n.querySelector("defs") || n.insertBefore(t, n.firstChild);
|
|
112
|
+
}
|
|
113
|
+
function H(n, i) {
|
|
114
|
+
const s = n.querySelectorAll("foreignObject"), t = i.querySelectorAll("foreignObject");
|
|
115
|
+
s.forEach((o, c) => {
|
|
116
|
+
const e = t[c];
|
|
117
|
+
if (!e) return;
|
|
118
|
+
function a(r, u) {
|
|
119
|
+
if (!r || !u) return;
|
|
120
|
+
if (r.nodeType === 1 && u.nodeType === 1) {
|
|
121
|
+
const l = window.getComputedStyle(u);
|
|
122
|
+
let f = "";
|
|
123
|
+
for (let d = 0; d < l.length; d++) {
|
|
124
|
+
const C = l[d];
|
|
125
|
+
f += `${C}:${l.getPropertyValue(C)};`;
|
|
126
|
+
}
|
|
127
|
+
r.setAttribute("style", f);
|
|
128
|
+
}
|
|
129
|
+
const m = r.children || [], p = u.children || [];
|
|
130
|
+
for (let l = 0; l < m.length; l++)
|
|
131
|
+
a(m[l], p[l]);
|
|
132
|
+
}
|
|
133
|
+
a(o, e);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function D(n) {
|
|
137
|
+
n.querySelectorAll("foreignObject").forEach((s) => {
|
|
138
|
+
let t = "";
|
|
139
|
+
const o = Array.from(s.querySelectorAll("*"));
|
|
140
|
+
if (o.length !== 0) {
|
|
141
|
+
for (const c of document.styleSheets) {
|
|
142
|
+
let e;
|
|
143
|
+
try {
|
|
144
|
+
e = c.cssRules;
|
|
145
|
+
} catch {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (e) {
|
|
149
|
+
for (const a of e)
|
|
150
|
+
if (!(typeof CSSStyleRule < "u" && !(a instanceof CSSStyleRule)))
|
|
151
|
+
try {
|
|
152
|
+
o.some((r) => r.matches(a.selectorText)) && (t += a.cssText + `
|
|
153
|
+
`);
|
|
154
|
+
} catch {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (t) {
|
|
160
|
+
const c = document.createElement("style");
|
|
161
|
+
c.textContent = t, s.insertBefore(c, s.firstChild);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function U(n) {
|
|
167
|
+
n.querySelectorAll("foreignObject").forEach((s) => {
|
|
168
|
+
const t = s.firstElementChild;
|
|
169
|
+
t && t.tagName.toLowerCase() !== "svg" && t.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function B(n, i) {
|
|
173
|
+
const s = n.querySelectorAll("foreignObject"), t = i.querySelectorAll("foreignObject");
|
|
174
|
+
s.forEach((o, c) => {
|
|
175
|
+
const e = t[c];
|
|
176
|
+
if (!o || !e) return;
|
|
177
|
+
const a = o.firstElementChild, r = e.firstElementChild;
|
|
178
|
+
a && r && j(a, r);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function j(n, i) {
|
|
182
|
+
if (n.nodeType !== 1 || !i) return;
|
|
183
|
+
v(n, i);
|
|
184
|
+
const s = n.children || [], t = i.children || [];
|
|
185
|
+
for (let o = 0; o < s.length; o++)
|
|
186
|
+
j(s[o], t[o]);
|
|
187
|
+
}
|
|
188
|
+
function O(n, i) {
|
|
189
|
+
const s = Array.from(i.querySelectorAll("img"));
|
|
190
|
+
n.querySelectorAll("img").forEach((t) => {
|
|
191
|
+
const o = t.getAttribute("src"), c = s.find((e) => e.getAttribute("src") === o);
|
|
192
|
+
if (c) {
|
|
193
|
+
const e = window.getComputedStyle(c);
|
|
194
|
+
let a = "";
|
|
195
|
+
for (let r = 0; r < e.length; r++) {
|
|
196
|
+
const u = e[r];
|
|
197
|
+
a += `${u}:${e.getPropertyValue(u)};`;
|
|
198
|
+
}
|
|
199
|
+
t.setAttribute("style", a);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async function k({ container: n, scale: i = 2, base64: s = !1 }) {
|
|
204
|
+
if (!n) throw new Error("No container provided");
|
|
205
|
+
await document.fonts.ready;
|
|
206
|
+
let t = window.getComputedStyle(n).fontFamily || "Helvetica";
|
|
207
|
+
t.toLowerCase().includes("helvetica") || (t += ", Helvetica");
|
|
208
|
+
const o = n.cloneNode(!0), c = o.querySelectorAll("canvas"), e = n.querySelectorAll("canvas");
|
|
209
|
+
for (let y = 0; y < e.length; y += 1) {
|
|
210
|
+
const g = e[y], h = c[y];
|
|
211
|
+
if (g && h) {
|
|
212
|
+
const w = document.createElement("img");
|
|
213
|
+
w.src = g.toDataURL("image/png"), w.width = g.width, w.height = g.height, w.style.width = g.style.width || g.width + "px", w.style.height = g.style.height || g.height + "px", h.replaceWith(w);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const a = n.querySelector("svg[aria-label]"), r = o.querySelector("svg[aria-label]");
|
|
217
|
+
if (a && r) {
|
|
218
|
+
U(r), D(r), H(r, a), B(r, a), R(r), $(r, t), O(r, a), await F(r);
|
|
219
|
+
const y = a.getBoundingClientRect(), g = y.width, h = y.height, w = Math.round(g * i), T = Math.round(h * i), I = await P(r, w, T), S = document.createElement("img");
|
|
220
|
+
S.src = I, S.width = g, S.height = h, S.style.width = g + "px", S.style.height = h + "px", r.parentNode.replaceChild(S, r);
|
|
221
|
+
}
|
|
222
|
+
v(o, n, t), O(o, n), E(o), await F(o);
|
|
223
|
+
const { width: u, height: m } = n.getBoundingClientRect(), p = Math.round(Math.max(o.scrollWidth, u) * i), l = Math.round(Math.max(o.scrollHeight, m) * 1.01 * i), f = document.createElementNS(x, "svg");
|
|
224
|
+
f.setAttribute("viewBox", `0 0 ${p} ${l}`), f.setAttribute("width", p), f.setAttribute("height", l), f.setAttribute("style", `font-family:${t};`);
|
|
225
|
+
const d = document.createElementNS(x, "foreignObject");
|
|
226
|
+
d.setAttribute("x", 0), d.setAttribute("y", 0), d.setAttribute("width", p), d.setAttribute("height", l), d.setAttribute("style", `font-family:${t};`), o.style.transform = `scale(${i})`, o.style.transformOrigin = "top left", o.style.width = u + "px", o.style.height = m + "px", o.style.background = window.getComputedStyle(n).backgroundColor, d.appendChild(o), M(f), f.appendChild(d);
|
|
227
|
+
const q = new XMLSerializer().serializeToString(f), L = W(q), b = new window.Image();
|
|
228
|
+
b.crossOrigin = "anonymous";
|
|
229
|
+
const A = `data:image/svg+xml;base64,${L}`;
|
|
230
|
+
return b.src = A, s ? new Promise((y) => {
|
|
231
|
+
y(A);
|
|
232
|
+
}) : new Promise((y, g) => {
|
|
233
|
+
b.onload = function() {
|
|
234
|
+
try {
|
|
235
|
+
const h = document.createElement("canvas");
|
|
236
|
+
h.width = p, h.height = l, h.getContext("2d").drawImage(b, 0, 0, p, l), y(h.toDataURL("image/png", 1));
|
|
237
|
+
} catch (h) {
|
|
238
|
+
g("Failed to draw SVG on canvas: " + h);
|
|
239
|
+
}
|
|
240
|
+
}, b.onerror = function() {
|
|
241
|
+
g("Failed to load SVG image for conversion");
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
export {
|
|
246
|
+
k as d
|
|
247
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { d as a } from "./dom-to-png-DGfv21rX.js";
|
|
2
|
+
async function g({ domElement: t, fileName: c, format: i = "png", scale: o = 2, base64: n = !1 }) {
|
|
3
|
+
if (!t) return Promise.reject("No element provided");
|
|
4
|
+
if (n)
|
|
5
|
+
try {
|
|
6
|
+
return a({ container: t, scale: o, base64: n }).then((r) => r);
|
|
7
|
+
} catch (r) {
|
|
8
|
+
console.error("Error generating the base64 string of the chart", r);
|
|
9
|
+
}
|
|
10
|
+
else
|
|
11
|
+
try {
|
|
12
|
+
const r = await a({ container: t, scale: o }), e = document.createElement("a");
|
|
13
|
+
e.href = r, e.download = `${c}.${i}`, document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
14
|
+
} catch (r) {
|
|
15
|
+
throw console.error("Error generating image:", r), r;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
g as default
|
|
20
|
+
};
|