yummies 5.4.6 → 5.4.8

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 (508) hide show
  1. package/async.cjs +70 -0
  2. package/async.d.cts +28 -0
  3. package/async.d.cts.map +1 -0
  4. package/async.d.ts +28 -0
  5. package/async.d.ts.map +1 -0
  6. package/async.js +62 -0
  7. package/common.cjs +18 -0
  8. package/common.d.cts +15 -0
  9. package/common.d.cts.map +1 -0
  10. package/common.d.ts +15 -0
  11. package/common.d.ts.map +1 -0
  12. package/common.js +14 -0
  13. package/complex/counter.cjs +21 -0
  14. package/complex/counter.d.cts +15 -0
  15. package/complex/counter.d.cts.map +1 -0
  16. package/complex/counter.d.ts +15 -0
  17. package/complex/counter.d.ts.map +1 -0
  18. package/complex/counter.js +17 -0
  19. package/complex/global-config.cjs +46 -0
  20. package/complex/global-config.d.cts +11 -0
  21. package/complex/global-config.d.cts.map +1 -0
  22. package/complex/global-config.d.ts +11 -0
  23. package/complex/global-config.d.ts.map +1 -0
  24. package/complex/global-config.js +41 -0
  25. package/complex/index.cjs +19 -0
  26. package/complex/index.d.cts +4 -0
  27. package/complex/index.d.cts.map +1 -0
  28. package/complex/index.d.ts +4 -0
  29. package/complex/index.d.ts.map +1 -0
  30. package/complex/index.js +3 -0
  31. package/complex/modules-factory.cjs +50 -0
  32. package/complex/modules-factory.d.cts +49 -0
  33. package/complex/modules-factory.d.cts.map +1 -0
  34. package/complex/modules-factory.d.ts +49 -0
  35. package/complex/modules-factory.d.ts.map +1 -0
  36. package/complex/modules-factory.js +46 -0
  37. package/cookie.cjs +13 -0
  38. package/cookie.d.cts +3 -0
  39. package/cookie.d.cts.map +1 -0
  40. package/cookie.d.ts +3 -0
  41. package/cookie.d.ts.map +1 -0
  42. package/cookie.js +9 -0
  43. package/css.cjs +28 -0
  44. package/css.d.cts +36 -0
  45. package/css.d.cts.map +1 -0
  46. package/css.d.ts +36 -0
  47. package/css.d.ts.map +1 -0
  48. package/css.js +20 -0
  49. package/data.cjs +58 -0
  50. package/data.d.cts +4 -0
  51. package/data.d.cts.map +1 -0
  52. package/data.d.ts +4 -0
  53. package/data.d.ts.map +1 -0
  54. package/data.js +52 -0
  55. package/date-time.cjs +171 -0
  56. package/date-time.d.cts +28 -0
  57. package/date-time.d.cts.map +1 -0
  58. package/date-time.d.ts +28 -0
  59. package/date-time.d.ts.map +1 -0
  60. package/date-time.js +160 -0
  61. package/device.cjs +28 -0
  62. package/device.d.cts +8 -0
  63. package/device.d.cts.map +1 -0
  64. package/device.d.ts +8 -0
  65. package/device.d.ts.map +1 -0
  66. package/device.js +21 -0
  67. package/encodings.cjs +270 -0
  68. package/encodings.d.cts +2 -0
  69. package/encodings.d.cts.map +1 -0
  70. package/encodings.d.ts +2 -0
  71. package/encodings.d.ts.map +1 -0
  72. package/encodings.js +267 -0
  73. package/errors.cjs +34 -0
  74. package/errors.d.cts +19 -0
  75. package/errors.d.cts.map +1 -0
  76. package/errors.d.ts +19 -0
  77. package/errors.d.ts.map +1 -0
  78. package/errors.js +30 -0
  79. package/file.cjs +29 -0
  80. package/file.d.cts +3 -0
  81. package/file.d.cts.map +1 -0
  82. package/file.d.ts +3 -0
  83. package/file.d.ts.map +1 -0
  84. package/file.js +24 -0
  85. package/format/_exports.cjs +20 -0
  86. package/format/_exports.d.cts +5 -0
  87. package/format/_exports.d.cts.map +1 -0
  88. package/format/_exports.d.ts +5 -0
  89. package/format/_exports.d.ts.map +1 -0
  90. package/format/_exports.js +4 -0
  91. package/format/constants.cjs +6 -0
  92. package/format/constants.d.cts +4 -0
  93. package/format/constants.d.cts.map +1 -0
  94. package/format/constants.d.ts +4 -0
  95. package/format/constants.d.ts.map +1 -0
  96. package/{src/format/constants.ts → format/constants.js} +0 -2
  97. package/format/index.cjs +40 -0
  98. package/format/index.d.cts +3 -0
  99. package/format/index.d.cts.map +1 -0
  100. package/format/index.d.ts +3 -0
  101. package/format/index.d.ts.map +1 -0
  102. package/{src/format/index.ts → format/index.js} +1 -2
  103. package/format/number.cjs +48 -0
  104. package/format/number.d.cts +36 -0
  105. package/format/number.d.cts.map +1 -0
  106. package/format/number.d.ts +36 -0
  107. package/format/number.d.ts.map +1 -0
  108. package/format/number.js +44 -0
  109. package/format/percent.cjs +27 -0
  110. package/format/percent.d.cts +15 -0
  111. package/format/percent.d.cts.map +1 -0
  112. package/format/percent.d.ts +15 -0
  113. package/format/percent.d.ts.map +1 -0
  114. package/format/percent.js +23 -0
  115. package/format/skip-spaces.cjs +8 -0
  116. package/format/skip-spaces.d.cts +5 -0
  117. package/format/skip-spaces.d.cts.map +1 -0
  118. package/format/skip-spaces.d.ts +5 -0
  119. package/format/skip-spaces.d.ts.map +1 -0
  120. package/format/skip-spaces.js +4 -0
  121. package/html.cjs +202 -0
  122. package/html.d.cts +44 -0
  123. package/html.d.cts.map +1 -0
  124. package/html.d.ts +44 -0
  125. package/html.d.ts.map +1 -0
  126. package/html.js +182 -0
  127. package/id.cjs +76 -0
  128. package/id.d.cts +63 -0
  129. package/id.d.cts.map +1 -0
  130. package/id.d.ts +63 -0
  131. package/id.d.ts.map +1 -0
  132. package/{src/id.ts → id.js} +6 -16
  133. package/imports.cjs +45 -0
  134. package/imports.d.cts +15 -0
  135. package/imports.d.cts.map +1 -0
  136. package/imports.d.ts +15 -0
  137. package/imports.d.ts.map +1 -0
  138. package/imports.js +40 -0
  139. package/math.cjs +23 -0
  140. package/math.d.cts +13 -0
  141. package/math.d.cts.map +1 -0
  142. package/math.d.ts +13 -0
  143. package/math.d.ts.map +1 -0
  144. package/math.js +17 -0
  145. package/media.cjs +115 -0
  146. package/media.d.cts +20 -0
  147. package/media.d.cts.map +1 -0
  148. package/media.d.ts +20 -0
  149. package/media.d.ts.map +1 -0
  150. package/media.js +103 -0
  151. package/mobx/apply-observable.cjs +16 -0
  152. package/mobx/apply-observable.d.cts +4 -0
  153. package/mobx/apply-observable.d.cts.map +1 -0
  154. package/mobx/apply-observable.d.ts +4 -0
  155. package/mobx/apply-observable.d.ts.map +1 -0
  156. package/mobx/apply-observable.js +12 -0
  157. package/mobx/create-enhanced-atom.cjs +16 -0
  158. package/mobx/create-enhanced-atom.d.cts +11 -0
  159. package/mobx/create-enhanced-atom.d.cts.map +1 -0
  160. package/mobx/create-enhanced-atom.d.ts +11 -0
  161. package/mobx/create-enhanced-atom.d.ts.map +1 -0
  162. package/mobx/create-enhanced-atom.js +12 -0
  163. package/mobx/deep-observable-struct.cjs +61 -0
  164. package/mobx/deep-observable-struct.d.cts +7 -0
  165. package/mobx/deep-observable-struct.d.cts.map +1 -0
  166. package/mobx/deep-observable-struct.d.ts +7 -0
  167. package/mobx/deep-observable-struct.d.ts.map +1 -0
  168. package/mobx/deep-observable-struct.js +57 -0
  169. package/mobx/get-mobx-administration.cjs +6 -0
  170. package/mobx/get-mobx-administration.d.cts +6 -0
  171. package/mobx/get-mobx-administration.d.cts.map +1 -0
  172. package/mobx/get-mobx-administration.d.ts +6 -0
  173. package/mobx/get-mobx-administration.d.ts.map +1 -0
  174. package/mobx/get-mobx-administration.js +2 -0
  175. package/mobx/index.cjs +21 -0
  176. package/mobx/index.d.cts +6 -0
  177. package/mobx/index.d.cts.map +1 -0
  178. package/mobx/index.d.ts +6 -0
  179. package/mobx/index.d.ts.map +1 -0
  180. package/mobx/index.js +5 -0
  181. package/mobx/lazy-observe.cjs +47 -0
  182. package/mobx/lazy-observe.d.cts +8 -0
  183. package/mobx/lazy-observe.d.cts.map +1 -0
  184. package/mobx/lazy-observe.d.ts +8 -0
  185. package/mobx/lazy-observe.d.ts.map +1 -0
  186. package/mobx/lazy-observe.js +43 -0
  187. package/ms.cjs +22 -0
  188. package/ms.d.cts +19 -0
  189. package/ms.d.cts.map +1 -0
  190. package/ms.d.ts +19 -0
  191. package/ms.d.ts.map +1 -0
  192. package/ms.js +18 -0
  193. package/number.cjs +16 -0
  194. package/number.d.cts +8 -0
  195. package/number.d.cts.map +1 -0
  196. package/number.d.ts +8 -0
  197. package/number.d.ts.map +1 -0
  198. package/number.js +13 -0
  199. package/package.json +163 -5
  200. package/parser/_exports.cjs +19 -0
  201. package/parser/_exports.d.cts +4 -0
  202. package/parser/_exports.d.cts.map +1 -0
  203. package/parser/_exports.d.ts +4 -0
  204. package/parser/_exports.d.ts.map +1 -0
  205. package/parser/_exports.js +3 -0
  206. package/parser/index.cjs +40 -0
  207. package/parser/index.d.cts +3 -0
  208. package/parser/index.d.cts.map +1 -0
  209. package/parser/index.d.ts +3 -0
  210. package/parser/index.d.ts.map +1 -0
  211. package/{src/parser/index.ts → parser/index.js} +1 -2
  212. package/parser/number.cjs +48 -0
  213. package/parser/number.d.cts +21 -0
  214. package/parser/number.d.cts.map +1 -0
  215. package/parser/number.d.ts +21 -0
  216. package/parser/number.d.ts.map +1 -0
  217. package/parser/number.js +44 -0
  218. package/parser/percent.cjs +8 -0
  219. package/parser/percent.d.cts +4 -0
  220. package/parser/percent.d.cts.map +1 -0
  221. package/parser/percent.d.ts +4 -0
  222. package/parser/percent.d.ts.map +1 -0
  223. package/parser/percent.js +4 -0
  224. package/parser/string.cjs +18 -0
  225. package/parser/string.d.cts +7 -0
  226. package/parser/string.d.cts.map +1 -0
  227. package/parser/string.d.ts +7 -0
  228. package/parser/string.d.ts.map +1 -0
  229. package/parser/string.js +14 -0
  230. package/price.cjs +21 -0
  231. package/price.d.cts +6 -0
  232. package/price.d.cts.map +1 -0
  233. package/price.d.ts +6 -0
  234. package/price.d.ts.map +1 -0
  235. package/price.js +17 -0
  236. package/random.cjs +25 -0
  237. package/random.d.cts +9 -0
  238. package/random.d.cts.map +1 -0
  239. package/random.d.ts +9 -0
  240. package/random.d.ts.map +1 -0
  241. package/random.js +14 -0
  242. package/react/hooks/index.cjs +37 -0
  243. package/react/hooks/index.d.cts +22 -0
  244. package/react/hooks/index.d.cts.map +1 -0
  245. package/react/hooks/index.d.ts +22 -0
  246. package/react/hooks/index.d.ts.map +1 -0
  247. package/react/hooks/index.js +21 -0
  248. package/react/hooks/use-abort-controller.cjs +15 -0
  249. package/react/hooks/use-abort-controller.d.cts +2 -0
  250. package/react/hooks/use-abort-controller.d.cts.map +1 -0
  251. package/react/hooks/use-abort-controller.d.ts +2 -0
  252. package/react/hooks/use-abort-controller.d.ts.map +1 -0
  253. package/react/hooks/use-abort-controller.js +11 -0
  254. package/react/hooks/use-abort-signal.cjs +8 -0
  255. package/react/hooks/use-abort-signal.d.cts +2 -0
  256. package/react/hooks/use-abort-signal.d.cts.map +1 -0
  257. package/react/hooks/use-abort-signal.d.ts +2 -0
  258. package/react/hooks/use-abort-signal.d.ts.map +1 -0
  259. package/react/hooks/use-abort-signal.js +4 -0
  260. package/react/hooks/use-click-outside.cjs +17 -0
  261. package/react/hooks/use-click-outside.d.cts +9 -0
  262. package/react/hooks/use-click-outside.d.cts.map +1 -0
  263. package/react/hooks/use-click-outside.d.ts +9 -0
  264. package/react/hooks/use-click-outside.d.ts.map +1 -0
  265. package/react/hooks/use-click-outside.js +13 -0
  266. package/react/hooks/use-constant.cjs +19 -0
  267. package/react/hooks/use-constant.d.cts +9 -0
  268. package/react/hooks/use-constant.d.cts.map +1 -0
  269. package/react/hooks/use-constant.d.ts +9 -0
  270. package/react/hooks/use-constant.d.ts.map +1 -0
  271. package/{src/react/hooks/use-constant.ts → react/hooks/use-constant.js} +6 -9
  272. package/react/hooks/use-define-ref.cjs +19 -0
  273. package/react/hooks/use-define-ref.d.cts +10 -0
  274. package/react/hooks/use-define-ref.d.cts.map +1 -0
  275. package/react/hooks/use-define-ref.d.ts +10 -0
  276. package/react/hooks/use-define-ref.d.ts.map +1 -0
  277. package/{src/react/hooks/use-define-ref.ts → react/hooks/use-define-ref.js} +7 -10
  278. package/react/hooks/use-element-ref.cjs +12 -0
  279. package/react/hooks/use-element-ref.d.cts +2 -0
  280. package/react/hooks/use-element-ref.d.cts.map +1 -0
  281. package/react/hooks/use-element-ref.d.ts +2 -0
  282. package/react/hooks/use-element-ref.d.ts.map +1 -0
  283. package/react/hooks/use-element-ref.js +8 -0
  284. package/react/hooks/use-event-listener.cjs +17 -0
  285. package/react/hooks/use-event-listener.d.cts +8 -0
  286. package/react/hooks/use-event-listener.d.cts.map +1 -0
  287. package/react/hooks/use-event-listener.d.ts +8 -0
  288. package/react/hooks/use-event-listener.d.ts.map +1 -0
  289. package/react/hooks/use-event-listener.js +13 -0
  290. package/react/hooks/use-event.cjs +23 -0
  291. package/react/hooks/use-event.d.cts +3 -0
  292. package/react/hooks/use-event.d.cts.map +1 -0
  293. package/react/hooks/use-event.d.ts +3 -0
  294. package/react/hooks/use-event.d.ts.map +1 -0
  295. package/react/hooks/use-event.js +19 -0
  296. package/react/hooks/use-flag.cjs +19 -0
  297. package/react/hooks/use-flag.d.cts +8 -0
  298. package/react/hooks/use-flag.d.cts.map +1 -0
  299. package/react/hooks/use-flag.d.ts +8 -0
  300. package/react/hooks/use-flag.d.ts.map +1 -0
  301. package/react/hooks/use-flag.js +15 -0
  302. package/react/hooks/use-force-update.cjs +11 -0
  303. package/react/hooks/use-force-update.d.cts +2 -0
  304. package/react/hooks/use-force-update.d.cts.map +1 -0
  305. package/react/hooks/use-force-update.d.ts +2 -0
  306. package/react/hooks/use-force-update.d.ts.map +1 -0
  307. package/react/hooks/use-force-update.js +7 -0
  308. package/react/hooks/use-initial-height.cjs +15 -0
  309. package/react/hooks/use-initial-height.d.cts +5 -0
  310. package/react/hooks/use-initial-height.d.cts.map +1 -0
  311. package/react/hooks/use-initial-height.d.ts +5 -0
  312. package/react/hooks/use-initial-height.d.ts.map +1 -0
  313. package/react/hooks/use-initial-height.js +11 -0
  314. package/react/hooks/use-instance.cjs +31 -0
  315. package/react/hooks/use-instance.d.cts +27 -0
  316. package/react/hooks/use-instance.d.cts.map +1 -0
  317. package/react/hooks/use-instance.d.ts +27 -0
  318. package/react/hooks/use-instance.d.ts.map +1 -0
  319. package/{src/react/hooks/use-instance.ts → react/hooks/use-instance.js} +9 -31
  320. package/react/hooks/use-intersection-observer.cjs +14 -0
  321. package/react/hooks/use-intersection-observer.d.cts +2 -0
  322. package/react/hooks/use-intersection-observer.d.cts.map +1 -0
  323. package/react/hooks/use-intersection-observer.d.ts +2 -0
  324. package/react/hooks/use-intersection-observer.d.ts.map +1 -0
  325. package/react/hooks/use-intersection-observer.js +10 -0
  326. package/react/hooks/use-last-defined-value.cjs +12 -0
  327. package/react/hooks/use-last-defined-value.d.cts +2 -0
  328. package/react/hooks/use-last-defined-value.d.cts.map +1 -0
  329. package/react/hooks/use-last-defined-value.d.ts +2 -0
  330. package/react/hooks/use-last-defined-value.d.ts.map +1 -0
  331. package/react/hooks/use-last-defined-value.js +8 -0
  332. package/react/hooks/use-last-value-ref.cjs +12 -0
  333. package/react/hooks/use-last-value-ref.d.cts +2 -0
  334. package/react/hooks/use-last-value-ref.d.cts.map +1 -0
  335. package/react/hooks/use-last-value-ref.d.ts +2 -0
  336. package/react/hooks/use-last-value-ref.d.ts.map +1 -0
  337. package/react/hooks/use-last-value-ref.js +8 -0
  338. package/react/hooks/use-life-cycle.cjs +14 -0
  339. package/react/hooks/use-life-cycle.d.cts +5 -0
  340. package/react/hooks/use-life-cycle.d.cts.map +1 -0
  341. package/react/hooks/use-life-cycle.d.ts +5 -0
  342. package/react/hooks/use-life-cycle.d.ts.map +1 -0
  343. package/react/hooks/use-life-cycle.js +10 -0
  344. package/react/hooks/use-resize-observer.cjs +15 -0
  345. package/react/hooks/use-resize-observer.d.cts +2 -0
  346. package/react/hooks/use-resize-observer.d.cts.map +1 -0
  347. package/react/hooks/use-resize-observer.d.ts +2 -0
  348. package/react/hooks/use-resize-observer.d.ts.map +1 -0
  349. package/react/hooks/use-resize-observer.js +11 -0
  350. package/react/hooks/use-sync-ref.cjs +10 -0
  351. package/react/hooks/use-sync-ref.d.cts +2 -0
  352. package/react/hooks/use-sync-ref.d.cts.map +1 -0
  353. package/react/hooks/use-sync-ref.d.ts +2 -0
  354. package/react/hooks/use-sync-ref.d.ts.map +1 -0
  355. package/react/hooks/use-sync-ref.js +6 -0
  356. package/react/hooks/use-toggle.cjs +10 -0
  357. package/react/hooks/use-toggle.d.cts +2 -0
  358. package/react/hooks/use-toggle.d.cts.map +1 -0
  359. package/react/hooks/use-toggle.d.ts +2 -0
  360. package/react/hooks/use-toggle.d.ts.map +1 -0
  361. package/react/hooks/use-toggle.js +6 -0
  362. package/react/hooks/use-value.cjs +12 -0
  363. package/react/hooks/use-value.d.cts +5 -0
  364. package/react/hooks/use-value.d.cts.map +1 -0
  365. package/react/hooks/use-value.d.ts +5 -0
  366. package/react/hooks/use-value.d.ts.map +1 -0
  367. package/react/hooks/use-value.js +8 -0
  368. package/react/hooks/use-visibility-state.cjs +18 -0
  369. package/react/hooks/use-visibility-state.d.cts +2 -0
  370. package/react/hooks/use-visibility-state.d.cts.map +1 -0
  371. package/react/hooks/use-visibility-state.d.ts +2 -0
  372. package/react/hooks/use-visibility-state.d.ts.map +1 -0
  373. package/react/hooks/use-visibility-state.js +14 -0
  374. package/react/index.cjs +17 -0
  375. package/react/index.d.cts +2 -0
  376. package/react/index.d.cts.map +1 -0
  377. package/react/index.d.ts +2 -0
  378. package/react/index.d.ts.map +1 -0
  379. package/react/index.js +1 -0
  380. package/sound.cjs +16 -0
  381. package/sound.d.cts +7 -0
  382. package/sound.d.cts.map +1 -0
  383. package/sound.d.ts +7 -0
  384. package/sound.d.ts.map +1 -0
  385. package/sound.js +12 -0
  386. package/storage.cjs +48 -0
  387. package/storage.d.cts +39 -0
  388. package/storage.d.cts.map +1 -0
  389. package/storage.d.ts +39 -0
  390. package/storage.d.ts.map +1 -0
  391. package/storage.js +43 -0
  392. package/text.cjs +53 -0
  393. package/text.d.cts +15 -0
  394. package/text.d.cts.map +1 -0
  395. package/text.d.ts +15 -0
  396. package/text.d.ts.map +1 -0
  397. package/text.js +48 -0
  398. package/type-guard/_exports.cjs +129 -0
  399. package/type-guard/_exports.d.cts +86 -0
  400. package/type-guard/_exports.d.cts.map +1 -0
  401. package/type-guard/_exports.d.ts +86 -0
  402. package/type-guard/_exports.d.ts.map +1 -0
  403. package/type-guard/_exports.js +125 -0
  404. package/type-guard/index.cjs +40 -0
  405. package/type-guard/index.d.cts +3 -0
  406. package/type-guard/index.d.cts.map +1 -0
  407. package/type-guard/index.d.ts +3 -0
  408. package/type-guard/index.d.ts.map +1 -0
  409. package/{src/type-guard/index.ts → type-guard/index.js} +1 -2
  410. package/utility-types.d.ts +396 -0
  411. package/utils/types.cjs +2 -0
  412. package/utils/types.d.cts +395 -0
  413. package/utils/types.d.cts.map +1 -0
  414. package/utils/types.d.ts +395 -0
  415. package/utils/types.d.ts.map +1 -0
  416. package/utils/types.js +1 -0
  417. package/vibrate.cjs +12 -0
  418. package/vibrate.d.cts +5 -0
  419. package/vibrate.d.cts.map +1 -0
  420. package/vibrate.d.ts +5 -0
  421. package/vibrate.d.ts.map +1 -0
  422. package/vibrate.js +8 -0
  423. package/.changeset/README.md +0 -8
  424. package/.changeset/config.json +0 -11
  425. package/.github/FUNDING.yml +0 -1
  426. package/.github/workflows/main.yml +0 -34
  427. package/.github/workflows/version-or-publish.yml +0 -45
  428. package/.nvmrc +0 -1
  429. package/.vscode/settings.json +0 -19
  430. package/CHANGELOG.md +0 -215
  431. package/CONTRIBUTING.md +0 -8
  432. package/Makefile +0 -7
  433. package/biome.json +0 -3
  434. package/commitfmt.toml +0 -18
  435. package/lefthook.yml +0 -14
  436. package/scripts/post-build.ts +0 -71
  437. package/src/async.ts +0 -86
  438. package/src/common.ts +0 -26
  439. package/src/complex/counter.test.ts +0 -41
  440. package/src/complex/counter.ts +0 -40
  441. package/src/complex/global-config.ts +0 -55
  442. package/src/complex/index.ts +0 -3
  443. package/src/complex/modules-factory.ts +0 -65
  444. package/src/cookie.ts +0 -11
  445. package/src/css.ts +0 -60
  446. package/src/data.test.ts +0 -99
  447. package/src/data.ts +0 -65
  448. package/src/date-time.test.ts +0 -119
  449. package/src/date-time.ts +0 -236
  450. package/src/device.ts +0 -42
  451. package/src/encodings.ts +0 -270
  452. package/src/errors.ts +0 -40
  453. package/src/file.ts +0 -25
  454. package/src/format/_exports.ts +0 -4
  455. package/src/format/number.test.ts +0 -16
  456. package/src/format/number.ts +0 -96
  457. package/src/format/percent.ts +0 -40
  458. package/src/format/skip-spaces.ts +0 -4
  459. package/src/html.ts +0 -238
  460. package/src/imports.ts +0 -52
  461. package/src/math.ts +0 -20
  462. package/src/media.ts +0 -134
  463. package/src/mobx/apply-observable.ts +0 -20
  464. package/src/mobx/create-enhanced-atom.ts +0 -28
  465. package/src/mobx/deep-observable-struct.test.ts +0 -69
  466. package/src/mobx/deep-observable-struct.ts +0 -69
  467. package/src/mobx/get-mobx-administration.ts +0 -10
  468. package/src/mobx/index.ts +0 -5
  469. package/src/mobx/lazy-observe.ts +0 -59
  470. package/src/ms.ts +0 -20
  471. package/src/number.ts +0 -14
  472. package/src/parser/_exports.ts +0 -3
  473. package/src/parser/number.test.ts +0 -38
  474. package/src/parser/number.ts +0 -73
  475. package/src/parser/percent.ts +0 -11
  476. package/src/parser/string.ts +0 -29
  477. package/src/price.ts +0 -33
  478. package/src/random.ts +0 -27
  479. package/src/react/hooks/index.ts +0 -21
  480. package/src/react/hooks/use-abort-controller.ts +0 -15
  481. package/src/react/hooks/use-abort-signal.ts +0 -5
  482. package/src/react/hooks/use-click-outside.ts +0 -27
  483. package/src/react/hooks/use-element-ref.ts +0 -11
  484. package/src/react/hooks/use-event-listener.ts +0 -29
  485. package/src/react/hooks/use-event.ts +0 -23
  486. package/src/react/hooks/use-flag.ts +0 -27
  487. package/src/react/hooks/use-force-update.ts +0 -9
  488. package/src/react/hooks/use-initial-height.ts +0 -16
  489. package/src/react/hooks/use-intersection-observer.ts +0 -18
  490. package/src/react/hooks/use-last-defined-value.ts +0 -9
  491. package/src/react/hooks/use-last-value-ref.ts +0 -11
  492. package/src/react/hooks/use-life-cycle.ts +0 -17
  493. package/src/react/hooks/use-resize-observer.ts +0 -14
  494. package/src/react/hooks/use-sync-ref.ts +0 -7
  495. package/src/react/hooks/use-toggle.ts +0 -9
  496. package/src/react/hooks/use-value.ts +0 -10
  497. package/src/react/hooks/use-visibility-state.ts +0 -19
  498. package/src/react/index.ts +0 -1
  499. package/src/sound.ts +0 -15
  500. package/src/storage.ts +0 -137
  501. package/src/text.test.ts +0 -91
  502. package/src/text.ts +0 -60
  503. package/src/type-guard/_exports.ts +0 -154
  504. package/src/type-guard/index.test.ts +0 -127
  505. package/src/vibrate.ts +0 -8
  506. package/tsconfig.json +0 -26
  507. package/tsconfig.test.json +0 -33
  508. package/vitest.config.ts +0 -20
