yummies 7.10.0 → 7.12.0

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 (154) hide show
  1. package/async.cjs +162 -48
  2. package/async.cjs.map +1 -1
  3. package/async.d.ts +112 -13
  4. package/async.js +163 -54
  5. package/async.js.map +1 -1
  6. package/chunk-CVq3Gv4J.cjs +50 -0
  7. package/chunk-YKewjYmz.js +37 -0
  8. package/common.cjs +48 -8
  9. package/common.cjs.map +1 -1
  10. package/common.d.ts +35 -2
  11. package/common.js +49 -11
  12. package/common.js.map +1 -1
  13. package/complex.cjs +275 -104
  14. package/complex.cjs.map +1 -1
  15. package/complex.d.ts +133 -13
  16. package/complex.js +275 -109
  17. package/complex.js.map +1 -1
  18. package/cookie.cjs +17 -7
  19. package/cookie.cjs.map +1 -1
  20. package/cookie.d.ts +8 -0
  21. package/cookie.js +18 -9
  22. package/cookie.js.map +1 -1
  23. package/css.cjs +147 -39
  24. package/css.cjs.map +1 -1
  25. package/css.d.ts +98 -6
  26. package/css.js +143 -41
  27. package/css.js.map +1 -1
  28. package/data.cjs +90 -55
  29. package/data.cjs.map +1 -1
  30. package/data.d.ts +32 -0
  31. package/data.js +91 -61
  32. package/data.js.map +1 -1
  33. package/date-time.cjs +578 -412
  34. package/date-time.cjs.map +1 -1
  35. package/date-time.d.ts +88 -0
  36. package/date-time.js +575 -421
  37. package/date-time.js.map +1 -1
  38. package/device.cjs +48 -23
  39. package/device.cjs.map +1 -1
  40. package/device.d.ts +32 -0
  41. package/device.js +49 -31
  42. package/device.js.map +1 -1
  43. package/encodings.cjs +275 -266
  44. package/encodings.cjs.map +1 -1
  45. package/encodings.d.ts +8 -0
  46. package/encodings.js +276 -268
  47. package/encodings.js.map +1 -1
  48. package/errors.cjs +20 -18
  49. package/errors.cjs.map +1 -1
  50. package/errors.js +19 -19
  51. package/errors.js.map +1 -1
  52. package/file.cjs +42 -24
  53. package/file.cjs.map +1 -1
  54. package/file.d.ts +16 -0
  55. package/file.js +43 -27
  56. package/file.js.map +1 -1
  57. package/format.cjs +125 -83
  58. package/format.cjs.map +1 -1
  59. package/format.d.ts +89 -4
  60. package/format.js +118 -82
  61. package/format.js.map +1 -1
  62. package/html.cjs +226 -137
  63. package/html.cjs.map +1 -1
  64. package/html.d.ts +67 -3
  65. package/html.js +223 -150
  66. package/html.js.map +1 -1
  67. package/id.cjs +74 -17
  68. package/id.cjs.map +1 -1
  69. package/id.d.ts +10 -10
  70. package/id.js +73 -24
  71. package/id.js.map +1 -1
  72. package/imports.cjs +41 -29
  73. package/imports.cjs.map +1 -1
  74. package/imports.d.ts +13 -4
  75. package/imports.js +40 -31
  76. package/imports.js.map +1 -1
  77. package/math.cjs +32 -6
  78. package/math.cjs.map +1 -1
  79. package/math.d.ts +17 -1
  80. package/math.js +33 -10
  81. package/math.js.map +1 -1
  82. package/media.cjs +275 -84
  83. package/media.cjs.map +1 -1
  84. package/media.d.ts +188 -2
  85. package/media.js +274 -93
  86. package/media.js.map +1 -1
  87. package/mobx.cjs +353 -193
  88. package/mobx.cjs.map +1 -1
  89. package/mobx.d.ts +172 -6
  90. package/mobx.js +351 -200
  91. package/mobx.js.map +1 -1
  92. package/ms.cjs +21 -10
  93. package/ms.cjs.map +1 -1
  94. package/ms.d.ts +1 -1
  95. package/ms.js +22 -13
  96. package/ms.js.map +1 -1
  97. package/number.cjs +13 -7
  98. package/number.cjs.map +1 -1
  99. package/number.js +14 -9
  100. package/number.js.map +1 -1
  101. package/package.json +13 -5
  102. package/parser.cjs +117 -64
  103. package/parser.cjs.map +1 -1
  104. package/parser.d.ts +63 -0
  105. package/parser.js +111 -64
  106. package/parser.js.map +1 -1
  107. package/price.cjs +24 -18
  108. package/price.cjs.map +1 -1
  109. package/price.d.ts +8 -0
  110. package/price.js +25 -20
  111. package/price.js.map +1 -1
  112. package/random.cjs +79 -13
  113. package/random.cjs.map +1 -1
  114. package/random.d.ts +64 -0
  115. package/random.js +80 -22
  116. package/random.js.map +1 -1
  117. package/react.cjs +673 -214
  118. package/react.cjs.map +1 -1
  119. package/react.d.ts +428 -9
  120. package/react.js +674 -239
  121. package/react.js.map +1 -1
  122. package/sound.cjs +14 -9
  123. package/sound.cjs.map +1 -1
  124. package/sound.d.ts +1 -1
  125. package/sound.js +15 -11
  126. package/sound.js.map +1 -1
  127. package/storage.cjs +49 -50
  128. package/storage.cjs.map +1 -1
  129. package/storage.d.ts +15 -6
  130. package/storage.js +50 -53
  131. package/storage.js.map +1 -1
  132. package/text.cjs +51 -34
  133. package/text.cjs.map +1 -1
  134. package/text.d.ts +5 -5
  135. package/text.js +52 -37
  136. package/text.js.map +1 -1
  137. package/type-guard.cjs +292 -72
  138. package/type-guard.cjs.map +1 -1
  139. package/type-guard.d.ts +199 -42
  140. package/type-guard.js +288 -73
  141. package/type-guard.js.map +1 -1
  142. package/types.cjs +0 -2
  143. package/types.global.cjs +0 -2
  144. package/types.global.js +0 -2
  145. package/types.js +0 -2
  146. package/vibrate.cjs +31 -6
  147. package/vibrate.cjs.map +1 -1
  148. package/vibrate.d.ts +23 -1
  149. package/vibrate.js +32 -8
  150. package/vibrate.js.map +1 -1
  151. package/types.cjs.map +0 -1
  152. package/types.global.cjs.map +0 -1
  153. package/types.global.js.map +0 -1
  154. package/types.js.map +0 -1
