@unicom-cloud/utils 0.1.32 → 0.1.34

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 (358) 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 +7 -7
  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 +1 -1
  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 +1 -1
  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 +14 -21
  103. package/file/index.js +1 -1
  104. package/file/saveAs.js +28 -31
  105. package/file.js +1 -1
  106. package/function/index.js +50 -0
  107. package/function.js +48 -0
  108. package/idb/index.js +1 -1
  109. package/idb.js +1 -1
  110. package/index.js +1 -1
  111. package/invariant/index.js +1 -1
  112. package/invariant.js +1 -1
  113. package/is/index.js +196 -141
  114. package/is/lib/isAscii.js +9 -0
  115. package/is/lib/isBase64.js +13 -0
  116. package/is/lib/isChinese.js +19 -0
  117. package/is/lib/isDataURI.js +25 -0
  118. package/is/lib/isEmail.js +72 -0
  119. package/is/lib/isFQDN.js +27 -0
  120. package/is/lib/isFullWidth.js +10 -0
  121. package/is/lib/isHSL.js +11 -0
  122. package/is/lib/isHalfWidth.js +10 -0
  123. package/is/lib/isHash.js +23 -0
  124. package/is/lib/isHexColor.js +12 -0
  125. package/is/lib/isIMEI.js +20 -0
  126. package/is/lib/isIP.js +21 -0
  127. package/is/lib/isIPRange.js +25 -0
  128. package/is/lib/isIdentityCard.js +190 -0
  129. package/is/lib/isJWT.js +14 -0
  130. package/is/lib/isMACAddress.js +9 -0
  131. package/is/lib/isMD5.js +9 -0
  132. package/is/lib/isMimeType.js +9 -0
  133. package/is/lib/isMobilePhone.js +192 -0
  134. package/is/lib/isPort.js +7 -0
  135. package/is/lib/isRgbColor.js +18 -0
  136. package/is/lib/isSemVer.js +20 -0
  137. package/is/lib/isSlug.js +9 -0
  138. package/is/lib/isStrongPassword.js +48 -0
  139. package/is/lib/isURL.js +78 -0
  140. package/is/lib/isUUID.js +24 -0
  141. package/is/lib/isVariableWidth.js +10 -0
  142. package/is/lib/util/assertString.js +12 -0
  143. package/is.js +122 -66
  144. package/lunar/index.js +1 -1
  145. package/lunar/lib/Holiday.js +1 -1
  146. package/lunar/lib/HolidayUtil.js +1 -1
  147. package/lunar/lib/I18n.js +1 -1
  148. package/lunar/lib/JieQi.js +1 -1
  149. package/lunar/lib/Lunar.js +1 -1
  150. package/lunar/lib/LunarMonth.js +1 -1
  151. package/lunar/lib/LunarTime.js +1 -1
  152. package/lunar/lib/LunarUtil.js +1 -1
  153. package/lunar/lib/LunarYear.js +1 -1
  154. package/lunar/lib/ShouXingUtil.js +1 -1
  155. package/lunar/lib/Solar.js +1 -1
  156. package/lunar/lib/SolarHalfYear.js +1 -1
  157. package/lunar/lib/SolarMonth.js +1 -1
  158. package/lunar/lib/SolarSeason.js +1 -1
  159. package/lunar/lib/SolarUtil.js +1 -1
  160. package/lunar/lib/SolarWeek.js +1 -1
  161. package/lunar/lib/SolarYear.js +1 -1
  162. package/lunar/lib/index.js +1 -1
  163. package/lunar.js +1 -1
  164. package/math/index.js +1 -1
  165. package/math.js +1 -1
  166. package/md5/index.js +1 -1
  167. package/md5.js +1 -1
  168. package/mock/MockWebSocket.js +1 -1
  169. package/mock/MockXMLHttpRequest.js +1 -1
  170. package/mock/index.js +1 -1
  171. package/mock.js +1 -1
  172. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  173. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  174. package/normalize-wheel/index.js +1 -1
  175. package/normalize-wheel/isEventSupported.js +1 -1
  176. package/normalizeWheel.js +1 -1
  177. package/number-to-chinese/index.js +1 -1
  178. package/numberToChinese.js +1 -1
  179. package/nzh/cn.js +1 -1
  180. package/nzh/hk.js +1 -1
  181. package/nzh/index.js +1 -1
  182. package/nzh/nzh.js +1 -1
  183. package/nzh/src/autoGet.js +1 -1
  184. package/nzh/src/index.js +1 -1
  185. package/nzh/src/langs/cn_b.js +1 -1
  186. package/nzh/src/langs/cn_s.js +1 -1
  187. package/nzh/src/langs/hk_b.js +1 -1
  188. package/nzh/src/langs/hk_s.js +1 -1
  189. package/nzh/src/utils.js +1 -1
  190. package/nzh.js +1 -1
  191. package/object-keys-sort/index.js +1 -1
  192. package/object-prototype-to-string-call/index.js +2 -2
  193. package/objectKeysSort.js +1 -1
  194. package/objectPrototypeToStringCall.js +1 -1
  195. package/package.json +1 -1
  196. package/pinyin/index.js +1 -1
  197. package/pinyin/simplified.js +1 -1
  198. package/pinyin/src/core.js +1 -1
  199. package/pinyin/src/simplified.js +6 -6
  200. package/pinyin/src/simplified_dict.js +5 -4
  201. package/pinyin/src/traditional.js +4 -4
  202. package/pinyin/src/traditional_dict.js +4 -3
  203. package/pinyin/traditional.js +1 -1
  204. package/pinyin.js +1 -1
  205. package/query-string/base.js +1 -1
  206. package/query-string/index.js +1 -1
  207. package/query-string/splitOnFirst.js +1 -1
  208. package/queryString.js +1 -1
  209. package/random/address.js +1 -1
  210. package/random/constellation.js +1 -1
  211. package/random/image.js +1 -1
  212. package/random/index.js +1 -1
  213. package/random/licensePlate.js +1 -1
  214. package/random/name.js +1 -1
  215. package/random/number.js +1 -1
  216. package/random/text.js +1 -1
  217. package/random/time.js +1 -1
  218. package/random/web.js +1 -1
  219. package/random.js +1 -1
  220. package/screenfull/index.js +1 -1
  221. package/screenfull.js +1 -1
  222. package/sleep/index.js +1 -1
  223. package/sleep.js +1 -1
  224. package/snapdom/index.js +1 -1
  225. package/snapdom/src/api/preCache.js +1 -1
  226. package/snapdom/src/api/snapdom.js +2 -2
  227. package/snapdom/src/core/cache.js +1 -1
  228. package/snapdom/src/core/capture.js +1 -1
  229. package/snapdom/src/core/clone.js +1 -1
  230. package/snapdom/src/core/context.js +1 -1
  231. package/snapdom/src/core/plugins.js +1 -1
  232. package/snapdom/src/core/prepare.js +1 -1
  233. package/snapdom/src/exporters/download.js +14 -9
  234. package/snapdom/src/exporters/toBlob.js +1 -1
  235. package/snapdom/src/exporters/toCanvas.js +1 -1
  236. package/snapdom/src/exporters/toImg.js +1 -1
  237. package/snapdom/src/modules/CSSVar.js +1 -1
  238. package/snapdom/src/modules/background.js +1 -1
  239. package/snapdom/src/modules/changeCSS.js +1 -1
  240. package/snapdom/src/modules/counter.js +1 -1
  241. package/snapdom/src/modules/fonts.js +1 -1
  242. package/snapdom/src/modules/iconFonts.js +1 -1
  243. package/snapdom/src/modules/images.js +1 -1
  244. package/snapdom/src/modules/lineClamp.js +1 -1
  245. package/snapdom/src/modules/pseudo.js +1 -1
  246. package/snapdom/src/modules/rasterize.js +1 -1
  247. package/snapdom/src/modules/snapFetch.js +1 -1
  248. package/snapdom/src/modules/styles.js +2 -2
  249. package/snapdom/src/modules/svgDefs.js +1 -1
  250. package/snapdom/src/utils/browser.js +1 -1
  251. package/snapdom/src/utils/capture.helpers.js +1 -1
  252. package/snapdom/src/utils/clone.helpers.js +1 -1
  253. package/snapdom/src/utils/css.js +1 -1
  254. package/snapdom/src/utils/helpers.js +1 -1
  255. package/snapdom/src/utils/image.js +1 -1
  256. package/snapdom/src/utils/prepare.helpers.js +1 -1
  257. package/snapdom/src/utils/transforms.helpers.js +1 -1
  258. package/snapdom.js +1 -1
  259. package/string/index.js +1 -1
  260. package/string.js +1 -1
  261. package/tinycolor/index.js +1 -1
  262. package/tinycolor/src/conversion.js +1 -1
  263. package/tinycolor/src/css-color-names.js +1 -1
  264. package/tinycolor/src/format-input.js +1 -1
  265. package/tinycolor/src/from-ratio.js +12 -11
  266. package/tinycolor/src/index.js +1 -1
  267. package/tinycolor/src/random.js +30 -29
  268. package/tinycolor/src/readability.js +1 -1
  269. package/tinycolor/src/to-ms-filter.js +1 -1
  270. package/tinycolor/src/utils.js +1 -1
  271. package/tinycolor.js +1 -1
  272. package/tree/index.js +54 -75
  273. package/tree/search/index.js +1 -1
  274. package/tree.js +9 -11
  275. package/tween/index.js +1 -1
  276. package/tween/src/easing.js +1 -1
  277. package/tween/src/tween.js +15 -14
  278. package/tween.js +1 -1
  279. package/types/clipboard-copy/index.d.ts +1 -1
  280. package/types/date/index.d.ts +3 -3
  281. package/types/dom-helpers/getElementCoordinates.d.ts +40 -0
  282. package/types/dom-helpers/index.d.ts +3 -1
  283. package/types/escape/index.d.ts +2 -0
  284. package/types/file/fileToURL.d.ts +1 -1
  285. package/types/function/index.d.ts +2 -0
  286. package/types/is/index.d.ts +28 -1
  287. package/types/is/lib/isAscii.d.ts +1 -0
  288. package/types/is/lib/isBase64.d.ts +1 -0
  289. package/types/is/lib/isChinese.d.ts +4 -0
  290. package/types/is/lib/isDataURI.d.ts +1 -0
  291. package/types/is/lib/isEmail.d.ts +1 -0
  292. package/types/is/lib/isFQDN.d.ts +1 -0
  293. package/types/is/lib/isFullWidth.d.ts +2 -0
  294. package/types/is/lib/isHSL.d.ts +1 -0
  295. package/types/is/lib/isHalfWidth.d.ts +2 -0
  296. package/types/is/lib/isHash.d.ts +1 -0
  297. package/types/is/lib/isHexColor.d.ts +1 -0
  298. package/types/is/lib/isIMEI.d.ts +1 -0
  299. package/types/is/lib/isIP.d.ts +3 -0
  300. package/types/is/lib/isIPRange.d.ts +1 -0
  301. package/types/is/lib/isIdentityCard.d.ts +1 -0
  302. package/types/is/lib/isJWT.d.ts +1 -0
  303. package/types/is/lib/isMACAddress.d.ts +1 -0
  304. package/types/is/lib/isMD5.d.ts +1 -0
  305. package/types/is/lib/isMimeType.d.ts +1 -0
  306. package/types/is/lib/isMobilePhone.d.ts +2 -0
  307. package/types/is/lib/isOctal.d.ts +1 -0
  308. package/types/is/lib/isPort.d.ts +1 -0
  309. package/types/is/lib/isRgbColor.d.ts +1 -0
  310. package/types/is/lib/isSemVer.d.ts +1 -0
  311. package/types/is/lib/isSlug.d.ts +1 -0
  312. package/types/is/lib/isStrongPassword.d.ts +1 -0
  313. package/types/is/lib/isURL.d.ts +1 -0
  314. package/types/is/lib/isUUID.d.ts +1 -0
  315. package/types/is/lib/isVariableWidth.d.ts +1 -0
  316. package/types/is/lib/util/assertString.d.ts +1 -0
  317. package/types/pinyin/es/main.d.ts +4 -0
  318. package/types/pinyin/es/traditional.d.ts +4 -0
  319. package/types/snapdom/src/api/snapdom.d.ts +1 -0
  320. package/types/tree/index.d.ts +3 -4
  321. package/types/validate/src/index.d.ts +23 -25
  322. package/types/validate/src/interface.d.ts +5 -3
  323. package/types/validate/src/locale/en-US.d.ts +12 -2
  324. package/types/validate/src/locale/index.d.ts +171 -0
  325. package/types/validate/src/locale/zh-CN.d.ts +12 -2
  326. package/types/validate/src/rules/base.d.ts +3 -1
  327. package/types/validate/src/rules/custom.d.ts +1 -1
  328. package/types/validate/src/rules/type.d.ts +10 -0
  329. package/ui-color/compareColorByRange.js +1 -1
  330. package/ui-color/index.js +8 -7
  331. package/uiColor.js +25 -24
  332. package/url-toolkit/index.js +1 -1
  333. package/url-toolkit/src/url-toolkit.js +1 -1
  334. package/urlToolkit.js +1 -1
  335. package/validate/index.js +23 -25
  336. package/validate/src/index.js +116 -73
  337. package/validate/src/locale/en-US.js +12 -2
  338. package/validate/src/locale/index.js +11 -0
  339. package/validate/src/locale/zh-CN.js +12 -2
  340. package/validate/src/rules/array.js +2 -2
  341. package/validate/src/rules/base.js +35 -31
  342. package/validate/src/rules/boolean.js +1 -1
  343. package/validate/src/rules/custom.js +2 -2
  344. package/validate/src/rules/number.js +1 -1
  345. package/validate/src/rules/object.js +1 -1
  346. package/validate/src/rules/string.js +6 -5
  347. package/validate/src/rules/type.js +84 -14
  348. package/validate.js +23 -25
  349. package/version/index.js +1 -1
  350. package/version.js +1 -1
  351. package/xlsx/index.d.ts +4 -8
  352. package/xlsx/index.js +1 -1
  353. package/xlsx/xlsx.js +2 -2
  354. package/xlsx.js +1 -1
  355. package/types/validate/src/message.d.ts +0 -2
  356. package/types/validate/src/utils.d.ts +0 -3
  357. package/validate/src/message.js +0 -5
  358. package/validate/src/utils.js +0 -8
