@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.
Files changed (290) hide show
  1. package/case-name/index.js +1 -1
  2. package/caseName.js +1 -1
  3. package/class-name/index.js +1 -1
  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/keyboardCode.js +1 -1
  15. package/constant/licensePlate.js +1 -1
  16. package/constant/name.js +1 -1
  17. package/constant/platform.js +1 -1
  18. package/constant/protocol.js +1 -1
  19. package/constant/ui.js +1 -1
  20. package/constant.js +1 -1
  21. package/content-disposition/index.js +1 -1
  22. package/contentDisposition.js +1 -1
  23. package/cookie/index.js +1 -1
  24. package/cookie/src/index.js +1 -1
  25. package/cookie.js +1 -1
  26. package/date/convertTime.js +1 -1
  27. package/date/convertToDuration.js +1 -1
  28. package/date/index.js +1 -1
  29. package/date.js +1 -1
  30. package/decimal/decimal.js +22 -22
  31. package/decimal/index.js +1 -1
  32. package/decimal.js +1 -1
  33. package/dom-helpers/activeElement.js +1 -1
  34. package/dom-helpers/addClass.js +1 -1
  35. package/dom-helpers/addEventListener.js +1 -1
  36. package/dom-helpers/animate.js +1 -1
  37. package/dom-helpers/animationFrame.js +1 -1
  38. package/dom-helpers/attribute.js +1 -1
  39. package/dom-helpers/camelize.js +1 -1
  40. package/dom-helpers/camelizeStyle.js +1 -1
  41. package/dom-helpers/canUseDOM.js +1 -1
  42. package/dom-helpers/childElements.js +1 -1
  43. package/dom-helpers/childNodes.js +1 -1
  44. package/dom-helpers/clear.js +1 -1
  45. package/dom-helpers/closest.js +1 -1
  46. package/dom-helpers/collectElements.js +1 -1
  47. package/dom-helpers/collectSiblings.js +1 -1
  48. package/dom-helpers/contains.js +1 -1
  49. package/dom-helpers/css.js +1 -1
  50. package/dom-helpers/filterEventHandler.js +1 -1
  51. package/dom-helpers/getComputedStyle.js +1 -1
  52. package/dom-helpers/getScrollAccessor.js +1 -1
  53. package/dom-helpers/hasClass.js +1 -1
  54. package/dom-helpers/height.js +1 -1
  55. package/dom-helpers/hyphenate.js +1 -1
  56. package/dom-helpers/hyphenateStyle.js +1 -1
  57. package/dom-helpers/index.js +1 -1
  58. package/dom-helpers/insertAfter.js +1 -1
  59. package/dom-helpers/isDocument.js +1 -1
  60. package/dom-helpers/isInput.js +1 -1
  61. package/dom-helpers/isTransform.js +1 -1
  62. package/dom-helpers/isVisible.js +1 -1
  63. package/dom-helpers/isWindow.js +1 -1
  64. package/dom-helpers/listen.js +1 -1
  65. package/dom-helpers/matches.js +1 -1
  66. package/dom-helpers/nextUntil.js +1 -1
  67. package/dom-helpers/offset.js +1 -1
  68. package/dom-helpers/offsetParent.js +1 -1
  69. package/dom-helpers/ownerDocument.js +1 -1
  70. package/dom-helpers/ownerWindow.js +1 -1
  71. package/dom-helpers/parents.js +1 -1
  72. package/dom-helpers/position.js +1 -1
  73. package/dom-helpers/prepend.js +1 -1
  74. package/dom-helpers/querySelectorAll.js +1 -1
  75. package/dom-helpers/reflow.js +1 -1
  76. package/dom-helpers/remove.js +1 -1
  77. package/dom-helpers/removeClass.js +1 -1
  78. package/dom-helpers/removeEventListener.js +1 -1
  79. package/dom-helpers/scrollLeft.js +1 -1
  80. package/dom-helpers/scrollParent.js +1 -1
  81. package/dom-helpers/scrollTo.js +1 -1
  82. package/dom-helpers/scrollTop.js +1 -1
  83. package/dom-helpers/scrollbarSize.js +1 -1
  84. package/dom-helpers/siblings.js +1 -1
  85. package/dom-helpers/text.js +1 -1
  86. package/dom-helpers/toggleClass.js +1 -1
  87. package/dom-helpers/transitionEnd.js +1 -1
  88. package/dom-helpers/triggerEvent.js +1 -1
  89. package/dom-helpers/types.js +5 -1
  90. package/dom-helpers/width.js +1 -1
  91. package/domHelpers.js +1 -1
  92. package/emitter/index.js +1 -1
  93. package/emitter/src/index.js +1 -1
  94. package/emitter.js +1 -1
  95. package/file/fileToURL.js +1 -1
  96. package/file/index.js +1 -1
  97. package/file/saveAs.js +1 -1
  98. package/file.js +1 -1
  99. package/idb/index.js +1 -1
  100. package/idb.js +1 -1
  101. package/index.js +1 -1
  102. package/invariant/index.js +1 -1
  103. package/invariant.js +1 -1
  104. package/is/index.js +1 -1
  105. package/is.js +1 -1
  106. package/js-cookie/index.js +1 -1
  107. package/js-cookie/src/api.js +1 -1
  108. package/js-cookie/src/assign.js +1 -1
  109. package/js-cookie/src/converter.js +1 -1
  110. package/jsCookie.js +1 -1
  111. package/lunar/index.js +1 -1
  112. package/lunar/lib/Holiday.js +1 -1
  113. package/lunar/lib/HolidayUtil.js +1 -1
  114. package/lunar/lib/I18n.js +1 -1
  115. package/lunar/lib/JieQi.js +1 -1
  116. package/lunar/lib/Lunar.js +1 -1
  117. package/lunar/lib/LunarMonth.js +1 -1
  118. package/lunar/lib/LunarTime.js +1 -1
  119. package/lunar/lib/LunarUtil.js +1 -1
  120. package/lunar/lib/LunarYear.js +1 -1
  121. package/lunar/lib/ShouXingUtil.js +1 -1
  122. package/lunar/lib/Solar.js +1 -1
  123. package/lunar/lib/SolarHalfYear.js +1 -1
  124. package/lunar/lib/SolarMonth.js +1 -1
  125. package/lunar/lib/SolarSeason.js +1 -1
  126. package/lunar/lib/SolarUtil.js +1 -1
  127. package/lunar/lib/SolarWeek.js +1 -1
  128. package/lunar/lib/SolarYear.js +1 -1
  129. package/lunar/lib/index.js +1 -1
  130. package/lunar.js +1 -1
  131. package/math/index.js +1 -1
  132. package/math.js +1 -1
  133. package/md5/index.js +1 -1
  134. package/md5.js +1 -1
  135. package/mock/MockWebSocket.js +1 -1
  136. package/mock/MockXMLHttpRequest.js +1 -1
  137. package/mock/index.js +1 -1
  138. package/mock.js +1 -1
  139. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  140. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  141. package/normalize-wheel/index.js +1 -1
  142. package/normalize-wheel/isEventSupported.js +10 -14
  143. package/normalizeWheel.js +1 -1
  144. package/number-to-chinese/index.js +1 -1
  145. package/numberToChinese.js +1 -1
  146. package/nzh/cn.js +1 -1
  147. package/nzh/hk.js +1 -1
  148. package/nzh/index.js +1 -1
  149. package/nzh/nzh.js +1 -1
  150. package/nzh/src/autoGet.js +1 -1
  151. package/nzh/src/index.js +1 -1
  152. package/nzh/src/langs/cn_b.js +1 -1
  153. package/nzh/src/langs/cn_s.js +1 -1
  154. package/nzh/src/langs/hk_b.js +1 -1
  155. package/nzh/src/langs/hk_s.js +1 -1
  156. package/nzh/src/utils.js +1 -1
  157. package/nzh.js +1 -1
  158. package/object-keys-sort/index.js +1 -1
  159. package/objectKeysSort.js +1 -1
  160. package/package.json +1 -1
  161. package/pinyin/index.js +1 -1
  162. package/pinyin/simplified.js +1 -1
  163. package/pinyin/src/core.js +1 -1
  164. package/pinyin/src/simplified.js +1 -1
  165. package/pinyin/src/simplified_dict.js +1 -1
  166. package/pinyin/src/traditional.js +1 -1
  167. package/pinyin/src/traditional_dict.js +1 -1
  168. package/pinyin/traditional.js +1 -1
  169. package/pinyin.js +1 -1
  170. package/query-string/base.js +1 -1
  171. package/query-string/index.js +1 -1
  172. package/query-string/splitOnFirst.js +1 -1
  173. package/queryString.js +1 -1
  174. package/random/address.js +1 -1
  175. package/random/constellation.js +1 -1
  176. package/random/image.js +1 -1
  177. package/random/index.js +1 -1
  178. package/random/licensePlate.js +1 -1
  179. package/random/name.js +1 -1
  180. package/random/number.js +1 -1
  181. package/random/text.js +1 -1
  182. package/random/time.js +1 -1
  183. package/random/web.js +1 -1
  184. package/random.js +1 -1
  185. package/screenfull/index.js +1 -1
  186. package/screenfull.js +1 -1
  187. package/sleep/index.js +1 -1
  188. package/sleep.js +1 -1
  189. package/snapdom/index.js +1 -1
  190. package/snapdom/src/api/preCache.js +51 -49
  191. package/snapdom/src/api/snapdom.js +171 -67
  192. package/snapdom/src/core/cache.js +2 -2
  193. package/snapdom/src/core/capture.js +249 -234
  194. package/snapdom/src/core/clone.js +151 -120
  195. package/snapdom/src/core/context.js +10 -8
  196. package/snapdom/src/core/plugins.js +69 -0
  197. package/snapdom/src/core/prepare.js +2 -2
  198. package/snapdom/src/exporters/download.js +1 -1
  199. package/snapdom/src/exporters/toBlob.js +1 -1
  200. package/snapdom/src/exporters/toCanvas.js +40 -40
  201. package/snapdom/src/exporters/toImg.js +1 -1
  202. package/snapdom/src/modules/CSSVar.js +66 -40
  203. package/snapdom/src/modules/background.js +39 -23
  204. package/snapdom/src/modules/changeCSS.js +1 -1
  205. package/snapdom/src/modules/counter.js +100 -86
  206. package/snapdom/src/modules/fonts.js +4 -4
  207. package/snapdom/src/modules/iconFonts.js +98 -14
  208. package/snapdom/src/modules/images.js +1 -1
  209. package/snapdom/src/modules/lineClamp.js +1 -1
  210. package/snapdom/src/modules/pseudo.js +147 -138
  211. package/snapdom/src/modules/rasterize.js +1 -1
  212. package/snapdom/src/modules/snapFetch.js +1 -1
  213. package/snapdom/src/modules/styles.js +1 -1
  214. package/snapdom/src/modules/svgDefs.js +86 -39
  215. package/snapdom/src/utils/browser.js +1 -1
  216. package/snapdom/src/utils/css.js +1 -1
  217. package/snapdom/src/utils/helpers.js +1 -1
  218. package/snapdom/src/utils/image.js +1 -1
  219. package/snapdom/types/snapdom.d.ts +253 -184
  220. package/snapdom.js +1 -1
  221. package/tinycolor/index.js +1 -1
  222. package/tinycolor/src/conversion.js +1 -1
  223. package/tinycolor/src/css-color-names.js +1 -1
  224. package/tinycolor/src/format-input.js +1 -1
  225. package/tinycolor/src/from-ratio.js +1 -1
  226. package/tinycolor/src/index.js +1 -1
  227. package/tinycolor/src/random.js +1 -1
  228. package/tinycolor/src/readability.js +1 -1
  229. package/tinycolor/src/to-ms-filter.js +1 -1
  230. package/tinycolor/src/utils.js +1 -1
  231. package/tinycolor.js +1 -1
  232. package/tree/index.js +1 -1
  233. package/tree/search/index.js +1 -1
  234. package/tree.js +1 -1
  235. package/tween/index.js +8 -0
  236. package/tween/src/easing.js +62 -0
  237. package/tween/src/tween.js +46 -0
  238. package/tween.js +8 -0
  239. package/types/dom-helpers/types.d.ts +2 -0
  240. package/types/normalize-wheel/index.d.ts +1 -1
  241. package/types/snapdom/src/api/snapdom.d.ts +4 -0
  242. package/types/snapdom/src/core/capture.d.ts +4 -18
  243. package/types/snapdom/src/core/context.d.ts +4 -4
  244. package/types/snapdom/src/core/exporters.d.ts +33 -0
  245. package/types/snapdom/src/core/plugins.d.ts +59 -0
  246. package/types/snapdom/src/modules/CSSVar.d.ts +3 -7
  247. package/types/snapdom/src/modules/iconFonts.d.ts +34 -0
  248. package/types/snapdom/src/modules/svgDefs.d.ts +9 -15
  249. package/types/tween/index.d.ts +1 -0
  250. package/types/tween/src/easing.d.ts +22 -0
  251. package/types/tween/src/index.d.ts +3 -0
  252. package/types/tween/src/tween.d.ts +22 -0
  253. package/types/validate/index.d.ts +3 -0
  254. package/types/validate/src/index.d.ts +39 -0
  255. package/types/validate/src/interface.d.ts +53 -0
  256. package/types/validate/src/locale/en-US.d.ts +47 -0
  257. package/types/validate/src/locale/zh-CN.d.ts +47 -0
  258. package/types/validate/src/message.d.ts +2 -0
  259. package/types/validate/src/rules/array.d.ts +12 -0
  260. package/types/validate/src/rules/base.d.ts +25 -0
  261. package/types/validate/src/rules/boolean.d.ts +8 -0
  262. package/types/validate/src/rules/custom.d.ts +7 -0
  263. package/types/validate/src/rules/number.d.ts +12 -0
  264. package/types/validate/src/rules/object.d.ts +9 -0
  265. package/types/validate/src/rules/string.d.ts +12 -0
  266. package/types/validate/src/rules/type.d.ts +9 -0
  267. package/types/validate/src/utils.d.ts +3 -0
  268. package/ui-color/compareColorByRange.js +1 -1
  269. package/ui-color/index.js +1 -1
  270. package/uiColor.js +1 -1
  271. package/url-toolkit/index.js +1 -1
  272. package/url-toolkit/src/url-toolkit.js +1 -1
  273. package/urlToolkit.js +1 -1
  274. package/validate/index.js +28 -0
  275. package/validate/src/index.js +106 -0
  276. package/validate/src/locale/en-US.js +50 -0
  277. package/validate/src/locale/zh-CN.js +50 -0
  278. package/validate/src/message.js +5 -0
  279. package/validate/src/rules/array.js +73 -0
  280. package/validate/src/rules/base.js +69 -0
  281. package/validate/src/rules/boolean.js +29 -0
  282. package/validate/src/rules/custom.js +26 -0
  283. package/validate/src/rules/number.js +54 -0
  284. package/validate/src/rules/object.js +39 -0
  285. package/validate/src/rules/string.js +54 -0
  286. package/validate/src/rules/type.js +35 -0
  287. package/validate/src/utils.js +8 -0
  288. package/validate.js +28 -0
  289. package/version/index.js +1 -1
  290. package/version.js +1 -1
