@unicom-cloud/utils 0.1.31 → 0.1.32
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 +6 -5
- 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/isMobile.js +7 -0
- package/constant/keyboardCode.js +1 -1
- package/constant/licensePlate.js +1 -1
- package/constant/name.js +1 -1
- package/constant/platform.js +18 -17
- package/constant/protocol.js +1 -1
- package/constant/string.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/api.js +1 -1
- package/cookie/src/assign.js +1 -1
- package/cookie/src/converter.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 +1 -1
- 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 +1 -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/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 +1 -1
- 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/object-prototype-to-string-call/index.js +1 -1
- package/objectKeysSort.js +1 -1
- package/objectPrototypeToStringCall.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 +1 -1
- package/snapdom/src/api/snapdom.js +198 -153
- package/snapdom/src/core/cache.js +1 -1
- package/snapdom/src/core/capture.js +121 -326
- package/snapdom/src/core/clone.js +117 -266
- package/snapdom/src/core/context.js +1 -1
- package/snapdom/src/core/plugins.js +1 -1
- package/snapdom/src/core/prepare.js +48 -157
- package/snapdom/src/exporters/download.js +9 -10
- package/snapdom/src/exporters/toBlob.js +10 -15
- package/snapdom/src/exporters/toCanvas.js +72 -65
- package/snapdom/src/exporters/toImg.js +1 -1
- package/snapdom/src/modules/CSSVar.js +1 -1
- package/snapdom/src/modules/background.js +1 -1
- package/snapdom/src/modules/changeCSS.js +1 -1
- package/snapdom/src/modules/counter.js +1 -1
- package/snapdom/src/modules/fonts.js +118 -112
- package/snapdom/src/modules/iconFonts.js +133 -69
- package/snapdom/src/modules/images.js +36 -33
- package/snapdom/src/modules/lineClamp.js +1 -1
- package/snapdom/src/modules/pseudo.js +275 -161
- package/snapdom/src/modules/rasterize.js +6 -7
- package/snapdom/src/modules/snapFetch.js +1 -1
- package/snapdom/src/modules/styles.js +89 -67
- package/snapdom/src/modules/svgDefs.js +73 -60
- package/snapdom/src/utils/browser.js +13 -8
- package/snapdom/src/utils/capture.helpers.js +131 -0
- package/snapdom/src/utils/clone.helpers.js +283 -0
- package/snapdom/src/utils/css.js +1 -1
- package/snapdom/src/utils/helpers.js +1 -1
- package/snapdom/src/utils/image.js +15 -24
- package/snapdom/src/utils/prepare.helpers.js +8 -0
- package/snapdom/src/utils/transforms.helpers.js +211 -0
- package/snapdom.js +1 -1
- package/string/index.js +1 -1
- package/string.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 +1 -1
- package/tween/src/easing.js +1 -1
- package/tween/src/tween.js +1 -1
- package/tween.js +1 -1
- package/types/constant/isMobile.d.ts +3 -0
- package/types/snapdom/src/api/snapdom.d.ts +10 -79
- package/types/snapdom/src/exporters/toCanvas.d.ts +11 -3
- package/types/snapdom/src/exporters/toJpg.d.ts +1 -0
- package/types/snapdom/src/exporters/toPng.d.ts +6 -0
- package/types/snapdom/src/exporters/toSvg.d.ts +1 -0
- package/types/snapdom/src/exporters/toWebp.d.ts +1 -0
- package/types/snapdom/src/modules/iconFonts.d.ts +7 -20
- package/types/snapdom/src/modules/pseudo.d.ts +18 -0
- package/types/snapdom/src/modules/rasterize.d.ts +6 -10
- package/types/snapdom/src/utils/browser.d.ts +0 -3
- package/types/snapdom/src/utils/capture.helpers.d.ts +45 -0
- package/types/snapdom/src/utils/clone.helpers.d.ts +97 -0
- package/types/snapdom/src/utils/image.d.ts +0 -8
- package/types/snapdom/src/utils/index.d.ts +1 -1
- package/types/snapdom/src/utils/prepare.helpers.d.ts +9 -0
- package/types/snapdom/src/utils/transforms.helpers.d.ts +118 -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 +1 -1
- package/validate/src/index.js +1 -1
- package/validate/src/locale/en-US.js +1 -1
- package/validate/src/locale/zh-CN.js +1 -1
- package/validate/src/message.js +1 -1
- package/validate/src/rules/array.js +1 -1
- package/validate/src/rules/base.js +1 -1
- package/validate/src/rules/boolean.js +1 -1
- package/validate/src/rules/custom.js +1 -1
- package/validate/src/rules/number.js +1 -1
- package/validate/src/rules/object.js +1 -1
- package/validate/src/rules/string.js +1 -1
- package/validate/src/rules/type.js +1 -1
- package/validate/src/utils.js +1 -1
- package/validate.js +1 -1
- package/version/index.js +1 -1
- package/version.js +1 -1
- package/xlsx/index.js +1 -1
- package/xlsx/xlsx.js +1 -1
- package/xlsx.js +1 -1
|
@@ -1,224 +1,338 @@
|
|
|
1
|
-
/* 2025-11-
|
|
2
|
-
import { cache as
|
|
3
|
-
import { buildCounterContext as
|
|
4
|
-
import { iconToImage as
|
|
5
|
-
import { isIconFont as
|
|
6
|
-
import { getStyle as
|
|
7
|
-
import { extractURL as
|
|
8
|
-
import { inlineSingleBackgroundEntry as
|
|
9
|
-
import { snapFetch as
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
1
|
+
/* 2025-11-27 12:11:03 */
|
|
2
|
+
import { cache as st } from "../core/cache.js";
|
|
3
|
+
import { buildCounterContext as it, hasCounters as lt, resolveCountersInContent as ct } from "./counter.js";
|
|
4
|
+
import { iconToImage as at } from "./fonts.js";
|
|
5
|
+
import { isIconFont as ut } from "./iconFonts.js";
|
|
6
|
+
import { getStyle as ft, snapshotComputedStyle as q, getStyleKey as Y, splitBackgroundImage as gt } from "../utils/css.js";
|
|
7
|
+
import { extractURL as dt, safeEncodeURI as mt } from "../utils/helpers.js";
|
|
8
|
+
import { inlineSingleBackgroundEntry as pt } from "../utils/image.js";
|
|
9
|
+
import { snapFetch as ht } from "./snapFetch.js";
|
|
10
|
+
const S = /* @__PURE__ */ new WeakMap(), O = 300;
|
|
11
|
+
function yt(t, o) {
|
|
12
|
+
const s = G(t);
|
|
13
|
+
return o ? (o.__pseudoPreflightFp !== s && (o.__pseudoPreflight = V(t), o.__pseudoPreflightFp = s), !!o.__pseudoPreflight) : V(t);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
function R(t) {
|
|
16
|
+
try {
|
|
17
|
+
return t && t.cssRules ? t.cssRules : null;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function G(t) {
|
|
23
|
+
const o = t.querySelectorAll('style,link[rel~="stylesheet"]');
|
|
24
|
+
let s = `n:${o.length}|`, c = 0;
|
|
25
|
+
for (let a = 0; a < o.length; a++) {
|
|
26
|
+
const i = o[a];
|
|
27
|
+
if (i.tagName === "STYLE") {
|
|
28
|
+
const l = i.textContent ? i.textContent.length : 0;
|
|
29
|
+
s += `S${l}|`;
|
|
30
|
+
const r = (
|
|
31
|
+
/** @type {HTMLStyleElement} */
|
|
32
|
+
i.sheet
|
|
33
|
+
), n = r ? R(r) : null;
|
|
34
|
+
n && (c += n.length);
|
|
35
|
+
} else {
|
|
36
|
+
const l = i.getAttribute("href") || "", r = i.getAttribute("media") || "all";
|
|
37
|
+
s += `L${l}|m:${r}|`;
|
|
38
|
+
const n = (
|
|
39
|
+
/** @type {HTMLLinkElement} */
|
|
40
|
+
i.sheet
|
|
41
|
+
), e = n ? R(n) : null;
|
|
42
|
+
e && (c += e.length);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const f = (
|
|
46
|
+
/** @type {any} */
|
|
47
|
+
t.adoptedStyleSheets
|
|
48
|
+
);
|
|
49
|
+
return s += `ass:${Array.isArray(f) ? f.length : 0}|tr:${c}`, s;
|
|
50
|
+
}
|
|
51
|
+
function X(t, o, s) {
|
|
52
|
+
const c = R(t);
|
|
53
|
+
if (!c) return !1;
|
|
54
|
+
for (let f = 0; f < c.length; f++) {
|
|
55
|
+
if (s.budget <= 0) return !1;
|
|
56
|
+
const a = c[f], i = a && a.cssText ? a.cssText : "";
|
|
57
|
+
s.budget--;
|
|
58
|
+
for (const l of o)
|
|
59
|
+
if (i.includes(l)) return !0;
|
|
60
|
+
if (a && a.cssRules && a.cssRules.length)
|
|
61
|
+
for (let l = 0; l < a.cssRules.length && s.budget > 0; l++) {
|
|
62
|
+
const r = a.cssRules[l], n = r && r.cssText ? r.cssText : "";
|
|
63
|
+
s.budget--;
|
|
64
|
+
for (const e of o)
|
|
65
|
+
if (n.includes(e)) return !0;
|
|
66
|
+
}
|
|
67
|
+
if (s.budget <= 0) return !1;
|
|
68
|
+
}
|
|
69
|
+
return !1;
|
|
70
|
+
}
|
|
71
|
+
function V(t = document) {
|
|
72
|
+
const o = G(t), s = S.get(t);
|
|
73
|
+
if (s && s.fingerprint === o) return s.result;
|
|
74
|
+
const c = [
|
|
75
|
+
// double-colon
|
|
76
|
+
"::before",
|
|
77
|
+
"::after",
|
|
78
|
+
"::first-letter",
|
|
79
|
+
// single-colon robustness
|
|
80
|
+
":before",
|
|
81
|
+
":after",
|
|
82
|
+
":first-letter",
|
|
83
|
+
// counters
|
|
84
|
+
"counter(",
|
|
85
|
+
"counters(",
|
|
86
|
+
"counter-increment",
|
|
87
|
+
"counter-reset"
|
|
88
|
+
], f = t.querySelectorAll("style");
|
|
89
|
+
for (let i = 0; i < f.length; i++) {
|
|
90
|
+
const l = f[i].textContent || "";
|
|
91
|
+
for (const r of c)
|
|
92
|
+
if (l.includes(r))
|
|
93
|
+
return S.set(t, { fingerprint: o, result: !0 }), !0;
|
|
94
|
+
}
|
|
95
|
+
const a = (
|
|
96
|
+
/** @type {any} */
|
|
97
|
+
t.adoptedStyleSheets
|
|
98
|
+
);
|
|
99
|
+
if (Array.isArray(a) && a.length) {
|
|
100
|
+
const i = { budget: O };
|
|
101
|
+
try {
|
|
102
|
+
for (const l of a)
|
|
103
|
+
if (X(l, c, i))
|
|
104
|
+
return S.set(t, { fingerprint: o, result: !0 }), !0;
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
{
|
|
109
|
+
const i = t.querySelectorAll('style,link[rel~="stylesheet"]'), l = { budget: O };
|
|
110
|
+
for (let r = 0; r < i.length && l.budget > 0; r++) {
|
|
111
|
+
const n = i[r];
|
|
112
|
+
let e = null;
|
|
113
|
+
if (n.tagName, e = /** @type {HTMLStyleElement} */
|
|
114
|
+
n.sheet || null, e && X(e, c, l))
|
|
115
|
+
return S.set(t, { fingerprint: o, result: !0 }), !0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return t.querySelector('[style*="counter("], [style*="counters("]') ? (S.set(t, { fingerprint: o, result: !0 }), !0) : (S.set(t, { fingerprint: o, result: !1 }), !1);
|
|
119
|
+
}
|
|
120
|
+
var x = /* @__PURE__ */ new WeakMap(), H = -1;
|
|
121
|
+
function bt(t) {
|
|
122
|
+
return (t || "").replace(/"([^"]*)"/g, "$1");
|
|
123
|
+
}
|
|
124
|
+
function kt(t) {
|
|
125
|
+
if (!t) return "";
|
|
126
|
+
const o = [], s = /"([^"]*)"/g;
|
|
17
127
|
let c;
|
|
18
|
-
for (; c =
|
|
19
|
-
return
|
|
128
|
+
for (; c = s.exec(t); ) o.push(c[1]);
|
|
129
|
+
return o.length ? o.join("") : bt(t);
|
|
20
130
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
131
|
+
function A(t, o) {
|
|
132
|
+
const s = t.parentElement, c = s ? x.get(s) : null;
|
|
23
133
|
return c ? {
|
|
24
|
-
get(
|
|
25
|
-
const
|
|
26
|
-
return typeof
|
|
134
|
+
get(f, a) {
|
|
135
|
+
const i = o.get(f, a), l = c.get(a);
|
|
136
|
+
return typeof l == "number" ? Math.max(i, l) : i;
|
|
27
137
|
},
|
|
28
|
-
getStack(
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
if (typeof
|
|
33
|
-
const
|
|
34
|
-
return
|
|
138
|
+
getStack(f, a) {
|
|
139
|
+
const i = o.getStack(f, a);
|
|
140
|
+
if (!i.length) return i;
|
|
141
|
+
const l = c.get(a);
|
|
142
|
+
if (typeof l == "number") {
|
|
143
|
+
const r = i.slice();
|
|
144
|
+
return r[r.length - 1] = Math.max(r[r.length - 1], l), r;
|
|
35
145
|
}
|
|
36
|
-
return
|
|
146
|
+
return i;
|
|
37
147
|
}
|
|
38
|
-
} :
|
|
148
|
+
} : o;
|
|
39
149
|
}
|
|
40
|
-
function
|
|
150
|
+
function v(t, o, s) {
|
|
41
151
|
const c = /* @__PURE__ */ new Map();
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
for (const
|
|
46
|
-
const
|
|
47
|
-
|
|
152
|
+
function f(r) {
|
|
153
|
+
const n = [];
|
|
154
|
+
if (!r || r === "none") return n;
|
|
155
|
+
for (const e of String(r).split(",")) {
|
|
156
|
+
const y = e.trim().split(/\s+/), m = y[0], F = Number.isFinite(Number(y[1])) ? Number(y[1]) : void 0;
|
|
157
|
+
m && n.push({ name: m, num: F });
|
|
48
158
|
}
|
|
49
|
-
return
|
|
159
|
+
return n;
|
|
50
160
|
}
|
|
51
|
-
const
|
|
52
|
-
function
|
|
53
|
-
if (c.has(
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
|
|
161
|
+
const a = f(o?.counterReset), i = f(o?.counterIncrement);
|
|
162
|
+
function l(r) {
|
|
163
|
+
if (c.has(r)) return c.get(r).slice();
|
|
164
|
+
let n = s.getStack(t, r);
|
|
165
|
+
n = n.length ? n.slice() : [];
|
|
166
|
+
const e = a.find((m) => m.name === r);
|
|
167
|
+
if (e) {
|
|
168
|
+
const m = Number.isFinite(e.num) ? e.num : 0;
|
|
169
|
+
n = n.length ? [...n, m] : [m];
|
|
60
170
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
|
|
171
|
+
const y = i.find((m) => m.name === r);
|
|
172
|
+
if (y) {
|
|
173
|
+
const m = Number.isFinite(y.num) ? y.num : 1;
|
|
174
|
+
n.length === 0 && (n = [0]), n[n.length - 1] += m;
|
|
65
175
|
}
|
|
66
|
-
return c.set(
|
|
176
|
+
return c.set(r, n.slice()), n;
|
|
67
177
|
}
|
|
68
178
|
return {
|
|
69
|
-
get(
|
|
70
|
-
const
|
|
71
|
-
return
|
|
179
|
+
get(r, n) {
|
|
180
|
+
const e = l(n);
|
|
181
|
+
return e.length ? e[e.length - 1] : 0;
|
|
72
182
|
},
|
|
73
|
-
getStack(
|
|
74
|
-
return
|
|
183
|
+
getStack(r, n) {
|
|
184
|
+
return l(n);
|
|
75
185
|
},
|
|
76
186
|
/** expone increments del pseudo para que el caller pueda propagar a hermanos */
|
|
77
|
-
__incs:
|
|
187
|
+
__incs: i
|
|
78
188
|
};
|
|
79
189
|
}
|
|
80
|
-
function
|
|
190
|
+
function St(t, o, s) {
|
|
81
191
|
let c;
|
|
82
192
|
try {
|
|
83
|
-
c = getComputedStyle(
|
|
193
|
+
c = getComputedStyle(t, o);
|
|
84
194
|
} catch {
|
|
85
195
|
}
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
return { text:
|
|
196
|
+
const f = c?.content;
|
|
197
|
+
if (!f || f === "none" || f === "normal") return { text: "", incs: [] };
|
|
198
|
+
const a = A(t, s), i = v(t, c, a);
|
|
199
|
+
let l = lt(f) ? ct(f, t, i) : f;
|
|
200
|
+
return { text: kt(l), incs: i.__incs || [] };
|
|
91
201
|
}
|
|
92
|
-
async function
|
|
93
|
-
if (!(
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
202
|
+
async function xt(t, o, s, c) {
|
|
203
|
+
if (!(t instanceof Element) || !(o instanceof Element)) return;
|
|
204
|
+
const f = t.ownerDocument || document;
|
|
205
|
+
if (!yt(f, s))
|
|
206
|
+
return;
|
|
207
|
+
const a = st?.session?.__counterEpoch ?? 0;
|
|
208
|
+
if (H !== a && (x = /* @__PURE__ */ new WeakMap(), s && (s.__counterCtx = null), H = a), !s.__counterCtx)
|
|
96
209
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
210
|
+
s.__counterCtx = it(
|
|
211
|
+
t.ownerDocument || document
|
|
99
212
|
);
|
|
100
213
|
} catch {
|
|
101
214
|
}
|
|
102
|
-
const
|
|
103
|
-
for (const
|
|
215
|
+
const i = s.__counterCtx;
|
|
216
|
+
for (const n of ["::before", "::after", "::first-letter"])
|
|
104
217
|
try {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
if (!(
|
|
110
|
-
const
|
|
111
|
-
(
|
|
218
|
+
const e = ft(t, n);
|
|
219
|
+
if (!e || e.content === "none" && e.backgroundImage === "none" && e.backgroundColor === "transparent" && (e.borderStyle === "none" || parseFloat(e.borderWidth) === 0) && (!e.transform || e.transform === "none") && e.display === "inline") continue;
|
|
220
|
+
if (n === "::first-letter") {
|
|
221
|
+
const g = getComputedStyle(t);
|
|
222
|
+
if (!(e.color !== g.color || e.fontSize !== g.fontSize || e.fontWeight !== g.fontWeight)) continue;
|
|
223
|
+
const p = Array.from(o.childNodes).find(
|
|
224
|
+
(j) => j.nodeType === Node.TEXT_NODE && j.textContent?.trim().length > 0
|
|
112
225
|
);
|
|
113
|
-
if (!
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
226
|
+
if (!p) continue;
|
|
227
|
+
const h = p.textContent, P = h.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], nt = h.slice(P?.length || 0);
|
|
228
|
+
if (!P || /[\uD800-\uDFFF]/.test(P)) continue;
|
|
116
229
|
const w = document.createElement("span");
|
|
117
|
-
w.textContent =
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
230
|
+
w.textContent = P, w.dataset.snapdomPseudo = "::first-letter";
|
|
231
|
+
const ot = q(e), rt = Y(ot, "span");
|
|
232
|
+
s.styleMap.set(w, rt);
|
|
233
|
+
const z = document.createTextNode(nt);
|
|
234
|
+
o.replaceChild(z, p), o.insertBefore(w, z);
|
|
122
235
|
continue;
|
|
123
236
|
}
|
|
124
|
-
const
|
|
237
|
+
const m = e.content ?? "", F = m === "" || m === "none" || m === "normal", { text: b, incs: k } = St(
|
|
238
|
+
t,
|
|
125
239
|
n,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
n,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
i.set(u, S);
|
|
240
|
+
i
|
|
241
|
+
), N = e.backgroundImage, C = e.backgroundColor, W = e.fontFamily, E = parseInt(e.fontSize) || 32, K = parseInt(e.fontWeight) || !1, J = e.color || "#000", T = e.borderStyle, Q = parseFloat(e.borderWidth), $ = e.transform, B = ut(W), D = !F && b !== "", I = N && N !== "none", M = C && C !== "transparent" && C !== "rgba(0, 0, 0, 0)", L = T && T !== "none" && Q > 0, U = $ && $ !== "none";
|
|
242
|
+
if (!(D || I || M || L || U)) {
|
|
243
|
+
if (k && k.length && t.parentElement) {
|
|
244
|
+
const g = x.get(t.parentElement) || /* @__PURE__ */ new Map();
|
|
245
|
+
for (const { name: d } of k) {
|
|
246
|
+
if (!d) continue;
|
|
247
|
+
const p = A(t, i), _ = v(
|
|
248
|
+
t,
|
|
249
|
+
getComputedStyle(t, n),
|
|
250
|
+
p
|
|
251
|
+
).get(t, d);
|
|
252
|
+
g.set(d, _);
|
|
140
253
|
}
|
|
141
|
-
|
|
254
|
+
x.set(t.parentElement, g);
|
|
142
255
|
}
|
|
143
256
|
continue;
|
|
144
257
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
258
|
+
const u = document.createElement("span");
|
|
259
|
+
u.dataset.snapdomPseudo = n, u.style.pointerEvents = "none";
|
|
260
|
+
const Z = q(e), tt = Y(Z, "span");
|
|
261
|
+
if (s.styleMap.set(u, tt), B && b && b.length === 1) {
|
|
149
262
|
const {
|
|
150
|
-
dataUrl:
|
|
151
|
-
width:
|
|
152
|
-
height:
|
|
153
|
-
} = await
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
),
|
|
160
|
-
|
|
161
|
-
} else if (
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
263
|
+
dataUrl: g,
|
|
264
|
+
width: d,
|
|
265
|
+
height: p
|
|
266
|
+
} = await at(
|
|
267
|
+
b,
|
|
268
|
+
W,
|
|
269
|
+
K,
|
|
270
|
+
E,
|
|
271
|
+
J
|
|
272
|
+
), h = document.createElement("img");
|
|
273
|
+
h.src = g, h.style = `height:${E}px;width:${d / p * E}px;object-fit:contain;`, u.appendChild(h), o.dataset.snapdomHasIcon = "true";
|
|
274
|
+
} else if (b && b.startsWith("url(")) {
|
|
275
|
+
const g = dt(b);
|
|
276
|
+
if (g?.trim())
|
|
164
277
|
try {
|
|
165
|
-
const
|
|
278
|
+
const d = document.createElement("img"), p = await ht(mt(g), {
|
|
166
279
|
as: "dataURL",
|
|
167
280
|
useProxy: c.useProxy
|
|
168
281
|
});
|
|
169
|
-
|
|
170
|
-
} catch (
|
|
171
|
-
console.error(`[snapdom] Error in pseudo ${
|
|
282
|
+
d.src = p.data, d.style = `width:${E}px;height:auto;object-fit:contain;`, u.appendChild(d);
|
|
283
|
+
} catch (d) {
|
|
284
|
+
console.error(`[snapdom] Error in pseudo ${n} for`, t, d);
|
|
172
285
|
}
|
|
173
|
-
} else !B &&
|
|
174
|
-
|
|
286
|
+
} else !B && D && (u.textContent = b);
|
|
287
|
+
u.style.backgroundImage = "none", "maskImage" in u.style && (u.style.maskImage = "none"), "webkitMaskImage" in u.style && (u.style.webkitMaskImage = "none");
|
|
175
288
|
try {
|
|
176
|
-
|
|
289
|
+
u.style.backgroundRepeat = e.backgroundRepeat, u.style.backgroundSize = e.backgroundSize, e.backgroundPositionX && e.backgroundPositionY ? (u.style.backgroundPositionX = e.backgroundPositionX, u.style.backgroundPositionY = e.backgroundPositionY) : u.style.backgroundPosition = e.backgroundPosition, u.style.backgroundOrigin = e.backgroundOrigin, u.style.backgroundClip = e.backgroundClip, u.style.backgroundAttachment = e.backgroundAttachment, u.style.backgroundBlendMode = e.backgroundBlendMode;
|
|
177
290
|
} catch {
|
|
178
291
|
}
|
|
179
|
-
if (
|
|
292
|
+
if (I)
|
|
180
293
|
try {
|
|
181
|
-
const
|
|
182
|
-
|
|
294
|
+
const g = gt(N), d = await Promise.all(
|
|
295
|
+
g.map(pt)
|
|
183
296
|
);
|
|
184
|
-
|
|
185
|
-
} catch (
|
|
297
|
+
u.style.backgroundImage = d.join(", ");
|
|
298
|
+
} catch (g) {
|
|
186
299
|
console.warn(
|
|
187
|
-
`[snapdom] Failed to inline background-image for ${
|
|
188
|
-
|
|
300
|
+
`[snapdom] Failed to inline background-image for ${n}`,
|
|
301
|
+
g
|
|
189
302
|
);
|
|
190
303
|
}
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
getComputedStyle(
|
|
197
|
-
|
|
304
|
+
M && (u.style.backgroundColor = C);
|
|
305
|
+
const et = u.childNodes.length > 0 || u.textContent?.trim() !== "" || I || M || L || U;
|
|
306
|
+
if (k && k.length && t.parentElement) {
|
|
307
|
+
const g = x.get(t.parentElement) || /* @__PURE__ */ new Map(), d = A(t, i), p = v(
|
|
308
|
+
t,
|
|
309
|
+
getComputedStyle(t, n),
|
|
310
|
+
d
|
|
198
311
|
);
|
|
199
|
-
for (const { name:
|
|
200
|
-
if (!
|
|
201
|
-
const
|
|
202
|
-
|
|
312
|
+
for (const { name: h } of k) {
|
|
313
|
+
if (!h) continue;
|
|
314
|
+
const _ = p.get(t, h);
|
|
315
|
+
g.set(h, _);
|
|
203
316
|
}
|
|
204
|
-
|
|
317
|
+
x.set(t.parentElement, g);
|
|
205
318
|
}
|
|
206
|
-
if (!
|
|
207
|
-
|
|
208
|
-
} catch (
|
|
209
|
-
console.warn(`[snapdom] Failed to capture ${
|
|
319
|
+
if (!et) continue;
|
|
320
|
+
n === "::before" ? o.insertBefore(u, o.firstChild) : o.appendChild(u);
|
|
321
|
+
} catch (e) {
|
|
322
|
+
console.warn(`[snapdom] Failed to capture ${n} for`, t, e);
|
|
210
323
|
}
|
|
211
|
-
const
|
|
212
|
-
(
|
|
324
|
+
const l = Array.from(t.children), r = Array.from(o.children).filter(
|
|
325
|
+
(n) => !n.dataset.snapdomPseudo
|
|
213
326
|
);
|
|
214
|
-
for (let
|
|
215
|
-
await
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
327
|
+
for (let n = 0; n < Math.min(l.length, r.length); n++)
|
|
328
|
+
await xt(
|
|
329
|
+
l[n],
|
|
330
|
+
r[n],
|
|
331
|
+
s,
|
|
219
332
|
c
|
|
220
333
|
);
|
|
221
334
|
}
|
|
222
335
|
export {
|
|
223
|
-
|
|
336
|
+
xt as inlinePseudoElements,
|
|
337
|
+
V as shouldProcessPseudos
|
|
224
338
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* 2025-11-
|
|
2
|
-
import { toCanvas as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return r.src = t.toDataURL(`image/${a.format}`, a.quality), await r.decode(), r.style.width = `${t.width / a.dpr}px`, r.style.height = `${t.height / a.dpr}px`, r;
|
|
1
|
+
/* 2025-11-27 12:11:03 */
|
|
2
|
+
import { toCanvas as i } from "../exporters/toCanvas.js";
|
|
3
|
+
async function d(r, a) {
|
|
4
|
+
const e = await i(r, a), t = new Image();
|
|
5
|
+
return t.src = e.toDataURL(`image/${a.format}`, a.quality), await t.decode(), t.style.width = `${e.width / a.dpr}px`, t.style.height = `${e.height / a.dpr}px`, t;
|
|
7
6
|
}
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
d as rasterize
|
|
10
9
|
};
|