@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.
Files changed (287) hide show
  1. package/case-name/index.js +1 -1
  2. package/caseName.js +1 -1
  3. package/class-name/index.js +6 -5
  4. package/className.js +1 -1
  5. package/clipboard-copy/index.js +1 -1
  6. package/clipboardCopy.js +1 -1
  7. package/constant/address.js +1 -1
  8. package/constant/chineseCharacters.js +1 -1
  9. package/constant/constellations.js +1 -1
  10. package/constant/domain.js +1 -1
  11. package/constant/emoji.js +1 -1
  12. package/constant/identity.js +1 -1
  13. package/constant/index.js +1 -1
  14. package/constant/isMobile.js +7 -0
  15. package/constant/keyboardCode.js +1 -1
  16. package/constant/licensePlate.js +1 -1
  17. package/constant/name.js +1 -1
  18. package/constant/platform.js +18 -17
  19. package/constant/protocol.js +1 -1
  20. package/constant/string.js +1 -1
  21. package/constant/ui.js +1 -1
  22. package/constant.js +1 -1
  23. package/content-disposition/index.js +1 -1
  24. package/contentDisposition.js +1 -1
  25. package/cookie/index.js +1 -1
  26. package/cookie/src/api.js +1 -1
  27. package/cookie/src/assign.js +1 -1
  28. package/cookie/src/converter.js +1 -1
  29. package/cookie.js +1 -1
  30. package/date/convertTime.js +1 -1
  31. package/date/convertToDuration.js +1 -1
  32. package/date/index.js +1 -1
  33. package/date.js +1 -1
  34. package/decimal/decimal.js +1 -1
  35. package/decimal/index.js +1 -1
  36. package/decimal.js +1 -1
  37. package/dom-helpers/activeElement.js +1 -1
  38. package/dom-helpers/addClass.js +1 -1
  39. package/dom-helpers/addEventListener.js +1 -1
  40. package/dom-helpers/animate.js +1 -1
  41. package/dom-helpers/animationFrame.js +1 -1
  42. package/dom-helpers/attribute.js +1 -1
  43. package/dom-helpers/camelize.js +1 -1
  44. package/dom-helpers/camelizeStyle.js +1 -1
  45. package/dom-helpers/canUseDOM.js +1 -1
  46. package/dom-helpers/childElements.js +1 -1
  47. package/dom-helpers/childNodes.js +1 -1
  48. package/dom-helpers/clear.js +1 -1
  49. package/dom-helpers/closest.js +1 -1
  50. package/dom-helpers/collectElements.js +1 -1
  51. package/dom-helpers/collectSiblings.js +1 -1
  52. package/dom-helpers/contains.js +1 -1
  53. package/dom-helpers/css.js +1 -1
  54. package/dom-helpers/filterEventHandler.js +1 -1
  55. package/dom-helpers/getComputedStyle.js +1 -1
  56. package/dom-helpers/getScrollAccessor.js +1 -1
  57. package/dom-helpers/hasClass.js +1 -1
  58. package/dom-helpers/height.js +1 -1
  59. package/dom-helpers/hyphenate.js +1 -1
  60. package/dom-helpers/hyphenateStyle.js +1 -1
  61. package/dom-helpers/index.js +1 -1
  62. package/dom-helpers/insertAfter.js +1 -1
  63. package/dom-helpers/isDocument.js +1 -1
  64. package/dom-helpers/isInput.js +1 -1
  65. package/dom-helpers/isTransform.js +1 -1
  66. package/dom-helpers/isVisible.js +1 -1
  67. package/dom-helpers/isWindow.js +1 -1
  68. package/dom-helpers/listen.js +1 -1
  69. package/dom-helpers/matches.js +1 -1
  70. package/dom-helpers/nextUntil.js +1 -1
  71. package/dom-helpers/offset.js +1 -1
  72. package/dom-helpers/offsetParent.js +1 -1
  73. package/dom-helpers/ownerDocument.js +1 -1
  74. package/dom-helpers/ownerWindow.js +1 -1
  75. package/dom-helpers/parents.js +1 -1
  76. package/dom-helpers/position.js +1 -1
  77. package/dom-helpers/prepend.js +1 -1
  78. package/dom-helpers/querySelectorAll.js +1 -1
  79. package/dom-helpers/reflow.js +1 -1
  80. package/dom-helpers/remove.js +1 -1
  81. package/dom-helpers/removeClass.js +1 -1
  82. package/dom-helpers/removeEventListener.js +1 -1
  83. package/dom-helpers/scrollLeft.js +1 -1
  84. package/dom-helpers/scrollParent.js +1 -1
  85. package/dom-helpers/scrollTo.js +1 -1
  86. package/dom-helpers/scrollTop.js +1 -1
  87. package/dom-helpers/scrollbarSize.js +1 -1
  88. package/dom-helpers/siblings.js +1 -1
  89. package/dom-helpers/text.js +1 -1
  90. package/dom-helpers/toggleClass.js +1 -1
  91. package/dom-helpers/transitionEnd.js +1 -1
  92. package/dom-helpers/triggerEvent.js +1 -1
  93. package/dom-helpers/types.js +1 -1
  94. package/dom-helpers/width.js +1 -1
  95. package/domHelpers.js +1 -1
  96. package/emitter/index.js +1 -1
  97. package/emitter/src/index.js +1 -1
  98. package/emitter.js +1 -1
  99. package/file/fileToURL.js +1 -1
  100. package/file/index.js +1 -1
  101. package/file/saveAs.js +1 -1
  102. package/file.js +1 -1
  103. package/idb/index.js +1 -1
  104. package/idb.js +1 -1
  105. package/index.js +1 -1
  106. package/invariant/index.js +1 -1
  107. package/invariant.js +1 -1
  108. package/is/index.js +1 -1
  109. package/is.js +1 -1
  110. package/lunar/index.js +1 -1
  111. package/lunar/lib/Holiday.js +1 -1
  112. package/lunar/lib/HolidayUtil.js +1 -1
  113. package/lunar/lib/I18n.js +1 -1
  114. package/lunar/lib/JieQi.js +1 -1
  115. package/lunar/lib/Lunar.js +1 -1
  116. package/lunar/lib/LunarMonth.js +1 -1
  117. package/lunar/lib/LunarTime.js +1 -1
  118. package/lunar/lib/LunarUtil.js +1 -1
  119. package/lunar/lib/LunarYear.js +1 -1
  120. package/lunar/lib/ShouXingUtil.js +1 -1
  121. package/lunar/lib/Solar.js +1 -1
  122. package/lunar/lib/SolarHalfYear.js +1 -1
  123. package/lunar/lib/SolarMonth.js +1 -1
  124. package/lunar/lib/SolarSeason.js +1 -1
  125. package/lunar/lib/SolarUtil.js +1 -1
  126. package/lunar/lib/SolarWeek.js +1 -1
  127. package/lunar/lib/SolarYear.js +1 -1
  128. package/lunar/lib/index.js +1 -1
  129. package/lunar.js +1 -1
  130. package/math/index.js +1 -1
  131. package/math.js +1 -1
  132. package/md5/index.js +1 -1
  133. package/md5.js +1 -1
  134. package/mock/MockWebSocket.js +1 -1
  135. package/mock/MockXMLHttpRequest.js +1 -1
  136. package/mock/index.js +1 -1
  137. package/mock.js +1 -1
  138. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  139. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  140. package/normalize-wheel/index.js +1 -1
  141. package/normalize-wheel/isEventSupported.js +1 -1
  142. package/normalizeWheel.js +1 -1
  143. package/number-to-chinese/index.js +1 -1
  144. package/numberToChinese.js +1 -1
  145. package/nzh/cn.js +1 -1
  146. package/nzh/hk.js +1 -1
  147. package/nzh/index.js +1 -1
  148. package/nzh/nzh.js +1 -1
  149. package/nzh/src/autoGet.js +1 -1
  150. package/nzh/src/index.js +1 -1
  151. package/nzh/src/langs/cn_b.js +1 -1
  152. package/nzh/src/langs/cn_s.js +1 -1
  153. package/nzh/src/langs/hk_b.js +1 -1
  154. package/nzh/src/langs/hk_s.js +1 -1
  155. package/nzh/src/utils.js +1 -1
  156. package/nzh.js +1 -1
  157. package/object-keys-sort/index.js +1 -1
  158. package/object-prototype-to-string-call/index.js +1 -1
  159. package/objectKeysSort.js +1 -1
  160. package/objectPrototypeToStringCall.js +1 -1
  161. package/package.json +1 -1
  162. package/pinyin/index.js +1 -1
  163. package/pinyin/simplified.js +1 -1
  164. package/pinyin/src/core.js +1 -1
  165. package/pinyin/src/simplified.js +1 -1
  166. package/pinyin/src/simplified_dict.js +1 -1
  167. package/pinyin/src/traditional.js +1 -1
  168. package/pinyin/src/traditional_dict.js +1 -1
  169. package/pinyin/traditional.js +1 -1
  170. package/pinyin.js +1 -1
  171. package/query-string/base.js +1 -1
  172. package/query-string/index.js +1 -1
  173. package/query-string/splitOnFirst.js +1 -1
  174. package/queryString.js +1 -1
  175. package/random/address.js +1 -1
  176. package/random/constellation.js +1 -1
  177. package/random/image.js +1 -1
  178. package/random/index.js +1 -1
  179. package/random/licensePlate.js +1 -1
  180. package/random/name.js +1 -1
  181. package/random/number.js +1 -1
  182. package/random/text.js +1 -1
  183. package/random/time.js +1 -1
  184. package/random/web.js +1 -1
  185. package/random.js +1 -1
  186. package/screenfull/index.js +1 -1
  187. package/screenfull.js +1 -1
  188. package/sleep/index.js +1 -1
  189. package/sleep.js +1 -1
  190. package/snapdom/index.js +1 -1
  191. package/snapdom/src/api/preCache.js +1 -1
  192. package/snapdom/src/api/snapdom.js +198 -153
  193. package/snapdom/src/core/cache.js +1 -1
  194. package/snapdom/src/core/capture.js +121 -326
  195. package/snapdom/src/core/clone.js +117 -266
  196. package/snapdom/src/core/context.js +1 -1
  197. package/snapdom/src/core/plugins.js +1 -1
  198. package/snapdom/src/core/prepare.js +48 -157
  199. package/snapdom/src/exporters/download.js +9 -10
  200. package/snapdom/src/exporters/toBlob.js +10 -15
  201. package/snapdom/src/exporters/toCanvas.js +72 -65
  202. package/snapdom/src/exporters/toImg.js +1 -1
  203. package/snapdom/src/modules/CSSVar.js +1 -1
  204. package/snapdom/src/modules/background.js +1 -1
  205. package/snapdom/src/modules/changeCSS.js +1 -1
  206. package/snapdom/src/modules/counter.js +1 -1
  207. package/snapdom/src/modules/fonts.js +118 -112
  208. package/snapdom/src/modules/iconFonts.js +133 -69
  209. package/snapdom/src/modules/images.js +36 -33
  210. package/snapdom/src/modules/lineClamp.js +1 -1
  211. package/snapdom/src/modules/pseudo.js +275 -161
  212. package/snapdom/src/modules/rasterize.js +6 -7
  213. package/snapdom/src/modules/snapFetch.js +1 -1
  214. package/snapdom/src/modules/styles.js +89 -67
  215. package/snapdom/src/modules/svgDefs.js +73 -60
  216. package/snapdom/src/utils/browser.js +13 -8
  217. package/snapdom/src/utils/capture.helpers.js +131 -0
  218. package/snapdom/src/utils/clone.helpers.js +283 -0
  219. package/snapdom/src/utils/css.js +1 -1
  220. package/snapdom/src/utils/helpers.js +1 -1
  221. package/snapdom/src/utils/image.js +15 -24
  222. package/snapdom/src/utils/prepare.helpers.js +8 -0
  223. package/snapdom/src/utils/transforms.helpers.js +211 -0
  224. package/snapdom.js +1 -1
  225. package/string/index.js +1 -1
  226. package/string.js +1 -1
  227. package/tinycolor/index.js +1 -1
  228. package/tinycolor/src/conversion.js +1 -1
  229. package/tinycolor/src/css-color-names.js +1 -1
  230. package/tinycolor/src/format-input.js +1 -1
  231. package/tinycolor/src/from-ratio.js +1 -1
  232. package/tinycolor/src/index.js +1 -1
  233. package/tinycolor/src/random.js +1 -1
  234. package/tinycolor/src/readability.js +1 -1
  235. package/tinycolor/src/to-ms-filter.js +1 -1
  236. package/tinycolor/src/utils.js +1 -1
  237. package/tinycolor.js +1 -1
  238. package/tree/index.js +1 -1
  239. package/tree/search/index.js +1 -1
  240. package/tree.js +1 -1
  241. package/tween/index.js +1 -1
  242. package/tween/src/easing.js +1 -1
  243. package/tween/src/tween.js +1 -1
  244. package/tween.js +1 -1
  245. package/types/constant/isMobile.d.ts +3 -0
  246. package/types/snapdom/src/api/snapdom.d.ts +10 -79
  247. package/types/snapdom/src/exporters/toCanvas.d.ts +11 -3
  248. package/types/snapdom/src/exporters/toJpg.d.ts +1 -0
  249. package/types/snapdom/src/exporters/toPng.d.ts +6 -0
  250. package/types/snapdom/src/exporters/toSvg.d.ts +1 -0
  251. package/types/snapdom/src/exporters/toWebp.d.ts +1 -0
  252. package/types/snapdom/src/modules/iconFonts.d.ts +7 -20
  253. package/types/snapdom/src/modules/pseudo.d.ts +18 -0
  254. package/types/snapdom/src/modules/rasterize.d.ts +6 -10
  255. package/types/snapdom/src/utils/browser.d.ts +0 -3
  256. package/types/snapdom/src/utils/capture.helpers.d.ts +45 -0
  257. package/types/snapdom/src/utils/clone.helpers.d.ts +97 -0
  258. package/types/snapdom/src/utils/image.d.ts +0 -8
  259. package/types/snapdom/src/utils/index.d.ts +1 -1
  260. package/types/snapdom/src/utils/prepare.helpers.d.ts +9 -0
  261. package/types/snapdom/src/utils/transforms.helpers.d.ts +118 -0
  262. package/ui-color/compareColorByRange.js +1 -1
  263. package/ui-color/index.js +1 -1
  264. package/uiColor.js +1 -1
  265. package/url-toolkit/index.js +1 -1
  266. package/url-toolkit/src/url-toolkit.js +1 -1
  267. package/urlToolkit.js +1 -1
  268. package/validate/index.js +1 -1
  269. package/validate/src/index.js +1 -1
  270. package/validate/src/locale/en-US.js +1 -1
  271. package/validate/src/locale/zh-CN.js +1 -1
  272. package/validate/src/message.js +1 -1
  273. package/validate/src/rules/array.js +1 -1
  274. package/validate/src/rules/base.js +1 -1
  275. package/validate/src/rules/boolean.js +1 -1
  276. package/validate/src/rules/custom.js +1 -1
  277. package/validate/src/rules/number.js +1 -1
  278. package/validate/src/rules/object.js +1 -1
  279. package/validate/src/rules/string.js +1 -1
  280. package/validate/src/rules/type.js +1 -1
  281. package/validate/src/utils.js +1 -1
  282. package/validate.js +1 -1
  283. package/version/index.js +1 -1
  284. package/version.js +1 -1
  285. package/xlsx/index.js +1 -1
  286. package/xlsx/xlsx.js +1 -1
  287. package/xlsx.js +1 -1