package/html.js ADDED
@@ -0,0 +1,182 @@
1
+ import DOMPurify from 'dompurify';
2
+ import { blobToUrl } from "./media.js";
3
+ /**
4
+ * Вытаскивает RGB из любого цвета
5
+ *
6
+ * Не рекомендуется к использованию так как вызывает reflow
7
+ */
8
+ export const getComputedColor = (color) => {
9
+ if (!color)
10
+ return null;
11
+ const d = document.createElement('div');
12
+ d.style.color = color;
13
+ document.body.append(d);
14
+ const rgbcolor = globalThis.getComputedStyle(d).color;
15
+ const match = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(rgbcolor);
16
+ d.remove();
17
+ if (!match)
18
+ return null;
19
+ return `${match[1]}, ${match[2]}, ${match[3]}`;
20
+ };
21
+ export const downloadUsingAnchor = (urlOrBlob, fileName) => {
22
+ const url = blobToUrl(urlOrBlob);
23
+ const a = document.createElement('a');
24
+ a.href = url;
25
+ a.download = fileName ?? 'file';
26
+ a.target = '_blank';
27
+ document.body.append(a);
28
+ a.click();
29
+ a.remove();
30
+ };
31
+ /**
32
+ * Surrounds string in an anchor tag
33
+ */
34
+ export function wrapTextToTagLink(link) {
35
+ const descr = String(link).replace(/^(https?:\/{0,2})?(w{3}\.)?/, 'www.');
36
+ if (!/^https?:\/{2}/.test(link))
37
+ link = `http://${link}`;
38
+ return `<a href=${link} target="_blank">${descr}</a>`;
39
+ }
40
+ export const collectOffsetTop = (element) => {
41
+ let offsetTop = 0;
42
+ let node = element;
43
+ while (node != null) {
44
+ offsetTop += node.offsetTop;
45
+ node = node.parentElement;
46
+ }
47
+ return offsetTop;
48
+ };
49
+ export const skipEvent = (e) => {
50
+ e.preventDefault();
51
+ e.stopPropagation();
52
+ return false;
53
+ };
54
+ export const globalScrollIntoViewForY = (node) => {
55
+ const scrollContainer = document.body;
56
+ const pageHeight = window.innerHeight;
57
+ const nodeBounding = node.getBoundingClientRect();
58
+ const scrollPagesCount = scrollContainer.scrollHeight / pageHeight;
59
+ const scrollPageNumber = Math.min(Math.max(nodeBounding.top / pageHeight, 1), scrollPagesCount);
60
+ window.scroll({
61
+ top: scrollPageNumber * pageHeight,
62
+ behavior: 'smooth',
63
+ });
64
+ };
65
+ const sanitizeDefaults = {
66
+ ALLOWED_TAGS: [
67
+ 'a',
68
+ 'article',
69
+ 'b',
70
+ 'blockquote',
71
+ 'br',
72
+ 'caption',
73
+ 'code',
74
+ 'del',
75
+ 'details',
76
+ 'div',
77
+ 'em',
78
+ 'h1',
79
+ 'h2',
80
+ 'h3',
81
+ 'h4',
82
+ 'h5',
83
+ 'h6',
84
+ 'hr',
85
+ 'i',
86
+ 'img',
87
+ 'ins',
88
+ 'kbd',
89
+ 'li',
90
+ 'main',
91
+ 'ol',
92
+ 'p',
93
+ 'pre',
94
+ 'section',
95
+ 'span',
96
+ 'strong',
97
+ 'sub',
98
+ 'summary',
99
+ 'sup',
100
+ 'table',
101
+ 'tbody',
102
+ 'td',
103
+ 'th',
104
+ 'thead',
105
+ 'tr',
106
+ 'u',
107
+ 'ul',
108
+ ],
109
+ ALLOWED_ATTR: ['href', 'target', 'name', 'src', 'class'],
110
+ };
111
+ export const sanitizeHtml = (html, config) => {
112
+ return DOMPurify.sanitize(html || '', {
113
+ ...sanitizeDefaults,
114
+ ...config,
115
+ });
116
+ };
117
+ export const checkElementHasParent = (element, parent) => {
118
+ let node = element;
119
+ if (!parent)
120
+ return false;
121
+ while (node != null) {
122
+ if (node === parent) {
123
+ return true;
124
+ }
125
+ else {
126
+ node = node.parentElement;
127
+ }
128
+ }
129
+ return false;
130
+ };
131
+ /**
132
+ * Executes a function within a view transition if supported by the browser.
133
+ *
134
+ * @param {VoidFunction} fn - The function to be executed.
135
+ * @returns {ViewTransition} - The result of the executed function.
136
+ *
137
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
138
+ */
139
+ export const startViewTransitionSafety = (fn, params) => {
140
+ if (document.startViewTransition && !params?.disabled) {
141
+ return document.startViewTransition(fn);
142
+ }
143
+ fn();
144
+ };
145
+ /**
146
+ * Вычисляет размер скроллбара
147
+ */
148
+ export const calcScrollbarWidth = () => {
149
+ const outer = document.createElement('div');
150
+ outer.style.visibility = 'hidden';
151
+ outer.style.width = '100px';
152
+ outer.style.overflow = 'scroll';
153
+ document.body.append(outer);
154
+ const inner = document.createElement('div');
155
+ inner.style.width = '100%';
156
+ outer.append(inner);
157
+ const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
158
+ outer.parentNode?.removeChild(outer);
159
+ return scrollbarWidth;
160
+ };
161
+ /**
162
+ * Calculates the inner height of an HTML element, accounting for padding.
163
+ */
164
+ export function getElementInnerHeight(element) {
165
+ const { clientHeight } = element;
166
+ const { paddingTop, paddingBottom } = getComputedStyle(element);
167
+ return (clientHeight -
168
+ Number.parseFloat(paddingTop) -
169
+ Number.parseFloat(paddingBottom));
170
+ }
171
+ /**
172
+ * Calculates the inner width of an HTML element, accounting for padding.
173
+ */
174
+ export function getElementInnerWidth(el) {
175
+ const { clientWidth } = el;
176
+ const { paddingLeft, paddingRight } = getComputedStyle(el);
177
+ return (clientWidth -
178
+ Number.parseFloat(paddingLeft) -
179
+ Number.parseFloat(paddingRight));
180
+ }
181
+ export const isPrefersDarkTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches;
182
+ export const isPrefersLightTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: light)')?.matches;
package/id.cjs ADDED
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateStackBasedId = exports.generateLinearNumericId = exports.createLinearNumericIdGenerator = exports.generateNumericShortId = exports.generateNumericId = exports.generateShortId = exports.generateId = void 0;
4
+ const nanoid_1 = require("nanoid");
5
+ const DIGITS = '0123456789';
6
+ const LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';
7
+ const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
8
+ /**
9
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
10
+ * Размер 6
11
+ */
12
+ exports.generateId = (0, nanoid_1.customAlphabet)(ALPHABET, 6);
13
+ /**
14
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
15
+ * Размер 4
16
+ */
17
+ exports.generateShortId = (0, nanoid_1.customAlphabet)(ALPHABET, 4);
18
+ /**
19
+ * Использует алфавит 0123456789
20
+ * Размер 6
21
+ */
22
+ exports.generateNumericId = (0, nanoid_1.customAlphabet)(DIGITS, 6);
23
+ /**
24
+ * Использует алфавит 0123456789
25
+ * Размер 4
26
+ */
27
+ exports.generateNumericShortId = (0, nanoid_1.customAlphabet)(DIGITS, 4);
28
+ /**
29
+ * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * generateLinearNumericId = createLinearNumericIdGenerator(6);
34
+ * generateLinearNumericId() // '000000'
35
+ * generateLinearNumericId() // '000001'
36
+ * ...
37
+ * generateLinearNumericId() // '999999'
38
+ * generateLinearNumericId() // '1000000'
39
+ * ...
40
+ * generateLinearNumericId() // '9999999'
41
+ * generateLinearNumericId() // '10000000'
42
+ * ```
43
+ *
44
+ * @param size размер
45
+ * @returns {()=>string}
46
+ */
47
+ const createLinearNumericIdGenerator = (size = 9) => {
48
+ let lastCount = 0;
49
+ return () => {
50
+ return (lastCount++).toString().padStart(size, '0');
51
+ };
52
+ };
53
+ exports.createLinearNumericIdGenerator = createLinearNumericIdGenerator;
54
+ /**
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * generateLinearNumericId() // '000000000'
59
+ * generateLinearNumericId() // '000000001'
60
+ * ...
61
+ * generateLinearNumericId() // '999999999'
62
+ * generateLinearNumericId() // '1000000000'
63
+ * ...
64
+ * generateLinearNumericId() // '9999999999'
65
+ * generateLinearNumericId() // '10000000000'
66
+ * ```
67
+ *
68
+ */
69
+ exports.generateLinearNumericId = (0, exports.createLinearNumericIdGenerator)();
70
+ /**
71
+ * Is not recommended to use.
72
+ *
73
+ * Generates execution stack based pseudo-id (just sliced string from error stack)
74
+ */
75
+ const generateStackBasedId = () => new Error().stack.split('\n').slice(1, 4).join('');
76
+ exports.generateStackBasedId = generateStackBasedId;
package/id.d.cts ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
3
+ * Размер 6
4
+ */
5
+ export declare const generateId: (size?: number) => string;
6
+ /**
7
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
8
+ * Размер 4
9
+ */
10
+ export declare const generateShortId: (size?: number) => string;
11
+ /**
12
+ * Использует алфавит 0123456789
13
+ * Размер 6
14
+ */
15
+ export declare const generateNumericId: (size?: number) => string;
16
+ /**
17
+ * Использует алфавит 0123456789
18
+ * Размер 4
19
+ */
20
+ export declare const generateNumericShortId: (size?: number) => string;
21
+ /**
22
+ * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * generateLinearNumericId = createLinearNumericIdGenerator(6);
27
+ * generateLinearNumericId() // '000000'
28
+ * generateLinearNumericId() // '000001'
29
+ * ...
30
+ * generateLinearNumericId() // '999999'
31
+ * generateLinearNumericId() // '1000000'
32
+ * ...
33
+ * generateLinearNumericId() // '9999999'
34
+ * generateLinearNumericId() // '10000000'
35
+ * ```
36
+ *
37
+ * @param size размер
38
+ * @returns {()=>string}
39
+ */
40
+ export declare const createLinearNumericIdGenerator: (size?: number) => () => string;
41
+ /**
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * generateLinearNumericId() // '000000000'
46
+ * generateLinearNumericId() // '000000001'
47
+ * ...
48
+ * generateLinearNumericId() // '999999999'
49
+ * generateLinearNumericId() // '1000000000'
50
+ * ...
51
+ * generateLinearNumericId() // '9999999999'
52
+ * generateLinearNumericId() // '10000000000'
53
+ * ```
54
+ *
55
+ */
56
+ export declare const generateLinearNumericId: () => string;
57
+ /**
58
+ * Is not recommended to use.
59
+ *
60
+ * Generates execution stack based pseudo-id (just sliced string from error stack)
61
+ */
62
+ export declare const generateStackBasedId: () => string;
63
+ //# sourceMappingURL=id.d.ts.map
package/id.d.cts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,UAAU,2BAA8B,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,eAAe,2BAA8B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2BAA4B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAM,MAAU,iBAK9D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,cAAmC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,cACoB,CAAC"}
package/id.d.ts ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
3
+ * Размер 6
4
+ */
5
+ export declare const generateId: (size?: number) => string;
6
+ /**
7
+ * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
8
+ * Размер 4
9
+ */
10
+ export declare const generateShortId: (size?: number) => string;
11
+ /**
12
+ * Использует алфавит 0123456789
13
+ * Размер 6
14
+ */
15
+ export declare const generateNumericId: (size?: number) => string;
16
+ /**
17
+ * Использует алфавит 0123456789
18
+ * Размер 4
19
+ */
20
+ export declare const generateNumericShortId: (size?: number) => string;
21
+ /**
22
+ * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * generateLinearNumericId = createLinearNumericIdGenerator(6);
27
+ * generateLinearNumericId() // '000000'
28
+ * generateLinearNumericId() // '000001'
29
+ * ...
30
+ * generateLinearNumericId() // '999999'
31
+ * generateLinearNumericId() // '1000000'
32
+ * ...
33
+ * generateLinearNumericId() // '9999999'
34
+ * generateLinearNumericId() // '10000000'
35
+ * ```
36
+ *
37
+ * @param size размер
38
+ * @returns {()=>string}
39
+ */
40
+ export declare const createLinearNumericIdGenerator: (size?: number) => () => string;
41
+ /**
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * generateLinearNumericId() // '000000000'
46
+ * generateLinearNumericId() // '000000001'
47
+ * ...
48
+ * generateLinearNumericId() // '999999999'
49
+ * generateLinearNumericId() // '1000000000'
50
+ * ...
51
+ * generateLinearNumericId() // '9999999999'
52
+ * generateLinearNumericId() // '10000000000'
53
+ * ```
54
+ *
55
+ */
56
+ export declare const generateLinearNumericId: () => string;
57
+ /**
58
+ * Is not recommended to use.
59
+ *
60
+ * Generates execution stack based pseudo-id (just sliced string from error stack)
61
+ */
62
+ export declare const generateStackBasedId: () => string;
63
+ //# sourceMappingURL=id.d.ts.map
package/id.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,UAAU,2BAA8B,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,eAAe,2BAA8B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2BAA4B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAM,MAAU,iBAK9D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,cAAmC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,cACoB,CAAC"}
@@ -1,34 +1,27 @@
1
1
  import { customAlphabet } from 'nanoid';
