@unicom-cloud/utils 0.1.30 → 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,224 +1,338 @@
1
- /* 2025-11-19 09:08:12 */
2
- import { cache as J } from "../core/cache.js";
3
- import { buildCounterContext as Q, hasCounters as Z, resolveCountersInContent as tt } from "./counter.js";
4
- import { iconToImage as nt } from "./fonts.js";
5
- import { isIconFont as et } from "./iconFonts.js";
6
- import { getStyle as ot, snapshotComputedStyle as T, getStyleKey as U, splitBackgroundImage as rt } from "../utils/css.js";
7
- import { extractURL as st, safeEncodeURI as it } from "../utils/helpers.js";
8
- import { inlineSingleBackgroundEntry as at } from "../utils/image.js";
9
- import { snapFetch as ct } from "./snapFetch.js";
10
- var k = /* @__PURE__ */ new WeakMap(), L = -1;
11
- function lt(n) {
12
- return (n || "").replace(/"([^"]*)"/g, "$1");
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 dt(n) {
15
- if (!n) return "";
16
- const r = [], a = /"([^"]*)"/g;
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 = a.exec(n); ) r.push(c[1]);
19
- return r.length ? r.join("") : lt(n);
128
+ for (; c = s.exec(t); ) o.push(c[1]);
129
+ return o.length ? o.join("") : bt(t);
20
130
  }