@@ -1,7 +1,7 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
2
2
  import { cache as g } from "../core/cache.js";
3
- import { extractURL as X } from "../utils/helpers.js";
4
3
  import { isIconFont as x } from "./iconFonts.js";
4
+ import { extractURL as X } from "../utils/helpers.js";
5
5
  import { snapFetch as A } from "./snapFetch.js";
6
6
  async function lt(o, e, r, a = 32, n = "#000") {
7
7
  e = e.replace(/^['"]+|['"]+$/g, "");
@@ -280,7 +280,7 @@ function rt(o) {
280
280
  if (!o) return o;
281
281
  const e = /@font-face[^{}]*\{[^}]*\}/gi, r = /* @__PURE__ */ new Set(), a = [];
282
282
  for (const c of o.match(e) || []) {
283
- const t = c.match(/font-family:\s*([^;]+);/i)?.[1] || "", f = T(t), s = (c.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), u = (c.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), m = (c.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), d = (c.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), p = (c.match(/src\s*:\s*([^;]+);/i)?.[1] || "").trim(), L = P(p, location.href), C = L.length ? L.map((l) => String(l).toLowerCase()).sort().join("|") : p.toLowerCase(), i = [
283
+ const t = c.match(/font-family:\s*([^;]+);/i)?.[1] || "", f = T(t), s = (c.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), u = (c.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), m = (c.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), d = (c.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), p = (c.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1] || "").trim(), L = P(p, location.href), C = L.length ? L.map((l) => String(l).toLowerCase()).sort().join("|") : p.toLowerCase(), i = [
284
284
  String(f || "").toLowerCase(),
285
285
  s,
286
286
  u,
@@ -466,7 +466,7 @@ async function ut({
466
466
  for (const S of l.match(nt) || []) {
467
467
  const y = (S.match(/font-family:\s*([^;]+);/i)?.[1] || "").trim(), R = T(y);
468
468
  if (!R || x(R)) continue;
469
- const b = (S.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), F = (S.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), M = (S.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), E = (S.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), k = (S.match(/src\s*:\s*([^;]+);/i)?.[1] || "").trim(), $ = P(k, i.href);
469
+ const b = (S.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), F = (S.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), M = (S.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), E = (S.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), k = (S.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1] || "").trim(), $ = P(k, i.href);
470
470
  if (!t(R, F, b, M))
471
471
  continue;
472
472
  const _ = B(E);
@@ -1,5 +1,5 @@
1
- /* 2025-10-28 09:57:10 */
2
- var s = [
1
+ /* 2025-11-03 10:27:31 */
2
+ var S = [
3
3
  // /uicons/i,
4
4
  /font\s*awesome/i,
5
5
  /material\s*icons/i,
@@ -11,19 +11,103 @@ var s = [
11
11
  /heroicons/i,
12
12
  /layui/i,
13
13
  /lucide/i
14
- ], o = [];
15
- function r(i) {
16
- const e = Array.isArray(i) ? i : [i];
17
- for (const t of e)
18
- t instanceof RegExp ? o.push(t) : typeof t == "string" ? o.push(new RegExp(t, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", t);
14
+ ], d = [];
15
+ function M(n) {
16
+ const t = Array.isArray(n) ? n : [n];
17
+ for (const o of t)
18
+ o instanceof RegExp ? d.push(o) : typeof o == "string" ? d.push(new RegExp(o, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", o);
19
19
  }
20
- function c(i) {
21
- const e = typeof i == "string" ? i : "", t = [...s, ...o];
22
- for (const n of t)
23
- if (n instanceof RegExp && n.test(e)) return !0;
24
- return !!(/icon/i.test(e) || /glyph/i.test(e) || /symbols/i.test(e) || /feather/i.test(e) || /fontawesome/i.test(e));
20
+ function $(n) {
21
+ const t = typeof n == "string" ? n : "", o = [...S, ...d];
22
+ for (const s of o)
23
+ if (s instanceof RegExp && s.test(t)) return !0;
24
+ return !!(/icon/i.test(t) || /glyph/i.test(t) || /symbols/i.test(t) || /feather/i.test(t) || /fontawesome/i.test(t));
25
+ }
26
+ function b(n = "") {
27
+ const t = String(n).toLowerCase();
28
+ return /\bmaterial\s*icons\b/.test(t) || /\bmaterial\s*symbols\b/.test(t);
29
+ }
30
+ async function I(n = "Material Icons", t = 24) {
31
+ try {
32
+ await Promise.all([
33
+ document.fonts.load(`400 ${t}px "${n.replace(/["']/g, "")}"`),
34
+ document.fonts.ready
35
+ ]);
36
+ } catch {
37
+ }
38
+ }
39
+ function v(n) {
40
+ let t = n.getPropertyValue("-webkit-text-fill-color")?.trim() || "";
41
+ const o = /rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);
42
+ if (t && !o && t.toLowerCase() !== "currentcolor")
43
+ return t;
44
+ const s = n.color?.trim();
45
+ return s && s !== "inherit" ? s : "#000";
46
+ }
47
+ async function F(n, {
48
+ family: t = "Material Icons",
49
+ weight: o = "normal",
50
+ fontSize: s = 32,
51
+ color: u = "#000",
52
+ variation: y = ""
53
+ } = {}) {
54
+ const i = String(t || "").replace(/^['"]+|['"]+$/g, ""), r = window.devicePixelRatio || 1;
55
+ await I(i, s);
56
+ const e = document.createElement("span");
57
+ e.textContent = n, e.style.position = "absolute", e.style.visibility = "hidden", e.style.left = "-99999px", e.style.whiteSpace = "nowrap", e.style.fontFamily = `"${i}"`, e.style.fontWeight = String(o || "normal"), e.style.fontSize = `${s}px`, e.style.lineHeight = "1", e.style.margin = "0", e.style.padding = "0", e.style.fontFeatureSettings = "'liga' 1", e.style.fontVariantLigatures = "normal", y && (e.style.fontVariationSettings = y), e.style.color = u, document.body.appendChild(e);
58
+ const a = e.getBoundingClientRect(), g = Math.max(1, Math.ceil(a.width)), m = Math.max(1, Math.ceil(a.height));
59
+ document.body.removeChild(e);
60
+ const c = document.createElement("canvas");
61
+ c.width = g * r, c.height = m * r;
62
+ const l = c.getContext("2d");
63
+ l.scale(r, r), l.font = `${o ? `${o} ` : ""}${s}px "${i}"`, l.textAlign = "left", l.textBaseline = "top", l.fillStyle = u;
64
+ try {
65
+ l.fontKerning = "normal";
66
+ } catch {
67
+ }
68
+ return l.fillText(n, 0, 0), {
69
+ dataUrl: c.toDataURL(),
70
+ width: g,
71
+ height: m
72
+ };
73
+ }
74
+ async function A(n, t) {
75
+ if (!(n instanceof Element)) return 0;
76
+ const o = '.material-icons, [class*="material-symbols"]', s = Array.from(n.querySelectorAll(o)).filter(
77
+ (i) => i && i.textContent && i.textContent.trim()
78
+ );
79
+ if (s.length === 0) return 0;
80
+ const u = t instanceof Element ? Array.from(t.querySelectorAll(o)).filter(
81
+ (i) => i && i.textContent && i.textContent.trim()
82
+ ) : [];
83
+ let y = 0;
84
+ for (let i = 0; i < s.length; i++) {
85
+ const r = s[i], e = u[i] || null;
86
+ try {
87
+ const a = getComputedStyle(e || r), g = a.fontFamily || "Material Icons";
88
+ if (!b(g)) continue;
89
+ const m = (e || r).textContent.trim();
90
+ if (!m) continue;
91
+ const c = parseInt(a.fontSize, 10) || 24, l = a.fontWeight && a.fontWeight !== "normal" ? a.fontWeight : "normal", h = v(a), p = a.fontVariationSettings && a.fontVariationSettings !== "normal" ? a.fontVariationSettings : "", { dataUrl: x, width: w, height: C } = await F(m, {
92
+ family: g,
93
+ weight: l,
94
+ fontSize: c,
95
+ color: h,
96
+ variation: p
97
+ });
98
+ r.textContent = "";
99
+ const f = r.ownerDocument.createElement("img");
100
+ f.src = x, f.alt = m, f.style.height = `${c}px`, f.style.width = `${Math.max(1, Math.round(w / C * c))}px`, f.style.objectFit = "contain", f.style.verticalAlign = getComputedStyle(r).verticalAlign || "baseline", r.appendChild(f), y++;
101
+ } catch {
102
+ }
103
+ }
104
+ return y;
25
105
  }
26
106
  export {
27
- r as extendIconFonts,
28
- c as isIconFont
107
+ I as ensureMaterialFontsReady,
108
+ M as extendIconFonts,
109
+ $ as isIconFont,
110
+ b as isMaterialFamily,
111
+ A as ligatureIconToImage,
112
+ F as materialIconToImage
29
113
  };
@@ -1,4 +1,4 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
2
2
  import { snapFetch as f } from "./snapFetch.js";
3
3
  async function H(u, s = {}) {
4
4
  const i = Array.from(u.querySelectorAll("img")), p = async (t) => {
@@ -1,4 +1,4 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
2
2
  function h(t) {
3
3
  if (!t) return () => {
4
4
  };
@@ -1,215 +1,224 @@
1
- /* 2025-10-28 09:57:10 */
2
- import { getStyle as G, snapshotComputedStyle as U, getStyleKey as A, splitBackgroundImage as J } from "../utils/css.js";
3
- import { extractURL as Q, safeEncodeURI as Y } from "../utils/helpers.js";
4
- import { inlineSingleBackgroundEntry as Z } from "../utils/image.js";
5
- import { buildCounterContext as tt, hasCounters as nt, resolveCountersInContent as et } from "./counter.js";
6
- import { iconToImage as ot } from "./fonts.js";
7
- import { isIconFont as st } from "./iconFonts.js";
8
- import { snapFetch as rt } from "./snapFetch.js";
9
- let C = null;
10
- const x = /* @__PURE__ */ new WeakMap();
11
- function it(n) {
1
+ /* 2025-11-03 10:27:31 */
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
12
  return (n || "").replace(/"([^"]*)"/g, "$1");
13
13
  }
14
- function at(n) {
14
+ function dt(n) {
15
15
  if (!n) return "";
16
- const o = [], p = /"([^"]*)"/g;
16
+ const r = [], a = /"([^"]*)"/g;
17
17
  let c;
18
- for (; c = p.exec(n); ) o.push(c[1]);
19
- return o.length ? o.join("") : it(n);
18
+ for (; c = a.exec(n); ) r.push(c[1]);
19
+ return r.length ? r.join("") : lt(n);
20
20
  }
21
- function I(n, o) {
22
- const p = n.parentElement, c = p ? x.get(p) : null;
21
+ function v(n, r) {
22
+ const a = n.parentElement, c = a ? k.get(a) : null;
23
23
  return c ? {
24
- get(l, g) {
25
- const e = o.get(l, g), t = c.get(g);
26
- return typeof t == "number" ? Math.max(e, t) : e;
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;
27
27
  },
28
- getStack(l, g) {
29
- const e = o.getStack(l, g);
30
- if (!e.length) return e;
31
- const t = c.get(g);
32
- if (typeof t == "number") {
33
- const r = e.slice();
34
- return r[r.length - 1] = Math.max(r[r.length - 1], t), r;
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;
35
35
  }
36
- return e;
36
+ return d;
37
37
  }
38
- } : o;
38
+ } : r;
39
39
  }
40
- function N(n, o, p) {
40
+ function F(n, r, a) {
41
41
  const c = /* @__PURE__ */ new Map();
42
- function l(r) {
43
- const s = [];
44
- if (!r || r === "none") return s;
45
- for (const i of String(r).split(",")) {
46
- const u = i.trim().split(/\s+/), m = u[0], b = Number.isFinite(Number(u[1])) ? Number(u[1]) : void 0;
47
- m && s.push({ name: m, num: b });
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 });
48
48
  }
49
- return s;
49
+ return t;
50
50
  }
51
- const g = l(o?.counterReset), e = l(o?.counterIncrement);
52
- function t(r) {
53
- if (c.has(r)) return c.get(r).slice();
54
- let s = p.getStack(n, r);
55
- s = s.length ? s.slice() : [];
56
- const i = g.find((m) => m.name === r);
57
- if (i) {
58
- const m = Number.isFinite(i.num) ? i.num : 0;
59
- s = s.length ? [...s, m] : [m];
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];
60
60
  }
61
- const u = e.find((m) => m.name === r);
62
- if (u) {
63
- const m = Number.isFinite(u.num) ? u.num : 1;
64
- s.length === 0 && (s = [0]), s[s.length - 1] += m;
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;
65
65
  }
66
- return c.set(r, s.slice()), s;
66
+ return c.set(e, t.slice()), t;
67
67
  }
68
68
  return {
69
- get(r, s) {
70
- const i = t(s);
71
- return i.length ? i[i.length - 1] : 0;
69
+ get(e, t) {
70
+ const h = g(t);
71
+ return h.length ? h[h.length - 1] : 0;
72
72
  },
73
- getStack(r, s) {
74
- return t(s);
73
+ getStack(e, t) {
74
+ return g(t);
75
75
  },
76
76
  /** expone increments del pseudo para que el caller pueda propagar a hermanos */
77
- __incs: e
77
+ __incs: d
78
78
  };
79
79
  }
80
- function ct(n, o, p) {
80
+ function ut(n, r, a) {
81
81
  let c;
82
82
  try {
83
- c = getComputedStyle(n, o);
83
+ c = getComputedStyle(n, r);
84
84
  } catch {
85
85
  }
86
86
  const l = c?.content;
87
87
  if (!l || l === "none" || l === "normal") return { text: "", incs: [] };
88
- const g = I(n, p), e = N(n, c, g);
89
- let t = nt(l) ? et(l, n, e) : l;
90
- return { text: at(t), incs: e.__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 || [] };
91
91
  }
92
- async function lt(n, o, p, c) {
93
- if (!(n instanceof Element) || !(o instanceof Element)) return;
94
- if (!C)
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)
95
96
  try {
96
- C = tt(n.ownerDocument || document);
97
+ a.__counterCtx = Q(
98
+ n.ownerDocument || document
99
+ );
97
100
  } catch {
98
101
  }
102
+ const f = a.__counterCtx;
99
103
  for (const e of ["::before", "::after", "::first-letter"])
100
104
  try {
101
- const t = G(n, e);
105
+ const t = ot(n, e);
102
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;
103
107
  if (e === "::first-letter") {
104
- const a = getComputedStyle(n);
105
- if (!(t.color !== a.color || t.fontSize !== a.fontSize || t.fontWeight !== a.fontWeight)) continue;
106
- const h = Array.from(o.childNodes).find(
107
- (T) => T.nodeType === Node.TEXT_NODE && T.textContent?.trim().length > 0
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
108
112
  );
109
- if (!h) continue;
110
- const y = h.textContent, k = y.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], H = y.slice(k?.length || 0);
111
- if (!k || /[\uD800-\uDFFF]/.test(k)) continue;
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;
112
116
  const w = document.createElement("span");
113
- w.textContent = k, w.dataset.snapdomPseudo = "::first-letter";
114
- const K = U(t), X = A(K, "span");
115
- p.styleMap.set(w, X);
116
- const R = document.createTextNode(H);
117
- o.replaceChild(R, h), o.insertBefore(w, R);
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, $);
118
122
  continue;
119
123
  }
120
- const s = t.content, { text: i, incs: u } = ct(
124
+ const b = t.content, { text: s, incs: y } = ut(
121
125
  n,
122
126
  e,
123
- C
124
- ), m = t.backgroundImage, b = t.backgroundColor, P = t.fontFamily, S = parseInt(t.fontSize) || 32, L = parseInt(t.fontWeight) || !1, j = t.color || "#000", W = t.borderStyle, z = parseFloat(t.borderWidth), M = t.transform, B = st(P), _ = s !== "none" && i !== "", F = m && m !== "none", v = b && b !== "transparent" && b !== "rgba(0, 0, 0, 0)", D = W && W !== "none" && z > 0, $ = M && M !== "none";
125
- if (!(_ || F || v || D || $)) {
126
- if (u && u.length && n.parentElement) {
127
- const a = x.get(n.parentElement) || /* @__PURE__ */ new Map();
128
- for (const { name: f } of u) {
129
- if (!f) continue;
130
- const h = I(n, C), E = N(
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(
131
135
  n,
132
136
  getComputedStyle(n, e),
133
- h
134
- ).get(n, f);
135
- a.set(f, E);
137
+ m
138
+ ).get(n, u);
139
+ i.set(u, S);
136
140
  }
137
- x.set(n.parentElement, a);
141
+ k.set(n.parentElement, i);
138
142
  }
139
143
  continue;
140
144
  }
141
- const d = document.createElement("span");
142
- d.dataset.snapdomPseudo = e, d.style.verticalAlign = "middle", d.style.pointerEvents = "none";
143
- const V = U(t), O = A(V, "span");
144
- if (p.styleMap.set(d, O), B && i && i.length === 1) {
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) {
145
149
  const {
146
- dataUrl: a,
147
- width: f,
148
- height: h
149
- } = await ot(
150
- i,
151
- P,
152
- L,
153
- S,
154
- j
155
- ), y = document.createElement("img");
156
- y.src = a, y.style = `height:${S}px;width:${f / h * S}px;object-fit:contain;`, d.appendChild(y), o.dataset.snapdomHasIcon = "true";
157
- } else if (i && i.startsWith("url(")) {
158
- const a = Q(i);
159
- if (a?.trim())
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())
160
164
  try {
161
- const f = document.createElement("img"), h = await rt(Y(a), {
165
+ const u = document.createElement("img"), m = await ct(it(i), {
162
166
  as: "dataURL",
163
167
  useProxy: c.useProxy
164
168
  });
165
- f.src = h.data, f.style = `width:${S}px;height:auto;object-fit:contain;`, d.appendChild(f);
166
- } catch (f) {
167
- console.error(`[snapdom] Error in pseudo ${e} for`, n, f);
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);
168
172
  }
169
- } else !B && _ && (d.textContent = i);
170
- if (d.style.background = "none", "mask" in d.style && (d.style.mask = "none"), F)
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");
175
+ 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;
177
+ } catch {
178
+ }
179
+ if (P)
171
180
  try {
172
- const a = J(m), f = await Promise.all(
173
- a.map(Z)
181
+ const i = rt(_), u = await Promise.all(
182
+ i.map(at)
174
183
  );
175
- d.style.backgroundImage = f.join(", ");
176
- } catch (a) {
184
+ o.style.backgroundImage = u.join(", ");
185
+ } catch (i) {
177
186
  console.warn(
178
187
  `[snapdom] Failed to inline background-image for ${e}`,
179
- a
188
+ i
180
189
  );
181
190
  }
182
- v && (d.style.backgroundColor = b);
183
- const q = d.childNodes.length > 0 || d.textContent?.trim() !== "" || F || v || D || $;
184
- if (u && u.length && n.parentElement) {
185
- const a = x.get(n.parentElement) || /* @__PURE__ */ new Map(), f = I(n, C), h = N(
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(
186
195
  n,
187
196
  getComputedStyle(n, e),
188
- f
197
+ u
189
198
  );
190
- for (const { name: y } of u) {
191
- if (!y) continue;
192
- const E = h.get(n, y);
193
- a.set(y, E);
199
+ for (const { name: p } of y) {
200
+ if (!p) continue;
201
+ const S = m.get(n, p);
202
+ i.set(p, S);
194
203
  }
195
- x.set(n.parentElement, a);
204
+ k.set(n.parentElement, i);
196
205
  }
197
206
  if (!q) continue;
198
- e === "::before" ? o.insertBefore(d, o.firstChild) : o.appendChild(d);
207
+ e === "::before" ? r.insertBefore(o, r.firstChild) : r.appendChild(o);
199
208
  } catch (t) {
200
209
  console.warn(`[snapdom] Failed to capture ${e} for`, n, t);
201
210
  }
202
- const l = Array.from(n.children), g = Array.from(o.children).filter(
211
+ const d = Array.from(n.children), g = Array.from(r.children).filter(
203
212
  (e) => !e.dataset.snapdomPseudo
204
213
  );
205
- for (let e = 0; e < Math.min(l.length, g.length); e++)
206
- await lt(
207
- l[e],
214
+ for (let e = 0; e < Math.min(d.length, g.length); e++)
215
+ await ft(
216
+ d[e],
208
217
  g[e],
209
- p,
218
+ a,
210
219
  c
211
220
  );
212
221
  }
213
222
  export {
214
- lt as inlinePseudoElements
223
+ ft as inlinePseudoElements
215
224
  };
@@ -1,4 +1,4 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
2
2
  import { toCanvas as d } from "../exporters/toCanvas.js";
3
3
  import { createBackground as n } from "../utils/image.js";
4
4
  async function m(c, a) {
@@ -1,4 +1,4 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
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();
@@ -1,4 +1,4 @@
1
- /* 2025-10-28 09:57:10 */
1
+ /* 2025-11-03 10:27:31 */
2
2
  import { cache as s } from "../core/cache.js";
3
3
  import { NO_DEFAULTS_TAGS as v, getStyleKey as E } from "../utils/css.js";
4
4
  const m = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new Map();