@@ -1,253 +1,96 @@
1
- /* 2025-11-19 10:03:21 */
2
- import { resolveCSSVars as N } from "../modules/CSSVar.js";
3
- import { inlineAllStyles as b } from "../modules/styles.js";
4
- import { NO_CAPTURE_TAGS as v } from "../utils/css.js";
5
- import { idle as M } from "../utils/browser.js";
6
- function E(t, r, n) {
7
- return Promise.all(
8
- t.map((e) => new Promise((o) => {
9
- function s() {
10
- M(
11
- (l) => {
12
- (l && typeof l.timeRemaining == "function" ? l.timeRemaining() > 0 : !0) ? r(e, o) : s();
13
- },
14
- { fast: n }
15
- );
16
- }
17
- s();
18
- }))
19
- );
20
- }
21
- function R(t) {
22
- return t = t.trim(), !t || /:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t) ? t : `${t}:not([data-sd-slotted])`;
23
- }
24
- function C(t, r, n = !0) {
25
- return t.split(",").map((e) => e.trim()).filter(Boolean).map((e) => {
26
- if (e.startsWith(":where(") || e.startsWith("@")) return e;
27
- const o = n ? R(e) : e;
28
- return `:where(${r} ${o})`;
29
- }).join(", ");
30
- }
31
- function T(t, r) {
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
- /(^|})(\s*)([^@}{]+){/g,
34
- (n, e, o, s) => {
35
- const l = C(
36
- s,
37
- r,
38
- /*excludeSlotted*/
39
- !0
40
- );
41
- return `${e}${o}${l}{`;
42
- }
43
- ), t) : "";
44
- }
45
- function k(t) {
46
- return t.shadowScopeSeq = (t.shadowScopeSeq || 0) + 1, `s${t.shadowScopeSeq}`;
47
- }
48
- function L(t) {
49
- let r = "";
50
- try {
51
- t.querySelectorAll("style").forEach((e) => {
52
- r += (e.textContent || "") + `
53
- `;
54
- });
55
- const n = t.adoptedStyleSheets || [];
56
- for (const e of n)
57
- try {
58
- if (e && e.cssRules)
59
- for (const o of e.cssRules) r += o.cssText + `
60
- `;
61
- } catch {
62
- }
63
- } catch {
64
- }
65
- return r;
66
- }
67
- function I(t, r, n) {
68
- if (!r) return;
69
- const e = document.createElement("style");
70
- e.setAttribute("data-sd", n), e.textContent = r, t.insertBefore(e, t.firstChild || null);
71
- }
72
- function W(t, r) {
73
- try {
74
- const n = t.currentSrc || t.src || "";
75
- if (!n) return;
76
- r.setAttribute("src", n), r.removeAttribute("srcset"), r.removeAttribute("sizes"), r.loading = "eager", r.decoding = "sync";
77
- } catch {
78
- }
79
- }
80
- function D(t) {
81
- const r = /* @__PURE__ */ new Set();
82
- if (!t) return r;
83
- const n = /var\(\s*(--[A-Za-z0-9_-]+)\b/g;
84
- let e;
85
- for (; e = n.exec(t); ) r.add(e[1]);
86
- return r;
87
- }
88
- function F(t, r) {
89
- try {
90
- let e = getComputedStyle(t).getPropertyValue(r).trim();
91
- if (e) return e;
92
- } catch {
93
- }
94
- try {
95
- let e = getComputedStyle(document.documentElement).getPropertyValue(r).trim();
96
- if (e) return e;
97
- } catch {
98
- }
99
- return "";
100
- }
101
- function H(t, r, n) {
102
- const e = [];
103
- for (const o of r) {
104
- const s = F(t, o);
105
- s && e.push(`${o}: ${s};`);
106
- }
107
- return e.length ? `${n}{${e.join("")}}
108
- ` : "";
109
- }
110
- function P(t) {
111
- t && (t.nodeType === Node.ELEMENT_NODE && t.setAttribute("data-sd-slotted", ""), t.querySelectorAll && t.querySelectorAll("*").forEach((r) => r.setAttribute("data-sd-slotted", "")));
112
- }
113
- async function B(t, r = 3) {
114
- const n = () => {
115
- try {
116
- return t.contentDocument || t.contentWindow?.document || null;
117
- } catch {
118
- return null;
119
- }
120
- };
121
- let e = n(), o = 0;
122
- for (; o < r && (!e || !e.body && !e.documentElement); )
123
- await new Promise((s) => setTimeout(s, 0)), e = n(), o++;
124
- return e && (e.body || e.documentElement) ? e : null;
125
- }
126
- function _(t) {
127
- const r = t.getBoundingClientRect();
128
- let n = 0, e = 0, o = 0, s = 0;
129
- try {
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
- } catch {
133
- }
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
- }
137
- function q(t, r, n) {
138
- const e = t.createElement("style");
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
- try {
141
- e.remove();
142
- } catch {
143
- }
144
- };
145
- }
146
- async function z(t, r, n) {
147
- const e = await B(t, 3);
148
- if (!e) throw new Error("iframe document not accessible/ready");
149
- const { contentWidth: o, contentHeight: s, rect: l } = _(t), h = n?.snap;
150
- if (!h || typeof h.toPng != "function")
151
- throw new Error("snapdom.toPng not available in iframe or window");
152
- const f = { ...n, scale: 1 }, i = q(e, o, s);
153
- let a;
154
- try {
155
- a = await h.toPng(e.documentElement, f);
156
- } finally {
157
- i();
158
- }
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
- }
163
- async function A(t, r, n) {
1
+ /* 2025-11-27 12:11:03 */
2
+ import { resolveCSSVars as T } from "../modules/CSSVar.js";
3
+ import { inlineAllStyles as p } from "../modules/styles.js";
4
+ import { rasterizeIframe as M, freezeImgSrcset as v, nextShadowScopeId as $, extractShadowCSS as L, rewriteShadowCSS as R, collectCustomPropsFromCSS as k, buildSeedCustomPropsRule as I, injectScopedStyle as H, idleCallback as x, markSlottedSubtree as C } from "../utils/clone.helpers.js";
5
+ import { NO_CAPTURE_TAGS as D } from "../utils/css.js";
6
+ async function S(t, s, c) {
164
7
  if (!t) throw new Error("Invalid node");
165
- const e = /* @__PURE__ */ new Set();
166
- let o = null, s = null;
8
+ const b = /* @__PURE__ */ new Set();
9
+ let w = null, y = null;
167
10
  if (t.nodeType === Node.ELEMENT_NODE) {
168
- const i = (t.localName || t.tagName || "").toLowerCase();
169
- if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || v.has(i))
11
+ const e = (t.localName || t.tagName || "").toLowerCase();
12
+ if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || D.has(e))
170
13
  return null;
171
14
  }