21
- function v(n, r) {
22
- const a = n.parentElement, c = a ? k.get(a) : null;
131
+ function A(t, o) {
132
+ const s = t.parentElement, c = s ? x.get(s) : null;
23
133
  return c ? {
24
- get(l, f) {
25
- const d = r.get(l, f), g = c.get(f);
26
- return typeof g == "number" ? Math.max(d, g) : d;
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(l, f) {
29
- const d = r.getStack(l, f);
30
- if (!d.length) return d;
31
- const g = c.get(f);
32
- if (typeof g == "number") {
33
- const e = d.slice();
34
- return e[e.length - 1] = Math.max(e[e.length - 1], g), e;
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 d;
146
+ return i;
37
147
  }
38
- } : r;
148
+ } : o;
39
149
  }
40
- function F(n, r, a) {
150
+ function v(t, o, s) {
41
151
  const c = /* @__PURE__ */ new Map();
42
- function l(e) {
43
- const t = [];
44
- if (!e || e === "none") return t;
45
- for (const h of String(e).split(",")) {
46
- const b = h.trim().split(/\s+/), s = b[0], y = Number.isFinite(Number(b[1])) ? Number(b[1]) : void 0;
47
- s && t.push({ name: s, num: y });
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 t;
159
+ return n;
50
160
  }
51
- const f = l(r?.counterReset), d = l(r?.counterIncrement);
52
- function g(e) {
53
- if (c.has(e)) return c.get(e).slice();
54
- let t = a.getStack(n, e);
55
- t = t.length ? t.slice() : [];
56
- const h = f.find((s) => s.name === e);
57
- if (h) {
58
- const s = Number.isFinite(h.num) ? h.num : 0;
59
- t = t.length ? [...t, s] : [s];
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 b = d.find((s) => s.name === e);
62
- if (b) {
63
- const s = Number.isFinite(b.num) ? b.num : 1;
64
- t.length === 0 && (t = [0]), t[t.length - 1] += s;
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(e, t.slice()), t;
176
+ return c.set(r, n.slice()), n;
67
177
  }
68
178
  return {
69
- get(e, t) {
70
- const h = g(t);
71
- return h.length ? h[h.length - 1] : 0;
179
+ get(r, n) {
180
+ const e = l(n);
181
+ return e.length ? e[e.length - 1] : 0;
72
182
  },
73
- getStack(e, t) {
74
- return g(t);
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: d
187
+ __incs: i
78
188
  };
79
189
  }
80
- function ut(n, r, a) {
190
+ function St(t, o, s) {
81
191
  let c;
82
192
  try {
83
- c = getComputedStyle(n, r);
193
+ c = getComputedStyle(t, o);
84
194
  } catch {
85
195
  }
86
- const l = c?.content;
87
- if (!l || l === "none" || l === "normal") return { text: "", incs: [] };
88
- const f = v(n, a), d = F(n, c, f);
89
- let g = Z(l) ? tt(l, n, d) : l;
90
- return { text: dt(g), incs: d.__incs || [] };
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 ft(n, r, a, c) {
93
- if (!(n instanceof Element) || !(r instanceof Element)) return;
94
- const l = J?.session?.__counterEpoch ?? 0;
95
- if (L !== l && (k = /* @__PURE__ */ new WeakMap(), a && (a.__counterCtx = null), L = l), !a.__counterCtx)
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
- a.__counterCtx = Q(
98
- n.ownerDocument || document
210
+ s.__counterCtx = it(
211
+ t.ownerDocument || document
99
212
  );
100
213
  } catch {
101
214
  }
102
- const f = a.__counterCtx;
103
- for (const e of ["::before", "::after", "::first-letter"])
215
+ const i = s.__counterCtx;
216
+ for (const n of ["::before", "::after", "::first-letter"])
104
217
  try {
105
- const t = ot(n, e);
106
- if (!t || typeof t[Symbol.iterator] != "function" || t.content === "none" && t.backgroundImage === "none" && t.backgroundColor === "transparent" && (t.borderStyle === "none" || parseFloat(t.borderWidth) === 0) && (!t.transform || t.transform === "none") && t.display === "inline") continue;
107
- if (e === "::first-letter") {
108
- const i = getComputedStyle(n);
109
- if (!(t.color !== i.color || t.fontSize !== i.fontSize || t.fontWeight !== i.fontWeight)) continue;
110
- const m = Array.from(r.childNodes).find(
111
- (z) => z.nodeType === Node.TEXT_NODE && z.textContent?.trim().length > 0
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 (!m) continue;
114
- const p = m.textContent, E = p.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], H = p.slice(E?.length || 0);
115
- if (!E || /[\uD800-\uDFFF]/.test(E)) continue;
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 = E, w.dataset.snapdomPseudo = "::first-letter";
118
- const K = T(t), G = U(K, "span");
119
- a.styleMap.set(w, G);
120
- const $ = document.createTextNode(H);
121
- r.replaceChild($, m), r.insertBefore(w, $);
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 b = t.content, { text: s, incs: y } = ut(
237
+ const m = e.content ?? "", F = m === "" || m === "none" || m === "normal", { text: b, incs: k } = St(
238
+ t,
125
239
  n,
126
- e,
127
- f
128
- ), _ = t.backgroundImage, C = t.backgroundColor, M = t.fontFamily, x = parseInt(t.fontSize) || 32, j = parseInt(t.fontWeight) || !1, O = t.color || "#000", N = t.borderStyle, X = parseFloat(t.borderWidth), W = t.transform, B = et(M), R = b !== "none" && s !== "", P = _ && _ !== "none", I = C && C !== "transparent" && C !== "rgba(0, 0, 0, 0)", A = N && N !== "none" && X > 0, D = W && W !== "none";
129
- if (!(R || P || I || A || D)) {
130
- if (y && y.length && n.parentElement) {
131
- const i = k.get(n.parentElement) || /* @__PURE__ */ new Map();
132
- for (const { name: u } of y) {
133
- if (!u) continue;
134
- const m = v(n, f), S = F(
135
- n,
136
- getComputedStyle(n, e),
137
- m
138
- ).get(n, u);
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
- k.set(n.parentElement, i);
254
+ x.set(t.parentElement, g);
142
255
  }
143
256
  continue;
144
257
  }
145
- const o = document.createElement("span");
146
- o.dataset.snapdomPseudo = e, o.style.display = "inline", o.style.verticalAlign = "baseline", o.style.pointerEvents = "none";
147
- const V = T(t), Y = U(V, "span");
148
- if (a.styleMap.set(o, Y), B && s && s.length === 1) {
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: i,
151
- width: u,
152
- height: m
153
- } = await nt(
154
- s,
155
- M,
156
- j,
157
- x,
158
- O
159
- ), p = document.createElement("img");
160
- p.src = i, p.style = `height:${x}px;width:${u / m * x}px;object-fit:contain;`, o.appendChild(p), r.dataset.snapdomHasIcon = "true";
161
- } else if (s && s.startsWith("url(")) {
162
- const i = st(s);
163
- if (i?.trim())
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 u = document.createElement("img"), m = await ct(it(i), {
278
+ const d = document.createElement("img"), p = await ht(mt(g), {
166
279
  as: "dataURL",
167
280
  useProxy: c.useProxy
168
281
  });
169
- u.src = m.data, u.style = `width:${x}px;height:auto;object-fit:contain;`, o.appendChild(u);
170
- } catch (u) {
171
- console.error(`[snapdom] Error in pseudo ${e} for`, n, u);
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 && R && (o.textContent = s);
174
- o.style.backgroundImage = "none", "maskImage" in o.style && (o.style.maskImage = "none"), "webkitMaskImage" in o.style && (o.style.webkitMaskImage = "none");
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
- o.style.backgroundRepeat = t.backgroundRepeat, o.style.backgroundSize = t.backgroundSize, t.backgroundPositionX && t.backgroundPositionY ? (o.style.backgroundPositionX = t.backgroundPositionX, o.style.backgroundPositionY = t.backgroundPositionY) : o.style.backgroundPosition = t.backgroundPosition, o.style.backgroundOrigin = t.backgroundOrigin, o.style.backgroundClip = t.backgroundClip, o.style.backgroundAttachment = t.backgroundAttachment, o.style.backgroundBlendMode = t.backgroundBlendMode;
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 (P)
292
+ if (I)
180
293
  try {
181
- const i = rt(_), u = await Promise.all(
182
- i.map(at)
294
+ const g = gt(N), d = await Promise.all(
295
+ g.map(pt)
183
296
  );
184
- o.style.backgroundImage = u.join(", ");
185
- } catch (i) {
297
+ u.style.backgroundImage = d.join(", ");
298
+ } catch (g) {
186
299
  console.warn(
187
- `[snapdom] Failed to inline background-image for ${e}`,
188
- i
300
+ `[snapdom] Failed to inline background-image for ${n}`,
301
+ g
189
302
  );
190
303
  }
191
- I && (o.style.backgroundColor = C);
192
- const q = o.childNodes.length > 0 || o.textContent?.trim() !== "" || P || I || A || D;
193
- if (y && y.length && n.parentElement) {
194
- const i = k.get(n.parentElement) || /* @__PURE__ */ new Map(), u = v(n, f), m = F(
195
- n,
196
- getComputedStyle(n, e),
197
- u
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: p } of y) {
200
- if (!p) continue;
201
- const S = m.get(n, p);
202
- i.set(p, S);
312
+ for (const { name: h } of k) {
313
+ if (!h) continue;
314
+ const _ = p.get(t, h);
315
+ g.set(h, _);
203
316
  }
204
- k.set(n.parentElement, i);
317
+ x.set(t.parentElement, g);
205
318
  }
206
- if (!q) continue;
207
- e === "::before" ? r.insertBefore(o, r.firstChild) : r.appendChild(o);
208
- } catch (t) {
209
- console.warn(`[snapdom] Failed to capture ${e} for`, n, t);
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 d = Array.from(n.children), g = Array.from(r.children).filter(
212
- (e) => !e.dataset.snapdomPseudo
324
+ const l = Array.from(t.children), r = Array.from(o.children).filter(
325
+ (n) => !n.dataset.snapdomPseudo
213
326
  );
214
- for (let e = 0; e < Math.min(d.length, g.length); e++)
215
- await ft(
216
- d[e],
217
- g[e],
218
- a,
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
- ft as inlinePseudoElements
336
+ xt as inlinePseudoElements,
337
+ V as shouldProcessPseudos
224
338
  };
@@ -1,10 +1,9 @@
1
- /* 2025-11-19 09:08:12 */
2
- import { toCanvas as d } from "../exporters/toCanvas.js";
3
- import { createBackground as n } from "../utils/image.js";
4
- async function m(c, a) {
5
- const e = await d(c, a), t = a.backgroundColor ? n(e, a.backgroundColor) : e, r = new Image();
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
- m as rasterize
8
+ d as rasterize
10
9
  };
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import { safeEncodeURI as U } from "../utils/helpers.js";
3
3
  function E(t = "[snapDOM]", { ttlMs: e = 5 * 6e4, maxEntries: n = 12 } = {}) {
4
4
  const r = /* @__PURE__ */ new Map();