package/async.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"async.js","sources":["../src/async.ts"],"sourcesContent":["/**\n * Создает промис, который будет ждать указанное количество ms, чтобы выполниться\n *\n * @param ms значение в миллисекундах\n * @returns Promise\n */\nexport const sleep = (time: number = 0, signal?: AbortSignal) =>\n new Promise((resolve, reject) => {\n const timerId = setTimeout(resolve, time);\n if (signal) {\n signal.addEventListener(\n 'abort',\n () => {\n clearTimeout(timerId);\n reject(signal.reason);\n },\n {\n once: true,\n },\n );\n }\n });\n\n/**\n * Создает промис, который будет ждать указанное количество ms, чтобы выполниться\n *\n * @deprecated используй {sleep}\n * @param ms значение в миллисекундах\n * @returns Promise\n */\nexport const waitAsync = async (ms = 1000) =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Создает вызов requestAnimationFrame, посылая туда фукнцию {quitFn}, если она возвращает true,\n * тогда повторно не будет создан вызов requestAnimationFrame, иначе будут создаваться повторно\n * вызовы requestAnimationFrame до тем пор, пока эта функция не вернёт true\n *\n * @param quitFn - сама фукнция которая исполнится в requestAnimationFrame\n * @param asMicrotask - дополнительно оборачивает RAF в queueMicrotask\n * @returns void\n */\nexport const endlessRAF = (\n quitFunction: () => boolean | void,\n asMicrotask?: boolean,\n) => {\n if (quitFunction()) return;\n\n const raf = () =>\n requestAnimationFrame(() => endlessRAF(quitFunction, asMicrotask));\n\n if (asMicrotask) {\n queueMicrotask(raf);\n } else {\n raf();\n }\n};\n\nexport function setAbortableTimeout(\n callback: VoidFunction,\n delayInMs?: number,\n signal?: AbortSignal,\n) {\n let internalTimer: number | null = null;\n\n const handleAbort = () => {\n if (internalTimer == null) {\n return;\n }\n clearTimeout(internalTimer);\n internalTimer = null;\n };\n\n signal?.addEventListener('abort', handleAbort, { once: true });\n\n internalTimer = setTimeout(() => {\n signal?.removeEventListener('abort', handleAbort);\n callback();\n }, delayInMs);\n}\n\nexport function setAbortableInterval(\n callback: VoidFunction,\n delayInMs?: number,\n signal?: AbortSignal,\n) {\n let timer: number | null = null;\n\n const handleAbort = () => {\n if (timer == null) {\n return;\n }\n clearInterval(timer);\n timer = null;\n };\n\n signal?.addEventListener('abort', handleAbort, { once: true });\n\n timer = setInterval(callback, delayInMs);\n}\n"],"names":[],"mappings":"AAMO,MAAM,QAAQ,CAAC,OAAe,GAAG,WACtC,IAAI,QAAQ,CAAC,SAAS,WAAW;AAC/B,QAAM,UAAU,WAAW,SAAS,IAAI;AACxC,MAAI,QAAQ;AACV,WAAO;AAAA,MACL;AAAA,MACA,MAAM;AACJ,qBAAa,OAAO;AACpB,eAAO,OAAO,MAAM;AAAA,MACtB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,MAAA;AAAA,IACR;AAAA,EAEJ;AACF,CAAC;AASI,MAAM,YAAY,OAAO,KAAK,QACnC,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAW3C,MAAM,aAAa,CACxB,cACA,gBACG;AACH,MAAI,eAAgB;AAEpB,QAAM,MAAM,MACV,sBAAsB,MAAM,WAAW,cAAc,WAAW,CAAC;AAEnE,MAAI,aAAa;AACf,mBAAe,GAAG;AAAA,EACpB,OAAO;AACL,QAAA;AAAA,EACF;AACF;AAEO,SAAS,oBACd,UACA,WACA,QACA;AACA,MAAI,gBAA+B;AAEnC,QAAM,cAAc,MAAM;AACxB,QAAI,iBAAiB,MAAM;AACzB;AAAA,IACF;AACA,iBAAa,aAAa;AAC1B,oBAAgB;AAAA,EAClB;AAEA,UAAQ,iBAAiB,SAAS,aAAa,EAAE,MAAM,MAAM;AAE7D,kBAAgB,WAAW,MAAM;AAC/B,YAAQ,oBAAoB,SAAS,WAAW;AAChD,aAAA;AAAA,EACF,GAAG,SAAS;AACd;AAEO,SAAS,qBACd,UACA,WACA,QACA;AACA,MAAI,QAAuB;AAE3B,QAAM,cAAc,MAAM;AACxB,QAAI,SAAS,MAAM;AACjB;AAAA,IACF;AACA,kBAAc,KAAK;AACnB,YAAQ;AAAA,EACV;AAEA,UAAQ,iBAAiB,SAAS,aAAa,EAAE,MAAM,MAAM;AAE7D,UAAQ,YAAY,UAAU,SAAS;AACzC;"}
1
+ {"version":3,"file":"async.js","names":[],"sources":["../src/async.ts"],"sourcesContent":["/**\n * Returns a promise that resolves after `time` milliseconds.\n *\n * When `signal` is passed and becomes aborted before the delay elapses, the promise\n * rejects with `signal.reason` (same as native `fetch` / `AbortController` usage).\n * The timeout is cleared on abort so no resolve happens after cancellation.\n *\n * @param time - Delay in milliseconds. Defaults to `0` (next macrotask tick, same idea as `setTimeout(0)`).\n * @param signal - Optional `AbortSignal` to cancel the wait early.\n * @returns A promise that resolves with `void` when the delay completes, or rejects if aborted.\n *\n * @example\n * Basic pause in an async function:\n * ```ts\n * await sleep(250);\n * console.log('after 250ms');\n * ```\n *\n * @example\n * Cancellable delay tied to component unmount or user action:\n * ```ts\n * const ac = new AbortController();\n * try {\n * await sleep(5000, ac.signal);\n * } catch (e) {\n * // aborted — e is signal.reason\n * }\n * ac.abort('user cancelled');\n * ```\n */\nexport const sleep = (time: number = 0, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal) {\n const abortListener = () => {\n clearTimeout(timerId);\n reject(signal?.reason);\n };\n const timerId = setTimeout(() => {\n signal.removeEventListener('abort', abortListener);\n resolve();\n }, time);\n signal.addEventListener('abort', abortListener, { once: true });\n } else {\n setTimeout(resolve, time);\n }\n });\n\n/**\n * Creates a promise that resolves after the specified number of milliseconds.\n *\n * @deprecated Use `sleep` instead.\n * @param ms Delay in milliseconds.\n * @returns Promise\n */\nexport const waitAsync = async (ms = 1000) =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Runs a loop driven by `requestAnimationFrame`: on each frame, `quitFunction` is called first.\n * If it returns a truthy value, the loop stops and no further frames are scheduled.\n * If it returns falsy or nothing, the next frame is scheduled recursively.\n *\n * Use this for per-frame work (animations, layout reads after paint) without managing\n * `cancelAnimationFrame` manually returning `true` from `quitFunction` is the exit condition.\n *\n * When `asMicrotask` is `true`, scheduling the next RAF is deferred with `queueMicrotask`\n * so other microtasks can run before the frame is requested (useful when you need to\n * batch DOM updates or let reactive frameworks flush first).\n *\n * @param quitFunction - Invoked each animation frame. Return `true` to stop the loop.\n * @param asMicrotask - If `true`, wrap the `requestAnimationFrame` call in `queueMicrotask`.\n *\n * @example\n * Stop after 60 frames (~1s at 60Hz):\n * ```ts\n * let frames = 0;\n * endlessRAF(() => {\n * frames++;\n * updateSomething(frames);\n * return frames >= 60;\n * });\n * ```\n *\n * @example\n * Run until an element is removed or a flag is set:\n * ```ts\n * let running = true;\n * endlessRAF(() => {\n * if (!running || !document.body.contains(el)) return true;\n * draw(el);\n * }, true);\n * ```\n */\nexport const endlessRAF = (\n quitFunction: () => boolean | void,\n asMicrotask?: boolean,\n) => {\n if (quitFunction()) return;\n\n const raf = () =>\n requestAnimationFrame(() => endlessRAF(quitFunction, asMicrotask));\n\n if (asMicrotask) {\n queueMicrotask(raf);\n } else {\n raf();\n }\n};\n\n/**\n * Like `setTimeout`, but if `signal` aborts before the delay fires, the timer is cleared\n * and `callback` is never run. If the callback runs normally, the abort listener is removed.\n *\n * Does nothing special if `signal` is omitted — behaves like a plain timeout.\n *\n * @param callback - Function to run once after `delayInMs` (same as `setTimeout` callback).\n * @param delayInMs - Milliseconds to wait. Passed through to `setTimeout` (browser/Node semantics apply).\n * @param signal - When aborted, clears the pending timeout so `callback` is not invoked.\n *\n * @example\n * ```ts\n * const controller = new AbortController();\n * setAbortableTimeout(() => console.log('done'), 500, controller.signal);\n * // later: controller.abort(); // timeout cancelled, log never runs\n * ```\n *\n * @example\n * Zero-delay scheduling that can still be cancelled before the macrotask runs:\n * ```ts\n * const ac = new AbortController();\n * setAbortableTimeout(() => startIntro(), 0, ac.signal);\n * // e.g. on teardown: ac.abort();\n * ```\n */\nexport function setAbortableTimeout(\n callback: VoidFunction,\n delayInMs?: number,\n signal?: AbortSignal,\n) {\n let internalTimer: number | null = null;\n\n const handleAbort = () => {\n if (internalTimer == null) {\n return;\n }\n clearTimeout(internalTimer);\n internalTimer = null;\n };\n\n signal?.addEventListener('abort', handleAbort, { once: true });\n\n internalTimer = setTimeout(() => {\n signal?.removeEventListener('abort', handleAbort);\n callback();\n }, delayInMs);\n}\n\n/**\n * Like `setInterval`, but when `signal` aborts, the interval is cleared with `clearInterval`\n * and `callback` stops being called. If `signal` is omitted, behaves like a normal interval\n * (you must clear it yourself).\n *\n * @param callback - Invoked every `delayInMs` milliseconds until aborted or cleared.\n * @param delayInMs - Interval period in milliseconds (same as `setInterval`).\n * @param signal - Aborting stops the interval and removes the abort listener path from keeping work alive.\n *\n * @example\n * ```ts\n * const controller = new AbortController();\n * setAbortableInterval(() => console.log('tick'), 1000, controller.signal);\n * // stop: controller.abort();\n * ```\n *\n * @example\n * ```ts\n * const ac = new AbortController();\n * setAbortableInterval(syncStatus, 30_000, ac.signal);\n * window.addEventListener('beforeunload', () => ac.abort());\n * ```\n */\nexport function setAbortableInterval(\n callback: VoidFunction,\n delayInMs?: number,\n signal?: AbortSignal,\n) {\n let timer: number | null = null;\n\n const handleAbort = () => {\n if (timer == null) {\n return;\n }\n clearInterval(timer);\n timer = null;\n };\n\n signal?.addEventListener('abort', handleAbort, { once: true });\n\n timer = setInterval(callback, delayInMs);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,SAAS,OAAe,GAAG,WACtC,IAAI,SAAe,SAAS,WAAW;AACrC,KAAI,QAAQ;EACV,MAAM,sBAAsB;AAC1B,gBAAa,QAAQ;AACrB,UAAO,QAAQ,OAAO;;EAExB,MAAM,UAAU,iBAAiB;AAC/B,UAAO,oBAAoB,SAAS,cAAc;AAClD,YAAS;KACR,KAAK;AACR,SAAO,iBAAiB,SAAS,eAAe,EAAE,MAAM,MAAM,CAAC;OAE/D,YAAW,SAAS,KAAK;EAE3B;;;;;;;;AASJ,IAAa,YAAY,OAAO,KAAK,QACnC,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCnD,IAAa,cACX,cACA,gBACG;AACH,KAAI,cAAc,CAAE;CAEpB,MAAM,YACJ,4BAA4B,WAAW,cAAc,YAAY,CAAC;AAEpE,KAAI,YACF,gBAAe,IAAI;KAEnB,MAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BT,SAAgB,oBACd,UACA,WACA,QACA;CACA,IAAI,gBAA+B;CAEnC,MAAM,oBAAoB;AACxB,MAAI,iBAAiB,KACnB;AAEF,eAAa,cAAc;AAC3B,kBAAgB;;AAGlB,SAAQ,iBAAiB,SAAS,aAAa,EAAE,MAAM,MAAM,CAAC;AAE9D,iBAAgB,iBAAiB;AAC/B,UAAQ,oBAAoB,SAAS,YAAY;AACjD,YAAU;IACT,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;AA0Bf,SAAgB,qBACd,UACA,WACA,QACA;CACA,IAAI,QAAuB;CAE3B,MAAM,oBAAoB;AACxB,MAAI,SAAS,KACX;AAEF,gBAAc,MAAM;AACpB,UAAQ;;AAGV,SAAQ,iBAAiB,SAAS,aAAa,EAAE,MAAM,MAAM,CAAC;AAE9D,SAAQ,YAAY,UAAU,UAAU"}
@@ -0,0 +1,50 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ //#endregion
33
+ Object.defineProperty(exports, "__commonJSMin", {
34
+ enumerable: true,
35
+ get: function() {
36
+ return __commonJSMin;
37
+ }
38
+ });
39
+ Object.defineProperty(exports, "__exportAll", {
40
+ enumerable: true,
41
+ get: function() {
42
+ return __exportAll;
43
+ }
44
+ });
45
+ Object.defineProperty(exports, "__toESM", {
46
+ enumerable: true,
47
+ get: function() {
48
+ return __toESM;
49
+ }
50
+ });
@@ -0,0 +1,37 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ key = keys[i];
21
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
+ get: ((k) => from[k]).bind(null, key),
23
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
+ });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
33
+ if (typeof require !== "undefined") return require.apply(this, arguments);
34
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
35
+ });
36
+ //#endregion
37
+ export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
package/common.cjs CHANGED
@@ -1,12 +1,52 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const callFunction = (fn, ...args) => {
4
- if (typeof fn === "function") {
5
- return fn(...args);
6
- }
7
- return fn;
2
+ //#region src/common.ts
3
+ /**
4
+ * Normalizes a {@link MaybeFn} — a value that may be either a plain `TValue` or a function
5
+ * `(...args: TArgs) => TValue`. If `fn` is callable, it is invoked with `args` and the return
6
+ * value is returned; otherwise `fn` is returned as-is (treated as the resolved value).
7
+ *
8
+ * Typical uses: config fields that accept a static value or a lazy/computed factory, theme
9
+ * tokens, labels, or callbacks where the caller should not branch on `typeof fn` themselves.
10
+ *
11
+ * @template TValue - Result type when `fn` is not a function, or return type when it is.
12
+ * @template TArgs - Tuple of argument types passed through when `fn` is invoked.
13
+ *
14
+ * @param fn - Either a `TValue` or a function producing `TValue` from `args`.
15
+ * @param args - Arguments forwarded to `fn` only when `fn` is a function.
16
+ * @returns The resolved `TValue`.
17
+ *
18
+ * @example
19
+ * Plain value — returned unchanged (no call):
20
+ * ```ts
21
+ * const n = callFunction(42); // 42
22
+ * const label = callFunction('Hello'); // 'Hello'
23
+ * ```
24
+ *
25
+ * @example
26
+ * Function — called with the given arguments:
27
+ * ```ts
28
+ * const sum = callFunction((a: number, b: number) => a + b, 2, 3); // 5
29
+ * ```
30
+ *
31
+ * @example
32
+ * Same API for “static or factory” props:
33
+ * ```ts
34
+ * type Title = MaybeFn<string, [locale: string]>;
35
+ * const title: Title = (loc) => (loc === 'ru' ? 'Привет' : 'Hi');
36
+ * const text = callFunction(title, 'ru'); // 'Привет'
37
+ * const fixed = callFunction('Hi', 'ru'); // 'Hi' — args ignored
38
+ * ```
39
+ */
40
+ var callFunction = (fn, ...args) => {
41
+ if (typeof fn === "function") return fn(...args);
42
+ return fn;
8
43
  };
9
- const resolveFnValue = callFunction;
44
+ /**
45
+ * @deprecated use {callFunction}
46
+ */
47
+ var resolveFnValue = callFunction;
48
+ //#endregion
10
49
  exports.callFunction = callFunction;
11
50
  exports.resolveFnValue = resolveFnValue;
12
- //# sourceMappingURL=common.cjs.map
51
+
52
+ //# sourceMappingURL=common.cjs.map
package/common.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"common.cjs","sources":["../src/common.ts"],"sourcesContent":["import type { MaybeFn } from 'yummies/types';\n\n/**\n * @deprecated use {MaybeFn} type\n */\nexport type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;\n\n/**\n * Calls the provided function with the given arguments if it is a function;\n * otherwise, returns the value directly.\n */\nexport const callFunction = <TValue, TArgs extends any[] = []>(\n fn: MaybeFn<TValue, TArgs>,\n ...args: TArgs\n) => {\n if (typeof fn === 'function') {\n return (fn as any)(...args) as TValue;\n }\n\n return fn;\n};\n\n/**\n * @deprecated use {callFunction}\n */\nexport const resolveFnValue = callFunction;\n"],"names":[],"mappings":";;AAWO,MAAM,eAAe,CAC1B,OACG,SACA;AACH,MAAI,OAAO,OAAO,YAAY;AAC5B,WAAQ,GAAW,GAAG,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;AAKO,MAAM,iBAAiB;;;"}
1
+ {"version":3,"file":"common.cjs","names":[],"sources":["../src/common.ts"],"sourcesContent":["import type { MaybeFn } from 'yummies/types';\n\n/**\n * @deprecated use {MaybeFn} type\n */\nexport type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;\n\n/**\n * Normalizes a {@link MaybeFn} — a value that may be either a plain `TValue` or a function\n * `(...args: TArgs) => TValue`. If `fn` is callable, it is invoked with `args` and the return\n * value is returned; otherwise `fn` is returned as-is (treated as the resolved value).\n *\n * Typical uses: config fields that accept a static value or a lazy/computed factory, theme\n * tokens, labels, or callbacks where the caller should not branch on `typeof fn` themselves.\n *\n * @template TValue - Result type when `fn` is not a function, or return type when it is.\n * @template TArgs - Tuple of argument types passed through when `fn` is invoked.\n *\n * @param fn - Either a `TValue` or a function producing `TValue` from `args`.\n * @param args - Arguments forwarded to `fn` only when `fn` is a function.\n * @returns The resolved `TValue`.\n *\n * @example\n * Plain value — returned unchanged (no call):\n * ```ts\n * const n = callFunction(42); // 42\n * const label = callFunction('Hello'); // 'Hello'\n * ```\n *\n * @example\n * Function — called with the given arguments:\n * ```ts\n * const sum = callFunction((a: number, b: number) => a + b, 2, 3); // 5\n * ```\n *\n * @example\n * Same API for “static or factory” props:\n * ```ts\n * type Title = MaybeFn<string, [locale: string]>;\n * const title: Title = (loc) => (loc === 'ru' ? 'Привет' : 'Hi');\n * const text = callFunction(title, 'ru'); // 'Привет'\n * const fixed = callFunction('Hi', 'ru'); // 'Hi' — args ignored\n * ```\n */\nexport const callFunction = <TValue, TArgs extends any[] = []>(\n fn: MaybeFn<TValue, TArgs>,\n ...args: TArgs\n) => {\n if (typeof fn === 'function') {\n return (fn as any)(...args) as TValue;\n }\n\n return fn;\n};\n\n/**\n * @deprecated use {callFunction}\n */\nexport const resolveFnValue = callFunction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,gBACX,IACA,GAAG,SACA;AACH,KAAI,OAAO,OAAO,WAChB,QAAQ,GAAW,GAAG,KAAK;AAG7B,QAAO;;;;;AAMT,IAAa,iBAAiB"}
package/common.d.ts CHANGED
@@ -5,8 +5,41 @@ import { MaybeFn } from 'yummies/types';
5
5
  */
6
6
  type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;
7
7
  /**
8
- * Calls the provided function with the given arguments if it is a function;
9
- * otherwise, returns the value directly.
8
+ * Normalizes a {@link MaybeFn} a value that may be either a plain `TValue` or a function
9
+ * `(...args: TArgs) => TValue`. If `fn` is callable, it is invoked with `args` and the return
10
+ * value is returned; otherwise `fn` is returned as-is (treated as the resolved value).
11
+ *
12
+ * Typical uses: config fields that accept a static value or a lazy/computed factory, theme
13
+ * tokens, labels, or callbacks where the caller should not branch on `typeof fn` themselves.
14
+ *
15
+ * @template TValue - Result type when `fn` is not a function, or return type when it is.
16
+ * @template TArgs - Tuple of argument types passed through when `fn` is invoked.
17
+ *
18
+ * @param fn - Either a `TValue` or a function producing `TValue` from `args`.
19
+ * @param args - Arguments forwarded to `fn` only when `fn` is a function.
20
+ * @returns The resolved `TValue`.
21
+ *
22
+ * @example
23
+ * Plain value — returned unchanged (no call):
24
+ * ```ts
25
+ * const n = callFunction(42); // 42
26
+ * const label = callFunction('Hello'); // 'Hello'
27
+ * ```
28
+ *
29
+ * @example
30
+ * Function — called with the given arguments:
31
+ * ```ts
32
+ * const sum = callFunction((a: number, b: number) => a + b, 2, 3); // 5
33
+ * ```
34
+ *
35
+ * @example
36
+ * Same API for “static or factory” props:
37
+ * ```ts
38
+ * type Title = MaybeFn<string, [locale: string]>;
39
+ * const title: Title = (loc) => (loc === 'ru' ? 'Привет' : 'Hi');
40
+ * const text = callFunction(title, 'ru'); // 'Привет'
41
+ * const fixed = callFunction('Hi', 'ru'); // 'Hi' — args ignored
42
+ * ```
10
43
  */
11
44
  declare const callFunction: <TValue, TArgs extends any[] = []>(fn: MaybeFn<TValue, TArgs>, ...args: TArgs) => TValue;
12
45
  /**
package/common.js CHANGED
@@ -1,12 +1,50 @@
1
- const callFunction = (fn, ...args) => {
2
- if (typeof fn === "function") {
3
- return fn(...args);
4
- }
5
- return fn;
1
+ //#region src/common.ts
2
+ /**
3
+ * Normalizes a {@link MaybeFn} — a value that may be either a plain `TValue` or a function
4
+ * `(...args: TArgs) => TValue`. If `fn` is callable, it is invoked with `args` and the return
5
+ * value is returned; otherwise `fn` is returned as-is (treated as the resolved value).
6
+ *
7
+ * Typical uses: config fields that accept a static value or a lazy/computed factory, theme
8
+ * tokens, labels, or callbacks where the caller should not branch on `typeof fn` themselves.
9
+ *
10
+ * @template TValue - Result type when `fn` is not a function, or return type when it is.
11
+ * @template TArgs - Tuple of argument types passed through when `fn` is invoked.
12
+ *
13
+ * @param fn - Either a `TValue` or a function producing `TValue` from `args`.
14
+ * @param args - Arguments forwarded to `fn` only when `fn` is a function.
15
+ * @returns The resolved `TValue`.
16
+ *
17
+ * @example
18
+ * Plain value — returned unchanged (no call):
19
+ * ```ts
20
+ * const n = callFunction(42); // 42
21
+ * const label = callFunction('Hello'); // 'Hello'
22
+ * ```
23
+ *
24
+ * @example
25
+ * Function — called with the given arguments:
26
+ * ```ts
27
+ * const sum = callFunction((a: number, b: number) => a + b, 2, 3); // 5
28
+ * ```
29
+ *
30
+ * @example
31
+ * Same API for “static or factory” props:
32
+ * ```ts
33
+ * type Title = MaybeFn<string, [locale: string]>;
34
+ * const title: Title = (loc) => (loc === 'ru' ? 'Привет' : 'Hi');
35
+ * const text = callFunction(title, 'ru'); // 'Привет'
36
+ * const fixed = callFunction('Hi', 'ru'); // 'Hi' — args ignored
37
+ * ```
38
+ */
39
+ var callFunction = (fn, ...args) => {
40
+ if (typeof fn === "function") return fn(...args);
41
+ return fn;
6
42
  };
7
- const resolveFnValue = callFunction;
8
- export {
9
- callFunction,
10
- resolveFnValue
11
- };
12
- //# sourceMappingURL=common.js.map
43
+ /**
44
+ * @deprecated use {callFunction}
45
+ */
46
+ var resolveFnValue = callFunction;
47
+ //#endregion
48
+ export { callFunction, resolveFnValue };
49
+
50
+ //# sourceMappingURL=common.js.map
package/common.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sources":["../src/common.ts"],"sourcesContent":["import type { MaybeFn } from 'yummies/types';\n\n/**\n * @deprecated use {MaybeFn} type\n */\nexport type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;\n\n/**\n * Calls the provided function with the given arguments if it is a function;\n * otherwise, returns the value directly.\n */\nexport const callFunction = <TValue, TArgs extends any[] = []>(\n fn: MaybeFn<TValue, TArgs>,\n ...args: TArgs\n) => {\n if (typeof fn === 'function') {\n return (fn as any)(...args) as TValue;\n }\n\n return fn;\n};\n\n/**\n * @deprecated use {callFunction}\n */\nexport const resolveFnValue = callFunction;\n"],"names":[],"mappings":"AAWO,MAAM,eAAe,CAC1B,OACG,SACA;AACH,MAAI,OAAO,OAAO,YAAY;AAC5B,WAAQ,GAAW,GAAG,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;AAKO,MAAM,iBAAiB;"}
1
+ {"version":3,"file":"common.js","names":[],"sources":["../src/common.ts"],"sourcesContent":["import type { MaybeFn } from 'yummies/types';\n\n/**\n * @deprecated use {MaybeFn} type\n */\nexport type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;\n\n/**\n * Normalizes a {@link MaybeFn} — a value that may be either a plain `TValue` or a function\n * `(...args: TArgs) => TValue`. If `fn` is callable, it is invoked with `args` and the return\n * value is returned; otherwise `fn` is returned as-is (treated as the resolved value).\n *\n * Typical uses: config fields that accept a static value or a lazy/computed factory, theme\n * tokens, labels, or callbacks where the caller should not branch on `typeof fn` themselves.\n *\n * @template TValue - Result type when `fn` is not a function, or return type when it is.\n * @template TArgs - Tuple of argument types passed through when `fn` is invoked.\n *\n * @param fn - Either a `TValue` or a function producing `TValue` from `args`.\n * @param args - Arguments forwarded to `fn` only when `fn` is a function.\n * @returns The resolved `TValue`.\n *\n * @example\n * Plain value — returned unchanged (no call):\n * ```ts\n * const n = callFunction(42); // 42\n * const label = callFunction('Hello'); // 'Hello'\n * ```\n *\n * @example\n * Function — called with the given arguments:\n * ```ts\n * const sum = callFunction((a: number, b: number) => a + b, 2, 3); // 5\n * ```\n *\n * @example\n * Same API for “static or factory” props:\n * ```ts\n * type Title = MaybeFn<string, [locale: string]>;\n * const title: Title = (loc) => (loc === 'ru' ? 'Привет' : 'Hi');\n * const text = callFunction(title, 'ru'); // 'Привет'\n * const fixed = callFunction('Hi', 'ru'); // 'Hi' — args ignored\n * ```\n */\nexport const callFunction = <TValue, TArgs extends any[] = []>(\n fn: MaybeFn<TValue, TArgs>,\n ...args: TArgs\n) => {\n if (typeof fn === 'function') {\n return (fn as any)(...args) as TValue;\n }\n\n return fn;\n};\n\n/**\n * @deprecated use {callFunction}\n */\nexport const resolveFnValue = callFunction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,gBACX,IACA,GAAG,SACA;AACH,KAAI,OAAO,OAAO,WAChB,QAAQ,GAAW,GAAG,KAAK;AAG7B,QAAO;;;;;AAMT,IAAa,iBAAiB"}