@unicom-cloud/utils 0.1.11 → 0.1.12
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/date/index.js +22 -0
- package/date.js +9 -0
- package/index.js +56 -54
- package/lunar/index.js +36 -0
- package/lunar/lib/Holiday.js +42 -0
- package/lunar/lib/HolidayUtil.js +128 -0
- package/lunar/lib/I18n.js +1005 -0
- package/lunar/lib/JieQi.js +40 -0
- package/lunar/lib/Lunar.js +1035 -0
- package/lunar/lib/LunarMonth.js +150 -0
- package/lunar/lib/LunarTime.js +138 -0
- package/lunar/lib/LunarUtil.js +1752 -0
- package/lunar/lib/LunarYear.js +616 -0
- package/lunar/lib/ShouXingUtil.js +6915 -0
- package/lunar/lib/Solar.js +311 -0
- package/lunar/lib/SolarHalfYear.js +45 -0
- package/lunar/lib/SolarMonth.js +55 -0
- package/lunar/lib/SolarSeason.js +42 -0
- package/lunar/lib/SolarUtil.js +256 -0
- package/lunar/lib/SolarWeek.js +153 -0
- package/lunar/lib/SolarYear.js +35 -0
- package/lunar/lib/index.js +35 -0
- package/lunar.js +36 -0
- package/package.json +1 -1
- package/snapdom/src/api/preCache.js +26 -36
- package/snapdom/src/api/snapdom.js +78 -61
- package/snapdom/src/core/capture.js +54 -54
- package/snapdom/src/core/prepare.js +46 -37
- package/snapdom/src/modules/fonts.js +90 -92
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +51 -49
- package/snapdom/src/modules/styles.js +27 -7
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/helpers.js +150 -103
- package/tinycolor/index.js +46 -0
- package/tinycolor/src/conversion.js +143 -0
- package/tinycolor/src/css-color-names.js +153 -0
- package/tinycolor/src/format-input.js +77 -0
- package/tinycolor/src/from-ratio.js +21 -0
- package/tinycolor/src/index.js +404 -0
- package/tinycolor/src/random.js +221 -0
- package/tinycolor/src/readability.js +37 -0
- package/tinycolor/src/to-ms-filter.js +15 -0
- package/tinycolor/src/util.js +32 -0
- package/tinycolor.js +46 -0
- package/tree/index.js +10 -8
- package/tree.js +9 -7
- package/types/date/index.d.ts +4 -0
- package/types/index.d.ts +4 -3
- package/types/lunar/index.d.ts +3 -0
- package/types/lunar/lib/Holiday.d.ts +17 -0
- package/types/lunar/lib/HolidayUtil.d.ts +23 -0
- package/types/lunar/lib/I18n.d.ts +23 -0
- package/types/lunar/lib/JieQi.d.ts +15 -0
- package/types/lunar/lib/Lunar.d.ts +245 -0
- package/types/lunar/lib/LunarMonth.d.ts +35 -0
- package/types/lunar/lib/LunarTime.d.ts +40 -0
- package/types/lunar/lib/LunarUtil.d.ts +128 -0
- package/types/lunar/lib/LunarYear.d.ts +61 -0
- package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
- package/types/lunar/lib/Solar.d.ts +51 -0
- package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
- package/types/lunar/lib/SolarMonth.d.ts +16 -0
- package/types/lunar/lib/SolarSeason.d.ts +15 -0
- package/types/lunar/lib/SolarUtil.d.ts +20 -0
- package/types/lunar/lib/SolarWeek.d.ts +23 -0
- package/types/lunar/lib/SolarYear.d.ts +12 -0
- package/types/lunar/lib/index.d.ts +17 -0
- package/types/snapdom/src/core/prepare.d.ts +1 -1
- package/types/snapdom/src/modules/fonts.d.ts +1 -3
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/pseudo.d.ts +1 -1
- package/types/snapdom/src/modules/styles.d.ts +1 -10
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/helpers.d.ts +1 -1
- package/types/tinycolor/index.d.ts +2 -0
- package/types/tinycolor/src/conversion.d.ts +79 -0
- package/types/tinycolor/src/css-color-names.d.ts +4 -0
- package/types/tinycolor/src/format-input.d.ts +38 -0
- package/types/tinycolor/src/from-ratio.d.ts +14 -0
- package/types/tinycolor/src/index.d.ts +214 -0
- package/types/tinycolor/src/interfaces.d.ts +57 -0
- package/types/tinycolor/src/public_api.d.ts +10 -0
- package/types/tinycolor/src/random.d.ts +24 -0
- package/types/tinycolor/src/readability.d.ts +46 -0
- package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
- package/types/tinycolor/src/umd_api.d.ts +22 -0
- package/types/tinycolor/src/util.d.ts +36 -0
- package/types/tree/index.d.ts +1 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +183 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +155 -0
- package/uiColor.js +28 -0
- package/convertTime.js +0 -4
- package/dayjs/index.js +0 -15
- package/dayjs.js +0 -5
- package/lunar-converter/index.js +0 -641
- package/lunarConverter.js +0 -4
- package/searchTree.js +0 -4
- package/types/dayjs/index.d.ts +0 -1
- package/types/lunar-converter/index.d.ts +0 -113
- /package/{convert-time/index.js → date/convertTime.js} +0 -0
- /package/{search-tree/index.js → tree/searchTree.js} +0 -0
- /package/types/{convert-time/index.d.ts → date/convertTime.d.ts} +0 -0
- /package/types/{search-tree/index.d.ts → tree/searchTree.d.ts} +0 -0
|
@@ -1,92 +1,109 @@
|
|
|
1
1
|
import { captureDOM as v } from "../core/capture.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { extendIconFonts as R } from "../modules/iconFonts.js";
|
|
3
|
+
import { isSafari as j } from "../utils/helpers.js";
|
|
4
|
+
async function x(a, { dpr: t = 1, scale: o = 1 }) {
|
|
5
|
+
const e = new Image();
|
|
6
|
+
return e.src = a, await e.decode(), j ? (e.width = e.width * o, e.height = e.height * o) : (e.width = e.width / o, e.height = e.height / o), e;
|
|
6
7
|
}
|
|
7
|
-
async function
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const n = document.createElement("canvas"),
|
|
11
|
-
n.width = Math.ceil(
|
|
8
|
+
async function u(a, { dpr: t = 1, scale: o = 1 } = {}) {
|
|
9
|
+
const e = new Image();
|
|
10
|
+
e.src = a, await e.decode();
|
|
11
|
+
const n = document.createElement("canvas"), c = e.width * o, i = e.height * o;
|
|
12
|
+
n.width = Math.ceil(c * t), n.height = Math.ceil(i * t);
|
|
12
13
|
const s = n.getContext("2d");
|
|
13
|
-
return s.scale(t, t), s.drawImage(
|
|
14
|
+
return s.scale(t, t), s.drawImage(e, 0, 0, c, i), n.style.width = `${c}px`, n.style.height = `${i}px`, n;
|
|
14
15
|
}
|
|
15
|
-
async function
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
async function l(a, { type: t = "svg", scale: o = 1, backgroundColor: e = "#fff", quality: n } = {}) {
|
|
17
|
+
const c = {
|
|
18
|
+
jpg: "image/jpeg",
|
|
19
|
+
jpeg: "image/jpeg",
|
|
20
|
+
png: "image/png",
|
|
21
|
+
webp: "image/webp"
|
|
22
|
+
}[t] || "image/png";
|
|
23
|
+
if (t === "svg") {
|
|
24
|
+
const s = decodeURIComponent(a.split(",")[1]);
|
|
25
|
+
return new Blob([s], { type: "image/svg+xml" });
|
|
26
|
+
}
|
|
27
|
+
const i = await m(
|
|
28
|
+
a,
|
|
29
|
+
{ dpr: 1, scale: o },
|
|
30
|
+
e
|
|
31
|
+
);
|
|
32
|
+
return new Promise((s) => {
|
|
33
|
+
i.toBlob((r) => s(r), `${c}`, n);
|
|
34
|
+
});
|
|
18
35
|
}
|
|
19
|
-
async function
|
|
20
|
-
const n = await
|
|
21
|
-
if (!
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return
|
|
36
|
+
async function m(a, { dpr: t = 1, scale: o = 1 }, e) {
|
|
37
|
+
const n = await u(a, { dpr: t, scale: o });
|
|
38
|
+
if (!e) return n;
|
|
39
|
+
const c = document.createElement("canvas");
|
|
40
|
+
c.width = n.width, c.height = n.height;
|
|
41
|
+
const i = c.getContext("2d");
|
|
42
|
+
return i.fillStyle = e, i.fillRect(0, 0, c.width, c.height), i.drawImage(n, 0, 0), c;
|
|
26
43
|
}
|
|
27
|
-
async function
|
|
28
|
-
const
|
|
29
|
-
return s.src =
|
|
44
|
+
async function p(a, { dpr: t = 1, scale: o = 1, backgroundColor: e = "#fff", quality: n }, c = "png") {
|
|
45
|
+
const i = await m(a, { dpr: t, scale: o }, e), s = new Image();
|
|
46
|
+
return s.src = i.toDataURL(`image/${c}`, n), await s.decode(), s.style.width = `${i.width / t}px`, s.style.height = `${i.height / t}px`, s;
|
|
30
47
|
}
|
|
31
|
-
async function I(
|
|
48
|
+
async function I(a, {
|
|
32
49
|
dpr: t = 1,
|
|
33
|
-
scale:
|
|
34
|
-
backgroundColor:
|
|
50
|
+
scale: o = 1,
|
|
51
|
+
backgroundColor: e = "#fff",
|
|
35
52
|
format: n = "png",
|
|
36
|
-
filename:
|
|
53
|
+
filename: c = "capture"
|
|
37
54
|
} = {}) {
|
|
38
55
|
if (n === "svg") {
|
|
39
|
-
const
|
|
40
|
-
|
|
56
|
+
const y = await l(a), h = URL.createObjectURL(y), d = document.createElement("a");
|
|
57
|
+
d.href = h, d.download = `${c}.svg`, d.click(), URL.revokeObjectURL(h);
|
|
41
58
|
return;
|
|
42
59
|
}
|
|
43
|
-
const
|
|
60
|
+
const i = ["jpg", "jpeg", "webp"].includes(n) ? "#fff" : void 0, r = await m(a, { dpr: t, scale: o }, e ?? i), f = {
|
|
44
61
|
jpg: "image/jpeg",
|
|
45
62
|
jpeg: "image/jpeg",
|
|
46
63
|
png: "image/png",
|
|
47
64
|
webp: "image/webp"
|
|
48
|
-
}[n] || "image/png",
|
|
49
|
-
|
|
65
|
+
}[n] || "image/png", b = r.toDataURL(f), w = document.createElement("a");
|
|
66
|
+
w.href = b, w.download = `${c}.${n}`, w.click();
|
|
50
67
|
}
|
|
51
|
-
async function
|
|
52
|
-
if (t = { scale: 1, ...t }, !
|
|
53
|
-
return await
|
|
68
|
+
async function g(a, t = {}) {
|
|
69
|
+
if (t = { scale: 1, ...t }, !a) throw new Error("Element cannot be null or undefined");
|
|
70
|
+
return t.iconFonts && R(t.iconFonts), await g.capture(a, t);
|
|
54
71
|
}
|
|
55
|
-
|
|
56
|
-
const
|
|
72
|
+
g.capture = async (a, t = {}) => {
|
|
73
|
+
const o = await v(a, t), e = window.devicePixelRatio || 1, n = t.scale || 1;
|
|
57
74
|
return {
|
|
58
|
-
url:
|
|
75
|
+
url: o,
|
|
59
76
|
options: t,
|
|
60
|
-
toRaw: () =>
|
|
61
|
-
toImg: () => x(
|
|
62
|
-
toCanvas: () =>
|
|
63
|
-
toBlob: () =>
|
|
64
|
-
toPng: (
|
|
65
|
-
toJpg: (
|
|
66
|
-
toWebp: (
|
|
77
|
+
toRaw: () => o,
|
|
78
|
+
toImg: () => x(o, { dpr: e, scale: n }),
|
|
79
|
+
toCanvas: () => u(o, { dpr: e, scale: n }),
|
|
80
|
+
toBlob: (c) => l(o, { scale: n, ...c }),
|
|
81
|
+
toPng: (c) => p(o, { dpr: e, scale: n, ...c }, "png"),
|
|
82
|
+
toJpg: (c) => p(o, { dpr: e, scale: n, ...c }, "jpeg"),
|
|
83
|
+
toWebp: (c) => p(o, { dpr: e, scale: n, ...c }, "webp"),
|
|
67
84
|
download: ({
|
|
68
|
-
format:
|
|
69
|
-
filename:
|
|
85
|
+
format: c = "png",
|
|
86
|
+
filename: i = "capture",
|
|
70
87
|
backgroundColor: s
|
|
71
|
-
} = {}) => I(
|
|
88
|
+
} = {}) => I(o, { dpr: e, scale: n, backgroundColor: s, format: c, filename: i })
|
|
72
89
|
};
|
|
73
90
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
g.toRaw = async (a, t) => (await g.capture(a, t)).toRaw();
|
|
92
|
+
g.toImg = async (a, t) => (await g.capture(a, t)).toImg();
|
|
93
|
+
g.toCanvas = async (a, t) => (await g.capture(a, t)).toCanvas();
|
|
94
|
+
g.toBlob = async (a, t) => (await g.capture(a, t)).toBlob(t);
|
|
95
|
+
g.toPng = async (a, t) => (await g.capture(a, t)).toPng(t);
|
|
96
|
+
g.toJpg = async (a, t) => (await g.capture(a, t)).toJpg(t);
|
|
97
|
+
g.toWebp = async (a, t) => (await g.capture(a, t)).toWebp(t);
|
|
98
|
+
g.download = async (a, t = {}) => {
|
|
82
99
|
const {
|
|
83
|
-
format:
|
|
84
|
-
filename:
|
|
100
|
+
format: o = "png",
|
|
101
|
+
filename: e = "capture",
|
|
85
102
|
backgroundColor: n,
|
|
86
|
-
...
|
|
103
|
+
...c
|
|
87
104
|
} = t;
|
|
88
|
-
return await (await
|
|
105
|
+
return await (await g.capture(a, c)).download({ format: o, filename: e, backgroundColor: n });
|
|
89
106
|
};
|
|
90
107
|
export {
|
|
91
|
-
|
|
108
|
+
g as snapdom
|
|
92
109
|
};
|
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import { baseCSSCache as S } from "./cache.js";
|
|
2
|
-
import { inlineBackgroundImages as
|
|
3
|
-
import { embedCustomFonts as
|
|
4
|
-
import { inlineImages as
|
|
5
|
-
import { collectUsedTagNames as
|
|
6
|
-
import { idle as
|
|
7
|
-
import { prepareClone as
|
|
8
|
-
async function
|
|
9
|
-
if (!
|
|
10
|
-
if (!(r instanceof Element))
|
|
11
|
-
throw new Error("captureDOM: Only Element nodes are supported");
|
|
2
|
+
import { inlineBackgroundImages as M } from "../modules/background.js";
|
|
3
|
+
import { embedCustomFonts as A } from "../modules/fonts.js";
|
|
4
|
+
import { inlineImages as O } from "../modules/images.js";
|
|
5
|
+
import { collectUsedTagNames as R, generateDedupedBaseCSS as U } from "../utils/cssTools.js";
|
|
6
|
+
import { idle as c, isSafari as j } from "../utils/helpers.js";
|
|
7
|
+
import { prepareClone as D } from "./prepare.js";
|
|
8
|
+
async function V(l, a = {}) {
|
|
9
|
+
if (!l) throw new Error("Element cannot be null or undefined");
|
|
12
10
|
const {
|
|
13
|
-
compress:
|
|
14
|
-
embedFonts:
|
|
15
|
-
fast:
|
|
16
|
-
scale:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
compress: p = !0,
|
|
12
|
+
embedFonts: b = !1,
|
|
13
|
+
fast: r = !0,
|
|
14
|
+
scale: h = 1,
|
|
15
|
+
useProxy: T = ""
|
|
16
|
+
} = a;
|
|
17
|
+
let t, y, v, C = "", m = "", x, $;
|
|
18
|
+
if ({ clone: t, classCSS: y, styleCache: v } = await D(
|
|
19
|
+
l,
|
|
20
|
+
p,
|
|
21
21
|
b,
|
|
22
|
-
|
|
22
|
+
T
|
|
23
23
|
), await new Promise((s) => {
|
|
24
|
-
|
|
24
|
+
c(
|
|
25
25
|
async () => {
|
|
26
|
-
await
|
|
26
|
+
await O(t, a), s();
|
|
27
27
|
},
|
|
28
|
-
{ fast:
|
|
28
|
+
{ fast: r }
|
|
29
29
|
);
|
|
30
30
|
}), await new Promise((s) => {
|
|
31
|
-
|
|
31
|
+
c(
|
|
32
32
|
async () => {
|
|
33
|
-
await
|
|
33
|
+
await M(l, t, v, a), s();
|
|
34
34
|
},
|
|
35
|
-
{ fast:
|
|
35
|
+
{ fast: r }
|
|
36
36
|
);
|
|
37
|
-
}),
|
|
38
|
-
|
|
37
|
+
}), b && await new Promise((s) => {
|
|
38
|
+
c(
|
|
39
39
|
async () => {
|
|
40
|
-
C = await
|
|
40
|
+
C = await A(), s();
|
|
41
41
|
},
|
|
42
|
-
{ fast:
|
|
42
|
+
{ fast: r }
|
|
43
43
|
);
|
|
44
|
-
}),
|
|
45
|
-
const s =
|
|
44
|
+
}), p) {
|
|
45
|
+
const s = R(t).sort(), i = s.join(",");
|
|
46
46
|
S.has(i) ? m = S.get(i) : await new Promise((e) => {
|
|
47
|
-
|
|
47
|
+
c(
|
|
48
48
|
() => {
|
|
49
|
-
m =
|
|
49
|
+
m = U(s), S.set(i, m), e();
|
|
50
50
|
},
|
|
51
|
-
{ fast:
|
|
51
|
+
{ fast: r }
|
|
52
52
|
);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
await new Promise((s) => {
|
|
56
|
-
|
|
56
|
+
c(
|
|
57
57
|
() => {
|
|
58
|
-
const i =
|
|
59
|
-
let e = i.width,
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
58
|
+
const i = l.getBoundingClientRect();
|
|
59
|
+
let e = i.width, n = i.height;
|
|
60
|
+
const w = Number.isFinite(a.width), d = Number.isFinite(a.height), u = typeof h == "number" && h !== 1;
|
|
61
|
+
if (!u) {
|
|
62
62
|
const g = i.width / i.height;
|
|
63
|
-
|
|
63
|
+
w && d ? (e = a.width, n = a.height) : w ? (e = a.width, n = e / g) : d && (n = a.height, e = n * g);
|
|
64
64
|
}
|
|
65
|
-
if (e = Math.ceil(e),
|
|
66
|
-
const g = i.width,
|
|
67
|
-
t.style.transform = `${
|
|
68
|
-
} else
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
65
|
+
if (e = Math.ceil(e), n = Math.ceil(n), t.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), t.style.transformOrigin = "top left", !u && (w || d)) {
|
|
66
|
+
const g = i.width, E = i.height, N = e / g, z = n / E, H = t.style.transform || "", I = `scale(${N}, ${z})`;
|
|
67
|
+
t.style.transform = `${I} ${H}`.trim();
|
|
68
|
+
} else u && j() && (t.style.scale = `${h}`);
|
|
69
|
+
const F = "http://www.w3.org/2000/svg", o = document.createElementNS(F, "foreignObject");
|
|
70
|
+
o.setAttribute("width", "100%"), o.setAttribute("height", "100%");
|
|
71
|
+
const P = document.createElement("style");
|
|
72
|
+
P.textContent = m + C + "svg{overflow:visible;}" + y, o.appendChild(P), o.appendChild(t);
|
|
73
|
+
const B = new XMLSerializer().serializeToString(o);
|
|
74
|
+
$ = `<svg xmlns="${F}" width="${e}" height="${n}" viewBox="0 0 ${e} ${n}">` + B + "</svg>", x = `data:image/svg+xml;charset=utf-8,${encodeURIComponent($)}`, s();
|
|
75
75
|
},
|
|
76
|
-
{ fast:
|
|
76
|
+
{ fast: r }
|
|
77
77
|
);
|
|
78
78
|
});
|
|
79
|
-
const
|
|
80
|
-
return
|
|
79
|
+
const f = document.getElementById("snapdom-sandbox");
|
|
80
|
+
return f && f.style.position === "absolute" && f.remove(), x;
|
|
81
81
|
}
|
|
82
82
|
export {
|
|
83
|
-
|
|
83
|
+
V as captureDOM
|
|
84
84
|
};
|
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
import { inlinePseudoElements as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { inlinePseudoElements as g } from "../modules/pseudo.js";
|
|
2
|
+
import { inlineExternalDef as u } from "../modules/svgDefs.js";
|
|
3
|
+
import { generateCSSClasses as h } from "../utils/cssTools.js";
|
|
4
|
+
import { stripTranslate as w } from "../utils/helpers.js";
|
|
5
|
+
import { deepClone as C } from "./clone.js";
|
|
6
|
+
async function T(n, y = !1, m = !1, p = "") {
|
|
7
|
+
const a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new Map();
|
|
8
|
+
let o;
|
|
8
9
|
try {
|
|
9
|
-
|
|
10
|
+
o = C(n, a, r, c, y);
|
|
10
11
|
} catch (e) {
|
|
11
12
|
throw console.warn("deepClone failed:", e), e;
|
|
12
13
|
}
|
|
13
14
|
try {
|
|
14
|
-
await
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
await g(
|
|
16
|
+
n,
|
|
17
|
+
o,
|
|
17
18
|
a,
|
|
18
19
|
r,
|
|
19
|
-
|
|
20
|
+
y,
|
|
21
|
+
m,
|
|
20
22
|
p
|
|
21
23
|
);
|
|
22
24
|
} catch (e) {
|
|
23
25
|
console.warn("inlinePseudoElements failed:", e);
|
|
24
26
|
}
|
|
27
|
+
try {
|
|
28
|
+
u(o);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.warn("inlineExternalDef failed:", e);
|
|
31
|
+
}
|
|
25
32
|
let d = "";
|
|
26
|
-
if (
|
|
27
|
-
const e =
|
|
28
|
-
d = Array.from(e.entries()).map(([
|
|
29
|
-
for (const [
|
|
30
|
-
if (
|
|
31
|
-
const i = e.get(
|
|
32
|
-
i &&
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
if (y) {
|
|
34
|
+
const e = h(a);
|
|
35
|
+
d = Array.from(e.entries()).map(([t, l]) => `.${l}{${t}}`).join("");
|
|
36
|
+
for (const [t, l] of a.entries()) {
|
|
37
|
+
if (t.tagName === "STYLE") continue;
|
|
38
|
+
const i = e.get(l);
|
|
39
|
+
i && t.classList.add(i);
|
|
40
|
+
const f = t.style?.backgroundImage;
|
|
41
|
+
t.removeAttribute("style"), f && f !== "none" && (t.style.backgroundImage = f);
|
|
35
42
|
}
|
|
36
43
|
} else
|
|
37
|
-
for (const [e,
|
|
38
|
-
e.tagName !== "STYLE" && e.setAttribute("style",
|
|
39
|
-
for (const [e,
|
|
40
|
-
const
|
|
41
|
-
if ((
|
|
44
|
+
for (const [e, t] of a.entries())
|
|
45
|
+
e.tagName !== "STYLE" && e.setAttribute("style", t.replace(/;/g, "; "));
|
|
46
|
+
for (const [e, t] of c.entries()) {
|
|
47
|
+
const l = t.scrollLeft, i = t.scrollTop;
|
|
48
|
+
if ((l || i) && e instanceof HTMLElement) {
|
|
42
49
|
e.style.overflow = "hidden", e.style.scrollbarWidth = "none", e.style.msOverflowStyle = "none";
|
|
43
|
-
const
|
|
44
|
-
for (
|
|
45
|
-
|
|
46
|
-
e.appendChild(
|
|
50
|
+
const s = document.createElement("div");
|
|
51
|
+
for (s.style.transform = `translate(${-l}px, ${-i}px)`, s.style.willChange = "transform", s.style.display = "inline-block", s.style.width = "100%"; e.firstChild; )
|
|
52
|
+
s.appendChild(e.firstChild);
|
|
53
|
+
e.appendChild(s);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
|
-
if (
|
|
50
|
-
const e = r.get(
|
|
51
|
-
r.set(
|
|
52
|
-
const
|
|
53
|
-
|
|
56
|
+
if (n === c.get(o)) {
|
|
57
|
+
const e = r.get(n) || window.getComputedStyle(n);
|
|
58
|
+
r.set(n, e);
|
|
59
|
+
const t = w(e.transform);
|
|
60
|
+
o.style.margin = "0", o.style.position = "static", o.style.top = "auto", o.style.left = "auto", o.style.right = "auto", o.style.bottom = "auto", o.style.zIndex = "auto", o.style.float = "none", o.style.clear = "none", o.style.transform = t || "";
|
|
54
61
|
}
|
|
55
|
-
|
|
62
|
+
for (const [e, t] of c.entries())
|
|
63
|
+
t.tagName === "PRE" && (e.style.marginTop = "0", e.style.marginBlockStart = "0");
|
|
64
|
+
return { clone: o, classCSS: d, styleCache: r };
|
|
56
65
|
}
|
|
57
66
|
export {
|
|
58
|
-
|
|
67
|
+
T as prepareClone
|
|
59
68
|
};
|