@unicom-cloud/utils 0.1.31 → 0.1.33

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 (369) 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 +5 -5
  33. package/date.js +5 -5
  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/getElementCoordinates.js +46 -0
  57. package/dom-helpers/getScrollAccessor.js +1 -1
  58. package/dom-helpers/hasClass.js +1 -1
  59. package/dom-helpers/height.js +1 -1
  60. package/dom-helpers/hyphenate.js +1 -1
  61. package/dom-helpers/hyphenateStyle.js +1 -1
  62. package/dom-helpers/index.js +87 -84
  63. package/dom-helpers/insertAfter.js +1 -1
  64. package/dom-helpers/isDocument.js +1 -1
  65. package/dom-helpers/isInput.js +1 -1
  66. package/dom-helpers/isTransform.js +1 -1
  67. package/dom-helpers/isVisible.js +1 -1
  68. package/dom-helpers/isWindow.js +1 -1
  69. package/dom-helpers/listen.js +1 -1
  70. package/dom-helpers/matches.js +1 -1
  71. package/dom-helpers/nextUntil.js +1 -1
  72. package/dom-helpers/offset.js +1 -1
  73. package/dom-helpers/offsetParent.js +1 -1
  74. package/dom-helpers/ownerDocument.js +1 -1
  75. package/dom-helpers/ownerWindow.js +1 -1
  76. package/dom-helpers/parents.js +1 -1
  77. package/dom-helpers/position.js +1 -1
  78. package/dom-helpers/prepend.js +1 -1
  79. package/dom-helpers/querySelectorAll.js +1 -1
  80. package/dom-helpers/reflow.js +1 -1
  81. package/dom-helpers/remove.js +1 -1
  82. package/dom-helpers/removeClass.js +1 -1
  83. package/dom-helpers/removeEventListener.js +1 -1
  84. package/dom-helpers/scrollLeft.js +1 -1
  85. package/dom-helpers/scrollParent.js +1 -1
  86. package/dom-helpers/scrollTo.js +1 -1
  87. package/dom-helpers/scrollTop.js +1 -1
  88. package/dom-helpers/scrollbarSize.js +1 -1
  89. package/dom-helpers/siblings.js +1 -1
  90. package/dom-helpers/text.js +1 -1
  91. package/dom-helpers/toggleClass.js +1 -1
  92. package/dom-helpers/transitionEnd.js +2 -2
  93. package/dom-helpers/triggerEvent.js +1 -1
  94. package/dom-helpers/types.js +1 -1
  95. package/dom-helpers/width.js +1 -1
  96. package/domHelpers.js +65 -63
  97. package/emitter/index.js +1 -1
  98. package/emitter/src/index.js +1 -1
  99. package/emitter.js +1 -1
  100. package/escape/index.js +11 -0
  101. package/escape.js +6 -0
  102. package/file/fileToURL.js +1 -1
  103. package/file/index.js +1 -1
  104. package/file/saveAs.js +1 -1
  105. package/file.js +1 -1
  106. package/idb/index.js +1 -1
  107. package/idb.js +1 -1
  108. package/index.js +1 -1
  109. package/invariant/index.js +1 -1
  110. package/invariant.js +1 -1
  111. package/is/index.js +196 -141
  112. package/is/lib/isAscii.js +9 -0
  113. package/is/lib/isBase64.js +13 -0
  114. package/is/lib/isChinese.js +19 -0
  115. package/is/lib/isDataURI.js +25 -0
  116. package/is/lib/isEmail.js +72 -0
  117. package/is/lib/isFQDN.js +21 -0
  118. package/is/lib/isFullWidth.js +10 -0
  119. package/is/lib/isHSL.js +11 -0
  120. package/is/lib/isHalfWidth.js +10 -0
  121. package/is/lib/isHash.js +23 -0
  122. package/is/lib/isHexColor.js +12 -0
  123. package/is/lib/isIMEI.js +19 -0
  124. package/is/lib/isIP.js +21 -0
  125. package/is/lib/isIPRange.js +25 -0
  126. package/is/lib/isIdentityCard.js +190 -0
  127. package/is/lib/isJWT.js +14 -0
  128. package/is/lib/isMACAddress.js +9 -0
  129. package/is/lib/isMD5.js +9 -0
  130. package/is/lib/isMimeType.js +9 -0
  131. package/is/lib/isMobilePhone.js +192 -0
  132. package/is/lib/isPort.js +7 -0
  133. package/is/lib/isRgbColor.js +18 -0
  134. package/is/lib/isSemVer.js +20 -0
  135. package/is/lib/isSlug.js +9 -0
  136. package/is/lib/isStrongPassword.js +48 -0
  137. package/is/lib/isURL.js +78 -0
  138. package/is/lib/isUUID.js +24 -0
  139. package/is/lib/isVariableWidth.js +10 -0
  140. package/is/lib/util/assertString.js +12 -0
  141. package/is.js +122 -66
  142. package/lunar/index.js +1 -1
  143. package/lunar/lib/Holiday.js +1 -1
  144. package/lunar/lib/HolidayUtil.js +1 -1
  145. package/lunar/lib/I18n.js +1 -1
  146. package/lunar/lib/JieQi.js +1 -1
  147. package/lunar/lib/Lunar.js +1 -1
  148. package/lunar/lib/LunarMonth.js +1 -1
  149. package/lunar/lib/LunarTime.js +1 -1
  150. package/lunar/lib/LunarUtil.js +1 -1
  151. package/lunar/lib/LunarYear.js +1 -1
  152. package/lunar/lib/ShouXingUtil.js +1 -1
  153. package/lunar/lib/Solar.js +1 -1
  154. package/lunar/lib/SolarHalfYear.js +1 -1
  155. package/lunar/lib/SolarMonth.js +1 -1
  156. package/lunar/lib/SolarSeason.js +1 -1
  157. package/lunar/lib/SolarUtil.js +1 -1
  158. package/lunar/lib/SolarWeek.js +1 -1
  159. package/lunar/lib/SolarYear.js +1 -1
  160. package/lunar/lib/index.js +1 -1
  161. package/lunar.js +1 -1
  162. package/math/index.js +1 -1
  163. package/math.js +1 -1
  164. package/md5/index.js +1 -1
  165. package/md5.js +1 -1
  166. package/mock/MockWebSocket.js +1 -1
  167. package/mock/MockXMLHttpRequest.js +1 -1
  168. package/mock/index.js +1 -1
  169. package/mock.js +1 -1
  170. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  171. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  172. package/normalize-wheel/index.js +1 -1
  173. package/normalize-wheel/isEventSupported.js +1 -1
  174. package/normalizeWheel.js +1 -1
  175. package/number-to-chinese/index.js +1 -1
  176. package/numberToChinese.js +1 -1
  177. package/nzh/cn.js +1 -1
  178. package/nzh/hk.js +1 -1
  179. package/nzh/index.js +1 -1
  180. package/nzh/nzh.js +1 -1
  181. package/nzh/src/autoGet.js +1 -1
  182. package/nzh/src/index.js +1 -1
  183. package/nzh/src/langs/cn_b.js +1 -1
  184. package/nzh/src/langs/cn_s.js +1 -1
  185. package/nzh/src/langs/hk_b.js +1 -1
  186. package/nzh/src/langs/hk_s.js +1 -1
  187. package/nzh/src/utils.js +1 -1
  188. package/nzh.js +1 -1
  189. package/object-keys-sort/index.js +1 -1
  190. package/object-prototype-to-string-call/index.js +2 -2
  191. package/objectKeysSort.js +1 -1
  192. package/objectPrototypeToStringCall.js +1 -1
  193. package/package.json +1 -1
  194. package/pinyin/index.js +1 -1
  195. package/pinyin/simplified.js +1 -1
  196. package/pinyin/src/core.js +1 -1
  197. package/pinyin/src/simplified.js +6 -6
  198. package/pinyin/src/simplified_dict.js +5 -4
  199. package/pinyin/src/traditional.js +4 -4
  200. package/pinyin/src/traditional_dict.js +4 -3
  201. package/pinyin/traditional.js +1 -1
  202. package/pinyin.js +1 -1
  203. package/query-string/base.js +1 -1
  204. package/query-string/index.js +1 -1
  205. package/query-string/splitOnFirst.js +1 -1
  206. package/queryString.js +1 -1
  207. package/random/address.js +1 -1
  208. package/random/constellation.js +1 -1
  209. package/random/image.js +1 -1
  210. package/random/index.js +1 -1
  211. package/random/licensePlate.js +1 -1
  212. package/random/name.js +1 -1
  213. package/random/number.js +1 -1
  214. package/random/text.js +1 -1
  215. package/random/time.js +1 -1
  216. package/random/web.js +1 -1
  217. package/random.js +1 -1
  218. package/screenfull/index.js +1 -1
  219. package/screenfull.js +1 -1
  220. package/sleep/index.js +1 -1
  221. package/sleep.js +1 -1
  222. package/snapdom/index.js +1 -1
  223. package/snapdom/src/api/preCache.js +1 -1
  224. package/snapdom/src/api/snapdom.js +198 -153
  225. package/snapdom/src/core/cache.js +1 -1
  226. package/snapdom/src/core/capture.js +121 -326
  227. package/snapdom/src/core/clone.js +117 -266
  228. package/snapdom/src/core/context.js +1 -1
  229. package/snapdom/src/core/plugins.js +1 -1
  230. package/snapdom/src/core/prepare.js +48 -157
  231. package/snapdom/src/exporters/download.js +15 -11
  232. package/snapdom/src/exporters/toBlob.js +10 -15
  233. package/snapdom/src/exporters/toCanvas.js +72 -65
  234. package/snapdom/src/exporters/toImg.js +1 -1
  235. package/snapdom/src/modules/CSSVar.js +1 -1
  236. package/snapdom/src/modules/background.js +1 -1
  237. package/snapdom/src/modules/changeCSS.js +1 -1
  238. package/snapdom/src/modules/counter.js +1 -1
  239. package/snapdom/src/modules/fonts.js +118 -112
  240. package/snapdom/src/modules/iconFonts.js +133 -69
  241. package/snapdom/src/modules/images.js +36 -33
  242. package/snapdom/src/modules/lineClamp.js +1 -1
  243. package/snapdom/src/modules/pseudo.js +275 -161
  244. package/snapdom/src/modules/rasterize.js +6 -7
  245. package/snapdom/src/modules/snapFetch.js +1 -1
  246. package/snapdom/src/modules/styles.js +89 -67
  247. package/snapdom/src/modules/svgDefs.js +73 -60
  248. package/snapdom/src/utils/browser.js +13 -8
  249. package/snapdom/src/utils/capture.helpers.js +131 -0
  250. package/snapdom/src/utils/clone.helpers.js +283 -0
  251. package/snapdom/src/utils/css.js +1 -1
  252. package/snapdom/src/utils/helpers.js +1 -1
  253. package/snapdom/src/utils/image.js +15 -24
  254. package/snapdom/src/utils/prepare.helpers.js +8 -0
  255. package/snapdom/src/utils/transforms.helpers.js +211 -0
  256. package/snapdom.js +1 -1
  257. package/string/index.js +1 -1
  258. package/string.js +1 -1
  259. package/tinycolor/index.js +1 -1
  260. package/tinycolor/src/conversion.js +1 -1
  261. package/tinycolor/src/css-color-names.js +1 -1
  262. package/tinycolor/src/format-input.js +1 -1
  263. package/tinycolor/src/from-ratio.js +12 -11
  264. package/tinycolor/src/index.js +1 -1
  265. package/tinycolor/src/random.js +30 -29
  266. package/tinycolor/src/readability.js +1 -1
  267. package/tinycolor/src/to-ms-filter.js +1 -1
  268. package/tinycolor/src/utils.js +1 -1
  269. package/tinycolor.js +1 -1
  270. package/tree/index.js +54 -75
  271. package/tree/search/index.js +1 -1
  272. package/tree.js +9 -11
  273. package/tween/index.js +1 -1
  274. package/tween/src/easing.js +1 -1
  275. package/tween/src/tween.js +15 -14
  276. package/tween.js +1 -1
  277. package/types/constant/isMobile.d.ts +3 -0
  278. package/types/date/index.d.ts +3 -3
  279. package/types/dom-helpers/getElementCoordinates.d.ts +40 -0
  280. package/types/dom-helpers/index.d.ts +3 -1
  281. package/types/escape/index.d.ts +2 -0
  282. package/types/is/index.d.ts +28 -1
  283. package/types/is/lib/isAscii.d.ts +1 -0
  284. package/types/is/lib/isBase64.d.ts +1 -0
  285. package/types/is/lib/isChinese.d.ts +4 -0
  286. package/types/is/lib/isDataURI.d.ts +1 -0
  287. package/types/is/lib/isEmail.d.ts +1 -0
  288. package/types/is/lib/isFQDN.d.ts +1 -0
  289. package/types/is/lib/isFullWidth.d.ts +2 -0
  290. package/types/is/lib/isHSL.d.ts +1 -0
  291. package/types/is/lib/isHalfWidth.d.ts +2 -0
  292. package/types/is/lib/isHash.d.ts +1 -0
  293. package/types/is/lib/isHexColor.d.ts +1 -0
  294. package/types/is/lib/isIMEI.d.ts +1 -0
  295. package/types/is/lib/isIP.d.ts +1 -0
  296. package/types/is/lib/isIPRange.d.ts +1 -0
  297. package/types/is/lib/isIdentityCard.d.ts +1 -0
  298. package/types/is/lib/isJWT.d.ts +1 -0
  299. package/types/is/lib/isMACAddress.d.ts +1 -0
  300. package/types/is/lib/isMD5.d.ts +1 -0
  301. package/types/is/lib/isMimeType.d.ts +1 -0
  302. package/types/is/lib/isMobilePhone.d.ts +2 -0
  303. package/types/is/lib/isOctal.d.ts +1 -0
  304. package/types/is/lib/isPort.d.ts +1 -0
  305. package/types/is/lib/isRgbColor.d.ts +1 -0
  306. package/types/is/lib/isSemVer.d.ts +1 -0
  307. package/types/is/lib/isSlug.d.ts +1 -0
  308. package/types/is/lib/isStrongPassword.d.ts +1 -0
  309. package/types/is/lib/isURL.d.ts +1 -0
  310. package/types/is/lib/isUUID.d.ts +1 -0
  311. package/types/is/lib/isVariableWidth.d.ts +1 -0
  312. package/types/is/lib/util/assertString.d.ts +1 -0
  313. package/types/pinyin/es/main.d.ts +4 -0
  314. package/types/pinyin/es/traditional.d.ts +4 -0
  315. package/types/snapdom/src/api/snapdom.d.ts +11 -79
  316. package/types/snapdom/src/exporters/toCanvas.d.ts +11 -3
  317. package/types/snapdom/src/exporters/toJpg.d.ts +1 -0
  318. package/types/snapdom/src/exporters/toPng.d.ts +6 -0
  319. package/types/snapdom/src/exporters/toSvg.d.ts +1 -0
  320. package/types/snapdom/src/exporters/toWebp.d.ts +1 -0
  321. package/types/snapdom/src/modules/iconFonts.d.ts +7 -20
  322. package/types/snapdom/src/modules/pseudo.d.ts +18 -0
  323. package/types/snapdom/src/modules/rasterize.d.ts +6 -10
  324. package/types/snapdom/src/utils/browser.d.ts +0 -3
  325. package/types/snapdom/src/utils/capture.helpers.d.ts +45 -0
  326. package/types/snapdom/src/utils/clone.helpers.d.ts +97 -0
  327. package/types/snapdom/src/utils/image.d.ts +0 -8
  328. package/types/snapdom/src/utils/index.d.ts +1 -1
  329. package/types/snapdom/src/utils/prepare.helpers.d.ts +9 -0
  330. package/types/snapdom/src/utils/transforms.helpers.d.ts +118 -0
  331. package/types/tree/index.d.ts +3 -4
  332. package/types/validate/src/index.d.ts +23 -25
  333. package/types/validate/src/interface.d.ts +5 -3
  334. package/types/validate/src/locale/en-US.d.ts +12 -2
  335. package/types/validate/src/locale/index.d.ts +171 -0
  336. package/types/validate/src/locale/zh-CN.d.ts +12 -2
  337. package/types/validate/src/rules/base.d.ts +3 -1
  338. package/types/validate/src/rules/custom.d.ts +1 -1
  339. package/types/validate/src/rules/type.d.ts +10 -0
  340. package/ui-color/compareColorByRange.js +1 -1
  341. package/ui-color/index.js +8 -7
  342. package/uiColor.js +25 -24
  343. package/url-toolkit/index.js +1 -1
  344. package/url-toolkit/src/url-toolkit.js +1 -1
  345. package/urlToolkit.js +1 -1
  346. package/validate/index.js +23 -25
  347. package/validate/src/index.js +116 -73
  348. package/validate/src/locale/en-US.js +12 -2
  349. package/validate/src/locale/index.js +11 -0
  350. package/validate/src/locale/zh-CN.js +12 -2
  351. package/validate/src/rules/array.js +2 -2
  352. package/validate/src/rules/base.js +35 -31
  353. package/validate/src/rules/boolean.js +1 -1
  354. package/validate/src/rules/custom.js +2 -2
  355. package/validate/src/rules/number.js +1 -1
  356. package/validate/src/rules/object.js +1 -1
  357. package/validate/src/rules/string.js +6 -5
  358. package/validate/src/rules/type.js +84 -14
  359. package/validate.js +23 -25
  360. package/version/index.js +1 -1
  361. package/version.js +1 -1
  362. package/xlsx/index.d.ts +4 -8
  363. package/xlsx/index.js +1 -1
  364. package/xlsx/xlsx.js +2 -2
  365. package/xlsx.js +1 -1
  366. package/types/validate/src/message.d.ts +0 -2
  367. package/types/validate/src/utils.d.ts +0 -3
  368. package/validate/src/message.js +0 -5
  369. package/validate/src/utils.js +0 -8