2
-
3
2
  const DIGITS = '0123456789';
4
3
  const LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';
5
-
6
4
  const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
7
-
8
5
  /**
9
6
  * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
10
7
  * Размер 6
11
8
  */
12
9
  export const generateId = customAlphabet(ALPHABET, 6);
13
-
14
10
  /**
15
11
  * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
16
12
  * Размер 4
17
13
  */
18
14
  export const generateShortId = customAlphabet(ALPHABET, 4);
19
-
20
15
  /**
21
16
  * Использует алфавит 0123456789
22
17
  * Размер 6
23
18
  */
24
19
  export const generateNumericId = customAlphabet(DIGITS, 6);
25
-
26
20
  /**
27
21
  * Использует алфавит 0123456789
28
22
  * Размер 4
29
23
  */
30
24
  export const generateNumericShortId = customAlphabet(DIGITS, 4);
31
-
32
25
  /**
33
26
  * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
34
27
  *
@@ -48,13 +41,12 @@ export const generateNumericShortId = customAlphabet(DIGITS, 4);
48
41
  * @param size размер
49
42
  * @returns {()=>string}
50
43
  */
51
- export const createLinearNumericIdGenerator = (size: number = 9) => {
52
- let lastCount = 0;
53
- return () => {
54
- return (lastCount++).toString().padStart(size, '0');
55
- };
44
+ export const createLinearNumericIdGenerator = (size = 9) => {
45
+ let lastCount = 0;
46
+ return () => {
47
+ return (lastCount++).toString().padStart(size, '0');
48
+ };
56
49
  };
57
-
58
50
  /**
59
51
  *
60
52
  * @example
@@ -71,11 +63,9 @@ export const createLinearNumericIdGenerator = (size: number = 9) => {
71
63
  *
72
64
  */
73
65
  export const generateLinearNumericId = createLinearNumericIdGenerator();
74
-
75
66
  /**
76
67
  * Is not recommended to use.
77
68
  *
78
69
  * Generates execution stack based pseudo-id (just sliced string from error stack)
79
70
  */
80
- export const generateStackBasedId = () =>
81
- new Error().stack!.split('\n').slice(1, 4).join('');
71
+ export const generateStackBasedId = () => new Error().stack.split('\n').slice(1, 4).join('');
package/imports.cjs ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unpackAsyncModule = exports.fetchLazyModule = void 0;
4
+ const async_js_1 = require("./async.cjs");
5
+ /**
6
+ * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток
7
+ * @example
8
+ * ```ts
9
+ * fetchLazyModule(() => import("./test.ts"), 3) // начнет загрузку test.ts
10
+ * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()
11
+ * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)
12
+ * ```
13
+ */
14
+ const fetchLazyModule = async (fetchModule, attempts = 3, delay = 1000) => {
15
+ const attemptsArray = Array.from({
16
+ length: attempts,
17
+ }).fill(fetchModule);
18
+ let lastError = null;
19
+ for await (const attempt of attemptsArray) {
20
+ try {
21
+ if (lastError !== null) {
22
+ await (0, async_js_1.sleep)(delay);
23
+ }
24
+ return await attempt();
25
+ }
26
+ catch (error) {
27
+ lastError = error;
28
+ }
29
+ }
30
+ throw lastError;
31
+ };
32
+ exports.fetchLazyModule = fetchLazyModule;
33
+ const unpackAsyncModule = async (maybeModule) => {
34
+ if (maybeModule instanceof Promise) {
35
+ const data = (await maybeModule);
36
+ if (data.default) {
37
+ return data.default;
38
+ }
39
+ else {
40
+ return data;
41
+ }
42
+ }
43
+ return maybeModule;
44
+ };
45
+ exports.unpackAsyncModule = unpackAsyncModule;
package/imports.d.cts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток
3
+ * @example
4
+ * ```ts
5
+ * fetchLazyModule(() => import("./test.ts"), 3) // начнет загрузку test.ts
6
+ * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()
7
+ * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)
8
+ * ```
9
+ */
10
+ export declare const fetchLazyModule: <T>(fetchModule: () => Promise<T>, attempts?: number, delay?: number) => Promise<T>;
11
+ export type PackedAsyncModule<T> = Promise<T | {
12
+ default: T;
13
+ }>;
14
+ export declare const unpackAsyncModule: <T>(maybeModule: T | PackedAsyncModule<T>) => Promise<T>;
15
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EACrC,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,EAC7B,iBAAY,EACZ,cAAY,KACX,OAAO,CAAC,CAAC,CAkBX,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB,GAAU,CAAC,EACvC,aAAa,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpC,OAAO,CAAC,CAAC,CAYX,CAAC"}
package/imports.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток
3
+ * @example
4
+ * ```ts
5
+ * fetchLazyModule(() => import("./test.ts"), 3) // начнет загрузку test.ts
6
+ * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()
7
+ * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)
8
+ * ```
9
+ */
10
+ export declare const fetchLazyModule: <T>(fetchModule: () => Promise<T>, attempts?: number, delay?: number) => Promise<T>;
11
+ export type PackedAsyncModule<T> = Promise<T | {
12
+ default: T;
13
+ }>;
14
+ export declare const unpackAsyncModule: <T>(maybeModule: T | PackedAsyncModule<T>) => Promise<T>;
15
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EACrC,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,EAC7B,iBAAY,EACZ,cAAY,KACX,OAAO,CAAC,CAAC,CAkBX,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB,GAAU,CAAC,EACvC,aAAa,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpC,OAAO,CAAC,CAAC,CAYX,CAAC"}
package/imports.js ADDED
@@ -0,0 +1,40 @@
1
+ import { sleep } from "./async.js";
2
+ /**
3
+ * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток
4
+ * @example
5
+ * ```ts
6
+ * fetchLazyModule(() => import("./test.ts"), 3) // начнет загрузку test.ts
7
+ * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()
8
+ * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)
9
+ * ```
10
+ */
11
+ export const fetchLazyModule = async (fetchModule, attempts = 3, delay = 1000) => {
12
+ const attemptsArray = Array.from({
13
+ length: attempts,
14
+ }).fill(fetchModule);
15
+ let lastError = null;
16
+ for await (const attempt of attemptsArray) {
17
+ try {
18
+ if (lastError !== null) {
19
+ await sleep(delay);
20
+ }
21
+ return await attempt();
22
+ }
23
+ catch (error) {
24
+ lastError = error;
25
+ }
26
+ }
27
+ throw lastError;
28
+ };
29
+ export const unpackAsyncModule = async (maybeModule) => {
30
+ if (maybeModule instanceof Promise) {
31
+ const data = (await maybeModule);
32
+ if (data.default) {
33
+ return data.default;
34
+ }
35
+ else {
36
+ return data;
37
+ }
38
+ }
39
+ return maybeModule;
40
+ };
package/math.cjs ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.percentFrom = void 0;
4
+ exports.degToRad = degToRad;
5
+ exports.radToDeg = radToDeg;
6
+ function degToRad(deg) {
7
+ return deg * (Math.PI / 180);
8
+ }
9
+ function radToDeg(rad) {
10
+ return rad * (180 / Math.PI);
11
+ }
12
+ /**
13
+ * Получить процент от числа
14
+ * @example
15
+ * ```ts
16
+ * percentFrom(500, 2000) // 25
17
+ * percentFrom(1000, 2000) // 50
18
+ * ```
19
+ */
20
+ const percentFrom = (value, from) => {
21
+ return ((value ?? 0) / (from ?? 0)) * 100 || 0;
22
+ };
23
+ exports.percentFrom = percentFrom;
package/math.d.cts ADDED
@@ -0,0 +1,13 @@
1
+ import type { Maybe } from "./utils/types.cjs";
2
+ export declare function degToRad(deg: number): number;
3
+ export declare function radToDeg(rad: number): number;
4
+ /**
5
+ * Получить процент от числа
6
+ * @example
7
+ * ```ts
8
+ * percentFrom(500, 2000) // 25
9
+ * percentFrom(1000, 2000) // 50
10
+ * ```
11
+ */
12
+ export declare const percentFrom: (value: Maybe<number>, from: Maybe<number>) => number;
13
+ //# sourceMappingURL=math.d.ts.map
package/math.d.cts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAyB;AAE9C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AACD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,WAEpE,CAAC"}
package/math.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { Maybe } from "./utils/types.js";
2
+ export declare function degToRad(deg: number): number;
3
+ export declare function radToDeg(rad: number): number;
4
+ /**
5
+ * Получить процент от числа
6
+ * @example
7
+ * ```ts
8
+ * percentFrom(500, 2000) // 25
9
+ * percentFrom(1000, 2000) // 50
10
+ * ```
11
+ */
12
+ export declare const percentFrom: (value: Maybe<number>, from: Maybe<number>) => number;
13
+ //# sourceMappingURL=math.d.ts.map
package/math.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB;AAE9C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AACD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,WAEpE,CAAC"}
package/math.js ADDED
@@ -0,0 +1,17 @@
1
+ export function degToRad(deg) {
2
+ return deg * (Math.PI / 180);
3
+ }
4
+ export function radToDeg(rad) {
5
+ return rad * (180 / Math.PI);
6
+ }
7
+ /**
8
+ * Получить процент от числа
9
+ * @example
10
+ * ```ts
11
+ * percentFrom(500, 2000) // 25
12
+ * percentFrom(1000, 2000) // 50
13
+ * ```
14
+ */
15
+ export const percentFrom = (value, from) => {
16
+ return ((value ?? 0) / (from ?? 0)) * 100 || 0;
17
+ };