@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
package/tree/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import a from "lodash/castArray";
3
3
  import c from "lodash/isArray.js";
4
4
  import g from "lodash/isObject.js";
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import E from "lodash/isArray";
3
3
  import B from "lodash/isFunction";
4
4
  import C from "lodash/isNil";
package/tree.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import "lodash/castArray";
3
3
  import "lodash/isArray.js";
4
4
  import "lodash/isObject.js";
package/tween/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import * as e from "./src/easing.js";
3
3
  import { default as r, default as t } from "./src/tween.js";
4
4
  export {
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  function u(n) {
3
3
  return function(t) {
4
4
  return Math.pow(t, n);
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import n from "lodash/isFunction.js";
3
3
  import d from "lodash/isString.js";
4
4
  import * as l from "./easing.js";
package/tween.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import * as e from "./tween/src/easing.js";
3
3
  import { default as r, default as t } from "./tween/src/tween.js";
4
4
  export {
@@ -0,0 +1,3 @@
1
+ export default isMobile;
2
+ export const isMobile: boolean;
3
+ export const isTablet: boolean;
@@ -1,3 +1,10 @@
1
+ export function plugins(...defs: any[]): typeof main & {
2
+ plugins: typeof plugins;
3
+ };
4
+ export const snapdom: typeof main & {
5
+ plugins: typeof plugins;
6
+ };
7
+ export default snapdom;
1
8
  /**
2
9
  * Main function that captures a DOM element and returns export utilities.
3
10
  * Local-first plugins: `options.plugins` override globals for this capture.
@@ -5,11 +12,10 @@
5
12
  * @param {HTMLElement} element - The DOM element to capture.
6
13
  * @param {object} userOptions - Options for rendering/exporting.
7
14
  * @returns {Promise<object>} Object with exporter methods:
8
- * @deprecated toImg()
9
15
  * - url: The raw data URL
10
16
  * - toRaw(): Gets raw data URL
11
- * - toImg(): Converts to Svg format
12
- * - toSvg(): Converts to Svg format
17
+ * - toImg(): Converts to Image element
18
+ * - toSvg(): Converts to SVG Image element
13
19
  * - toCanvas(): Converts to HTMLCanvasElement
14
20
  * - toBlob(): Converts to Blob
15
21
  * - toPng(): Converts to PNG format
@@ -17,79 +23,4 @@
17
23
  * - toWebp(): Converts to WebP format
18
24
  * - download(): Triggers file download
19
25
  */
20
- export function snapdom(element: HTMLElement, userOptions: object): Promise<object>;
21
- export namespace snapdom {
22
- function plugins(...defs: any[]): typeof snapdom;
23
- /**
24
- * Internal capture method that returns helper methods for transformation/export.
25
- * Integrates export hooks: beforeExport → work() → afterExport → afterSnap(once per URL)
26
- * @private
27
- * @param {HTMLElement} el - The DOM element to capture.
28
- * @param {object} context - Normalized context options.
29
- * @param {symbol} _token - Internal security token.
30
- * @returns {Promise<object>} Exporter functions.
31
- */
32
- function capture(el: HTMLElement, context: object, _token: symbol): Promise<object>;
33
- /**
34
- * Returns the raw data URL from a captured element.
35
- * @param {HTMLElement} el - DOM element to capture.
36
- * @param {object} [options] - Rendering options.
37
- * @returns {Promise<string>} Raw data URL.
38
- */
39
- function toRaw(el: HTMLElement, options?: object): Promise<string>;
40
- /**
41
- * Returns an HTMLImageElement from a captured element.
42
- * @param {HTMLElement} el - DOM element to capture.
43
- * @param {object} [options] - Rendering options.
44
- * @returns {Promise<HTMLImageElement>} Loaded image element.
45
- */
46
- function toImg(el: HTMLElement, options?: object): Promise<HTMLImageElement>;
47
- function toSvg(el: any, options: any): Promise<any>;
48
- /**
49
- * Returns a Canvas element from a captured element.
50
- * @param {HTMLElement} el - DOM element to capture.
51
- * @param {object} [options] - Rendering options.
52
- * @returns {Promise<HTMLCanvasElement>} Rendered canvas element.
53
- */
54
- function toCanvas(el: HTMLElement, options?: object): Promise<HTMLCanvasElement>;
55
- /**
56
- * Returns a Blob from a captured element.
57
- * @param {HTMLElement} el - DOM element to capture.
58
- * @param {object} [options] - Rendering options.
59
- * @returns {Promise<Blob>} Image blob.
60
- */
61
- function toBlob(el: HTMLElement, options?: object): Promise<Blob>;
62
- /**
63
- * Returns a PNG image from a captured element.
64
- * @param {HTMLElement} el - DOM element to capture.
65
- * @param {object} [options] - Rendering options.
66
- * @returns {Promise<HTMLImageElement>} PNG image element.
67
- */
68
- function toPng(el: HTMLElement, options?: object): Promise<HTMLImageElement>;
69
- /**
70
- * Returns a JPEG image from a captured element.
71
- * @param {HTMLElement} el - DOM element to capture.
72
- * @param {object} [options] - Rendering options.
73
- * @returns {Promise<HTMLImageElement>} JPEG image element.
74
- */
75
- function toJpg(el: HTMLElement, options?: object): Promise<HTMLImageElement>;
76
- /**
77
- * Returns a WebP image from a captured element.
78
- * @param {HTMLElement} el - DOM element to capture.
79
- * @param {object} [options] - Rendering options.
80
- * @returns {Promise<HTMLImageElement>} WebP image element.
81
- */
82
- function toWebp(el: HTMLElement, options?: object): Promise<HTMLImageElement>;
83
- /**
84
- * Downloads the captured image in the specified format.
85
- * @param {HTMLElement} el - DOM element to capture.
86
- * @param {object} options - Download options including filename.
87
- * @param {string} options.filename - Name for the downloaded file.
88
- * @param {string} [options.format='png'] - Image format ('png', 'jpeg', 'webp', 'svg').
89
- * @returns {Promise<void>}
90
- */
91
- function download(el: HTMLElement, options: {
92
- filename: string;
93
- format?: string | undefined;
94
- }): Promise<void>;
95
- }
26
+ declare function main(element: HTMLElement, userOptions: object): Promise<object>;
@@ -1,8 +1,15 @@
1
1
  /**
2
- * Rasterize SVG into a canvas honoring width/height + scale.
3
- * Uses options.meta for natural sizes (from captureDOM).
2
+ * Rasterize SVG (o data URL) en un canvas respetando width/height + scale.
3
+ * Soporta aplanar un background color sin canvas intermedio.
4
4
  * @param {string} url
5
- * @param {{width?:number,height?:number,scale?:number,dpr?:number,meta?:object}} options
5
+ * @param {{
6
+ * width?:number,
7
+ * height?:number,
8
+ * scale?:number,
9
+ * dpr?:number,
10
+ * meta?:object,
11
+ * backgroundColor?: string // <- NUEVO: color opcional para aplanar fondo
12
+ * }} options
6
13
  * @returns {Promise<HTMLCanvasElement>}
7
14
  */
8
15
  export function toCanvas(url: string, options: {
@@ -11,4 +18,5 @@ export function toCanvas(url: string, options: {
11
18
  scale?: number;
12
19
  dpr?: number;
13
20
  meta?: object;
21
+ backgroundColor?: string;
14
22
  }): Promise<HTMLCanvasElement>;
@@ -0,0 +1 @@
1
+ export function toJpg(elOrUrl: any, opts?: {}): Promise<HTMLImageElement>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {HTMLElement|string} elOrUrl
3
+ * @param {object} opts
4
+ * @returns {Promise<HTMLImageElement|string|HTMLCanvasElement|Blob>} según tu contrato de `rasterize`
5
+ */
6
+ export function toPng(elOrUrl: HTMLElement | string, opts?: object): Promise<HTMLImageElement | string | HTMLCanvasElement | Blob>;
@@ -0,0 +1 @@
1
+ export { toSvg } from "./toImg.js";
@@ -0,0 +1 @@
1
+ export function toWebp(elOrUrl: any, opts?: {}): Promise<HTMLImageElement>;
@@ -1,36 +1,23 @@
1
1
  export function extendIconFonts(fonts: any): void;
2
2
  export function isIconFont(input: any): boolean;
3
- /**
4
- * Rasterization helpers for Google Material Icons / Material Symbols that use ligatures.
5
- * Converts elements that render icons via text ligatures into inline <img> (data URL).
6
- * This runs on the CLONE tree (never mutates the original).
7
- *
8
- * @module materialIcons
9
- */
10
- /** True si la familia es Material Icons / Material Symbols */
11
3
  export function isMaterialFamily(family?: string): boolean;
12
- /** Espera a que la fuente esté lista (ligaduras) */
13
4
  export function ensureMaterialFontsReady(family?: string, px?: number): Promise<void>;
14
- /**
15
- * Dibuja la ligadura (ej. "face") en canvas → dataURL PNG.
16
- */
17
- export function materialIconToImage(ligatureText: any, { family, weight, fontSize, color, variation, }?: {
5
+ export function materialIconToImage(ligatureText: any, { family, weight, fontSize, color, variation, className, }?: {
18
6
  family?: string | undefined;
19
7
  weight?: string | undefined;
20
8
  fontSize?: number | undefined;
21
9
  color?: string | undefined;
22
10
  variation?: string | undefined;
11
+ className?: string | undefined;
23
12
  }): Promise<{
24
13
  dataUrl: string;
25
14
  width: number;
26
15
  height: number;
27
16
  }>;
28
17
  /**
29
- * Reemplaza nodos de Material (ligaduras) por <img> en el CLONE.
30
- * IMPORTANTE: leé estilos del SOURCE para obtener el color correcto.
31
- *
32
- * @param {Element} cloneRoot - subárbol clonado
33
- * @param {Element} sourceRoot - subárbol original (para estilos reales)
34
- * @returns {Promise<number>}
18
+ * Replace Material ligature nodes in the CLONE by <img>.
19
+ * Reads styles from SOURCE for accurate size/color/variation/class.
35
20
  */
36
- export function ligatureIconToImage(cloneRoot: Element, sourceRoot: Element): Promise<number>;
21
+ export function ligatureIconToImage(cloneRoot: any, sourceRoot: any): Promise<number>;
22
+ export const defaultIconFonts: RegExp[];
23
+ export const ICON_FONT_URLS: any;
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Fast preflight to decide whether pseudo/counter inlining is needed at all.
3
+ * Triggers true if detects any:
4
+ * - ::before / ::after / ::first-letter (and single-colon variants)
5
+ * - counter( / counters( / counter-increment / counter-reset
6
+ *
7
+ * Strategy (fast → slower):
8
+ * 1) Scan inline <style> textContent
9
+ * 2) Scan adoptedStyleSheets (cssRules) if available
10
+ * 3) Scan a small budget of cssRules in <style>/<link> same-origin
11
+ * 4) Cheap DOM hint for inline styles with counter(
12
+ *
13
+ * Memoized by document + style fingerprint.
14
+ *
15
+ * @param {Document} doc
16
+ * @returns {boolean}
17
+ */
18
+ export function shouldProcessPseudos(doc?: Document): boolean;
1
19
  /**
2
20
  * Creates elements to represent ::before, ::after, and ::first-letter pseudo-elements, inlining their styles and content.
3
21
  *
@@ -1,16 +1,12 @@
1
1
  /**
2
2
  * Converts to an HTMLImageElement with raster format.
3
- * @param {string} url - Image data URL.
4
- * @param {object} options - Context including format and dpr.
5
- * @param {string} options.format - Output format ('png', 'jpeg', 'webp').
6
- * @param {number} options.dpr - Device pixel ratio.
7
- * @param {number} [options.quality] - Image quality for lossy formats.
8
- * @param {string} [options.backgroundColor] - Optional background color.
9
- * @returns {Promise<HTMLImageElement>} Resolves with the rasterized Image element.
3
+ * @param {string} url
4
+ * @param {{ format:'png'|'jpeg'|'webp', dpr:number, quality?:number, backgroundColor?:string }} options
5
+ * @returns {Promise<HTMLImageElement>}
10
6
  */
11
7
  export function rasterize(url: string, options: {
12
- format: string;
8
+ format: "png" | "jpeg" | "webp";
13
9
  dpr: number;
14
- quality?: number | undefined;
15
- backgroundColor?: string | undefined;
10
+ quality?: number;
11
+ backgroundColor?: string;
16
12
  }): Promise<HTMLImageElement>;
@@ -6,7 +6,4 @@
6
6
  export function idle(fn: any, { fast }?: {
7
7
  fast?: boolean | undefined;
8
8
  }): Promise<void>;
9
- /**
10
- * Detecta Safari real + Safari en iOS WebView (UIWebView/WKWebView) + variantes WeChat.
11
- */
12
9
  export function isSafari(): boolean;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Helper utilities for DOM capture operations
3
+ * @module utils/capture.helpers
4
+ */
5
+ /**
6
+ * Strip shadow-like visuals on the CLONE ROOT ONLY (box/text-shadow, outline, blur()/drop-shadow()).
7
+ * Children remain intact.
8
+ * @param {Element} originalEl
9
+ * @param {HTMLElement} cloneRoot
10
+ */
11
+ export function stripRootShadows(originalEl: Element, cloneRoot: HTMLElement): void;
12
+ /** Remove all HTML comments (prevents invalid XML like "--") */
13
+ export function removeAllComments(root: any): void;
14
+ /**
15
+ * Sanitize attributes to produce valid XHTML inside foreignObject.
16
+ * - Drop "@", unknown ":" prefixes
17
+ * - Drop common framework directives (x-*, v-*, :*, on:*, bind:*, let:*, class:*)
18
+ */
19
+ export function sanitizeAttributesForXHTML(root: any, opts?: {}): void;
20
+ export function sanitizeCloneForXHTML(root: any, opts?: {}): void;
21
+ /**
22
+ * Post-clone "shrink pass": for parents that lost children due to excludeMode:"remove",
23
+ * override snapshot sizes so they can collapse naturally.
24
+ *
25
+ * It writes inline overrides on the CLONE (never the real DOM):
26
+ * - height/width: auto
27
+ * - remove logical sizes (block-size/inline-size)
28
+ * - relax min/max to allow collapse
29
+ *
30
+ * @param {Element} sourceRoot - original subtree root (for reading computed styles)
31
+ * @param {HTMLElement} cloneRoot - cloned subtree root (to write overrides)
32
+ * @param {Map<Element, CSSStyleDeclaration>} styleCache - optional cache you already build
33
+ */
34
+ export function shrinkAutoSizeBoxes(sourceRoot: Element, cloneRoot: HTMLElement, styleCache?: Map<Element, CSSStyleDeclaration>): void;
35
+ /**
36
+ * Compute the kept-children vertical span inside container's content box.
37
+ * We take the min(top) and max(bottom) of included, in-flow children,
38
+ * then add container paddings and borders to rebuild total height.
39
+ * This avoids double-counting collapsed margins.
40
+ * @param {Element} container
41
+ * @param {any} options
42
+ * @returns {number} estimated outerHeight (border+padding+content)
43
+ */
44
+ export function estimateKeptHeight(container: Element, options: any): number;
45
+ export function limitDecimals(v: any, n?: number): any;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Schedule work across idle slices without relying on IdleDeadline constructor.
3
+ * Falls back to setTimeout on browsers without requestIdleCallback.
4
+ * @param {Node[]} childList
5
+ * @param {(child: Node, done: () => void) => void} callback
6
+ * @param {boolean} fast
7
+ * @returns {Promise<(Node|null)[]>}
8
+ */
9
+ export function idleCallback(childList: Node[], callback: (child: Node, done: () => void) => void, fast: boolean): Promise<(Node | null)[]>;
10
+ /**
11
+ * Rewrite Shadow DOM selectors to a flat, host-scoped form with specificity 0.
12
+ * - :host(.foo) => :where([data-sd="sN"]:is(.foo))
13
+ * - :host => :where([data-sd="sN"])
14
+ * - ::slotted(X) => :where([data-sd="sN"] X) (no excluye sloteados)
15
+ * - (resto, p.ej. .button)=> :where([data-sd="sN"] .button:not([data-sd-slotted]))
16
+ * - :host-context(Y) => :where(:where(Y) [data-sd="sN"]) (aprox)
17
+ */
18
+ export function rewriteShadowCSS(cssText: any, scopeSelector: any): any;
19
+ /**
20
+ * Generate a unique shadow scope id for this session.
21
+ * @param {{shadowScopeSeq?: number}} sessionCache
22
+ * @returns {string} like "s1", "s2", ...
23
+ */
24
+ export function nextShadowScopeId(sessionCache: {
25
+ shadowScopeSeq?: number;
26
+ }): string;
27
+ /**
28
+ * Extract CSS text from a ShadowRoot: inline <style> plus adoptedStyleSheets (if readable).
29
+ * @param {ShadowRoot} sr
30
+ * @returns {string}
31
+ */
32
+ export function extractShadowCSS(sr: ShadowRoot): string;
33
+ /**
34
+ * Inject a <style> as the first child of `hostClone` with rewritten CSS.
35
+ * @param {Element} hostClone
36
+ * @param {string} cssText
37
+ * @param {string} scopeId like s1
38
+ */
39
+ export function injectScopedStyle(hostClone: Element, cssText: string, scopeId: string): void;
40
+ /**
41
+ * Freeze the responsive selection of an <img> that has srcset/sizes.
42
+ * Copies a concrete URL into `src` and removes `srcset`/`sizes` so the clone
43
+ * doesn't need layout to resolve a candidate.
44
+ * Works with <picture> because currentSrc reflects the chosen source.
45
+ * @param {HTMLImageElement} original - Image in the live DOM.
46
+ * @param {HTMLImageElement} cloned - Just-created cloned <img>.
47
+ */
48
+ export function freezeImgSrcset(original: HTMLImageElement, cloned: HTMLImageElement): void;
49
+ /**
50
+ * Collect all custom properties referenced via var(--foo) in a CSS string.
51
+ * @param {string} cssText
52
+ * @returns {Set<string>} e.g. new Set(['--o-fill','--o-gray-light'])
53
+ */
54
+ export function collectCustomPropsFromCSS(cssText: string): Set<string>;
55
+ /**
56
+ * Build a seed rule that initializes given custom props on the scope.
57
+ * Placed before the rewritten shadow CSS so later rules (e.g. :hover) can override.
58
+ * @param {Element} hostEl
59
+ * @param {Iterable<string>} names
60
+ * @param {string} scopeSelector e.g. [data-sd="s3"]
61
+ * @returns {string} CSS rule text (or "" if nothing to seed)
62
+ */
63
+ export function buildSeedCustomPropsRule(hostEl: Element, names: Iterable<string>, scopeSelector: string): string;
64
+ /**
65
+ * Mark slotted subtree with data-sd-slotted attribute
66
+ * @param {Node} root
67
+ */
68
+ export function markSlottedSubtree(root: Node): void;
69
+ /**
70
+ * Wait for an accessible same-origin Document for a given <iframe>.
71
+ * @param {HTMLIFrameElement} iframe
72
+ * @param {number} [attempts=3]
73
+ * @returns {Promise<Document|null>}
74
+ */
75
+ export function getAccessibleIframeDocument(iframe: HTMLIFrameElement, attempts?: number): Promise<Document | null>;
76
+ /**
77
+ * Rasterize a same-origin iframe exactly at its content-box size, as the user requested:
78
+ * - Capture iframe.contentDocument.documentElement
79
+ * - Force a bitmap (toPng) sized to the iframe viewport (not the content height)
80
+ * - Wrap with a styled container that mimics the <iframe> box (borders, radius, etc.)
81
+ *
82
+ * @param {HTMLIFrameElement} iframe
83
+ * @param {object} sessionCache
84
+ * @param {object} options
85
+ * @returns {Promise<HTMLElement>}
86
+ */
87
+ export function rasterizeIframe(iframe: HTMLIFrameElement, sessionCache: object, options: object): Promise<HTMLElement>;
88
+ /**
89
+ * Read a blob: URL and return its data URL, with memoization + shared cache.
90
+ * - Usa snapFetch(as:'dataURL') para convertir directo.
91
+ * - Dedupea inflight guardando la promesa en el Map.
92
+ * - Escribe también en cache.resource para reuso cross-módulo.
93
+ * @param {string} blobUrl
94
+ * @returns {Promise<string>} data URL
95
+ */
96
+ export function blobUrlToDataUrl(blobUrl: string): Promise<string>;
97
+ export function resolveBlobUrlsInTree(root: any): Promise<void>;
@@ -1,11 +1,3 @@
1
- /**
2
- * Adds a background color to the canvas if specified.
3
- * @param {HTMLCanvasElement} baseCanvas - Source canvas element.
4
- * @param {string} backgroundColor - CSS color string for the background.
5
- * @returns {HTMLCanvasElement} Returns the original canvas if no background needed,
6
- * or a new canvas with the background applied.
7
- */
8
- export function createBackground(baseCanvas: HTMLCanvasElement, backgroundColor: string): HTMLCanvasElement;
9
1
  /**
10
2
  * Inline a single background-image entry (one layer) robustly.
11
3
  * - If it's a URL() and fetching fails, degrade to "none" instead of throwing.
@@ -1,4 +1,4 @@
1
+ export { inlineSingleBackgroundEntry } from "./image.js";
1
2
  export { idle, isSafari } from "./browser.js";
2
3
  export { collectUsedTagNames, generateCSSClasses, generateDedupedBaseCSS, getDefaultStyleForTag, getStyle, getStyleKey, NO_CAPTURE_TAGS, NO_DEFAULTS_TAGS, parseContent, precacheCommonTags, snapshotComputedStyle, splitBackgroundImage } from "./css.js";
3
4
  export { extractURL, isIconFont, safeEncodeURI, stripTranslate } from "./helpers.js";
4
- export { createBackground, inlineSingleBackgroundEntry } from "./image.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Helper utilities for preparing DOM clones
3
+ * @module utils/prepare.helpers
4
+ */
5
+ /**
6
+ * Stabilize layout by adding transparent border if element has outline but no border
7
+ * @param {Element} element
8
+ */
9
+ export function stabilizeLayout(element: Element): void;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Parse box-shadow and calculate bleed dimensions
3
+ * @param {CSSStyleDeclaration} cs
4
+ * @returns {{top: number, right: number, bottom: number, left: number}}
5
+ */
6
+ export function parseBoxShadow(cs: CSSStyleDeclaration): {
7
+ top: number;
8
+ right: number;
9
+ bottom: number;
10
+ left: number;
11
+ };
12
+ /**
13
+ * Parse filter blur and calculate bleed
14
+ * @param {CSSStyleDeclaration} cs
15
+ * @returns {{top: number, right: number, bottom: number, left: number}}
16
+ */
17
+ export function parseFilterBlur(cs: CSSStyleDeclaration): {
18
+ top: number;
19
+ right: number;
20
+ bottom: number;
21
+ left: number;
22
+ };
23
+ /**
24
+ * Parse outline and calculate bleed
25
+ * @param {CSSStyleDeclaration} cs
26
+ * @returns {{top: number, right: number, bottom: number, left: number}}
27
+ */
28
+ export function parseOutline(cs: CSSStyleDeclaration): {
29
+ top: number;
30
+ right: number;
31
+ bottom: number;
32
+ left: number;
33
+ };
34
+ /**
35
+ * Parse filter drop-shadow and calculate bleed
36
+ * @param {CSSStyleDeclaration} cs
37
+ * @returns {{bleed: {top: number, right: number, bottom: number, left: number}, has: boolean}}
38
+ */
39
+ export function parseFilterDropShadows(cs: CSSStyleDeclaration): {
40
+ bleed: {
41
+ top: number;
42
+ right: number;
43
+ bottom: number;
44
+ left: number;
45
+ };
46
+ has: boolean;
47
+ };
48
+ /**
49
+ * Remove only translate/rotate from CLONE ROOT transform, keeping scale/skew.
50
+ * Also forces transformOrigin to 0 0 to avoid negative offsets.
51
+ * Returns the applied 2D matrix components so the caller can expand the viewBox accordingly.
52
+ *
53
+ * @param {Element} originalEl
54
+ * @param {HTMLElement} cloneRoot
55
+ * @returns {{a:number,b:number,c:number,d:number}|null} The 2D matrix (without translation) or null if not applicable.
56
+ */
57
+ export function normalizeRootTransforms(originalEl: Element, cloneRoot: HTMLElement): {
58
+ a: number;
59
+ b: number;
60
+ c: number;
61
+ d: number;
62
+ } | null;
63
+ /**
64
+ * Calculate bounding box with transform origin
65
+ * @param {number} w2
66
+ * @param {number} h2
67
+ * @param {DOMMatrix} M
68
+ * @param {number} ox2
69
+ * @param {number} oy2
70
+ * @returns {{minX: number, minY: number, maxX: number, maxY: number, width: number, height: number}}
71
+ */
72
+ export function bboxWithOriginFull(w2: number, h2: number, M: DOMMatrix, ox2: number, oy2: number): {
73
+ minX: number;
74
+ minY: number;
75
+ maxX: number;
76
+ maxY: number;
77
+ width: number;
78
+ height: number;
79
+ };
80
+ /**
81
+ * Parses transform-origin supporting keywords (left/center/right, top/center/bottom).
82
+ * Returns pixel offsets.
83
+ * @param {CSSStyleDeclaration} cs
84
+ * @param {number} w
85
+ * @param {number} h
86
+ */
87
+ export function parseTransformOriginPx(cs: CSSStyleDeclaration, w: number, h: number): {
88
+ ox: any;
89
+ oy: any;
90
+ };
91
+ /**
92
+ * Returns a robust snapshot of individual transform-like properties.
93
+ * Supports CSS Typed OM (CSSScale/CSSRotate/CSSTranslate) and legacy strings.
94
+ * @param {Element} el
95
+ * @returns {{ rotate:string, scale:string|null, translate:string|null }}
96
+ */
97
+ export function readIndividualTransforms(el: Element): {
98
+ rotate: string;
99
+ scale: string | null;
100
+ translate: string | null;
101
+ };
102
+ /**
103
+ * Read total transform matrix from combined transform properties
104
+ * @param {object} t - Transform properties
105
+ * @returns {DOMMatrix}
106
+ */
107
+ export function readTotalTransformMatrix(t: object): DOMMatrix;
108
+ /**
109
+ * True if any transform (matrix or individual) can affect layout/bbox.
110
+ * @param {Element} el
111
+ */
112
+ export function hasBBoxAffectingTransform(el: Element): boolean;
113
+ /**
114
+ * Get matrix from computed style
115
+ * @param {Element} el
116
+ * @returns {DOMMatrix}
117
+ */
118
+ export function matrixFromComputed(el: Element): DOMMatrix;
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  function i(r = [34797, 15747172]) {
3
3
  return (n = 1) => {
4
4
  const o = r, t = Math.log(256) / Math.log(2), e = o[0] >>> t * 2 & 255, g = o[0] >>> t * 1 & 255, l = o[0] >>> t * 0 & 255, c = o[1] >>> t * 2 & 255, s = o[1] >>> t * 1 & 255, f = o[1] >>> t * 0 & 255, a = c - (c - e) * n, b = s - (s - g) * n, h = f - (f - l) * n;
package/ui-color/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import { TinyColor as e } from "../tinycolor/src/index.js";
3
3
  import { default as Q } from "./compareColorByRange.js";
4
4
  const c = 10, f = {
package/uiColor.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import "./tinycolor/src/index.js";
3
3
  import { default as o } from "./ui-color/compareColorByRange.js";
4
4
  import { LENGTH as t, PRIMARY_COLOR_KEY_MAPPING as p, blue as g, colorPresets as n, colors as m, cyan as s, generate as y, generateDark as P, gold as c, gray as d, grayPresets as i, green as u, lime as R, magenta as f, orange as k, orangered as _, palette as x, paletteDark as A, pinkpurple as C, primary as D, purple as E, red as G, yellow as I } from "./ui-color/index.js";
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import { buildAbsoluteURL as e, buildURLFromParts as l, default as o, normalizePath as t, parseURL as u } from "./src/url-toolkit.js";
3
3
  export {
4
4
  e as buildAbsoluteURL,
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  const l = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^/?#]*)?))\2(?=((?:(?:[^?#/]*\/)*[^;?#/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, p = /^(?=([^/?#]*))\1([^]*)$/, f = /(?:\/|^)\.(?=\/)/g, m = /(?:\/|^)\.\.\/(?!\.\.\/)[^/]*(?=\/)/g;
3
3
  function E(r, a, s) {
4
4
  if (s = s || {}, r = r.trim(), a = a.trim(), !a) {
package/urlToolkit.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import { buildAbsoluteURL as e, buildURLFromParts as l, default as o, normalizePath as t, parseURL as u } from "./url-toolkit/src/url-toolkit.js";
3
3
  export {
4
4
  e as buildAbsoluteURL,
package/validate/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import { Schema as t, default as o } from "./src/index.js";
3
3
  import { default as l } from "./src/rules/array.js";
4
4
  import { default as d } from "./src/rules/boolean.js";
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 09:08:12 */
1
+ /* 2025-11-27 12:11:03 */
2
2
  import V from "lodash/defaultsDeep";
3
3
  import u from "lodash/isArray.js";
4
4
  import E from "lodash/isFunction.js";