@@ -1,186 +1,77 @@
1
- /* 2025-11-19 10:03:21 */
2
- import { cache as h } from "./cache.js";
3
- import { freezeSticky as b } from "../modules/changeCSS.js";
4
- import { inlinePseudoElements as w } from "../modules/pseudo.js";
5
- import { snapFetch as A } from "../modules/snapFetch.js";
1
+ /* 2025-12-17 18:26:57 */
2
+ import { cache as c } from "./cache.js";
3
+ import { freezeSticky as h } from "../modules/changeCSS.js";
4
+ import { inlinePseudoElements as g } from "../modules/pseudo.js";
6
5
  import { inlineExternalDefsAndSymbols as C } from "../modules/svgDefs.js";
7
- import { generateCSSClasses as E } from "../utils/css.js";
8
- import { stripTranslate as M } from "../utils/helpers.js";
9
- import { deepClone as N } from "./clone.js";
10
- async function H(t, r = {}) {
11
- const o = {
12
- styleMap: h.session.styleMap,
13
- styleCache: h.session.styleCache,
14
- nodeMap: h.session.nodeMap
6
+ import { resolveBlobUrlsInTree as u } from "../utils/clone.helpers.js";
7
+ import { generateCSSClasses as w } from "../utils/css.js";
8
+ import { stripTranslate as S } from "../utils/helpers.js";
9
+ import { stabilizeLayout as E } from "../utils/prepare.helpers.js";
10
+ import { deepClone as M } from "./clone.js";
11
+ async function R(s, d = {}) {
12
+ const n = {
13
+ styleMap: c.session.styleMap,
14
+ styleCache: c.session.styleCache,
15
+ nodeMap: c.session.nodeMap
15
16
  };
16
- let s, c = "", y = "";
17
- q(t);
17
+ let t, i = "", y = "";
18
+ E(s);
18
19
  try {
19
- C(t);
20
+ C(s);
20
21
  } catch (e) {
21
22
  console.warn("inlineExternal defs or symbol failed:", e);
22
23
  }
23
24
  try {
24
- s = await N(t, o, r, t);
25
+ t = await M(s, n, d, s);
25
26
  } catch (e) {
26
27
  throw console.warn("deepClone failed:", e), e;
27
28
  }
28
29
  try {
29
- await w(t, s, o, r);
30
+ await g(s, t, n, d);
30
31
  } catch (e) {
31
32
  console.warn("inlinePseudoElements failed:", e);
32
33
  }
33
- await k(s);
34
+ await u(t);
34
35
  try {
35
- const e = s.querySelectorAll("style[data-sd]");
36
- for (const l of e)
37
- y += l.textContent || "", l.remove();
36
+ const e = t.querySelectorAll("style[data-sd]");
37
+ for (const o of e)
38
+ y += o.textContent || "", o.remove();
38
39
  } catch {
39
40
  }
40
- const n = E(o.styleMap);
41
- c = Array.from(n.entries()).map(([e, l]) => `.${l}{${e}}`).join(""), c = y + c;
42
- for (const [e, l] of o.styleMap.entries()) {
41
+ const f = w(n.styleMap);
42
+ i = Array.from(f.entries()).map(([e, o]) => `.${o}{${e}}`).join(""), i = y + i;
43
+ for (const [e, o] of n.styleMap.entries()) {
43
44
  if (e.tagName === "STYLE") continue;
44
45
  if (e.getRootNode && e.getRootNode() instanceof ShadowRoot) {
45
- e.setAttribute("style", l.replace(/;/g, "; "));
46
+ e.setAttribute("style", o.replace(/;/g, "; "));
46
47
  continue;
47
48
  }
48
- const i = n.get(l);
49
- i && e.classList.add(i);
50
- const f = e.style?.backgroundImage, d = e.dataset?.snapdomHasIcon;
51
- f && f !== "none" && (e.style.backgroundImage = f), d && (e.style.verticalAlign = "middle", e.style.display = "inline");
49
+ const r = f.get(o);
50
+ r && e.classList.add(r);
51
+ const l = e.style?.backgroundImage, m = e.dataset?.snapdomHasIcon;
52
+ l && l !== "none" && (e.style.backgroundImage = l), m && (e.style.verticalAlign = "middle", e.style.display = "inline");
52
53
  }
53
- for (const [e, l] of o.nodeMap.entries()) {
54
- const i = l.scrollLeft, f = l.scrollTop;
55
- if ((i || f) && e instanceof HTMLElement) {
54
+ for (const [e, o] of n.nodeMap.entries()) {
55
+ const r = o.scrollLeft, l = o.scrollTop;
56
+ if ((r || l) && e instanceof HTMLElement) {
56
57
  e.style.overflow = "hidden", e.style.scrollbarWidth = "none", e.style.msOverflowStyle = "none";
57
- const u = document.createElement("div");
58
- for (u.style.transform = `translate(${-i}px, ${-f}px)`, u.style.willChange = "transform", u.style.display = "inline-block", u.style.width = "100%"; e.firstChild; )
59
- u.appendChild(e.firstChild);
60
- e.appendChild(u);
58
+ const a = document.createElement("div");
59
+ for (a.style.transform = `translate(${-r}px, ${-l}px)`, a.style.willChange = "transform", a.style.display = "inline-block", a.style.width = "100%"; e.firstChild; )
60
+ a.appendChild(e.firstChild);
61
+ e.appendChild(a);
61
62
  }
62
63
  }
63
- const a = s instanceof HTMLElement && s.firstElementChild instanceof HTMLElement ? s.firstElementChild : s;
64
- if (b(t, a), t === o.nodeMap.get(s)) {
65
- const e = o.styleCache.get(t) || window.getComputedStyle(t);
66
- o.styleCache.set(t, e);
67
- const l = M(e.transform);
68
- s.style.margin = "0", s.style.top = "auto", s.style.left = "auto", s.style.right = "auto", s.style.bottom = "auto", s.style.animation = "none", s.style.transition = "none", s.style.willChange = "auto", s.style.float = "none", s.style.clear = "none", s.style.transform = l || "";
69
- }
70
- for (const [e, l] of o.nodeMap.entries())
71
- l.tagName === "PRE" && (e.style.marginTop = "0", e.style.marginBlockStart = "0");
72
- return { clone: s, classCSS: c, styleCache: o.styleCache };
73
- }
74
- function q(t) {
75
- const r = getComputedStyle(t), o = r.outlineStyle, s = r.outlineWidth, c = r.borderStyle, y = r.borderWidth, n = o !== "none" && parseFloat(s) > 0, a = c === "none" || parseFloat(y) === 0;
76
- n && a && (t.style.border = `${s} solid transparent`);
77
- }
78
- var p = /* @__PURE__ */ new Map();
79
- async function m(t) {
80
- if (h.resource?.has(t)) return h.resource.get(t);
81
- if (p.has(t)) return p.get(t);
82
- const r = (async () => {
83
- const o = await A(t, { as: "dataURL", silent: !0 });
84
- if (!o.ok || typeof o.data != "string")
85
- throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);
86
- return h.resource?.set(t, o.data), o.data;
87
- })();
88
- p.set(t, r);
89
- try {
90
- const o = await r;
91
- return p.set(t, o), o;
92
- } catch (o) {
93
- throw p.delete(t), o;
94
- }
95
- }
96
- var L = /\bblob:[^)"'\s]+/g;
97
- async function S(t) {
98
- if (!t || t.indexOf("blob:") === -1) return t;
99
- const r = Array.from(new Set(t.match(L) || []));
100
- if (r.length === 0) return t;
101
- let o = t;
102
- for (const s of r)
103
- try {
104
- const c = await m(s);
105
- o = o.split(s).join(c);
106
- } catch {
107
- }
108
- return o;
109
- }
110
- function g(t) {
111
- return typeof t == "string" && t.startsWith("blob:");
112
- }
113
- function v(t) {
114
- return (t || "").split(",").map((r) => r.trim()).filter(Boolean).map((r) => {
115
- const o = r.match(/^(\S+)(\s+.+)?$/);
116
- return o ? { url: o[1], desc: o[2] || "" } : null;
117
- }).filter(Boolean);
118
- }
119
- function $(t) {
120
- return t.map((r) => r.desc ? `${r.url} ${r.desc.trim()}` : r.url).join(", ");
121
- }
122
- async function k(t) {
123
- if (!t) return;
124
- const r = t.querySelectorAll ? t.querySelectorAll("img") : [];
125
- for (const n of r)
126
- try {
127
- const e = n.getAttribute("src") || n.currentSrc || "";
128
- if (g(e)) {
129
- const i = await m(e);
130
- n.setAttribute("src", i);
131
- }
132
- const l = n.getAttribute("srcset");
133
- if (l && l.includes("blob:")) {
134
- const i = v(l);
135
- let f = !1;
136
- for (const d of i)
137
- if (g(d.url))
138
- try {
139
- d.url = await m(d.url), f = !0;
140
- } catch {
141
- }
142
- f && n.setAttribute("srcset", $(i));
143
- }
144
- } catch {
145
- }
146
- const o = t.querySelectorAll ? t.querySelectorAll("image") : [];
147
- for (const n of o)
148
- try {
149
- const a = "http://www.w3.org/1999/xlink", e = n.getAttribute("href") || n.getAttributeNS?.(a, "href");
150
- if (g(e)) {
151
- const l = await m(e);
152
- n.setAttribute("href", l), n.removeAttributeNS?.(a, "href");
153
- }
154
- } catch {
155
- }
156
- const s = t.querySelectorAll ? t.querySelectorAll("[style*='blob:']") : [];
157
- for (const n of s)
158
- try {
159
- const a = n.getAttribute("style");
160
- if (a && a.includes("blob:")) {
161
- const e = await S(a);
162
- n.setAttribute("style", e);
163
- }
164
- } catch {
165
- }
166
- const c = t.querySelectorAll ? t.querySelectorAll("style") : [];
167
- for (const n of c)
168
- try {
169
- const a = n.textContent || "";
170
- a.includes("blob:") && (n.textContent = await S(a));
171
- } catch {
172
- }
173
- const y = ["poster"];
174
- for (const n of y) {
175
- const a = t.querySelectorAll ? t.querySelectorAll(`[${n}^='blob:']`) : [];
176
- for (const e of a)
177
- try {
178
- const l = e.getAttribute(n);
179
- g(l) && e.setAttribute(n, await m(l));
180
- } catch {
181
- }
64
+ const p = t instanceof HTMLElement && t.firstElementChild instanceof HTMLElement ? t.firstElementChild : t;
65
+ if (h(s, p), s === n.nodeMap.get(t)) {
66
+ const e = n.styleCache.get(s) || window.getComputedStyle(s);
67
+ n.styleCache.set(s, e);
68
+ const o = S(e.transform);
69
+ t.style.margin = "0", t.style.top = "auto", t.style.left = "auto", t.style.right = "auto", t.style.bottom = "auto", t.style.animation = "none", t.style.transition = "none", t.style.willChange = "auto", t.style.float = "none", t.style.clear = "none", t.style.transform = o || "";
182
70
  }
71
+ for (const [e, o] of n.nodeMap.entries())
72
+ o.tagName === "PRE" && (e.style.marginTop = "0", e.style.marginBlockStart = "0");
73
+ return { clone: t, classCSS: i, styleCache: n.styleCache };
183
74
  }
184
75
  export {
185
- H as prepareClone
76
+ R as prepareClone
186
77
  };
@@ -1,16 +1,20 @@
1
- /* 2025-11-19 10:03:21 */
2
- import { createBackground as l } from "../utils/image.js";
3
- import { toBlob as d } from "./toBlob.js";
4
- import { toCanvas as f } from "./toCanvas.js";
5
- async function k(t, a) {
6
- if (a.dpr = 1, a.format === "svg") {
7
- const m = await d(t, { ...a, type: "svg" }), o = URL.createObjectURL(m), c = document.createElement("a");
8
- c.href = o, c.download = a.filename, c.click(), URL.revokeObjectURL(o);
1
+ /* 2025-12-17 18:26:57 */
2
+ import { toBlob as f } from "./toBlob.js";
3
+ import { toCanvas as i } from "./toCanvas.js";
4
+ async function b(c, t) {
5
+ const r = (t?.format || t?.type || "").toLowerCase(), e = r === "jpg" ? "jpeg" : r || "png", m = t?.filename || `snapdom.${e}`, a = {
6
+ ...t || {},
7
+ format: e,
8
+ type: e
9
+ };
10
+ if (a.dpr = 1, e === "svg") {
11
+ const d = await f(c, { ...a, type: "svg" }), s = URL.createObjectURL(d), n = document.createElement("a");
12
+ n.href = s, n.download = m, n.click(), URL.revokeObjectURL(s);
9
13
  return;
10
14
  }
11
- const r = await f(t, a), n = a.backgroundColor ? l(r, a.backgroundColor) : r, e = document.createElement("a");
12
- e.href = n.toDataURL(`image/${a.format}`, a.quality), e.download = a.filename, e.click();
15
+ const l = await i(c, a), o = document.createElement("a");
16
+ o.href = l.toDataURL(`image/${e}`, t?.quality), o.download = m, o.click();
13
17
  }
14
18
  export {
15
- k as download
19
+ b as download
16
20
  };
@@ -1,21 +1,16 @@
1
- /* 2025-11-19 10:03:21 */
2
- import { createBackground as m } from "../utils/image.js";
3
- import { toCanvas as s } from "./toCanvas.js";
4
- async function i(a, o) {
5
- const e = o.type;
6
- if (e === "svg") {
7
- const t = decodeURIComponent(a.split(",")[1]);
8
- return new Blob([t], { type: "image/svg+xml" });
1
+ /* 2025-12-17 18:26:57 */
2
+ import { toCanvas as c } from "./toCanvas.js";
3
+ async function m(o, t) {
4
+ const n = t.type;
5
+ if (n === "svg") {
6
+ const e = decodeURIComponent(o.split(",")[1]);
7
+ return new Blob([e], { type: "image/svg+xml" });
9
8
  }
10
- const n = await s(a, o), r = o.backgroundColor ? m(n, o.backgroundColor) : n;
9
+ const a = await c(o, t);
11
10
  return new Promise(
12
- (t) => r.toBlob(
13
- (c) => t(c),
14
- `image/${e}`,
15
- o.quality
16
- )
11
+ (e) => a.toBlob((s) => e(s), `image/${n}`, t.quality)
17
12
  );
18
13
  }
19
14
  export {
20
- i as toBlob
15
+ m as toBlob
21
16
  };
@@ -1,106 +1,113 @@
1
- /* 2025-11-19 10:03:21 */
2
- import { isSafari as b } from "../utils/browser.js";
3
- function y(e) {
4
- return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
5
- }
1
+ /* 2025-12-17 18:26:57 */
2
+ import { isSafari as y } from "../utils/browser.js";
6
3
  function S(e) {
7
- const s = e.indexOf(",");
8
- return s >= 0 ? decodeURIComponent(e.slice(s + 1)) : "";
4
+ return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
9
5
  }
10
6
  function C(e) {
11
- return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
7
+ const n = e.indexOf(",");
8
+ return n >= 0 ? decodeURIComponent(e.slice(n + 1)) : "";
12
9
  }
13
10
  function v(e) {
14
- let s = [], t = "", i = 0;
15
- for (let r = 0; r < e.length; r++) {
16
- const o = e[r];
17
- o === "(" && i++, o === ")" && (i = Math.max(0, i - 1)), o === ";" && i === 0 ? (s.push(t), t = "") : t += o;
18
- }
19
- return t.trim() && s.push(t), s.map((r) => r.trim()).filter(Boolean);
11
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
20
12
  }
21
13
  function D(e) {
22
- const s = [];
14
+ let n = [], t = "", i = 0;
15
+ for (let a = 0; a < e.length; a++) {
16
+ const o = e[a];
17
+ o === "(" && i++, o === ")" && (i = Math.max(0, i - 1)), o === ";" && i === 0 ? (n.push(t), t = "") : t += o;
18
+ }
19
+ return t.trim() && n.push(t), n.map((a) => a.trim()).filter(Boolean);
20
+ }
21
+ function k(e) {
22
+ const n = [];
23
23
  let t = "", i = 0;
24
24
  for (let o = 0; o < e.length; o++) {
25
- const a = e[o];
26
- a === "(" && i++, a === ")" && (i = Math.max(0, i - 1)), a === "," && i === 0 ? (s.push(t.trim()), t = "") : t += a;
25
+ const c = e[o];
26
+ c === "(" && i++, c === ")" && (i = Math.max(0, i - 1)), c === "," && i === 0 ? (n.push(t.trim()), t = "") : t += c;
27
27
  }
28
- t.trim() && s.push(t.trim());
29
- const r = [];
30
- for (const o of s) {
28
+ t.trim() && n.push(t.trim());
29
+ const a = [];
30
+ for (const o of n) {
31
31
  if (/\binset\b/i.test(o)) continue;
32
- const a = o.match(/-?\d+(?:\.\d+)?px/gi) || [], [n = "0px", l = "0px", f = "0px"] = a;
33
- let c = o.replace(/-?\d+(?:\.\d+)?px/gi, "").replace(/\binset\b/gi, "").trim().replace(/\s{2,}/g, " ");
34
- const m = !!c && c !== ",";
35
- r.push(`drop-shadow(${n} ${l} ${f}${m ? ` ${c}` : ""})`);
32
+ const c = o.match(/-?\d+(?:\.\d+)?px/gi) || [], [s = "0px", r = "0px", u = "0px"] = c;
33
+ let l = o.replace(/-?\d+(?:\.\d+)?px/gi, "").replace(/\binset\b/gi, "").trim().replace(/\s{2,}/g, " ");
34
+ const p = !!l && l !== ",";
35
+ a.push(`drop-shadow(${s} ${r} ${u}${p ? ` ${l}` : ""})`);
36
36
  }
37
- return r.join(" ");
37
+ return a.join(" ");
38
38
  }
39
- function $(e) {
40
- const s = v(e);
41
- let t = null, i = null, r = null;
39
+ function b(e) {
40
+ const n = D(e);
41
+ let t = null, i = null, a = null;
42
42
  const o = [];
43
- for (const n of s) {
44
- const l = n.indexOf(":");
45
- if (l < 0) continue;
46
- const f = n.slice(0, l).trim().toLowerCase(), c = n.slice(l + 1).trim();
47
- f === "box-shadow" ? r = c : f === "filter" ? t = c : f === "-webkit-filter" ? i = c : o.push([f, c]);
43
+ for (const s of n) {
44
+ const r = s.indexOf(":");
45
+ if (r < 0) continue;
46
+ const u = s.slice(0, r).trim().toLowerCase(), l = s.slice(r + 1).trim();
47
+ u === "box-shadow" ? a = l : u === "filter" ? t = l : u === "-webkit-filter" ? i = l : o.push([u, l]);
48
48
  }
49
- if (r) {
50
- const n = D(r);
51
- n && (t = t ? `${t} ${n}` : n, i = i ? `${i} ${n}` : n);
49
+ if (a) {
50
+ const s = k(a);
51
+ s && (t = t ? `${t} ${s}` : s, i = i ? `${i} ${s}` : s);
52
52
  }
53
- const a = [...o];
54
- return t && a.push(["filter", t]), i && a.push(["-webkit-filter", i]), a.map(([n, l]) => `${n}:${l}`).join(";");
53
+ const c = [...o];
54
+ return t && c.push(["filter", t]), i && c.push(["-webkit-filter", i]), c.map(([s, r]) => `${s}:${r}`).join(";");
55
55
  }
56
56
  function F(e) {
57
57
  return e.replace(
58
58
  /([^{}]+)\{([^}]*)\}/g,
59
- (s, t, i) => `${t}{${$(i)}}`
59
+ (n, t, i) => `${t}{${b(i)}}`
60
60
  );
61
61
  }
62
62
  function H(e) {
63
63
  return e = e.replace(
64
64
  /<style[^>]*>([\s\S]*?)<\/style>/gi,
65
- (s, t) => s.replace(t, F(t))
65
+ (n, t) => n.replace(t, F(t))
66
66
  ), e = e.replace(
67
67
  /style=(['"])([\s\S]*?)\1/gi,
68
- (s, t, i) => `style=${t}${$(i)}${t}`
68
+ (n, t, i) => `style=${t}${b(i)}${t}`
69
69
  ), e;
70
70
  }
71
71
  function M(e) {
72
- if (!b() || !y(e)) return e;
72
+ if (!y() || !S(e)) return e;
73
73
  try {
74
- const s = S(e), t = H(s);
75
- return C(t);
74
+ const n = C(e), t = H(n);
75
+ return v(t);
76
76
  } catch {
77
77
  return e;
78
78
  }
79
79
  }
80
- async function k(e, s) {
81
- let { width: t, height: i, scale: r = 1, dpr: o = 1, meta: a = {} } = s;
80
+ async function W(e, n) {
81
+ let {
82
+ width: t,
83
+ height: i,
84
+ scale: a = 1,
85
+ dpr: o = 1,
86
+ meta: c = {},
87
+ backgroundColor: s
88
+ } = n;
82
89
  e = M(e);
83
- const n = new Image();
84
- n.loading = "eager", n.decoding = "sync", n.crossOrigin = "anonymous", n.src = e, await n.decode();
85
- const l = n.naturalWidth, f = n.naturalHeight, c = Number.isFinite(a.w0) ? a.w0 : l, m = Number.isFinite(a.h0) ? a.h0 : f;
86
- let h, u;
87
- const g = Number.isFinite(t), x = Number.isFinite(i);
88
- if (g && x)
89
- h = Math.max(1, t), u = Math.max(1, i);
90
- else if (g) {
91
- const p = t / Math.max(1, c);
92
- h = t, u = m * p;
93
- } else if (x) {
94
- const p = i / Math.max(1, m);
95
- u = i, h = c * p;
90
+ const r = new Image();
91
+ r.loading = "eager", r.decoding = "sync", r.crossOrigin = "anonymous", r.src = e, await r.decode();
92
+ const u = r.naturalWidth, l = r.naturalHeight, p = Number.isFinite(c.w0) ? c.w0 : u, x = Number.isFinite(c.h0) ? c.h0 : l;
93
+ let f, h;
94
+ const w = Number.isFinite(t), $ = Number.isFinite(i);
95
+ if (w && $)
96
+ f = Math.max(1, t), h = Math.max(1, i);
97
+ else if (w) {
98
+ const g = t / Math.max(1, p);
99
+ f = t, h = x * g;
100
+ } else if ($) {
101
+ const g = i / Math.max(1, x);
102
+ h = i, f = p * g;
96
103
  } else
97
- h = l, u = f;
98
- h = h * r, u = u * r;
104
+ f = u, h = l;
105
+ f = f * a, h = h * a;
99
106
  const d = document.createElement("canvas");
100
- d.width = h * o, d.height = u * o, d.style.width = `${h}px`, d.style.height = `${u}px`;
101
- const w = d.getContext("2d");
102
- return o !== 1 && w.scale(o, o), w.drawImage(n, 0, 0, h, u), d;
107
+ d.width = f * o, d.height = h * o, d.style.width = `${f}px`, d.style.height = `${h}px`;
108
+ const m = d.getContext("2d");
109
+ return o !== 1 && m.scale(o, o), s && (m.save(), m.fillStyle = s, m.fillRect(0, 0, f, h), m.restore()), m.drawImage(r, 0, 0, f, h), d;
103
110
  }
104
111
  export {
105
- k as toCanvas
112
+ W as toCanvas
106
113
  };
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-12-17 18:26:57 */
2
2
  import { rasterize as p } from "../modules/rasterize.js";
3
3
  import { isSafari as f } from "../utils/browser.js";
4
4
  async function x(i, g) {
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-12-17 18:26:57 */
2
2
  const f = ["fill", "stroke", "color", "background-color", "stop-color"], p = /* @__PURE__ */ new Map();
3
3
  function y(r, c) {
4
4
  const l = c + "::" + r.toLowerCase();
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-12-17 18:26:57 */
2
2
  import { getStyle as h, splitBackgroundImage as w } from "../utils/css.js";
3
3
  import { inlineSingleBackgroundEntry as O } from "../utils/image.js";
4
4
  async function _(k, d, s, l = {}) {
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-12-17 18:26:57 */
2
2
  function F(t, n) {
3
3
  if (!t || !n) return;
4
4
  const o = t.scrollTop || 0;
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:03:21 */
1
+ /* 2025-12-17 18:26:57 */
2
2
  import { cache as F } from "../core/cache.js";
3
3
  function D(e) {
4
4
  return /\bcounter\s*\(|\bcounters\s*\(/.test(e || "");