172
15
  if (t.nodeType === Node.TEXT_NODE || t.nodeType !== Node.ELEMENT_NODE)
173
16
  return t.cloneNode(!0);
174
17
  if (t.getAttribute("data-capture") === "exclude") {
175
- if (n.excludeMode === "hide") {
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
- } else if (n.excludeMode === "remove")
18
+ if (c.excludeMode === "hide") {
19
+ const e = document.createElement("div"), a = t.getBoundingClientRect();
20
+ return e.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, e;
21
+ } else if (c.excludeMode === "remove")
179
22
  return null;
180
23
  }
181
- if (n.exclude && Array.isArray(n.exclude))
182
- for (const i of n.exclude)
24
+ if (c.exclude && Array.isArray(c.exclude))
25
+ for (const e of c.exclude)
183
26
  try {
184
- if (t.matches?.(i)) {
185
- if (n.excludeMode === "hide") {
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
- } else if (n.excludeMode === "remove")
27
+ if (t.matches?.(e)) {
28
+ if (c.excludeMode === "hide") {
29
+ const a = document.createElement("div"), i = t.getBoundingClientRect();
30
+ return a.style.cssText = `display:inline-block;width:${i.width}px;height:${i.height}px;visibility:hidden;`, a;
31
+ } else if (c.excludeMode === "remove")
189
32
  return null;
190
33
  }
191
34
  } catch (a) {
192
- console.warn(`Invalid selector in exclude option: ${i}`, a);
35
+ console.warn(`Invalid selector in exclude option: ${e}`, a);
193
36
  }
194
- if (typeof n.filter == "function")
37
+ if (typeof c.filter == "function")
195
38
  try {
196
- if (!n.filter(t)) {
197
- if (n.filterMode === "hide") {
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
- } else if (n.filterMode === "remove")
39
+ if (!c.filter(t)) {
40
+ if (c.filterMode === "hide") {
41
+ const e = document.createElement("div"), a = t.getBoundingClientRect();
42
+ return e.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, e;
43
+ } else if (c.filterMode === "remove")
201
44
  return null;
202
45
  }
203
- } catch (i) {
204
- console.warn("Error in filter function:", i);
46
+ } catch (e) {
47
+ console.warn("Error in filter function:", e);
205
48
  }
206
49
  if (t.tagName === "IFRAME") {
207
- let i = !1;
50
+ let e = !1;
208
51
  try {
209
- i = !!(t.contentDocument || t.contentWindow?.document);
52
+ e = !!(t.contentDocument || t.contentWindow?.document);
210
53
  } catch {
211
- i = !1;
54
+ e = !1;
212
55
  }
213
- if (i)
56
+ if (e)
214
57
  try {
215
- return await z(t, r, n);
58
+ return await M(t, s, c);
216
59
  } catch (a) {
217
60
  console.warn("[SnapDOM] iframe rasterization failed, fallback:", a);
218
61
  }
219
- if (n.placeholders) {
62
+ if (c.placeholders) {
220
63
  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;
64
+ 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;`, p(t, a, s, c), a;
222
65
  } else {
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;
66
+ const a = t.getBoundingClientRect(), i = document.createElement("div");
67
+ return i.style.cssText = `display:inline-block;width:${a.width}px;height:${a.height}px;visibility:hidden;`, p(t, i, s, c), i;
225
68
  }
226
69
  }
227
70
  if (t.getAttribute("data-capture") === "placeholder") {
228
- const i = t.cloneNode(!1);
229
- r.nodeMap.set(i, t), b(t, i, r, n);
71
+ const e = t.cloneNode(!1);
72
+ s.nodeMap.set(e, t), p(t, e, s, c);
230
73
  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;
74
+ 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;", e.appendChild(a), e;
232
75
  }
233
76
  if (t.tagName === "CANVAS") {
234
- let i = "";
77
+ let e = "";
235
78
  try {
236
- const c = t.getContext("2d", { willReadFrequently: !0 });
79
+ const i = t.getContext("2d", { willReadFrequently: !0 });
237
80
  try {
238
- c && c.getImageData(0, 0, 1, 1);
81
+ i && i.getImageData(0, 0, 1, 1);
239
82
  } catch {
240
83
  }
241
- if (await new Promise((u) => requestAnimationFrame(u)), i = t.toDataURL("image/png"), !i || i === "data:,") {
84
+ if (await new Promise((l) => requestAnimationFrame(l)), e = t.toDataURL("image/png"), !e || e === "data:,") {
242
85
  try {
243
- c && c.getImageData(0, 0, 1, 1);
86
+ i && i.getImageData(0, 0, 1, 1);
244
87
  } catch {
245
88
  }
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"));
89
+ if (await new Promise((l) => requestAnimationFrame(l)), e = t.toDataURL("image/png"), !e || e === "data:,") {
90
+ const l = document.createElement("canvas");
91
+ l.width = t.width, l.height = t.height;
92
+ const n = l.getContext("2d");
93
+ n && (n.drawImage(t, 0, 0), e = l.toDataURL("image/png"));
251
94
  }
252
95
  }
253
96
  } catch {
@@ -257,108 +100,116 @@ async function A(t, r, n) {
257
100
  a.decoding = "sync", a.loading = "eager";
258
101
  } catch {
259
102
  }
260
- i && (a.src = i), a.width = t.width, a.height = t.height;
103
+ e && (a.src = e), a.width = t.width, a.height = t.height;
261
104
  try {
262
- const c = getComputedStyle(t);
263
- c.width && (a.style.width = c.width), c.height && (a.style.height = c.height);
105
+ const i = getComputedStyle(t);
106
+ i.width && (a.style.width = i.width), i.height && (a.style.height = i.height);
264
107
  } catch {
265
108
  }
266
- return r.nodeMap.set(a, t), b(t, a, r, n), a;
109
+ return s.nodeMap.set(a, t), p(t, a, s, c), a;
267
110
  }
268
- let l;
111
+ let r;
269
112
  try {
270
- if (l = t.cloneNode(!1), N(t, l), r.nodeMap.set(l, t), t.tagName === "IMG") {
271
- W(t, l);
113
+ if (r = t.cloneNode(!1), T(t, r), s.nodeMap.set(r, t), t.tagName === "IMG") {
114
+ v(t, r);
272
115
  try {
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);
116
+ const e = t.getBoundingClientRect();
117
+ let a = Math.round(e.width || 0), i = Math.round(e.height || 0);
118
+ if (!a || !i) {
119
+ const l = window.getComputedStyle(t), n = parseFloat(l.width) || 0, h = parseFloat(l.height) || 0, u = parseInt(t.getAttribute("width") || "", 10) || 0, o = parseInt(t.getAttribute("height") || "", 10) || 0, g = t.width || t.naturalWidth || 0, d = t.height || t.naturalHeight || 0;
120
+ a = Math.round(a || n || u || g || 0), i = Math.round(i || h || o || d || 0);
278
121
  }
279
- a && (l.dataset.snapdomWidth = String(a)), c && (l.dataset.snapdomHeight = String(c));
122
+ a && (r.dataset.snapdomWidth = String(a)), i && (r.dataset.snapdomHeight = String(i));
123
+ } catch {
124
+ }
125
+ try {
126
+ const e = t.getAttribute("style") || "", a = window.getComputedStyle(t), i = (o) => {
127
+ const g = e.match(new RegExp(`${o}\\s*:\\s*([^;]+)`, "i")), d = g ? g[1].trim() : a.getPropertyValue(o);
128
+ return /%|auto/i.test(String(d || ""));
129
+ }, l = parseInt(r.dataset.snapdomWidth || "0", 10), n = parseInt(r.dataset.snapdomHeight || "0", 10), h = i("width") || !l, u = i("height") || !n;
130
+ h && l && (r.style.width = `${l}px`), u && n && (r.style.height = `${n}px`), l && (r.style.minWidth = `${l}px`), n && (r.style.minHeight = `${n}px`);
280
131
  } catch {
281
132
  }
282
133
  }
283
- } catch (i) {
284
- throw console.error("[Snapdom] Failed to clone node:", t, i), i;
134
+ } catch (e) {
135
+ throw console.error("[Snapdom] Failed to clone node:", t, e), e;
285
136
  }
286
137
  if (t instanceof HTMLTextAreaElement) {
287
- const i = t.getBoundingClientRect();
288
- l.style.width = `${i.width}px`, l.style.height = `${i.height}px`;
138
+ const e = t.getBoundingClientRect();
139
+ r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
289
140
  }
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) {
141
+ if (t instanceof HTMLInputElement && (r.value = t.value, r.setAttribute("value", t.value), t.checked !== void 0 && (r.checked = t.checked, t.checked && r.setAttribute("checked", ""), t.indeterminate && (r.indeterminate = t.indeterminate))), t instanceof HTMLSelectElement && (w = t.value), t instanceof HTMLTextAreaElement && (y = t.value), p(t, r, s, c), t.shadowRoot) {
142
+ let o = function(d, f) {
292
143
  if (d.nodeType === Node.ELEMENT_NODE && d.tagName === "STYLE")
293
- return w(null);
294
- A(d, r, n).then((x) => {
295
- w(x || null);
144
+ return f(null);
145
+ S(d, s, c).then((m) => {
146
+ f(m || null);
296
147
  }).catch(() => {
297
- w(null);
148
+ f(null);
298
149
  });
299
150
  };
300
151
  try {
301
152
  const d = t.shadowRoot.querySelectorAll("slot");
302
- for (const w of d) {
303
- let x = [];
153
+ for (const f of d) {
154
+ let m = [];
304
155
  try {
305
- x = w.assignedNodes?.({ flatten: !0 }) || w.assignedNodes?.() || [];
156
+ m = f.assignedNodes?.({ flatten: !0 }) || f.assignedNodes?.() || [];
306
157
  } catch {
307
- x = w.assignedNodes?.() || [];
158
+ m = f.assignedNodes?.() || [];
308
159
  }
309
- for (const $ of x) e.add($);
160
+ for (const N of m) b.add(N);
310
161
  }
311
162
  } catch {
312
163
  }
313
- const i = k(r), a = `[data-sd="${i}"]`;
164
+ const e = $(s), a = `[data-sd="${e}"]`;
314
165
  try {
315
- l.setAttribute("data-sd", i);
166
+ r.setAttribute("data-sd", e);
316
167
  } catch {
317
168
  }
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(
169
+ const i = L(t.shadowRoot), l = R(i, a), n = k(i), h = I(t, n, a);
170
+ H(r, h + l, e);
171
+ const u = document.createDocumentFragment(), g = await x(
321
172
  Array.from(t.shadowRoot.childNodes),
322
- y,
323
- n.fast
173
+ o,
174
+ c.fast
324
175
  );
325
- p.append(...S.filter((d) => !!d)), l.appendChild(p);
176
+ u.append(...g.filter((d) => !!d)), r.appendChild(u);
326
177
  }
327
178
  if (t.tagName === "SLOT") {
328
- let u = function(g, p) {
329
- A(g, r, n).then((y) => {
330
- y && P(y), p(y || null);
179
+ let l = function(h, u) {
180
+ S(h, s, c).then((o) => {
181
+ o && C(o), u(o || null);
331
182
  }).catch(() => {
332
- p(null);
183
+ u(null);
333
184
  });
334
185
  };
335
- const i = t.assignedNodes?.({ flatten: !0 }) || [], a = i.length > 0 ? i : Array.from(t.childNodes), c = document.createDocumentFragment(), m = await E(
186
+ const e = t.assignedNodes?.({ flatten: !0 }) || [], a = e.length > 0 ? e : Array.from(t.childNodes), i = document.createDocumentFragment(), n = await x(
336
187
  Array.from(a),
337
- u,
338
- n.fast
188
+ l,
189
+ c.fast
339
190
  );
340
- return c.append(...m.filter((g) => !!g)), c;
191
+ return i.append(...n.filter((h) => !!h)), i;
341
192
  }
342
- function h(i, a) {
343
- if (e.has(i)) return a(null);
344
- A(i, r, n).then((c) => {
345
- a(c || null);
193
+ function E(e, a) {
194
+ if (b.has(e)) return a(null);
195
+ S(e, s, c).then((i) => {
196
+ a(i || null);
346
197
  }).catch(() => {
347
198
  a(null);
348
199
  });
349
200
  }
350
- const f = await E(
201
+ const A = await x(
351
202
  Array.from(t.childNodes),
352
- h,
353
- n.fast
203
+ E,
204
+ c.fast
354
205
  );
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");
206
+ if (r.append(...A.filter((e) => !!e)), w !== null && r instanceof HTMLSelectElement) {
207
+ r.value = w;
208
+ for (const e of r.options)
209
+ e.value === w ? e.setAttribute("selected", "") : e.removeAttribute("selected");
359
210
  }
360
- return s !== null && l instanceof HTMLTextAreaElement && (l.textContent = s), l;
211
+ return y !== null && r instanceof HTMLTextAreaElement && (r.textContent = y), r;
361
212
  }
362
213
  export {
363
- A as deepClone
214
+ S as deepClone
364
215
  };
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  function a(e) {
3
3
  if (typeof e == "string") {
4
4
  const l = e.toLowerCase().trim();
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  const e = [];
3
3
  function a(n) {
4
4
  if (!n) return null;