package/tree/index.js CHANGED
@@ -1,93 +1,72 @@
1
- /* 2025-11-27 12:11:03 */
2
- import a from "lodash/castArray";
3
- import c from "lodash/isArray.js";
4
- import g from "lodash/isObject.js";
5
- import d from "lodash/isUndefined.js";
6
- import { default as j } from "./search/index.js";
7
- function p(t, n, l, r = "children") {
8
- if (c(t) && (t = {
9
- [r]: t
10
- }), !(t && g(t))) return null;
11
- if (n in t && t[n] === l)
12
- return t;
13
- const f = t[r] ?? t.items ?? t.list;
14
- if (c(f))
15
- for (let i of f) {
16
- const e = p(i, n, l, r);
17
- if (e)
18
- return e;
1
+ /* 2025-12-19 15:35:18 */
2
+ import d from "lodash/castArray";
3
+ import s from "lodash/isArray.js";
4
+ import h from "lodash/isObject.js";
5
+ import p from "lodash/isUndefined.js";
6
+ import A from "./search/index.js";
7
+ function g(e, i, r, n = "children") {
8
+ if (s(e) && (e = {
9
+ [n]: e
10
+ }), !(e && h(e))) return null;
11
+ if (i in e && e[i] === r)
12
+ return e;
13
+ const f = e[n] ?? e.items ?? e.list;
14
+ if (s(f))
15
+ for (let l of f) {
16
+ const t = g(l, i, r, n);
17
+ if (t)
18
+ return t;
19
19
  }
20
20
  return null;
21
21
  }
22
- function h(t, n, l, r = "children", f = !0) {
23
- if (!t) return;
24
- let i = [...a(t)];
25
- e: for (; i.length; ) {
26
- let e = i.shift();
27
- if (!e) continue e;
28
- const u = e[n];
29
- if (!c(e)) {
30
- if (f ? u === l : u == l)
31
- return e;
32
- let s = e[r] ?? e.items ?? e.list;
33
- if (d(s))
22
+ function a(e, i, r, n = "children", f = !0) {
23
+ if (!e) return;
24
+ let l = [...d(e)];
25
+ e: for (; l.length; ) {
26
+ let t = l.shift();
27
+ if (!t) continue e;
28
+ const c = t[i];
29
+ if (!s(t)) {
30
+ if (f ? c === r : c == r)
31
+ return t;
32
+ let u = t[n] ?? t.items ?? t.list;
33
+ if (p(u))
34
34
  continue e;
35
- e = s;
35
+ t = u;
36
36
  }
37
- i = i.concat(e);
37
+ l = l.concat(t);
38
38
  }
39
39
  }
40
- function b(t, n, l, r = "children") {
41
- if (!t) return;
42
- const f = [...a(t)];
43
- e: for (; f.length; ) {
44
- let i = f.pop();
45
- if (!i) continue e;
46
- if (!c(i)) {
47
- if (i[n] === l)
48
- return i;
49
- let e = i[r] ?? i.items ?? i.list;
50
- if (d(e))
51
- continue e;
52
- i = e;
53
- }
54
- if (c(i))
55
- for (let e = 0, u = i.length; e < u; e++)
56
- f.push(i[u - 1 - e]);
57
- }
58
- }
59
- function x(t, n) {
60
- return h(t, "id", n);
40
+ function D(e, i) {
41
+ return a(e, "id", i);
61
42
  }
62
- function N(t, n, l = !0) {
63
- let r = h(t, "value", n)?.label;
64
- return !r && l && (r = n), r;
43
+ function N(e, i, r = !0) {
44
+ let n = a(e, "value", i)?.label;
45
+ return !n && r && (n = i), n;
65
46
  }
66
- function w(t, n, l, r = "children") {
67
- if (!t) return;
47
+ function j(e, i, r, n = "children") {
48
+ if (!e) return;
68
49
  let f = null;
69
- function i(e) {
70
- if (!e) return;
71
- let u = c(e) ? e : e[r] ?? e.items ?? e.list ?? [];
72
- for (let s = 0; s < u.length; s++) {
73
- const m = u[s];
74
- if (m?.[n] === l) {
75
- f = { item: m, parent: e, index: s };
50
+ function l(t) {
51
+ if (!t) return;
52
+ let c = s(t) ? t : t[n] ?? t.items ?? t.list ?? [];
53
+ for (let u = 0; u < c.length; u++) {
54
+ const m = c[u];
55
+ if (m?.[i] === r) {
56
+ f = { item: m, parent: t, index: u };
76
57
  return;
77
58
  }
78
- i(m);
59
+ l(m);
79
60
  }
80
61
  }
81
- return i(t), f;
62
+ return l(e), f;
82
63
  }
83
64
  export {
84
- h as default,
85
- p as findNodeBy,
86
- w as getChildWithParentBy,
87
- h as getItemBy,
88
- b as getItemBy2,
89
- p as getItemBy3,
90
- x as getItemByID,
65
+ A as default,
66
+ g as findNodeBy,
67
+ j as getChildWithParentBy,
68
+ a as getItemBy,
69
+ D as getItemByID,
91
70
  N as getLabelFromDictionaryByValue,
92
- j as searchTree
71
+ A as searchTree
93
72
  };
@@ -1,4 +1,4 @@
1
- /* 2025-11-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
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,18 +1,16 @@
1
- /* 2025-11-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
2
2
  import "lodash/castArray";
3
3
  import "lodash/isArray.js";
4
4
  import "lodash/isObject.js";
5
5
  import "lodash/isUndefined.js";
6
- import { default as i } from "./tree/search/index.js";
7
- import { getItemBy as B, findNodeBy as d, getChildWithParentBy as g, getItemBy as f, getItemBy2 as p, findNodeBy as I, getItemByID as l, getLabelFromDictionaryByValue as n } from "./tree/index.js";
6
+ import { default as a, default as p } from "./tree/search/index.js";
7
+ import { findNodeBy as d, getChildWithParentBy as f, getItemBy as l, getItemByID as B, getLabelFromDictionaryByValue as g } from "./tree/index.js";
8
8
  export {
9
- B as default,
9
+ a as default,
10
10
  d as findNodeBy,
11
- g as getChildWithParentBy,
12
- f as getItemBy,
13
- p as getItemBy2,
14
- I as getItemBy3,
15
- l as getItemByID,
16
- n as getLabelFromDictionaryByValue,
17
- i as searchTree
11
+ f as getChildWithParentBy,
12
+ l as getItemBy,
13
+ B as getItemByID,
14
+ g as getLabelFromDictionaryByValue,
15
+ p as searchTree
18
16
  };
package/tween/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
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-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
2
2
  function u(n) {
3
3
  return function(t) {
4
4
  return Math.pow(t, n);
@@ -1,26 +1,27 @@
1
- /* 2025-11-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
2
2
  import n from "lodash/isFunction.js";
3
- import d from "lodash/isString.js";
4
- import * as l from "./easing.js";
5
- import { linear as u } from "./easing.js";
6
- class F {
3
+ import l from "lodash/isString.js";
4
+ import a from "lodash/isUndefined.js";
5
+ import * as u from "./easing.js";
6
+ import { linear as p } from "./easing.js";
7
+ class S {
7
8
  constructor(i) {
8
9
  const {
9
10
  from: s,
10
11
  to: e,
11
- duration: a = 500,
12
- delay: r = 0,
12
+ duration: r = 500,
13
+ delay: o = 0,
13
14
  easing: h,
14
- onStart: o,
15
- onUpdate: f = function() {
15
+ onStart: f,
16
+ onUpdate: m = function() {
16
17
  },
17
- onFinish: m
18
+ onFinish: d
18
19
  } = i;
19
20
  for (const t in s)
20
- e[t] === void 0 && (e[t] = s[t]);
21
+ a(e[t]) && (e[t] = s[t]);
21
22
  for (const t in e)
22
- s[t] === void 0 && (s[t] = e[t]);
23
- this.from = s, this.to = e, this.duration = a, this.delay = r, n(h) ? this.easing = h : d(h) && (this.easing = l[h]), this.easing ||= u, this.onStart = o, this.onUpdate = f, this.onFinish = m, this.startTime = Date.now() + this.delay, this.started = !1, this.finished = !1, this.timer = null, this.keys = {};
23
+ a(s[t]) && (s[t] = e[t]);
24
+ this.from = s, this.to = e, this.duration = r, this.delay = o, n(h) ? this.easing = h : l(h) && (this.easing = u[h]), this.easing ||= p, this.onStart = f, this.onUpdate = m, this.onFinish = d, this.startTime = Date.now() + this.delay, this.started = !1, this.finished = !1, this.timer = null, this.keys = {};
24
25
  }
25
26
  update() {
26
27
  if (this.time = Date.now(), !(this.time < this.startTime) && !this.finished) {
@@ -42,5 +43,5 @@ class F {
42
43
  }
43
44
  }
44
45
  export {
45
- F as default
46
+ S as default
46
47
  };
package/tween.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-27 12:11:03 */
1
+ /* 2025-12-19 15:35:18 */
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 {
@@ -1,2 +1,2 @@
1
1
  export default clipboardCopy;
2
- declare function clipboardCopy(text: any): Promise<void>;
2
+ declare function clipboardCopy(text: any): Promise<boolean | void>;
@@ -1,4 +1,4 @@
1
- export function dateFormat(date: any, template: any): any;
2
- export { default as convertTime } from "./convertTime";
1
+ import convertTime from './convertTime';
3
2
  import convertToDurationBasedOnTimeUnits from './convertToDuration';
4
- export { convertToDurationBasedOnTimeUnits, dateFormat as dayjsFormat };
3
+ export function dateFormat(date: any, template: any): any;
4
+ export { convertTime, convertToDurationBasedOnTimeUnits, dateFormat as dayjsFormat };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 获取元素相对于屏幕的精确位置
3
+ * @param {HTMLElement} element
4
+ * @returns {Object} 包含各种坐标系的位置信息
5
+ */
6
+ declare function getElementCoordinates(element: any): {
7
+ viewport: {
8
+ x: any;
9
+ y: any;
10
+ left: any;
11
+ top: any;
12
+ right: any;
13
+ bottom: any;
14
+ width: any;
15
+ height: any;
16
+ };
17
+ document: {
18
+ x: any;
19
+ y: any;
20
+ left: any;
21
+ top: any;
22
+ };
23
+ screen: {
24
+ x: any;
25
+ y: any;
26
+ left: any;
27
+ top: any;
28
+ };
29
+ center: {
30
+ viewport: {
31
+ x: any;
32
+ y: any;
33
+ };
34
+ screen: {
35
+ x: any;
36
+ y: any;
37
+ };
38
+ };
39
+ } | null;
40
+ export default getElementCoordinates;
@@ -12,6 +12,7 @@ import contains from './contains';
12
12
  import style from './css';
13
13
  import filter from './filterEventHandler';
14
14
  import getComputedStyle from './getComputedStyle';
15
+ import getElementCoordinates from './getElementCoordinates';
15
16
  import hasClass from './hasClass';
16
17
  import height from './height';
17
18
  import insertAfter from './insertAfter';
@@ -42,8 +43,9 @@ import toggleClass from './toggleClass';
42
43
  import transitionEnd from './transitionEnd';
43
44
  import triggerEvent from './triggerEvent';
44
45
  import width from './width';
45
- export { activeElement, addClass, addEventListener, animate, attribute, cancelAnimationFrame, childElements, childNodes, clear, closest, contains, filter, getComputedStyle, hasClass, height, insertAfter, isInput, isVisible, listen, matches, nextUntil, offset, offsetParent, ownerDocument, ownerWindow, parents, position, prepend, querySelectorAll, remove, removeClass, removeEventListener, requestAnimationFrame, scrollbarSize, scrollLeft, scrollParent, scrollTo, scrollTop, siblings, style, text, toggleClass, transitionEnd, triggerEvent, width, };
46
+ export { activeElement, addClass, addEventListener, animate, attribute, cancelAnimationFrame, childElements, childNodes, clear, closest, contains, filter, getComputedStyle, getElementCoordinates, hasClass, height, insertAfter, isInput, isVisible, listen, matches, nextUntil, offset, offsetParent, ownerDocument, ownerWindow, parents, position, prepend, querySelectorAll, remove, removeClass, removeEventListener, requestAnimationFrame, scrollbarSize, scrollLeft, scrollParent, scrollTo, scrollTop, siblings, style, text, toggleClass, transitionEnd, triggerEvent, width, };
46
47
  declare const _default: {
48
+ getElementCoordinates: typeof getElementCoordinates;
47
49
  addEventListener: typeof addEventListener;
48
50
  removeEventListener: typeof removeEventListener;
49
51
  triggerEvent: typeof triggerEvent;
@@ -0,0 +1,2 @@
1
+ export function escape(str: any): any;
2
+ export function unescape(str: any): any;
@@ -1,2 +1,2 @@
1
1
  export default fileToURL;
2
- export function fileToURL(file: any): Promise<any>;
2
+ export function fileToURL(value: any): Promise<any>;
@@ -0,0 +1,2 @@
1
+ declare function callOrReturn(value: any, ...args: any[]): any;
2
+ export { callOrReturn };
@@ -35,6 +35,33 @@ import isTypedArray from 'lodash/isTypedArray.js';
35
35
  import isUndefined from 'lodash/isUndefined.js';
36
36
  import isWeakMap from 'lodash/isWeakMap.js';
37
37
  import isWeakSet from 'lodash/isWeakSet.js';
38
+ import isAscii from './lib/isAscii';
39
+ import isBase64 from './lib/isBase64';
40
+ import isChinese, { isAllChinese } from './lib/isChinese';
41
+ import isDataURI from './lib/isDataURI';
42
+ import isEmail from './lib/isEmail';
43
+ import isFullWidth from './lib/isFullWidth';
44
+ import isHalfWidth from './lib/isHalfWidth';
45
+ import isHash from './lib/isHash';
46
+ import isHexColor from './lib/isHexColor';
47
+ import isHSL from './lib/isHSL';
48
+ import isIdentityCard from './lib/isIdentityCard';
49
+ import isIMEI from './lib/isIMEI';
50
+ import isIP from './lib/isIP';
51
+ import isIPRange from './lib/isIPRange';
52
+ import isJWT from './lib/isJWT';
53
+ import isMACAddress from './lib/isMACAddress';
54
+ import isMD5 from './lib/isMD5';
55
+ import isMimeType from './lib/isMimeType';
56
+ import isMobilePhone, { locales as isMobilePhoneLocales } from './lib/isMobilePhone';
57
+ import isPort from './lib/isPort';
58
+ import isRgbColor from './lib/isRgbColor';
59
+ import isSemVer from './lib/isSemVer';
60
+ import isSlug from './lib/isSlug';
61
+ import isStrongPassword from './lib/isStrongPassword';
62
+ import isURL from './lib/isURL';
63
+ import isUUID from './lib/isUUID';
64
+ import isVariableWidth from './lib/isVariableWidth';
38
65
  export declare function isPromise(params: any): boolean;
39
66
  export declare function isFile(params: any): boolean;
40
67
  export declare function isBlob(params: any): boolean;
@@ -51,4 +78,4 @@ export declare function isColorValue_(params: any): boolean;
51
78
  export declare function is32Bit(params: string): boolean;
52
79
  export declare function isExist(params: any): boolean;
53
80
  export declare function isWindow(params: any): boolean;
54
- export { isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, };
81
+ export { isAllChinese, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isAscii, isBase64, isBoolean, isBuffer, isChinese, isDataURI, isDate, isElement, isEmail, isEmpty, isEqual, isEqualWith, isError, isFinite, isFullWidth, isFunction, isHalfWidth, isHash, isHexColor, isHSL, isIdentityCard, isIMEI, isInteger, isIP, isIPRange, isJWT, isLength, isMACAddress, isMap, isMatch, isMatchWith, isMD5, isMimeType, isMobilePhone, isMobilePhoneLocales, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isPort, isRegExp, isRgbColor, isSafeInteger, isSemVer, isSet, isSlug, isString, isStrongPassword, isSymbol, isTypedArray, isUndefined, isURL, isUUID, isVariableWidth, isWeakMap, isWeakSet, };
@@ -0,0 +1 @@
1
+ export default function isAscii(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isBase64(str: any, options: any): boolean;
@@ -0,0 +1,4 @@
1
+ declare function isChinese(str: any): boolean;
2
+ declare function isAllChinese(str: any): boolean;
3
+ export { isAllChinese };
4
+ export default isChinese;
@@ -0,0 +1 @@
1
+ export default function isDataURI(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isEmail(str: any, options: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isFQDN(str: any, options: any): any;
@@ -0,0 +1,2 @@
1
+ export declare const fullWidth: RegExp;
2
+ export default function isFullWidth(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isHSL(str: any): boolean;
@@ -0,0 +1,2 @@
1
+ export declare const halfWidth: RegExp;
2
+ export default function isHalfWidth(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isHash(str: any, algorithm: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isHexColor(str: any, options: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isIMEI(str: any, options: any): boolean;
@@ -0,0 +1,3 @@
1
+ export default function isIP(ipAddress: any, options?: {
2
+ [key in string]: unknown;
3
+ } | number | string): any;
@@ -0,0 +1 @@
1
+ export default function isIPRange(str: any, version?: string): boolean;
@@ -0,0 +1 @@
1
+ export default function isIdentityCard(str: any, locale: any): any;
@@ -0,0 +1 @@
1
+ export default function isJWT(str: any): any;
@@ -0,0 +1 @@
1
+ export default function isMACAddress(str: any, options: any): any;
@@ -0,0 +1 @@
1
+ export default function isMD5(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isMimeType(str: any): boolean;
@@ -0,0 +1,2 @@
1
+ export default function isMobilePhone(str: any, locale: any, options: any): any;
2
+ export declare const locales: string[];
@@ -0,0 +1 @@
1
+ export default function isOctal(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isPort(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isRgbColor(str: any, options: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isSemVer(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isSlug(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isStrongPassword(str: any, options?: null): number | boolean;
@@ -0,0 +1 @@
1
+ export default function isURL(url: any, options: any): boolean;
@@ -0,0 +1 @@
1
+ export default function isUUID(str: any, version: any): any;
@@ -0,0 +1 @@
1
+ export default function isVariableWidth(str: any): boolean;
@@ -0,0 +1 @@
1
+ export default function assertString(input: any): void;
@@ -0,0 +1,4 @@
1
+ export { l as default };
2
+ declare namespace l {
3
+ function match(a: any, o: any): false | any[];
4
+ }
@@ -0,0 +1,4 @@
1
+ export { l as default };
2
+ declare namespace l {
3
+ function match(a: any, o: any): false | any[];
4
+ }
@@ -1,6 +1,7 @@
1
1
  export function plugins(...defs: any[]): typeof main & {
2
2
  plugins: typeof plugins;
3
3
  };
4
+ export { preCache } from "./preCache.js";
4
5
  export const snapdom: typeof main & {
5
6
  plugins: typeof plugins;
6
7
  };
@@ -1,9 +1,8 @@
1
- export default getItemBy;
2
- export { default as searchTree } from "./search";
1
+ export default searchTree;
3
2
  export function findNodeBy(root: any, key: any, value: any, childrenKey?: string): any;
4
3
  export function getChildWithParentBy(root: any, key: any, value: any, childrenKey?: string): null | undefined;
5
4
  export function getItemBy(root: any, key: any, value: any, childrenKey?: string, strict?: boolean): any;
6
- export function getItemBy2(root: any, key: any, value: any, childrenKey?: string): any;
7
5
  export function getItemByID(root: any, value: any): any;
8
6
  export function getLabelFromDictionaryByValue(a: any, value: any, 保底?: boolean): any;
9
- export { findNodeBy as getItemBy3 };
7
+ import searchTree from './search';
8
+ export { searchTree };
@@ -1,31 +1,29 @@
1
1
  import type { GlobalConfig, InnerValidateOptions, SchemaType, ValidateMessagesType, ValidateOptions } from './interface';
2
- import enUSValidateLocale from './locale/en-US';
3
- import zhCNValidateLocale from './locale/zh-CN';
4
- import DefaultValidateMessage from './message';
5
- import ArrayValidator from './rules/array';
6
- import BooleanValidator from './rules/boolean';
7
- import CustomValidator from './rules/custom';
8
- import NumberValidator from './rules/number';
9
- import ObjectValidator from './rules/object';
10
- import StringValidator from './rules/string';
11
- import TypeValidator from './rules/type';
12
- import { mergeTemplate } from './utils';
13
- declare const PqbValidate: {
14
- (object: unknown, options: ValidateOptions): Validate;
2
+ import validatorLocale from './locale';
3
+ import ValidatorArray from './rules/array';
4
+ import ValidatorBase from './rules/base';
5
+ import ValidatorBoolean from './rules/boolean';
6
+ import ValidatorCustom from './rules/custom';
7
+ import ValidatorNumber from './rules/number';
8
+ import ValidatorObject from './rules/object';
9
+ import ValidatorString from './rules/string';
10
+ import ValidatorType from './rules/type';
11
+ declare const PqbValidator: {
12
+ (object: unknown, options: ValidateOptions): Validator;
15
13
  globalConfig: GlobalConfig;
16
14
  setGlobalConfig(options: GlobalConfig): void;
17
15
  };
18
- declare class Validate {
19
- number: NumberValidator;
20
- string: StringValidator;
21
- array: ArrayValidator;
22
- object: ObjectValidator;
23
- boolean: BooleanValidator;
24
- type: TypeValidator;
25
- custom: CustomValidator;
26
- constructor(object: unknown, _options: InnerValidateOptions);
16
+ declare class Validator {
17
+ number: ValidatorNumber;
18
+ string: ValidatorString;
19
+ array: ValidatorArray;
20
+ object: ValidatorObject;
21
+ boolean: ValidatorBoolean;
22
+ type: ValidatorType;
23
+ custom: ValidatorCustom;
24
+ constructor(object: unknown, options_: InnerValidateOptions);
27
25
  }
28
- declare class Schema {
26
+ declare class ValidatorSchema {
29
27
  schema: SchemaType;
30
28
  options: ValidateOptions;
31
29
  constructor(schema: SchemaType, options?: ValidateOptions);
@@ -34,6 +32,6 @@ declare class Schema {
34
32
  [key: string]: unknown;
35
33
  }, callback: any): void;
36
34
  }
37
- export { ArrayValidator, BooleanValidator, CustomValidator, zhCNValidateLocale as defaultValidateLocale, DefaultValidateMessage, enUSValidateLocale, mergeTemplate, NumberValidator, ObjectValidator, Schema, StringValidator, TypeValidator, zhCNValidateLocale, };
38
- export default PqbValidate;
35
+ export { PqbValidator, Validator, ValidatorArray, ValidatorBase, ValidatorBoolean, ValidatorCustom, validatorLocale, ValidatorNumber, ValidatorObject, ValidatorSchema, ValidatorString, ValidatorType, };
36
+ export default Validator;
39
37
  export type { CustomValidatorType, GlobalConfig, InnerValidateOptions, RuleType, SchemaRuleType, SchemaType, ValidateMessagesTemplateType, ValidateMessagesType, ValidateOptions, ValidatorError, } from './interface';
@@ -1,9 +1,9 @@
1
- import ValidateMessages from './message';
2
- export type ValidateMessagesTemplateType = typeof ValidateMessages;
1
+ import locale from './locale';
2
+ export type ValidateMessagesTemplateType = typeof locale.default;
3
3
  export type ValidateMessagesType = Partial<{
4
4
  [key in keyof ValidateMessagesTemplateType]: ValidateMessagesTemplateType[key] extends string ? ValidateMessagesTemplateType[key] : Record<keyof ValidateMessagesTemplateType[key], string | ((info: any) => unknown)>;
5
5
  }>;
6
- export type RuleType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'url' | 'email' | 'ip' | 'type' | 'custom';
6
+ export type RuleType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'url' | 'email' | 'ip' | 'strongPassword' | 'port' | 'mac' | 'identity' | 'phone' | 'semver' | 'ascii' | 'halfWidth' | 'fullWidth' | 'chinese' | 'type' | 'custom';
7
7
  export type GlobalConfig = Pick<ValidateOptions, 'strict' | 'trim' | 'ignoreEmptyString' | 'validateMessages'>;
8
8
  export type ValidateOptions = {
9
9
  strict?: boolean;
@@ -12,9 +12,11 @@ export type ValidateOptions = {
12
12
  message?: unknown;
13
13
  type?: RuleType;
14
14
  validateMessages?: ValidateMessagesType;
15
+ locale?: string;
15
16
  };
16
17
  export type InnerValidateOptions = ValidateOptions & {
17
18
  field?: string;
19
+ label?: string;
18
20
  };
19
21
  export type CustomValidatorType = (value: unknown, callback: (message?: unknown) => void) => Promise<void> | void;
20
22
  export type SchemaRuleType = {