@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,48 +1,48 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
2
|
import { resolveCSSVars as N } from "../modules/CSSVar.js";
|
|
3
|
-
import { inlineAllStyles as
|
|
3
|
+
import { inlineAllStyles as b } from "../modules/styles.js";
|
|
4
4
|
import { NO_CAPTURE_TAGS as v } from "../utils/css.js";
|
|
5
5
|
import { idle as M } from "../utils/browser.js";
|
|
6
6
|
function E(t, r, n) {
|
|
7
7
|
return Promise.all(
|
|
8
8
|
t.map((e) => new Promise((o) => {
|
|
9
|
-
function
|
|
9
|
+
function s() {
|
|
10
10
|
M(
|
|
11
|
-
(
|
|
12
|
-
(
|
|
11
|
+
(l) => {
|
|
12
|
+
(l && typeof l.timeRemaining == "function" ? l.timeRemaining() > 0 : !0) ? r(e, o) : s();
|
|
13
13
|
},
|
|
14
14
|
{ fast: n }
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
s();
|
|
18
18
|
}))
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
function R(t) {
|
|
22
22
|
return t = t.trim(), !t || /:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t) ? t : `${t}:not([data-sd-slotted])`;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function C(t, r, n = !0) {
|
|
25
25
|
return t.split(",").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
26
26
|
if (e.startsWith(":where(") || e.startsWith("@")) return e;
|
|
27
27
|
const o = n ? R(e) : e;
|
|
28
28
|
return `:where(${r} ${o})`;
|
|
29
29
|
}).join(", ");
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function T(t, r) {
|
|
32
32
|
return t ? (t = t.replace(/:host\(([^)]+)\)/g, (n, e) => `:where(${r}:is(${e.trim()}))`), t = t.replace(/:host\b/g, `:where(${r})`), t = t.replace(/:host-context\(([^)]+)\)/g, (n, e) => `:where(:where(${e.trim()}) ${r})`), t = t.replace(/::slotted\(([^)]+)\)/g, (n, e) => `:where(${r} ${e.trim()})`), t = t.replace(
|
|
33
33
|
/(^|})(\s*)([^@}{]+){/g,
|
|
34
|
-
(n, e, o,
|
|
35
|
-
const
|
|
36
|
-
|
|
34
|
+
(n, e, o, s) => {
|
|
35
|
+
const l = C(
|
|
36
|
+
s,
|
|
37
37
|
r,
|
|
38
38
|
/*excludeSlotted*/
|
|
39
39
|
!0
|
|
40
40
|
);
|
|
41
|
-
return `${e}${o}${
|
|
41
|
+
return `${e}${o}${l}{`;
|
|
42
42
|
}
|
|
43
43
|
), t) : "";
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function k(t) {
|
|
46
46
|
return t.shadowScopeSeq = (t.shadowScopeSeq || 0) + 1, `s${t.shadowScopeSeq}`;
|
|
47
47
|
}
|
|
48
48
|
function L(t) {
|
|
@@ -64,12 +64,12 @@ function L(t) {
|
|
|
64
64
|
}
|
|
65
65
|
return r;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function I(t, r, n) {
|
|
68
68
|
if (!r) return;
|
|
69
69
|
const e = document.createElement("style");
|
|
70
70
|
e.setAttribute("data-sd", n), e.textContent = r, t.insertBefore(e, t.firstChild || null);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function W(t, r) {
|
|
73
73
|
try {
|
|
74
74
|
const n = t.currentSrc || t.src || "";
|
|
75
75
|
if (!n) return;
|
|
@@ -77,7 +77,7 @@ function I(t, r) {
|
|
|
77
77
|
} catch {
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function D(t) {
|
|
81
81
|
const r = /* @__PURE__ */ new Set();
|
|
82
82
|
if (!t) return r;
|
|
83
83
|
const n = /var\(\s*(--[A-Za-z0-9_-]+)\b/g;
|
|
@@ -85,7 +85,7 @@ function H(t) {
|
|
|
85
85
|
for (; e = n.exec(t); ) r.add(e[1]);
|
|
86
86
|
return r;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function F(t, r) {
|
|
89
89
|
try {
|
|
90
90
|
let e = getComputedStyle(t).getPropertyValue(r).trim();
|
|
91
91
|
if (e) return e;
|
|
@@ -98,19 +98,19 @@ function B(t, r) {
|
|
|
98
98
|
}
|
|
99
99
|
return "";
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function H(t, r, n) {
|
|
102
102
|
const e = [];
|
|
103
103
|
for (const o of r) {
|
|
104
|
-
const
|
|
105
|
-
|
|
104
|
+
const s = F(t, o);
|
|
105
|
+
s && e.push(`${o}: ${s};`);
|
|
106
106
|
}
|
|
107
107
|
return e.length ? `${n}{${e.join("")}}
|
|
108
108
|
` : "";
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function P(t) {
|
|
111
111
|
t && (t.nodeType === Node.ELEMENT_NODE && t.setAttribute("data-sd-slotted", ""), t.querySelectorAll && t.querySelectorAll("*").forEach((r) => r.setAttribute("data-sd-slotted", "")));
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
113
|
+
async function B(t, r = 3) {
|
|
114
114
|
const n = () => {
|
|
115
115
|
try {
|
|
116
116
|
return t.contentDocument || t.contentWindow?.document || null;
|
|
@@ -120,21 +120,21 @@ async function P(t, r = 3) {
|
|
|
120
120
|
};
|
|
121
121
|
let e = n(), o = 0;
|
|
122
122
|
for (; o < r && (!e || !e.body && !e.documentElement); )
|
|
123
|
-
await new Promise((
|
|
123
|
+
await new Promise((s) => setTimeout(s, 0)), e = n(), o++;
|
|
124
124
|
return e && (e.body || e.documentElement) ? e : null;
|
|
125
125
|
}
|
|
126
126
|
function _(t) {
|
|
127
127
|
const r = t.getBoundingClientRect();
|
|
128
|
-
let n = 0, e = 0, o = 0,
|
|
128
|
+
let n = 0, e = 0, o = 0, s = 0;
|
|
129
129
|
try {
|
|
130
|
-
const
|
|
131
|
-
n = parseFloat(
|
|
130
|
+
const f = getComputedStyle(t);
|
|
131
|
+
n = parseFloat(f.borderLeftWidth) || 0, e = parseFloat(f.borderRightWidth) || 0, o = parseFloat(f.borderTopWidth) || 0, s = parseFloat(f.borderBottomWidth) || 0;
|
|
132
132
|
} catch {
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
return { contentWidth:
|
|
134
|
+
const l = Math.max(0, Math.round(r.width - (n + e))), h = Math.max(0, Math.round(r.height - (o + s)));
|
|
135
|
+
return { contentWidth: l, contentHeight: h, rect: r };
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function q(t, r, n) {
|
|
138
138
|
const e = t.createElement("style");
|
|
139
139
|
return e.setAttribute("data-sd-iframe-pin", ""), e.textContent = `html, body {margin: 0 !important;padding: 0 !important;width: ${r}px !important;height: ${n}px !important;min-width: ${r}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`, (t.head || t.documentElement).appendChild(e), () => {
|
|
140
140
|
try {
|
|
@@ -143,190 +143,221 @@ function z(t, r, n) {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
async function
|
|
147
|
-
const e = await
|
|
146
|
+
async function z(t, r, n) {
|
|
147
|
+
const e = await B(t, 3);
|
|
148
148
|
if (!e) throw new Error("iframe document not accessible/ready");
|
|
149
|
-
const { contentWidth: o, contentHeight:
|
|
150
|
-
if (!
|
|
149
|
+
const { contentWidth: o, contentHeight: s, rect: l } = _(t), h = n?.snap;
|
|
150
|
+
if (!h || typeof h.toPng != "function")
|
|
151
151
|
throw new Error("snapdom.toPng not available in iframe or window");
|
|
152
|
-
const
|
|
153
|
-
let
|
|
152
|
+
const f = { ...n, scale: 1 }, i = q(e, o, s);
|
|
153
|
+
let a;
|
|
154
154
|
try {
|
|
155
|
-
|
|
155
|
+
a = await h.toPng(e.documentElement, f);
|
|
156
156
|
} finally {
|
|
157
|
-
|
|
157
|
+
i();
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
return r.nodeMap.set(
|
|
159
|
+
a.style.display = "block", a.style.width = `${o}px`, a.style.height = `${s}px`;
|
|
160
|
+
const c = document.createElement("div");
|
|
161
|
+
return r.nodeMap.set(c, t), b(t, c, r, n), c.style.overflow = "hidden", c.style.display = "block", c.style.width || (c.style.width = `${Math.round(l.width)}px`), c.style.height || (c.style.height = `${Math.round(l.height)}px`), c.appendChild(a), c;
|
|
162
162
|
}
|
|
163
163
|
async function A(t, r, n) {
|
|
164
164
|
if (!t) throw new Error("Invalid node");
|
|
165
165
|
const e = /* @__PURE__ */ new Set();
|
|
166
|
-
let o = null,
|
|
166
|
+
let o = null, s = null;
|
|
167
167
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
168
|
-
const
|
|
169
|
-
if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || v.has(
|
|
168
|
+
const i = (t.localName || t.tagName || "").toLowerCase();
|
|
169
|
+
if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || v.has(i))
|
|
170
170
|
return null;
|
|
171
171
|
}
|
|
172
172
|
if (t.nodeType === Node.TEXT_NODE || t.nodeType !== Node.ELEMENT_NODE)
|
|
173
173
|
return t.cloneNode(!0);
|
|
174
174
|
if (t.getAttribute("data-capture") === "exclude") {
|
|
175
175
|
if (n.excludeMode === "hide") {
|
|
176
|
-
const
|
|
177
|
-
return
|
|
176
|
+
const i = document.createElement("div"), a = t.getBoundingClientRect();
|
|
177
|
+
return i.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, i;
|
|
178
178
|
} else if (n.excludeMode === "remove")
|
|
179
179
|
return null;
|
|
180
180
|
}
|
|
181
181
|
if (n.exclude && Array.isArray(n.exclude))
|
|
182
|
-
for (const
|
|
182
|
+
for (const i of n.exclude)
|
|
183
183
|
try {
|
|
184
|
-
if (t.matches?.(
|
|
184
|
+
if (t.matches?.(i)) {
|
|
185
185
|
if (n.excludeMode === "hide") {
|
|
186
|
-
const
|
|
187
|
-
return
|
|
186
|
+
const a = document.createElement("div"), c = t.getBoundingClientRect();
|
|
187
|
+
return a.style.cssText = `display:inline-block;width:${c.width}px;height:${c.height}px;visibility:hidden;`, a;
|
|
188
188
|
} else if (n.excludeMode === "remove")
|
|
189
189
|
return null;
|
|
190
190
|
}
|
|
191
|
-
} catch (
|
|
192
|
-
console.warn(`Invalid selector in exclude option: ${
|
|
191
|
+
} catch (a) {
|
|
192
|
+
console.warn(`Invalid selector in exclude option: ${i}`, a);
|
|
193
193
|
}
|
|
194
194
|
if (typeof n.filter == "function")
|
|
195
195
|
try {
|
|
196
196
|
if (!n.filter(t)) {
|
|
197
197
|
if (n.filterMode === "hide") {
|
|
198
|
-
const
|
|
199
|
-
return
|
|
198
|
+
const i = document.createElement("div"), a = t.getBoundingClientRect();
|
|
199
|
+
return i.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, i;
|
|
200
200
|
} else if (n.filterMode === "remove")
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
|
-
} catch (
|
|
204
|
-
console.warn("Error in filter function:",
|
|
203
|
+
} catch (i) {
|
|
204
|
+
console.warn("Error in filter function:", i);
|
|
205
205
|
}
|
|
206
206
|
if (t.tagName === "IFRAME") {
|
|
207
|
-
let
|
|
207
|
+
let i = !1;
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
i = !!(t.contentDocument || t.contentWindow?.document);
|
|
210
210
|
} catch {
|
|
211
|
-
|
|
211
|
+
i = !1;
|
|
212
212
|
}
|
|
213
|
-
if (
|
|
213
|
+
if (i)
|
|
214
214
|
try {
|
|
215
|
-
return await
|
|
216
|
-
} catch (
|
|
217
|
-
console.warn("[SnapDOM] iframe rasterization failed, fallback:",
|
|
215
|
+
return await z(t, r, n);
|
|
216
|
+
} catch (a) {
|
|
217
|
+
console.warn("[SnapDOM] iframe rasterization failed, fallback:", a);
|
|
218
218
|
}
|
|
219
219
|
if (n.placeholders) {
|
|
220
|
-
const
|
|
221
|
-
return
|
|
220
|
+
const a = document.createElement("div");
|
|
221
|
+
return a.style.cssText = `width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`, b(t, a, r, n), a;
|
|
222
222
|
} else {
|
|
223
|
-
const
|
|
224
|
-
return
|
|
223
|
+
const a = t.getBoundingClientRect(), c = document.createElement("div");
|
|
224
|
+
return c.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, b(t, c, r, n), c;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
if (t.getAttribute("data-capture") === "placeholder") {
|
|
228
|
-
const
|
|
229
|
-
r.nodeMap.set(
|
|
230
|
-
const
|
|
231
|
-
return
|
|
228
|
+
const i = t.cloneNode(!1);
|
|
229
|
+
r.nodeMap.set(i, t), b(t, i, r, n);
|
|
230
|
+
const a = document.createElement("div");
|
|
231
|
+
return a.textContent = t.getAttribute("data-placeholder-text") || "", a.style.cssText = "color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;", i.appendChild(a), i;
|
|
232
232
|
}
|
|
233
233
|
if (t.tagName === "CANVAS") {
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
let i = "";
|
|
235
|
+
try {
|
|
236
|
+
const c = t.getContext("2d", { willReadFrequently: !0 });
|
|
237
|
+
try {
|
|
238
|
+
c && c.getImageData(0, 0, 1, 1);
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
if (await new Promise((u) => requestAnimationFrame(u)), i = t.toDataURL("image/png"), !i || i === "data:,") {
|
|
242
|
+
try {
|
|
243
|
+
c && c.getImageData(0, 0, 1, 1);
|
|
244
|
+
} catch {
|
|
245
|
+
}
|
|
246
|
+
if (await new Promise((u) => requestAnimationFrame(u)), i = t.toDataURL("image/png"), !i || i === "data:,") {
|
|
247
|
+
const u = document.createElement("canvas");
|
|
248
|
+
u.width = t.width, u.height = t.height;
|
|
249
|
+
const m = u.getContext("2d");
|
|
250
|
+
m && (m.drawImage(t, 0, 0), i = u.toDataURL("image/png"));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
const a = document.createElement("img");
|
|
256
|
+
try {
|
|
257
|
+
a.decoding = "sync", a.loading = "eager";
|
|
258
|
+
} catch {
|
|
259
|
+
}
|
|
260
|
+
i && (a.src = i), a.width = t.width, a.height = t.height;
|
|
261
|
+
try {
|
|
262
|
+
const c = getComputedStyle(t);
|
|
263
|
+
c.width && (a.style.width = c.width), c.height && (a.style.height = c.height);
|
|
264
|
+
} catch {
|
|
265
|
+
}
|
|
266
|
+
return r.nodeMap.set(a, t), b(t, a, r, n), a;
|
|
236
267
|
}
|
|
237
|
-
let
|
|
268
|
+
let l;
|
|
238
269
|
try {
|
|
239
|
-
if (
|
|
240
|
-
|
|
270
|
+
if (l = t.cloneNode(!1), N(t, l), r.nodeMap.set(l, t), t.tagName === "IMG") {
|
|
271
|
+
W(t, l);
|
|
241
272
|
try {
|
|
242
|
-
const
|
|
243
|
-
let
|
|
244
|
-
if (!
|
|
245
|
-
const
|
|
246
|
-
|
|
273
|
+
const i = t.getBoundingClientRect();
|
|
274
|
+
let a = Math.round(i.width || 0), c = Math.round(i.height || 0);
|
|
275
|
+
if (!a || !c) {
|
|
276
|
+
const u = window.getComputedStyle(t), m = parseFloat(u.width) || 0, g = parseFloat(u.height) || 0, p = parseInt(t.getAttribute("width") || "", 10) || 0, y = parseInt(t.getAttribute("height") || "", 10) || 0, S = t.width || t.naturalWidth || 0, d = t.height || t.naturalHeight || 0;
|
|
277
|
+
a = Math.round(a || m || p || S || 0), c = Math.round(c || g || y || d || 0);
|
|
247
278
|
}
|
|
248
|
-
|
|
279
|
+
a && (l.dataset.snapdomWidth = String(a)), c && (l.dataset.snapdomHeight = String(c));
|
|
249
280
|
} catch {
|
|
250
281
|
}
|
|
251
282
|
}
|
|
252
|
-
} catch (
|
|
253
|
-
throw console.error("[Snapdom] Failed to clone node:", t,
|
|
283
|
+
} catch (i) {
|
|
284
|
+
throw console.error("[Snapdom] Failed to clone node:", t, i), i;
|
|
254
285
|
}
|
|
255
286
|
if (t instanceof HTMLTextAreaElement) {
|
|
256
|
-
const
|
|
257
|
-
|
|
287
|
+
const i = t.getBoundingClientRect();
|
|
288
|
+
l.style.width = `${i.width}px`, l.style.height = `${i.height}px`;
|
|
258
289
|
}
|
|
259
|
-
if (t instanceof HTMLInputElement && (
|
|
260
|
-
let
|
|
290
|
+
if (t instanceof HTMLInputElement && (l.value = t.value, l.setAttribute("value", t.value), t.checked !== void 0 && (l.checked = t.checked, t.checked && l.setAttribute("checked", ""), t.indeterminate && (l.indeterminate = t.indeterminate))), t instanceof HTMLSelectElement && (o = t.value), t instanceof HTMLTextAreaElement && (s = t.value), b(t, l, r, n), t.shadowRoot) {
|
|
291
|
+
let y = function(d, w) {
|
|
261
292
|
if (d.nodeType === Node.ELEMENT_NODE && d.tagName === "STYLE")
|
|
262
|
-
return
|
|
293
|
+
return w(null);
|
|
263
294
|
A(d, r, n).then((x) => {
|
|
264
|
-
|
|
295
|
+
w(x || null);
|
|
265
296
|
}).catch(() => {
|
|
266
|
-
|
|
297
|
+
w(null);
|
|
267
298
|
});
|
|
268
299
|
};
|
|
269
300
|
try {
|
|
270
301
|
const d = t.shadowRoot.querySelectorAll("slot");
|
|
271
|
-
for (const
|
|
302
|
+
for (const w of d) {
|
|
272
303
|
let x = [];
|
|
273
304
|
try {
|
|
274
|
-
x =
|
|
305
|
+
x = w.assignedNodes?.({ flatten: !0 }) || w.assignedNodes?.() || [];
|
|
275
306
|
} catch {
|
|
276
|
-
x =
|
|
307
|
+
x = w.assignedNodes?.() || [];
|
|
277
308
|
}
|
|
278
309
|
for (const $ of x) e.add($);
|
|
279
310
|
}
|
|
280
311
|
} catch {
|
|
281
312
|
}
|
|
282
|
-
const
|
|
313
|
+
const i = k(r), a = `[data-sd="${i}"]`;
|
|
283
314
|
try {
|
|
284
|
-
|
|
315
|
+
l.setAttribute("data-sd", i);
|
|
285
316
|
} catch {
|
|
286
317
|
}
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
const
|
|
318
|
+
const c = L(t.shadowRoot), u = T(c, a), m = D(c), g = H(t, m, a);
|
|
319
|
+
I(l, g + u, i);
|
|
320
|
+
const p = document.createDocumentFragment(), S = await E(
|
|
290
321
|
Array.from(t.shadowRoot.childNodes),
|
|
291
|
-
|
|
322
|
+
y,
|
|
292
323
|
n.fast
|
|
293
324
|
);
|
|
294
|
-
|
|
325
|
+
p.append(...S.filter((d) => !!d)), l.appendChild(p);
|
|
295
326
|
}
|
|
296
327
|
if (t.tagName === "SLOT") {
|
|
297
|
-
let
|
|
298
|
-
A(
|
|
299
|
-
|
|
328
|
+
let u = function(g, p) {
|
|
329
|
+
A(g, r, n).then((y) => {
|
|
330
|
+
y && P(y), p(y || null);
|
|
300
331
|
}).catch(() => {
|
|
301
|
-
|
|
332
|
+
p(null);
|
|
302
333
|
});
|
|
303
334
|
};
|
|
304
|
-
const
|
|
305
|
-
Array.from(
|
|
306
|
-
|
|
335
|
+
const i = t.assignedNodes?.({ flatten: !0 }) || [], a = i.length > 0 ? i : Array.from(t.childNodes), c = document.createDocumentFragment(), m = await E(
|
|
336
|
+
Array.from(a),
|
|
337
|
+
u,
|
|
307
338
|
n.fast
|
|
308
339
|
);
|
|
309
|
-
return
|
|
340
|
+
return c.append(...m.filter((g) => !!g)), c;
|
|
310
341
|
}
|
|
311
|
-
function
|
|
312
|
-
if (e.has(
|
|
313
|
-
A(
|
|
314
|
-
|
|
342
|
+
function h(i, a) {
|
|
343
|
+
if (e.has(i)) return a(null);
|
|
344
|
+
A(i, r, n).then((c) => {
|
|
345
|
+
a(c || null);
|
|
315
346
|
}).catch(() => {
|
|
316
|
-
|
|
347
|
+
a(null);
|
|
317
348
|
});
|
|
318
349
|
}
|
|
319
|
-
const
|
|
350
|
+
const f = await E(
|
|
320
351
|
Array.from(t.childNodes),
|
|
321
|
-
|
|
352
|
+
h,
|
|
322
353
|
n.fast
|
|
323
354
|
);
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
for (const
|
|
327
|
-
|
|
355
|
+
if (l.append(...f.filter((i) => !!i)), o !== null && l instanceof HTMLSelectElement) {
|
|
356
|
+
l.value = o;
|
|
357
|
+
for (const i of l.options)
|
|
358
|
+
i.value === o ? i.setAttribute("selected", "") : i.removeAttribute("selected");
|
|
328
359
|
}
|
|
329
|
-
return
|
|
360
|
+
return s !== null && l instanceof HTMLTextAreaElement && (l.textContent = s), l;
|
|
330
361
|
}
|
|
331
362
|
export {
|
|
332
363
|
A as deepClone
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
function
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
function a(e) {
|
|
3
3
|
if (typeof e == "string") {
|
|
4
4
|
const l = e.toLowerCase().trim();
|
|
5
5
|
if (l === "disabled" || l === "full" || l === "auto" || l === "soft")
|
|
@@ -11,7 +11,9 @@ function r(e) {
|
|
|
11
11
|
return "soft";
|
|
12
12
|
}
|
|
13
13
|
function c(e = {}) {
|
|
14
|
-
|
|
14
|
+
let l = e.format ?? "png";
|
|
15
|
+
l === "jpg" && (l = "jpeg");
|
|
16
|
+
const r = a(e.cache);
|
|
15
17
|
return {
|
|
16
18
|
// Debug & perf
|
|
17
19
|
debug: e.debug ?? !1,
|
|
@@ -32,7 +34,7 @@ function c(e = {}) {
|
|
|
32
34
|
excludeFonts: e.excludeFonts ?? void 0,
|
|
33
35
|
fallbackURL: e.fallbackURL ?? void 0,
|
|
34
36
|
/** @type {CachePolicy} */
|
|
35
|
-
cache:
|
|
37
|
+
cache: r,
|
|
36
38
|
// Network
|
|
37
39
|
useProxy: typeof e.useProxy == "string" ? e.useProxy : "",
|
|
38
40
|
// Output
|
|
@@ -42,16 +44,16 @@ function c(e = {}) {
|
|
|
42
44
|
type: e.type ?? "svg",
|
|
43
45
|
quality: e.quality ?? 0.92,
|
|
44
46
|
dpr: e.dpr ?? (window.devicePixelRatio || 1),
|
|
45
|
-
backgroundColor: e.backgroundColor ?? (["
|
|
47
|
+
backgroundColor: e.backgroundColor ?? (["jpeg", "webp"].includes(l) ? "#ffffff" : null),
|
|
46
48
|
filename: e.filename ?? "snapDOM",
|
|
47
49
|
// NEW flags (user-friendly)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
outerTransforms: e.outerTransforms ?? !0,
|
|
51
|
+
outerShadows: e.outerShadows ?? !1
|
|
50
52
|
// Plugins (reservado)
|
|
51
53
|
// plugins: normalizePlugins(...),
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
export {
|
|
55
57
|
c as createContext,
|
|
56
|
-
|
|
58
|
+
a as normalizeCachePolicy
|
|
57
59
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
const e = [];
|
|
3
|
+
function a(n) {
|
|
4
|
+
if (!n) return null;
|
|
5
|
+
if (Array.isArray(n)) {
|
|
6
|
+
const [t, o] = n;
|
|
7
|
+
return typeof t == "function" ? t(o) : t;
|
|
8
|
+
}
|
|
9
|
+
if (typeof n == "object" && "plugin" in n) {
|
|
10
|
+
const { plugin: t, options: o } = n;
|
|
11
|
+
return typeof t == "function" ? t(o) : t;
|
|
12
|
+
}
|
|
13
|
+
return typeof n == "function" ? n() : n;
|
|
14
|
+
}
|
|
15
|
+
function y(...n) {
|
|
16
|
+
const t = n.flat();
|
|
17
|
+
for (const o of t) {
|
|
18
|
+
const i = a(o);
|
|
19
|
+
i && (e.some((f) => f && f.name && i.name && f.name === i.name) || e.push(i));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function c(n) {
|
|
23
|
+
return (n && Array.isArray(n.plugins) ? n.plugins : e) || e;
|
|
24
|
+
}
|
|
25
|
+
async function g(n, t, o) {
|
|
26
|
+
let i = o;
|
|
27
|
+
const f = c(t);
|
|
28
|
+
for (const u of f) {
|
|
29
|
+
const r = u && typeof u[n] == "function" ? u[n] : null;
|
|
30
|
+
if (!r) continue;
|
|
31
|
+
const s = await r(t, i);
|
|
32
|
+
typeof s < "u" && (i = s);
|
|
33
|
+
}
|
|
34
|
+
return i;
|
|
35
|
+
}
|
|
36
|
+
async function p(n, t, o) {
|
|
37
|
+
const i = [], f = c(t);
|
|
38
|
+
for (const u of f) {
|
|
39
|
+
const r = u && typeof u[n] == "function" ? u[n] : null;
|
|
40
|
+
if (!r) continue;
|
|
41
|
+
const s = await r(t, o);
|
|
42
|
+
typeof s < "u" && i.push(s);
|
|
43
|
+
}
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
function l(n) {
|
|
47
|
+
const t = [];
|
|
48
|
+
if (Array.isArray(n))
|
|
49
|
+
for (const o of n) {
|
|
50
|
+
const i = a(o);
|
|
51
|
+
if (!i || !i.name) continue;
|
|
52
|
+
const f = t.findIndex((u) => u && u.name === i.name);
|
|
53
|
+
f >= 0 && t.splice(f, 1), t.push(i);
|
|
54
|
+
}
|
|
55
|
+
for (const o of e)
|
|
56
|
+
o && o.name && !t.some((i) => i.name === o.name) && t.push(o);
|
|
57
|
+
return Object.freeze(t);
|
|
58
|
+
}
|
|
59
|
+
function m(n, t, o = !1) {
|
|
60
|
+
return !n || n.plugins && !o || (n.plugins = l(t)), n;
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
m as attachSessionPlugins,
|
|
64
|
+
l as mergePlugins,
|
|
65
|
+
a as normalizePlugin,
|
|
66
|
+
y as registerPlugins,
|
|
67
|
+
p as runAll,
|
|
68
|
+
g as runHook
|
|
69
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
import { cache as h } from "./cache.js";
|
|
2
3
|
import { freezeSticky as b } from "../modules/changeCSS.js";
|
|
3
4
|
import { inlinePseudoElements as w } from "../modules/pseudo.js";
|
|
4
5
|
import { snapFetch as A } from "../modules/snapFetch.js";
|
|
5
6
|
import { inlineExternalDefsAndSymbols as C } from "../modules/svgDefs.js";
|
|
6
7
|
import { generateCSSClasses as E } from "../utils/css.js";
|
|
7
8
|
import { stripTranslate as M } from "../utils/helpers.js";
|
|
8
|
-
import { cache as h } from "./cache.js";
|
|
9
9
|
import { deepClone as N } from "./clone.js";
|
|
10
10
|
async function H(t, r = {}) {
|
|
11
11
|
const o = {
|