@unicom-cloud/utils 0.1.24 → 0.1.25
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/case-name/index.js +1 -1
- package/caseName.js +1 -1
- package/class-name/index.js +1 -1
- package/className.js +1 -1
- package/clipboard-copy/index.js +1 -1
- package/clipboardCopy.js +1 -1
- package/constant/address.js +1 -1
- package/constant/chineseCharacters.js +1 -1
- package/constant/constellations.js +1 -1
- package/constant/domain.js +1 -1
- package/constant/emoji.js +1 -1
- package/constant/identity.js +1 -1
- package/constant/index.js +1 -1
- package/constant/keyboardCode.js +1 -1
- package/constant/licensePlate.js +1 -1
- package/constant/name.js +1 -1
- package/constant/platform.js +1 -1
- package/constant/protocol.js +1 -1
- package/constant/ui.js +1 -1
- package/constant.js +1 -1
- package/content-disposition/index.js +1 -1
- package/contentDisposition.js +1 -1
- package/cookie/index.js +1 -1
- package/cookie/src/index.js +1 -1
- package/cookie.js +1 -1
- package/date/convertTime.js +1 -1
- package/date/convertToDuration.js +1 -1
- package/date/index.js +1 -1
- package/date.js +1 -1
- package/decimal/decimal.js +22 -22
- package/decimal/index.js +1 -1
- package/decimal.js +1 -1
- package/dom-helpers/activeElement.js +1 -1
- package/dom-helpers/addClass.js +1 -1
- package/dom-helpers/addEventListener.js +1 -1
- package/dom-helpers/animate.js +1 -1
- package/dom-helpers/animationFrame.js +1 -1
- package/dom-helpers/attribute.js +1 -1
- package/dom-helpers/camelize.js +1 -1
- package/dom-helpers/camelizeStyle.js +1 -1
- package/dom-helpers/canUseDOM.js +1 -1
- package/dom-helpers/childElements.js +1 -1
- package/dom-helpers/childNodes.js +1 -1
- package/dom-helpers/clear.js +1 -1
- package/dom-helpers/closest.js +1 -1
- package/dom-helpers/collectElements.js +1 -1
- package/dom-helpers/collectSiblings.js +1 -1
- package/dom-helpers/contains.js +1 -1
- package/dom-helpers/css.js +1 -1
- package/dom-helpers/filterEventHandler.js +1 -1
- package/dom-helpers/getComputedStyle.js +1 -1
- package/dom-helpers/getScrollAccessor.js +1 -1
- package/dom-helpers/hasClass.js +1 -1
- package/dom-helpers/height.js +1 -1
- package/dom-helpers/hyphenate.js +1 -1
- package/dom-helpers/hyphenateStyle.js +1 -1
- package/dom-helpers/index.js +1 -1
- package/dom-helpers/insertAfter.js +1 -1
- package/dom-helpers/isDocument.js +1 -1
- package/dom-helpers/isInput.js +1 -1
- package/dom-helpers/isTransform.js +1 -1
- package/dom-helpers/isVisible.js +1 -1
- package/dom-helpers/isWindow.js +1 -1
- package/dom-helpers/listen.js +1 -1
- package/dom-helpers/matches.js +1 -1
- package/dom-helpers/nextUntil.js +1 -1
- package/dom-helpers/offset.js +1 -1
- package/dom-helpers/offsetParent.js +1 -1
- package/dom-helpers/ownerDocument.js +1 -1
- package/dom-helpers/ownerWindow.js +1 -1
- package/dom-helpers/parents.js +1 -1
- package/dom-helpers/position.js +1 -1
- package/dom-helpers/prepend.js +1 -1
- package/dom-helpers/querySelectorAll.js +1 -1
- package/dom-helpers/reflow.js +1 -1
- package/dom-helpers/remove.js +1 -1
- package/dom-helpers/removeClass.js +1 -1
- package/dom-helpers/removeEventListener.js +1 -1
- package/dom-helpers/scrollLeft.js +1 -1
- package/dom-helpers/scrollParent.js +1 -1
- package/dom-helpers/scrollTo.js +1 -1
- package/dom-helpers/scrollTop.js +1 -1
- package/dom-helpers/scrollbarSize.js +1 -1
- package/dom-helpers/siblings.js +1 -1
- package/dom-helpers/text.js +1 -1
- package/dom-helpers/toggleClass.js +1 -1
- package/dom-helpers/transitionEnd.js +1 -1
- package/dom-helpers/triggerEvent.js +1 -1
- package/dom-helpers/types.js +5 -1
- package/dom-helpers/width.js +1 -1
- package/domHelpers.js +1 -1
- package/emitter/index.js +1 -1
- package/emitter/src/index.js +1 -1
- package/emitter.js +1 -1
- package/file/fileToURL.js +1 -1
- package/file/index.js +1 -1
- package/file/saveAs.js +1 -1
- package/file.js +1 -1
- package/idb/index.js +1 -1
- package/idb.js +1 -1
- package/index.js +1 -1
- package/invariant/index.js +1 -1
- package/invariant.js +1 -1
- package/is/index.js +1 -1
- package/is.js +1 -1
- package/js-cookie/index.js +1 -1
- package/js-cookie/src/api.js +1 -1
- package/js-cookie/src/assign.js +1 -1
- package/js-cookie/src/converter.js +1 -1
- package/jsCookie.js +1 -1
- package/lunar/index.js +1 -1
- package/lunar/lib/Holiday.js +1 -1
- package/lunar/lib/HolidayUtil.js +1 -1
- package/lunar/lib/I18n.js +1 -1
- package/lunar/lib/JieQi.js +1 -1
- package/lunar/lib/Lunar.js +1 -1
- package/lunar/lib/LunarMonth.js +1 -1
- package/lunar/lib/LunarTime.js +1 -1
- package/lunar/lib/LunarUtil.js +1 -1
- package/lunar/lib/LunarYear.js +1 -1
- package/lunar/lib/ShouXingUtil.js +1 -1
- package/lunar/lib/Solar.js +1 -1
- package/lunar/lib/SolarHalfYear.js +1 -1
- package/lunar/lib/SolarMonth.js +1 -1
- package/lunar/lib/SolarSeason.js +1 -1
- package/lunar/lib/SolarUtil.js +1 -1
- package/lunar/lib/SolarWeek.js +1 -1
- package/lunar/lib/SolarYear.js +1 -1
- package/lunar/lib/index.js +1 -1
- package/lunar.js +1 -1
- package/math/index.js +1 -1
- package/math.js +1 -1
- package/md5/index.js +1 -1
- package/md5.js +1 -1
- package/mock/MockWebSocket.js +1 -1
- package/mock/MockXMLHttpRequest.js +1 -1
- package/mock/index.js +1 -1
- package/mock.js +1 -1
- package/normalize-wheel/ExecutionEnvironment.js +1 -1
- package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
- package/normalize-wheel/index.js +1 -1
- package/normalize-wheel/isEventSupported.js +10 -14
- package/normalizeWheel.js +1 -1
- package/number-to-chinese/index.js +1 -1
- package/numberToChinese.js +1 -1
- package/nzh/cn.js +1 -1
- package/nzh/hk.js +1 -1
- package/nzh/index.js +1 -1
- package/nzh/nzh.js +1 -1
- package/nzh/src/autoGet.js +1 -1
- package/nzh/src/index.js +1 -1
- package/nzh/src/langs/cn_b.js +1 -1
- package/nzh/src/langs/cn_s.js +1 -1
- package/nzh/src/langs/hk_b.js +1 -1
- package/nzh/src/langs/hk_s.js +1 -1
- package/nzh/src/utils.js +1 -1
- package/nzh.js +1 -1
- package/object-keys-sort/index.js +1 -1
- package/objectKeysSort.js +1 -1
- package/package.json +1 -1
- package/pinyin/index.js +1 -1
- package/pinyin/simplified.js +1 -1
- package/pinyin/src/core.js +1 -1
- package/pinyin/src/simplified.js +1 -1
- package/pinyin/src/simplified_dict.js +1 -1
- package/pinyin/src/traditional.js +1 -1
- package/pinyin/src/traditional_dict.js +1 -1
- package/pinyin/traditional.js +1 -1
- package/pinyin.js +1 -1
- package/query-string/base.js +1 -1
- package/query-string/index.js +1 -1
- package/query-string/splitOnFirst.js +1 -1
- package/queryString.js +1 -1
- package/random/address.js +1 -1
- package/random/constellation.js +1 -1
- package/random/image.js +1 -1
- package/random/index.js +1 -1
- package/random/licensePlate.js +1 -1
- package/random/name.js +1 -1
- package/random/number.js +1 -1
- package/random/text.js +1 -1
- package/random/time.js +1 -1
- package/random/web.js +1 -1
- package/random.js +1 -1
- package/screenfull/index.js +1 -1
- package/screenfull.js +1 -1
- package/sleep/index.js +1 -1
- package/sleep.js +1 -1
- package/snapdom/index.js +1 -1
- package/snapdom/src/api/preCache.js +51 -49
- package/snapdom/src/api/snapdom.js +171 -67
- package/snapdom/src/core/cache.js +2 -2
- package/snapdom/src/core/capture.js +249 -234
- package/snapdom/src/core/clone.js +151 -120
- package/snapdom/src/core/context.js +10 -8
- package/snapdom/src/core/plugins.js +69 -0
- package/snapdom/src/core/prepare.js +2 -2
- package/snapdom/src/exporters/download.js +1 -1
- package/snapdom/src/exporters/toBlob.js +1 -1
- package/snapdom/src/exporters/toCanvas.js +40 -40
- package/snapdom/src/exporters/toImg.js +1 -1
- package/snapdom/src/modules/CSSVar.js +66 -40
- package/snapdom/src/modules/background.js +39 -23
- package/snapdom/src/modules/changeCSS.js +1 -1
- package/snapdom/src/modules/counter.js +100 -86
- package/snapdom/src/modules/fonts.js +4 -4
- package/snapdom/src/modules/iconFonts.js +98 -14
- package/snapdom/src/modules/images.js +1 -1
- package/snapdom/src/modules/lineClamp.js +1 -1
- package/snapdom/src/modules/pseudo.js +147 -138
- package/snapdom/src/modules/rasterize.js +1 -1
- package/snapdom/src/modules/snapFetch.js +1 -1
- package/snapdom/src/modules/styles.js +1 -1
- package/snapdom/src/modules/svgDefs.js +86 -39
- package/snapdom/src/utils/browser.js +1 -1
- package/snapdom/src/utils/css.js +1 -1
- package/snapdom/src/utils/helpers.js +1 -1
- package/snapdom/src/utils/image.js +1 -1
- package/snapdom/types/snapdom.d.ts +253 -184
- package/snapdom.js +1 -1
- package/tinycolor/index.js +1 -1
- package/tinycolor/src/conversion.js +1 -1
- package/tinycolor/src/css-color-names.js +1 -1
- package/tinycolor/src/format-input.js +1 -1
- package/tinycolor/src/from-ratio.js +1 -1
- package/tinycolor/src/index.js +1 -1
- package/tinycolor/src/random.js +1 -1
- package/tinycolor/src/readability.js +1 -1
- package/tinycolor/src/to-ms-filter.js +1 -1
- package/tinycolor/src/utils.js +1 -1
- package/tinycolor.js +1 -1
- package/tree/index.js +1 -1
- package/tree/search/index.js +1 -1
- package/tree.js +1 -1
- package/tween/index.js +8 -0
- package/tween/src/easing.js +62 -0
- package/tween/src/tween.js +46 -0
- package/tween.js +8 -0
- package/types/dom-helpers/types.d.ts +2 -0
- package/types/normalize-wheel/index.d.ts +1 -1
- package/types/snapdom/src/api/snapdom.d.ts +4 -0
- package/types/snapdom/src/core/capture.d.ts +4 -18
- package/types/snapdom/src/core/context.d.ts +4 -4
- package/types/snapdom/src/core/exporters.d.ts +33 -0
- package/types/snapdom/src/core/plugins.d.ts +59 -0
- package/types/snapdom/src/modules/CSSVar.d.ts +3 -7
- package/types/snapdom/src/modules/iconFonts.d.ts +34 -0
- package/types/snapdom/src/modules/svgDefs.d.ts +9 -15
- package/types/tween/index.d.ts +1 -0
- package/types/tween/src/easing.d.ts +22 -0
- package/types/tween/src/index.d.ts +3 -0
- package/types/tween/src/tween.d.ts +22 -0
- package/types/validate/index.d.ts +3 -0
- package/types/validate/src/index.d.ts +39 -0
- package/types/validate/src/interface.d.ts +53 -0
- package/types/validate/src/locale/en-US.d.ts +47 -0
- package/types/validate/src/locale/zh-CN.d.ts +47 -0
- package/types/validate/src/message.d.ts +2 -0
- package/types/validate/src/rules/array.d.ts +12 -0
- package/types/validate/src/rules/base.d.ts +25 -0
- package/types/validate/src/rules/boolean.d.ts +8 -0
- package/types/validate/src/rules/custom.d.ts +7 -0
- package/types/validate/src/rules/number.d.ts +12 -0
- package/types/validate/src/rules/object.d.ts +9 -0
- package/types/validate/src/rules/string.d.ts +12 -0
- package/types/validate/src/rules/type.d.ts +9 -0
- package/types/validate/src/utils.d.ts +3 -0
- package/ui-color/compareColorByRange.js +1 -1
- package/ui-color/index.js +1 -1
- package/uiColor.js +1 -1
- package/url-toolkit/index.js +1 -1
- package/url-toolkit/src/url-toolkit.js +1 -1
- package/urlToolkit.js +1 -1
- package/validate/index.js +28 -0
- package/validate/src/index.js +106 -0
- package/validate/src/locale/en-US.js +50 -0
- package/validate/src/locale/zh-CN.js +50 -0
- package/validate/src/message.js +5 -0
- package/validate/src/rules/array.js +73 -0
- package/validate/src/rules/base.js +69 -0
- package/validate/src/rules/boolean.js +29 -0
- package/validate/src/rules/custom.js +26 -0
- package/validate/src/rules/number.js +54 -0
- package/validate/src/rules/object.js +39 -0
- package/validate/src/rules/string.js +54 -0
- package/validate/src/rules/type.js +35 -0
- package/validate/src/utils.js +8 -0
- package/validate.js +28 -0
- package/version/index.js +1 -1
- package/version.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
2
|
import { isSafari as b } from "../utils/browser.js";
|
|
3
3
|
function y(e) {
|
|
4
4
|
return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
|
|
@@ -7,99 +7,99 @@ function S(e) {
|
|
|
7
7
|
const s = e.indexOf(",");
|
|
8
8
|
return s >= 0 ? decodeURIComponent(e.slice(s + 1)) : "";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function C(e) {
|
|
11
11
|
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
let s = [], t = "",
|
|
13
|
+
function v(e) {
|
|
14
|
+
let s = [], t = "", i = 0;
|
|
15
15
|
for (let r = 0; r < e.length; r++) {
|
|
16
16
|
const o = e[r];
|
|
17
|
-
o === "(" &&
|
|
17
|
+
o === "(" && i++, o === ")" && (i = Math.max(0, i - 1)), o === ";" && i === 0 ? (s.push(t), t = "") : t += o;
|
|
18
18
|
}
|
|
19
19
|
return t.trim() && s.push(t), s.map((r) => r.trim()).filter(Boolean);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function D(e) {
|
|
22
22
|
const s = [];
|
|
23
|
-
let t = "",
|
|
23
|
+
let t = "", i = 0;
|
|
24
24
|
for (let o = 0; o < e.length; o++) {
|
|
25
25
|
const a = e[o];
|
|
26
|
-
a === "(" &&
|
|
26
|
+
a === "(" && i++, a === ")" && (i = Math.max(0, i - 1)), a === "," && i === 0 ? (s.push(t.trim()), t = "") : t += a;
|
|
27
27
|
}
|
|
28
28
|
t.trim() && s.push(t.trim());
|
|
29
29
|
const r = [];
|
|
30
30
|
for (const o of s) {
|
|
31
31
|
if (/\binset\b/i.test(o)) continue;
|
|
32
|
-
const a = o.match(/-?\d+(?:\.\d+)?px/gi) || [], [
|
|
32
|
+
const a = o.match(/-?\d+(?:\.\d+)?px/gi) || [], [n = "0px", l = "0px", f = "0px"] = a;
|
|
33
33
|
let c = o.replace(/-?\d+(?:\.\d+)?px/gi, "").replace(/\binset\b/gi, "").trim().replace(/\s{2,}/g, " ");
|
|
34
34
|
const m = !!c && c !== ",";
|
|
35
|
-
r.push(`drop-shadow(${
|
|
35
|
+
r.push(`drop-shadow(${n} ${l} ${f}${m ? ` ${c}` : ""})`);
|
|
36
36
|
}
|
|
37
37
|
return r.join(" ");
|
|
38
38
|
}
|
|
39
39
|
function $(e) {
|
|
40
|
-
const s =
|
|
41
|
-
let t = null,
|
|
40
|
+
const s = v(e);
|
|
41
|
+
let t = null, i = null, r = null;
|
|
42
42
|
const o = [];
|
|
43
|
-
for (const
|
|
44
|
-
const l =
|
|
43
|
+
for (const n of s) {
|
|
44
|
+
const l = n.indexOf(":");
|
|
45
45
|
if (l < 0) continue;
|
|
46
|
-
const f =
|
|
47
|
-
f === "box-shadow" ? r = c : f === "filter" ? t = c : f === "-webkit-filter" ?
|
|
46
|
+
const f = n.slice(0, l).trim().toLowerCase(), c = n.slice(l + 1).trim();
|
|
47
|
+
f === "box-shadow" ? r = c : f === "filter" ? t = c : f === "-webkit-filter" ? i = c : o.push([f, c]);
|
|
48
48
|
}
|
|
49
49
|
if (r) {
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const n = D(r);
|
|
51
|
+
n && (t = t ? `${t} ${n}` : n, i = i ? `${i} ${n}` : n);
|
|
52
52
|
}
|
|
53
53
|
const a = [...o];
|
|
54
|
-
return t && a.push(["filter", t]),
|
|
54
|
+
return t && a.push(["filter", t]), i && a.push(["-webkit-filter", i]), a.map(([n, l]) => `${n}:${l}`).join(";");
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function F(e) {
|
|
57
57
|
return e.replace(
|
|
58
58
|
/([^{}]+)\{([^}]*)\}/g,
|
|
59
|
-
(s, t,
|
|
59
|
+
(s, t, i) => `${t}{${$(i)}}`
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function H(e) {
|
|
63
63
|
return e = e.replace(
|
|
64
64
|
/<style[^>]*>([\s\S]*?)<\/style>/gi,
|
|
65
|
-
(s, t) => s.replace(t,
|
|
65
|
+
(s, t) => s.replace(t, F(t))
|
|
66
66
|
), e = e.replace(
|
|
67
67
|
/style=(['"])([\s\S]*?)\1/gi,
|
|
68
|
-
(s, t,
|
|
68
|
+
(s, t, i) => `style=${t}${$(i)}${t}`
|
|
69
69
|
), e;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function M(e) {
|
|
72
72
|
if (!b() || !y(e)) return e;
|
|
73
73
|
try {
|
|
74
|
-
const s = S(e), t =
|
|
75
|
-
return
|
|
74
|
+
const s = S(e), t = H(s);
|
|
75
|
+
return C(t);
|
|
76
76
|
} catch {
|
|
77
77
|
return e;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
async function k(e, s) {
|
|
81
|
-
let { width: t, height:
|
|
82
|
-
e =
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const l =
|
|
81
|
+
let { width: t, height: i, scale: r = 1, dpr: o = 1, meta: a = {} } = s;
|
|
82
|
+
e = M(e);
|
|
83
|
+
const n = new Image();
|
|
84
|
+
n.loading = "eager", n.decoding = "sync", n.crossOrigin = "anonymous", n.src = e, await n.decode();
|
|
85
|
+
const l = n.naturalWidth, f = n.naturalHeight, c = Number.isFinite(a.w0) ? a.w0 : l, m = Number.isFinite(a.h0) ? a.h0 : f;
|
|
86
86
|
let h, u;
|
|
87
|
-
const g = Number.isFinite(t), x = Number.isFinite(
|
|
87
|
+
const g = Number.isFinite(t), x = Number.isFinite(i);
|
|
88
88
|
if (g && x)
|
|
89
|
-
h = Math.max(1, t), u = Math.max(1,
|
|
89
|
+
h = Math.max(1, t), u = Math.max(1, i);
|
|
90
90
|
else if (g) {
|
|
91
91
|
const p = t / Math.max(1, c);
|
|
92
|
-
h = t, u =
|
|
92
|
+
h = t, u = m * p;
|
|
93
93
|
} else if (x) {
|
|
94
|
-
const p =
|
|
95
|
-
u =
|
|
94
|
+
const p = i / Math.max(1, m);
|
|
95
|
+
u = i, h = c * p;
|
|
96
96
|
} else
|
|
97
97
|
h = l, u = f;
|
|
98
|
-
h =
|
|
98
|
+
h = h * r, u = u * r;
|
|
99
99
|
const d = document.createElement("canvas");
|
|
100
|
-
d.width =
|
|
100
|
+
d.width = h * o, d.height = u * o, d.style.width = `${h}px`, d.style.height = `${u}px`;
|
|
101
101
|
const w = d.getContext("2d");
|
|
102
|
-
return o !== 1 && w.scale(o, o), w.drawImage(
|
|
102
|
+
return o !== 1 && w.scale(o, o), w.drawImage(n, 0, 0, h, u), d;
|
|
103
103
|
}
|
|
104
104
|
export {
|
|
105
105
|
k as toCanvas
|
|
@@ -1,61 +1,87 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
const f = ["fill", "stroke", "color", "background-color", "stop-color"], p = /* @__PURE__ */ new Map();
|
|
3
|
+
function y(r, c) {
|
|
4
|
+
const l = c + "::" + r.toLowerCase();
|
|
5
|
+
let a = p.get(l);
|
|
6
|
+
if (a) return a;
|
|
7
|
+
const n = document, o = c === "http://www.w3.org/2000/svg" ? n.createElementNS(c, r) : n.createElement(r), e = n.createElement("div");
|
|
8
|
+
e.style.cssText = "position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;", e.appendChild(o), n.documentElement.appendChild(e);
|
|
9
|
+
const t = getComputedStyle(o), s = {};
|
|
10
|
+
for (const i of f)
|
|
11
|
+
s[i] = t.getPropertyValue(i) || "";
|
|
12
|
+
return e.remove(), p.set(l, s), s;
|
|
13
|
+
}
|
|
14
|
+
function u(r, c) {
|
|
15
|
+
if (!(r instanceof Element) || !(c instanceof Element)) return;
|
|
16
|
+
const l = r.getAttribute?.("style");
|
|
17
|
+
let a = !!(l && l.includes("var("));
|
|
18
|
+
if (!a && r.attributes?.length) {
|
|
19
|
+
const o = r.attributes;
|
|
20
|
+
for (let e = 0; e < o.length; e++) {
|
|
21
|
+
const t = o[e];
|
|
22
|
+
if (t && typeof t.value == "string" && t.value.includes("var(")) {
|
|
23
|
+
a = !0;
|
|
12
24
|
break;
|
|
13
25
|
}
|
|
14
26
|
}
|
|
15
27
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
let n = null;
|
|
29
|
+
if (a)
|
|
30
|
+
try {
|
|
31
|
+
n = getComputedStyle(r);
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
if (a) {
|
|
35
|
+
const o = r.style;
|
|
36
|
+
if (o && o.length)
|
|
37
|
+
for (let e = 0; e < o.length; e++) {
|
|
38
|
+
const t = o[e], s = o.getPropertyValue(t);
|
|
39
|
+
if (!s || !s.includes("var(")) continue;
|
|
40
|
+
const i = n && n.getPropertyValue(t);
|
|
41
|
+
if (i)
|
|
42
|
+
try {
|
|
43
|
+
c.style.setProperty(
|
|
44
|
+
t,
|
|
45
|
+
i.trim(),
|
|
46
|
+
o.getPropertyPriority(t)
|
|
47
|
+
);
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
22
51
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for (let
|
|
26
|
-
const t =
|
|
27
|
-
if (!
|
|
28
|
-
|
|
52
|
+
if (a && r.attributes?.length) {
|
|
53
|
+
const o = r.attributes;
|
|
54
|
+
for (let e = 0; e < o.length; e++) {
|
|
55
|
+
const t = o[e];
|
|
56
|
+
if (!t || typeof t.value != "string" || !t.value.includes("var("))
|
|
57
|
+
continue;
|
|
58
|
+
const s = t.name, i = n && n.getPropertyValue(s);
|
|
29
59
|
if (i)
|
|
30
60
|
try {
|
|
31
|
-
|
|
32
|
-
t,
|
|
33
|
-
i.trim(),
|
|
34
|
-
a.getPropertyPriority(t)
|
|
35
|
-
);
|
|
61
|
+
c.style.setProperty(s, i.trim());
|
|
36
62
|
} catch {
|
|
37
63
|
}
|
|
38
64
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const e = r[t];
|
|
43
|
-
if (!e || typeof e.value != "string" || !e.value.includes("var("))
|
|
44
|
-
continue;
|
|
45
|
-
const i = e.name;
|
|
46
|
-
let c = "";
|
|
65
|
+
}
|
|
66
|
+
if (!a) {
|
|
67
|
+
if (!n)
|
|
47
68
|
try {
|
|
48
|
-
|
|
69
|
+
n = getComputedStyle(r);
|
|
49
70
|
} catch {
|
|
71
|
+
n = null;
|
|
50
72
|
}
|
|
51
|
-
|
|
73
|
+
if (!n) return;
|
|
74
|
+
const o = r.namespaceURI || "html", e = y(r.tagName, o);
|
|
75
|
+
for (const t of f) {
|
|
76
|
+
const s = n.getPropertyValue(t) || "", i = e[t] || "";
|
|
77
|
+
if (s && s !== i)
|
|
52
78
|
try {
|
|
53
|
-
|
|
79
|
+
c.style.setProperty(t, s.trim());
|
|
54
80
|
} catch {
|
|
55
81
|
}
|
|
56
82
|
}
|
|
57
83
|
}
|
|
58
84
|
}
|
|
59
85
|
export {
|
|
60
|
-
|
|
86
|
+
u as resolveCSSVars
|
|
61
87
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
import { getStyle as
|
|
3
|
-
import { inlineSingleBackgroundEntry as
|
|
4
|
-
async function
|
|
5
|
-
const a = [[k,
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
import { getStyle as h, splitBackgroundImage as w } from "../utils/css.js";
|
|
3
|
+
import { inlineSingleBackgroundEntry as O } from "../utils/image.js";
|
|
4
|
+
async function _(k, d, s, l = {}) {
|
|
5
|
+
const a = [[k, d]], p = [
|
|
6
6
|
"background-image",
|
|
7
7
|
// Mask shorthands & images (both standard and WebKit)
|
|
8
8
|
"mask",
|
|
@@ -17,7 +17,7 @@ async function A(k, g, n, p = {}) {
|
|
|
17
17
|
// Border image
|
|
18
18
|
"border-image",
|
|
19
19
|
"border-image-source"
|
|
20
|
-
],
|
|
20
|
+
], u = [
|
|
21
21
|
"mask-position",
|
|
22
22
|
"mask-size",
|
|
23
23
|
"mask-repeat",
|
|
@@ -33,41 +33,57 @@ async function A(k, g, n, p = {}) {
|
|
|
33
33
|
// Some engines expose X/Y position separately:
|
|
34
34
|
"-webkit-mask-position-x",
|
|
35
35
|
"-webkit-mask-position-y"
|
|
36
|
-
],
|
|
36
|
+
], b = [
|
|
37
|
+
"background-position",
|
|
38
|
+
"background-position-x",
|
|
39
|
+
"background-position-y",
|
|
40
|
+
"background-size",
|
|
41
|
+
"background-repeat",
|
|
42
|
+
"background-origin",
|
|
43
|
+
"background-clip",
|
|
44
|
+
"background-attachment",
|
|
45
|
+
"background-blend-mode"
|
|
46
|
+
], f = [
|
|
37
47
|
"border-image-slice",
|
|
38
48
|
"border-image-width",
|
|
39
49
|
"border-image-outset",
|
|
40
50
|
"border-image-repeat"
|
|
41
51
|
];
|
|
42
52
|
for (; a.length; ) {
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
const
|
|
53
|
+
const [r, i] = a.shift(), t = s.get(r) || h(r);
|
|
54
|
+
s.has(r) || s.set(r, t);
|
|
55
|
+
const y = (() => {
|
|
46
56
|
const e = t.getPropertyValue("border-image"), o = t.getPropertyValue("border-image-source");
|
|
47
57
|
return e && e !== "none" || o && o !== "none";
|
|
48
58
|
})();
|
|
49
|
-
for (const e of
|
|
59
|
+
for (const e of b) {
|
|
60
|
+
const o = t.getPropertyValue(e);
|
|
61
|
+
o && i.style.setProperty(e, o);
|
|
62
|
+
}
|
|
63
|
+
for (const e of p) {
|
|
50
64
|
const o = t.getPropertyValue(e);
|
|
51
65
|
if (!o || o === "none") continue;
|
|
52
|
-
const
|
|
53
|
-
|
|
66
|
+
const P = w(o), g = await Promise.all(
|
|
67
|
+
P.map((n) => O(n, l))
|
|
54
68
|
);
|
|
55
|
-
|
|
69
|
+
g.some((n) => n && n !== "none" && !/^url\(undefined/.test(n)) && i.style.setProperty(e, g.join(", "));
|
|
56
70
|
}
|
|
57
|
-
for (const e of
|
|
71
|
+
for (const e of u) {
|
|
58
72
|
const o = t.getPropertyValue(e);
|
|
59
|
-
!o || o === "initial" ||
|
|
73
|
+
!o || o === "initial" || i.style.setProperty(e, o);
|
|
60
74
|
}
|
|
61
|
-
if (
|
|
62
|
-
for (const e of
|
|
75
|
+
if (y)
|
|
76
|
+
for (const e of f) {
|
|
63
77
|
const o = t.getPropertyValue(e);
|
|
64
|
-
!o || o === "initial" ||
|
|
78
|
+
!o || o === "initial" || i.style.setProperty(e, o);
|
|
65
79
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
const c = Array.from(r.children), m = Array.from(i.children).filter(
|
|
81
|
+
(e) => !(e.dataset && e.dataset.snapdomPseudo)
|
|
82
|
+
);
|
|
83
|
+
for (let e = 0; e < Math.min(c.length, m.length); e++)
|
|
84
|
+
a.push([c[e], m[e]]);
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
87
|
export {
|
|
72
|
-
|
|
88
|
+
_ as inlineBackgroundImages
|
|
73
89
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
import { cache as F } from "../core/cache.js";
|
|
3
|
+
function D(e) {
|
|
3
4
|
return /\bcounter\s*\(|\bcounters\s*\(/.test(e || "");
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
+
function X(e) {
|
|
6
7
|
return (e || "").replace(/"([^"]*)"/g, "$1");
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
for (;
|
|
11
|
-
|
|
12
|
-
return
|
|
9
|
+
function k(e, u = !1) {
|
|
10
|
+
let c = "", o = Math.max(1, e);
|
|
11
|
+
for (; o > 0; )
|
|
12
|
+
o--, c = String.fromCharCode(97 + o % 26) + c, o = Math.floor(o / 26);
|
|
13
|
+
return u ? c.toUpperCase() : c;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
15
|
+
function x(e, u = !0) {
|
|
16
|
+
const c = [
|
|
16
17
|
[1e3, "M"],
|
|
17
18
|
[900, "CM"],
|
|
18
19
|
[500, "D"],
|
|
@@ -27,104 +28,116 @@ function L(e, o = !0) {
|
|
|
27
28
|
[4, "IV"],
|
|
28
29
|
[1, "I"]
|
|
29
30
|
];
|
|
30
|
-
let
|
|
31
|
-
for (const [
|
|
32
|
-
for (;
|
|
33
|
-
|
|
34
|
-
return
|
|
31
|
+
let o = Math.max(1, Math.min(3999, e)), f = "";
|
|
32
|
+
for (const [N, C] of c)
|
|
33
|
+
for (; o >= N; )
|
|
34
|
+
f += C, o -= N;
|
|
35
|
+
return u ? f : f.toLowerCase();
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
switch ((
|
|
37
|
+
function I(e, u) {
|
|
38
|
+
switch ((u || "decimal").toLowerCase()) {
|
|
38
39
|
case "decimal":
|
|
39
40
|
return String(Math.max(0, e));
|
|
40
41
|
case "decimal-leading-zero":
|
|
41
42
|
return (e < 10 ? "0" : "") + String(Math.max(0, e));
|
|
42
43
|
case "lower-alpha":
|
|
43
|
-
return
|
|
44
|
+
return k(e, !1);
|
|
44
45
|
case "upper-alpha":
|
|
45
|
-
return
|
|
46
|
+
return k(e, !0);
|
|
46
47
|
case "lower-roman":
|
|
47
|
-
return
|
|
48
|
+
return x(e, !1);
|
|
48
49
|
case "upper-roman":
|
|
49
|
-
return
|
|
50
|
+
return x(e, !0);
|
|
50
51
|
default:
|
|
51
52
|
return String(Math.max(0, e));
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
function $(e) {
|
|
56
|
+
const u = () => F?.session?.__counterEpoch ?? 0;
|
|
57
|
+
let c = u();
|
|
58
|
+
const o = /* @__PURE__ */ new WeakMap(), f = e instanceof Document ? e.documentElement : e, N = (n) => n && n.tagName === "LI", C = (n) => {
|
|
59
|
+
let r = 0, t = n?.parentElement;
|
|
57
60
|
if (!t) return 0;
|
|
58
|
-
for (const
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
+
for (const s of t.children) {
|
|
62
|
+
if (s === n) break;
|
|
63
|
+
s.tagName === "LI" && r++;
|
|
61
64
|
}
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
const
|
|
65
|
-
for (const [t,
|
|
66
|
-
return
|
|
67
|
-
},
|
|
68
|
-
const
|
|
69
|
-
let
|
|
65
|
+
return r;
|
|
66
|
+
}, S = (n) => {
|
|
67
|
+
const r = /* @__PURE__ */ new Map();
|
|
68
|
+
for (const [t, s] of n) r.set(t, s.slice());
|
|
69
|
+
return r;
|
|
70
|
+
}, g = (n, r, t) => {
|
|
71
|
+
const s = S(n);
|
|
72
|
+
let h;
|
|
70
73
|
try {
|
|
71
|
-
|
|
74
|
+
h = t.style?.counterReset || getComputedStyle(t).counterReset;
|
|
72
75
|
} catch {
|
|
73
76
|
}
|
|
74
|
-
if (
|
|
75
|
-
for (const
|
|
76
|
-
const
|
|
77
|
+
if (h && h !== "none")
|
|
78
|
+
for (const M of h.split(",")) {
|
|
79
|
+
const m = M.trim().split(/\s+/), i = m[0], l = Number.isFinite(Number(m[1])) ? Number(m[1]) : 0;
|
|
77
80
|
if (!i) continue;
|
|
78
|
-
const a =
|
|
81
|
+
const a = r.get(i);
|
|
79
82
|
if (a && a.length) {
|
|
80
|
-
const
|
|
81
|
-
|
|
83
|
+
const w = a.slice();
|
|
84
|
+
w.push(l), s.set(i, w);
|
|
82
85
|
} else
|
|
83
|
-
|
|
86
|
+
s.set(i, [l]);
|
|
84
87
|
}
|
|
85
|
-
let
|
|
88
|
+
let y;
|
|
86
89
|
try {
|
|
87
|
-
|
|
90
|
+
y = t.style?.counterIncrement || getComputedStyle(t).counterIncrement;
|
|
88
91
|
} catch {
|
|
89
92
|
}
|
|
90
|
-
if (
|
|
91
|
-
for (const
|
|
92
|
-
const
|
|
93
|
+
if (y && y !== "none")
|
|
94
|
+
for (const M of y.split(",")) {
|
|
95
|
+
const m = M.trim().split(/\s+/), i = m[0], l = Number.isFinite(Number(m[1])) ? Number(m[1]) : 1;
|
|
93
96
|
if (!i) continue;
|
|
94
|
-
const a =
|
|
95
|
-
a.length === 0 && a.push(0), a[a.length - 1] +=
|
|
97
|
+
const a = s.get(i) || [];
|
|
98
|
+
a.length === 0 && a.push(0), a[a.length - 1] += l, s.set(i, a);
|
|
96
99
|
}
|
|
97
100
|
try {
|
|
98
|
-
if (getComputedStyle(t).display === "list-item" &&
|
|
99
|
-
const
|
|
101
|
+
if (getComputedStyle(t).display === "list-item" && N(t)) {
|
|
102
|
+
const m = t.parentElement;
|
|
100
103
|
let i = 1;
|
|
101
|
-
if (
|
|
102
|
-
const a =
|
|
103
|
-
i = Number.isFinite(Number(
|
|
104
|
+
if (m && m.tagName === "OL") {
|
|
105
|
+
const a = m.getAttribute("start"), w = Number.isFinite(Number(a)) ? Number(a) : 1, E = C(t), L = t.getAttribute("value");
|
|
106
|
+
i = Number.isFinite(Number(L)) ? Number(L) : w + E;
|
|
104
107
|
} else
|
|
105
|
-
i = 1 +
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
+
i = 1 + C(t);
|
|
109
|
+
const l = s.get("list-item") || [];
|
|
110
|
+
l.length === 0 && l.push(0), l[l.length - 1] = i, s.set("list-item", l);
|
|
108
111
|
}
|
|
109
112
|
} catch {
|
|
110
113
|
}
|
|
111
|
-
return
|
|
112
|
-
},
|
|
113
|
-
const
|
|
114
|
-
o.set(n,
|
|
115
|
-
let
|
|
116
|
-
for (const
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
-
},
|
|
120
|
-
|
|
114
|
+
return s;
|
|
115
|
+
}, p = (n, r, t) => {
|
|
116
|
+
const s = g(t, r, n);
|
|
117
|
+
o.set(n, s);
|
|
118
|
+
let h = s;
|
|
119
|
+
for (const y of n.children)
|
|
120
|
+
h = p(y, s, h);
|
|
121
|
+
return s;
|
|
122
|
+
}, b = /* @__PURE__ */ new Map();
|
|
123
|
+
p(f, b, b);
|
|
124
|
+
function d() {
|
|
125
|
+
const n = u();
|
|
126
|
+
if (n !== c) {
|
|
127
|
+
c = n;
|
|
128
|
+
const r = /* @__PURE__ */ new Map();
|
|
129
|
+
p(f, r, r);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
121
133
|
/**
|
|
122
134
|
* Get top value for counter name at given node.
|
|
123
135
|
* @param {Element} node
|
|
124
136
|
* @param {string} name
|
|
125
137
|
*/
|
|
126
|
-
get(n,
|
|
127
|
-
|
|
138
|
+
get(n, r) {
|
|
139
|
+
d();
|
|
140
|
+
const t = o.get(n)?.get(r);
|
|
128
141
|
return t && t.length ? t[t.length - 1] : 0;
|
|
129
142
|
},
|
|
130
143
|
/**
|
|
@@ -132,34 +145,35 @@ function X(e) {
|
|
|
132
145
|
* @param {Element} node
|
|
133
146
|
* @param {string} name
|
|
134
147
|
*/
|
|
135
|
-
getStack(n,
|
|
136
|
-
|
|
148
|
+
getStack(n, r) {
|
|
149
|
+
d();
|
|
150
|
+
const t = o.get(n)?.get(r);
|
|
137
151
|
return t ? t.slice() : [];
|
|
138
152
|
}
|
|
139
153
|
};
|
|
140
154
|
}
|
|
141
|
-
function
|
|
155
|
+
function R(e, u, c) {
|
|
142
156
|
if (!e || e === "none") return e;
|
|
143
157
|
try {
|
|
144
|
-
const
|
|
145
|
-
let
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
const
|
|
149
|
-
return
|
|
158
|
+
const o = /\b(counter|counters)\s*\(([^)]+)\)/g;
|
|
159
|
+
let f = e.replace(o, (N, C, S) => {
|
|
160
|
+
const g = String(S).split(",").map((p) => p.trim());
|
|
161
|
+
if (C === "counter") {
|
|
162
|
+
const p = g[0]?.replace(/^["']|["']$/g, ""), b = (g[1] || "decimal").toLowerCase(), d = c.get(u, p);
|
|
163
|
+
return I(d, b);
|
|
150
164
|
} else {
|
|
151
|
-
const
|
|
152
|
-
return
|
|
165
|
+
const p = g[0]?.replace(/^["']|["']$/g, ""), b = g[1]?.replace(/^["']|["']$/g, "") ?? "", d = (g[2] || "decimal").toLowerCase(), n = c.getStack(u, p);
|
|
166
|
+
return n.length ? n.map((t) => I(t, d)).join(b) : "";
|
|
153
167
|
}
|
|
154
168
|
});
|
|
155
|
-
return
|
|
169
|
+
return X(f);
|
|
156
170
|
} catch {
|
|
157
171
|
return "- ";
|
|
158
172
|
}
|
|
159
173
|
}
|
|
160
174
|
export {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
175
|
+
$ as buildCounterContext,
|
|
176
|
+
D as hasCounters,
|
|
177
|
+
R as resolveCountersInContent,
|
|
178
|
+
X as unquoteDoubleStrings
|
|
165
179
|
};
|