yummies 7.11.0 → 7.13.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 (159) hide show
  1. package/README.md +5 -87
  2. package/async.cjs +179 -48
  3. package/async.cjs.map +1 -1
  4. package/async.d.ts +125 -7
  5. package/async.js +180 -54
  6. package/async.js.map +1 -1
  7. package/chunk-CVq3Gv4J.cjs +50 -0
  8. package/chunk-YKewjYmz.js +37 -0
  9. package/common.cjs +48 -8
  10. package/common.cjs.map +1 -1
  11. package/common.d.ts +53 -2
  12. package/common.js +49 -11
  13. package/common.js.map +1 -1
  14. package/complex.cjs +275 -128
  15. package/complex.cjs.map +1 -1
  16. package/complex.d.ts +66 -0
  17. package/complex.js +275 -133
  18. package/complex.js.map +1 -1
  19. package/cookie.cjs +17 -7
  20. package/cookie.cjs.map +1 -1
  21. package/cookie.d.ts +26 -0
  22. package/cookie.js +18 -9
  23. package/cookie.js.map +1 -1
  24. package/css.cjs +163 -39
  25. package/css.cjs.map +1 -1
  26. package/css.d.ts +115 -6
  27. package/css.js +159 -41
  28. package/css.js.map +1 -1
  29. package/data.cjs +90 -55
  30. package/data.cjs.map +1 -1
  31. package/data.d.ts +50 -0
  32. package/data.js +91 -61
  33. package/data.js.map +1 -1
  34. package/date-time.cjs +594 -412
  35. package/date-time.cjs.map +1 -1
  36. package/date-time.d.ts +105 -0
  37. package/date-time.js +591 -421
  38. package/date-time.js.map +1 -1
  39. package/device.cjs +65 -23
  40. package/device.cjs.map +1 -1
  41. package/device.d.ts +49 -0
  42. package/device.js +66 -31
  43. package/device.js.map +1 -1
  44. package/encodings.cjs +275 -266
  45. package/encodings.cjs.map +1 -1
  46. package/encodings.d.ts +25 -0
  47. package/encodings.js +276 -268
  48. package/encodings.js.map +1 -1
  49. package/errors.cjs +36 -18
  50. package/errors.cjs.map +1 -1
  51. package/errors.d.ts +17 -0
  52. package/errors.js +35 -19
  53. package/errors.js.map +1 -1
  54. package/file.cjs +58 -24
  55. package/file.cjs.map +1 -1
  56. package/file.d.ts +32 -0
  57. package/file.js +59 -27
  58. package/file.js.map +1 -1
  59. package/format.cjs +125 -83
  60. package/format.cjs.map +1 -1
  61. package/format.d.ts +18 -0
  62. package/format.js +118 -82
  63. package/format.js.map +1 -1
  64. package/html.cjs +242 -137
  65. package/html.cjs.map +1 -1
  66. package/html.d.ts +81 -0
  67. package/html.js +239 -150
  68. package/html.js.map +1 -1
  69. package/id.cjs +90 -17
  70. package/id.cjs.map +1 -1
  71. package/id.d.ts +16 -0
  72. package/id.js +89 -24
  73. package/id.js.map +1 -1
  74. package/imports.cjs +57 -29
  75. package/imports.cjs.map +1 -1
  76. package/imports.d.ts +24 -0
  77. package/imports.js +56 -31
  78. package/imports.js.map +1 -1
  79. package/math.cjs +32 -6
  80. package/math.cjs.map +1 -1
  81. package/math.d.ts +33 -0
  82. package/math.js +33 -10
  83. package/math.js.map +1 -1
  84. package/media.cjs +291 -84
  85. package/media.cjs.map +1 -1
  86. package/media.d.ts +204 -2
  87. package/media.js +290 -93
  88. package/media.js.map +1 -1
  89. package/mobx.cjs +449 -193
  90. package/mobx.cjs.map +1 -1
  91. package/mobx.d.ts +108 -0
  92. package/mobx.js +447 -200
  93. package/mobx.js.map +1 -1
  94. package/ms.cjs +37 -10
  95. package/ms.cjs.map +1 -1
  96. package/ms.d.ts +16 -0
  97. package/ms.js +38 -13
  98. package/ms.js.map +1 -1
  99. package/number.cjs +29 -7
  100. package/number.cjs.map +1 -1
  101. package/number.d.ts +16 -0
  102. package/number.js +30 -9
  103. package/number.js.map +1 -1
  104. package/package.json +11 -3
  105. package/parser.cjs +117 -64
  106. package/parser.cjs.map +1 -1
  107. package/parser.d.ts +17 -0
  108. package/parser.js +111 -64
  109. package/parser.js.map +1 -1
  110. package/price.cjs +24 -18
  111. package/price.cjs.map +1 -1
  112. package/price.d.ts +24 -0
  113. package/price.js +25 -20
  114. package/price.js.map +1 -1
  115. package/random.cjs +95 -13
  116. package/random.cjs.map +1 -1
  117. package/random.d.ts +80 -0
  118. package/random.js +96 -22
  119. package/random.js.map +1 -1
  120. package/react.cjs +673 -214
  121. package/react.cjs.map +1 -1
  122. package/react.d.ts +21 -0
  123. package/react.js +674 -239
  124. package/react.js.map +1 -1
  125. package/sound.cjs +30 -9
  126. package/sound.cjs.map +1 -1
  127. package/sound.d.ts +16 -0
  128. package/sound.js +31 -11
  129. package/sound.js.map +1 -1
  130. package/storage.cjs +49 -50
  131. package/storage.cjs.map +1 -1
  132. package/storage.d.ts +24 -0
  133. package/storage.js +50 -53
  134. package/storage.js.map +1 -1
  135. package/text.cjs +67 -34
  136. package/text.cjs.map +1 -1
  137. package/text.d.ts +16 -0
  138. package/text.js +68 -37
  139. package/text.js.map +1 -1
  140. package/type-guard.cjs +292 -72
  141. package/type-guard.cjs.map +1 -1
  142. package/type-guard.d.ts +18 -0
  143. package/type-guard.js +288 -73
  144. package/type-guard.js.map +1 -1
  145. package/types.cjs +0 -2
  146. package/types.d.ts +41 -0
  147. package/types.global.cjs +0 -2
  148. package/types.global.d.ts +41 -0
  149. package/types.global.js +0 -2
  150. package/types.js +0 -2
  151. package/vibrate.cjs +47 -6
  152. package/vibrate.cjs.map +1 -1
  153. package/vibrate.d.ts +39 -1
  154. package/vibrate.js +48 -8
  155. package/vibrate.js.map +1 -1
  156. package/types.cjs.map +0 -1
  157. package/types.global.cjs.map +0 -1
  158. package/types.global.js.map +0 -1
  159. package/types.js.map +0 -1
package/mobx.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mobx.js","sources":["../src/mobx/apply-observable.ts","../src/mobx/create-enhanced-atom.ts","../src/mobx/create-ref.ts","../src/mobx/deep-observable-struct.ts","../src/mobx/get-mobx-administration.ts","../src/mobx/lazy-observe.ts"],"sourcesContent":["import { type AnnotationMapEntry, makeObservable } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport type ObservableAnnotationsArray<T extends AnyObject = AnyObject> = [\n AnnotationMapEntry,\n ...(keyof T | (string & {}))[],\n][];\n\n/**\n * Applies a compact list of MobX annotations to an object using either\n * decorator-style invocation or the annotation map form accepted by `makeObservable`.\n *\n * @template T Target object type.\n * @param context Object that should become observable.\n * @param annotationsArray Tuples of annotation followed by annotated field names.\n * @param useDecorators Enables decorator-style application before calling `makeObservable`.\n *\n * @example\n * ```ts\n * applyObservable(store, [[observable, 'items'], [action, 'setItems']]);\n * ```\n *\n * @example\n * ```ts\n * applyObservable(viewModel, [[computed, 'fullName']], true);\n * ```\n */\nexport const applyObservable = <T extends AnyObject>(\n context: T,\n annotationsArray: ObservableAnnotationsArray<T>,\n useDecorators?: boolean,\n) => {\n if (useDecorators) {\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n // @ts-expect-error\n annotation(context, field);\n });\n });\n\n makeObservable(context);\n } else {\n const annotationsObject: AnyObject = {};\n\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n annotationsObject[field] = annotation;\n });\n });\n\n makeObservable(context, annotationsObject);\n }\n};\n","import { createAtom, type IAtom } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport interface IEnhancedAtom<TMeta extends AnyObject = AnyObject>\n extends IAtom {\n meta: TMeta;\n}\n\n/**\n * Creates a MobX atom extended with metadata and bound reporting methods.\n *\n * @template TMeta Metadata object stored on the atom.\n * @param name Atom name used by MobX for debugging.\n * @param onBecomeObservedHandler Callback fired when the atom becomes observed.\n * @param onBecomeUnobservedHandler Callback fired when the atom is no longer observed.\n * @param meta Optional metadata attached to the atom.\n * @returns Atom instance with `meta`, `reportChanged` and `reportObserved`.\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('user-status');\n * atom.reportChanged();\n * ```\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('cache', undefined, undefined, { scope: 'users' });\n * atom.meta.scope;\n * ```\n */\nexport const createEnhancedAtom = <TMeta extends AnyObject>(\n name: string,\n onBecomeObservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n onBecomeUnobservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n meta?: TMeta,\n): IEnhancedAtom<TMeta> => {\n const atom = createAtom(\n name,\n onBecomeObservedHandler && (() => onBecomeObservedHandler(atom)),\n onBecomeUnobservedHandler && (() => onBecomeUnobservedHandler(atom)),\n ) as IEnhancedAtom<TMeta>;\n atom.meta = meta ?? ({} as TMeta);\n atom.reportChanged = atom.reportChanged.bind(atom);\n atom.reportObserved = atom.reportObserved.bind(atom);\n return atom;\n};\n","import {\n type IEqualsComparer,\n makeObservable,\n comparer as mobxComparer,\n observable,\n runInAction,\n} from 'mobx';\nimport type { AnyObject, Maybe } from 'yummies/types';\n\n/**\n * You can return `false` if you don't want to change the value in this ref\n */\nexport type RefChangeListener<T> = (\n value: T | null,\n prevValue: T | undefined,\n) => void | false;\n\n/**\n * Alternative to React.createRef but works in MobX world.\n * Typically it the should be the same React.LegacyRef (fn style)\n */\nexport interface Ref<T = any, TMeta = AnyObject> {\n /**\n * Setter function\n */\n (value: Maybe<T>): void;\n\n set(value: Maybe<T>): void;\n listeners: Set<RefChangeListener<NoInfer<T>>>;\n current: NoInfer<T> | null;\n meta: TMeta;\n}\n\nexport interface CreateRefConfig<T = any, TMeta = AnyObject> {\n onSet?: (node: T, prevValue: T | undefined) => void;\n onUnset?: (lastValue: T | undefined) => void;\n onChange?: RefChangeListener<T>;\n meta?: TMeta;\n initial?: Maybe<T>;\n comparer?: IEqualsComparer<T | null>;\n}\n\n/**\n * Creates a MobX-aware ref that behaves like a callback ref and exposes\n * observable `current` and `meta` fields.\n *\n * @template T Referenced value type.\n * @template TMeta Additional observable metadata stored on the ref.\n * @param cfg Optional callbacks, initial value and comparer configuration.\n * @returns Observable ref function object.\n *\n * @example\n * ```ts\n * const inputRef = createRef<HTMLInputElement>();\n * inputRef.set(document.createElement('input'));\n * ```\n *\n * @example\n * ```ts\n * const nodeRef = createRef({\n * onUnset: () => console.log('detached'),\n * meta: { mounted: false },\n * });\n * ```\n */\nexport const createRef = <T = any, TMeta = AnyObject>(\n cfg?: CreateRefConfig<T, TMeta>,\n): Ref<T, TMeta> => {\n let lastValue: T | undefined;\n const comparer = cfg?.comparer ?? mobxComparer.default;\n\n const setValue: Ref<T, TMeta>['set'] = (value) => {\n const nextValue = value ?? null;\n\n if (comparer(ref.current, nextValue)) {\n return;\n }\n\n runInAction(() => {\n const prevLastValue = lastValue;\n lastValue = ref.current ?? undefined;\n ref.current = nextValue;\n\n let isNextValueIgnored = false;\n\n ref.listeners.forEach((listener) => {\n const listenerResult = listener(ref.current, lastValue);\n\n if (listenerResult === false) {\n isNextValueIgnored = true;\n }\n });\n\n if (isNextValueIgnored) {\n lastValue = prevLastValue;\n ref.current = lastValue ?? null;\n } else if (ref.current === null && lastValue !== undefined) {\n lastValue = undefined;\n }\n });\n };\n\n const ref = setValue as Ref<T, TMeta>;\n\n ref.set = setValue;\n\n ref.listeners = new Set(cfg?.onChange ? [cfg.onChange] : []);\n\n if (cfg?.onSet || cfg?.onUnset) {\n ref.listeners.add((value, prevValue) => {\n if (value) {\n cfg.onSet?.(value, prevValue);\n } else {\n cfg.onUnset?.(prevValue);\n }\n });\n }\n\n ref.current = cfg?.initial ?? null;\n ref.meta = cfg?.meta ?? ({} as TMeta);\n\n makeObservable(ref, {\n current: observable.ref,\n meta: observable,\n });\n\n return ref;\n};\n\n/**\n * Checks whether the provided value is a ref created by `createRef`.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Value to inspect.\n * @returns `true` when the value is a ref-like function with `current`.\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * isRef(ref); // true\n * ```\n *\n * @example\n * ```ts\n * isRef({ current: 1 }); // false\n * ```\n */\nexport const isRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n): value is Ref<T, TMeta> => {\n return typeof value === 'function' && 'current' in value;\n};\n\n/**\n * Normalizes a plain value or an existing ref into a `Ref` instance.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Existing ref or initial plain value.\n * @param cfg Optional ref configuration applied when a new ref is created.\n * @returns Existing ref or a newly created ref initialized with `value`.\n *\n * @example\n * ```ts\n * const ref = toRef(document.body);\n * ref.current === document.body;\n * ```\n *\n * @example\n * ```ts\n * const existingRef = createRef<number>();\n * const sameRef = toRef(existingRef);\n * ```\n */\nexport const toRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n cfg?: Omit<CreateRefConfig<T, TMeta>, 'initial'>,\n): Ref<T, TMeta> => {\n return isRef(value) ? value : createRef({ initial: value, ...cfg });\n};\n","import { action, makeObservable, observable } from 'mobx';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { AnyObject } from 'yummies/types';\n\n/**\n * Wraps a plain object into a deeply observable structure and allows\n * patch-like updates while preserving nested observable references where possible.\n *\n * @template TData Observable object shape.\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ user: { name: 'Ann' } });\n * state.set({ user: { name: 'Bob' } });\n * ```\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ filters: { active: true } });\n * state.set({ filters: { active: false, archived: true } });\n * ```\n */\nexport class DeepObservableStruct<TData extends AnyObject> {\n data: TData;\n\n constructor(data: TData) {\n this.data = data;\n\n makeObservable(this, {\n data: observable.deep,\n set: action,\n });\n }\n\n set(newData: Partial<TData>) {\n type StackItem = [key: string, currObservable: AnyObject, new: AnyObject];\n\n const stack: StackItem[] = Object.keys(this.data).map((key) => [\n key,\n this.data,\n newData,\n ]);\n\n let currentIndex = 0;\n let stackLength = stack.length;\n\n while (currentIndex < stackLength) {\n const [key, currObservableData, newData] = stack[currentIndex];\n const newValue = newData[key];\n const currValue = currObservableData[key];\n\n currentIndex++;\n\n if (key in newData) {\n if (typeGuard.isObject(newValue) && typeGuard.isObject(currValue)) {\n const newValueKeys = Object.keys(newValue);\n\n Object.keys(currValue).forEach((childKey) => {\n if (!(childKey in newValue)) {\n delete currObservableData[key][childKey];\n }\n });\n\n newValueKeys.forEach((childKey) => {\n const length = stack.push([\n childKey,\n currObservableData[key],\n newValue,\n ]);\n stackLength = length;\n });\n } else if (newValue !== currValue) {\n currObservableData[key] = newValue;\n }\n } else {\n delete currObservableData[key];\n }\n }\n\n Object.keys(newData).forEach((newDataKey) => {\n if (!this.data[newDataKey]) {\n // @ts-expect-error\n this.data[newDataKey] = newData[newDataKey];\n }\n });\n }\n}\n","import { $mobx, type AnnotationMapEntry } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\ntype ObservableObjectAdministration = Parameters<\n Exclude<AnnotationMapEntry, boolean>['make_']\n>[0];\n\n/**\n * Returns the internal MobX administration object associated with an observable target.\n *\n * @param context Observable object instance.\n * @returns MobX administration internals stored under `$mobx`.\n *\n * @example\n * ```ts\n * const admin = getMobxAdministration(store);\n * admin.name_;\n * ```\n *\n * @example\n * ```ts\n * const values = getMobxAdministration(formState).values_;\n * ```\n */\nexport const getMobxAdministration = (\n context: AnyObject,\n): ObservableObjectAdministration => context[$mobx];\n","import { onBecomeObserved, onBecomeUnobserved } from 'mobx';\n\n/**\n * Starts side effects only while one or more MobX observables are being observed.\n *\n * When the first property becomes observed, `onStart` is called. When all tracked\n * properties become unobserved, `onEnd` is called with the value returned by\n * `onStart`. Cleanup can be delayed via `endDelay`.\n *\n * It uses MobX `onBecomeObserved` and `onBecomeUnobserved` hooks to perform\n * lazy subscription management.\n *\n * @template TMetaData Data returned from `onStart` and forwarded to `onEnd`.\n * @param config Configuration for tracked properties and lifecycle callbacks.\n * @returns Cleanup function that clears the tracked state and runs `onEnd`.\n *\n * @example\n * ```ts\n * const stop = lazyObserve({\n * context: store,\n * property: 'items',\n * onStart: () => api.subscribe(),\n * onEnd: (subscription) => subscription.unsubscribe(),\n * });\n * ```\n *\n * @example\n * ```ts\n * lazyObserve({\n * property: [boxA, boxB],\n * onStart: () => console.log('observed'),\n * endDelay: 300,\n * });\n * ```\n */\nexport const lazyObserve = <TMetaData = void>({\n context,\n property,\n onStart,\n onEnd,\n endDelay = false,\n}: {\n context?: any;\n property: any | any[];\n onStart?: () => TMetaData;\n onEnd?: (metaData: TMetaData, cleanupFn: VoidFunction) => void;\n endDelay?: number | false;\n}) => {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let metaData: TMetaData | undefined;\n const observingProps = new Set<string>();\n const properties = Array.isArray(property) ? property : [property];\n\n const cleanup = () => {\n observingProps.clear();\n\n if (endDelay === false) {\n onEnd?.(metaData!, cleanup);\n metaData = undefined;\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n timeoutId = setTimeout(() => {\n onEnd?.(metaData!, cleanup);\n timeoutId = undefined;\n metaData = undefined;\n }, endDelay);\n };\n\n const start = (property: string) => {\n const isAlreadyObserving = observingProps.size > 0;\n observingProps.add(property);\n\n if (isAlreadyObserving) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n metaData = onStart?.();\n };\n\n const stop = (property: string) => {\n const isAlreadyNotObserving = !observingProps.size;\n\n observingProps.delete(property);\n\n const isObserving = observingProps.size > 0;\n\n if (isAlreadyNotObserving || isObserving) {\n return;\n }\n\n cleanup();\n };\n\n properties.forEach((property) => {\n if (context) {\n onBecomeObserved(context, property, () => start(property));\n onBecomeUnobserved(context, property, () => stop(property));\n } else {\n onBecomeObserved(property, () => start(property));\n onBecomeUnobserved(property, () => stop(property));\n }\n });\n\n return cleanup;\n};\n"],"names":["comparer","mobxComparer","newData","property"],"mappings":";;AA2BO,MAAM,kBAAkB,CAC7B,SACA,kBACA,kBACG;AACH,MAAI,eAAe;AACjB,qBAAiB,QAAQ,CAAC,CAAC,qBAAqB,MAAM;AACpD,aAAO,QAAQ,CAAC,UAAU;AAExB,mBAAW,SAAS,KAAK;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAED,mBAAe,OAAO;AAAA,EACxB,OAAO;AACL,UAAM,oBAA+B,CAAA;AAErC,qBAAiB,QAAQ,CAAC,CAAC,qB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BAAoB;AACtB;AAAA,IACF;AAEA,QAAI,WAAW;AACb,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAEA,eAAW,UAAA;AAAA,EACb;AAEA,QAAM,OAAO,CAACA,cAAqB;AACjC,UAAM,wBAAwB,CAAC,eAAe;AAE9C,mBAAe,OAAOA,SAAQ;AAE9B,UAAM,cAAc,eAAe,OAAO;AAE1C,QAAI,yBAAyB,aAAa;AACxC;AAAA,IACF;AAEA,YAAA;AAAA,EACF;AAEA,aAAW,QAAQ,CAACA,cAAa;AAC/B,QAAI,SAAS;AACX,uBAAiB,SAASA,WAAU,MAAM,MAAMA,SAAQ,CAAC;AACzD,yBAAmB,SAASA,WAAU,MAAM,KAAKA,SAAQ,CAAC;AAAA,IAC5D,OAAO;AACL,uBAAiBA,WAAU,MAAM,MAAMA,SAAQ,CAAC;AAChD,yBAAmBA,WAAU,MAAM,KAAKA,SAAQ,CAAC;AAAA,IACnD;AAAA,EACF,CAAC;AAED,SAAO;AACT;"}
1
+ {"version":3,"file":"mobx.js","names":[],"sources":["../src/mobx/apply-observable.ts","../src/mobx/create-enhanced-atom.ts","../src/mobx/create-ref.ts","../src/mobx/deep-observable-struct.ts","../src/mobx/get-mobx-administration.ts","../src/mobx/lazy-observe.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Compact **MobX `makeObservable`** wiring from tuple lists of annotations and keys. Reduces boilerplate\n * when many fields share `observable`, `action`, or `computed` decorators and you want one call site\n * instead of sprawling annotation maps across large stores.\n *\n * ## Usage\n *\n * ```ts\n * import { applyObservable } from \"yummies/mobx\";\n * ```\n */\n\nimport { type AnnotationMapEntry, makeObservable } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport type ObservableAnnotationsArray<T extends AnyObject = AnyObject> = [\n AnnotationMapEntry,\n ...(keyof T | (string & {}))[],\n][];\n\n/**\n * Applies a compact list of MobX annotations to an object using either\n * decorator-style invocation or the annotation map form accepted by `makeObservable`.\n *\n * @template T Target object type.\n * @param context Object that should become observable.\n * @param annotationsArray Tuples of annotation followed by annotated field names.\n * @param useDecorators Enables decorator-style application before calling `makeObservable`.\n *\n * @example\n * ```ts\n * applyObservable(store, [[observable, 'items'], [action, 'setItems']]);\n * ```\n *\n * @example\n * ```ts\n * applyObservable(viewModel, [[computed, 'fullName']], true);\n * ```\n */\nexport const applyObservable = <T extends AnyObject>(\n context: T,\n annotationsArray: ObservableAnnotationsArray<T>,\n useDecorators?: boolean,\n) => {\n if (useDecorators) {\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n // @ts-expect-error\n annotation(context, field);\n });\n });\n\n makeObservable(context);\n } else {\n const annotationsObject: AnyObject = {};\n\n annotationsArray.forEach(([annotation, ...fields]) => {\n fields.forEach((field) => {\n annotationsObject[field] = annotation;\n });\n });\n\n makeObservable(context, annotationsObject);\n }\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **`createAtom` wrapper** that attaches arbitrary metadata and keeps MobX’s observed/unobserved\n * hooks in one place. Useful for custom reactive primitives, async resources, or debugging atoms\n * where the stock API is too bare.\n *\n * ## Usage\n *\n * ```ts\n * import { createEnhancedAtom } from \"yummies/mobx\";\n * ```\n */\n\nimport { createAtom, type IAtom } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\nexport interface IEnhancedAtom<TMeta extends AnyObject = AnyObject>\n extends IAtom {\n meta: TMeta;\n}\n\n/**\n * Creates a MobX atom extended with metadata and bound reporting methods.\n *\n * @template TMeta Metadata object stored on the atom.\n * @param name Atom name used by MobX for debugging.\n * @param onBecomeObservedHandler Callback fired when the atom becomes observed.\n * @param onBecomeUnobservedHandler Callback fired when the atom is no longer observed.\n * @param meta Optional metadata attached to the atom.\n * @returns Atom instance with `meta`, `reportChanged` and `reportObserved`.\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('user-status');\n * atom.reportChanged();\n * ```\n *\n * @example\n * ```ts\n * const atom = createEnhancedAtom('cache', undefined, undefined, { scope: 'users' });\n * atom.meta.scope;\n * ```\n */\nexport const createEnhancedAtom = <TMeta extends AnyObject>(\n name: string,\n onBecomeObservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n onBecomeUnobservedHandler?: (atom: IEnhancedAtom<TMeta>) => void,\n meta?: TMeta,\n): IEnhancedAtom<TMeta> => {\n const atom = createAtom(\n name,\n onBecomeObservedHandler && (() => onBecomeObservedHandler(atom)),\n onBecomeUnobservedHandler && (() => onBecomeUnobservedHandler(atom)),\n ) as IEnhancedAtom<TMeta>;\n atom.meta = meta ?? ({} as TMeta);\n atom.reportChanged = atom.reportChanged.bind(atom);\n atom.reportObserved = atom.reportObserved.bind(atom);\n return atom;\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Observable ref** pattern for MobX: boxed mutable references with change listeners, metadata,\n * and optional custom equality. Bridges React-style ref holders and MobX reactivity when a single\n * mutable cell must notify dependents without replacing the whole parent object graph.\n *\n * ## Usage\n *\n * ```ts\n * import { createRef } from \"yummies/mobx\";\n * ```\n */\n\nimport {\n type IEqualsComparer,\n makeObservable,\n comparer as mobxComparer,\n observable,\n runInAction,\n} from 'mobx';\nimport type { AnyObject, Maybe } from 'yummies/types';\n\n/**\n * You can return `false` if you don't want to change the value in this ref\n */\nexport type RefChangeListener<T> = (\n value: T | null,\n prevValue: T | undefined,\n) => void | false;\n\n/**\n * Alternative to React.createRef but works in MobX world.\n * Typically it the should be the same React.LegacyRef (fn style)\n */\nexport interface Ref<T = any, TMeta = AnyObject> {\n /**\n * Setter function\n */\n (value: Maybe<T>): void;\n\n set(value: Maybe<T>): void;\n listeners: Set<RefChangeListener<NoInfer<T>>>;\n current: NoInfer<T> | null;\n meta: TMeta;\n}\n\nexport interface CreateRefConfig<T = any, TMeta = AnyObject> {\n onSet?: (node: T, prevValue: T | undefined) => void;\n onUnset?: (lastValue: T | undefined) => void;\n onChange?: RefChangeListener<T>;\n meta?: TMeta;\n initial?: Maybe<T>;\n comparer?: IEqualsComparer<T | null>;\n}\n\n/**\n * Creates a MobX-aware ref that behaves like a callback ref and exposes\n * observable `current` and `meta` fields.\n *\n * @template T Referenced value type.\n * @template TMeta Additional observable metadata stored on the ref.\n * @param cfg Optional callbacks, initial value and comparer configuration.\n * @returns Observable ref function object.\n *\n * @example\n * ```ts\n * const inputRef = createRef<HTMLInputElement>();\n * inputRef.set(document.createElement('input'));\n * ```\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * ref(3);\n * ref.current; // 3\n * ```\n *\n * @example\n * ```ts\n * const nodeRef = createRef({\n * onUnset: () => console.log('detached'),\n * meta: { mounted: false },\n * });\n * ```\n */\nexport const createRef = <T = any, TMeta = AnyObject>(\n cfg?: CreateRefConfig<T, TMeta>,\n): Ref<T, TMeta> => {\n let lastValue: T | undefined;\n const comparer = cfg?.comparer ?? mobxComparer.default;\n\n const setValue: Ref<T, TMeta>['set'] = (value) => {\n const nextValue = value ?? null;\n\n if (comparer(ref.current, nextValue)) {\n return;\n }\n\n runInAction(() => {\n const prevLastValue = lastValue;\n lastValue = ref.current ?? undefined;\n ref.current = nextValue;\n\n let isNextValueIgnored = false;\n\n ref.listeners.forEach((listener) => {\n const listenerResult = listener(ref.current, lastValue);\n\n if (listenerResult === false) {\n isNextValueIgnored = true;\n }\n });\n\n if (isNextValueIgnored) {\n lastValue = prevLastValue;\n ref.current = lastValue ?? null;\n } else if (ref.current === null && lastValue !== undefined) {\n lastValue = undefined;\n }\n });\n };\n\n const ref = setValue as Ref<T, TMeta>;\n\n ref.set = setValue;\n\n ref.listeners = new Set(cfg?.onChange ? [cfg.onChange] : []);\n\n if (cfg?.onSet || cfg?.onUnset) {\n ref.listeners.add((value, prevValue) => {\n if (value) {\n cfg.onSet?.(value, prevValue);\n } else {\n cfg.onUnset?.(prevValue);\n }\n });\n }\n\n ref.current = cfg?.initial ?? null;\n ref.meta = cfg?.meta ?? ({} as TMeta);\n\n makeObservable(ref, {\n current: observable.ref,\n meta: observable,\n });\n\n return ref;\n};\n\n/**\n * Checks whether the provided value is a ref created by `createRef`.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Value to inspect.\n * @returns `true` when the value is a ref-like function with `current`.\n *\n * @example\n * ```ts\n * const ref = createRef<number>();\n * isRef(ref); // true\n * ```\n *\n * @example\n * ```ts\n * isRef({ current: 1 }); // false\n * ```\n */\nexport const isRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n): value is Ref<T, TMeta> => {\n return typeof value === 'function' && 'current' in value;\n};\n\n/**\n * Normalizes a plain value or an existing ref into a `Ref` instance.\n *\n * @template T Referenced value type.\n * @template TMeta Ref metadata type.\n * @param value Existing ref or initial plain value.\n * @param cfg Optional ref configuration applied when a new ref is created.\n * @returns Existing ref or a newly created ref initialized with `value`.\n *\n * @example\n * ```ts\n * const ref = toRef(document.body);\n * ref.current === document.body;\n * ```\n *\n * @example\n * ```ts\n * const existingRef = createRef<number>();\n * const sameRef = toRef(existingRef);\n * ```\n */\nexport const toRef = <T, TMeta = any>(\n value: T | Ref<T, TMeta>,\n cfg?: Omit<CreateRefConfig<T, TMeta>, 'initial'>,\n): Ref<T, TMeta> => {\n return isRef(value) ? value : createRef({ initial: value, ...cfg });\n};\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Deep observable object** with structural `set` patches that reuse nested observables when keys\n * overlap. Helps store trees (forms, filters, entities) under MobX without wholesale replacement\n * and without manual `observable.map` wiring for every level.\n *\n * ## Usage\n *\n * ```ts\n * import { DeepObservableStruct } from \"yummies/mobx\";\n * ```\n */\n\nimport { action, makeObservable, observable } from 'mobx';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { AnyObject } from 'yummies/types';\n\n/**\n * Wraps a plain object into a deeply observable structure and allows\n * patch-like updates while preserving nested observable references where possible.\n *\n * @template TData Observable object shape.\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ user: { name: 'Ann' } });\n * state.set({ user: { name: 'Bob' } });\n * ```\n *\n * @example\n * ```ts\n * const state = new DeepObservableStruct({ filters: { active: true } });\n * state.set({ filters: { active: false, archived: true } });\n * ```\n */\nexport class DeepObservableStruct<TData extends AnyObject> {\n data: TData;\n\n constructor(data: TData) {\n this.data = data;\n\n makeObservable(this, {\n data: observable.deep,\n set: action,\n });\n }\n\n set(newData: Partial<TData>) {\n type StackItem = [key: string, currObservable: AnyObject, new: AnyObject];\n\n const stack: StackItem[] = Object.keys(this.data).map((key) => [\n key,\n this.data,\n newData,\n ]);\n\n let currentIndex = 0;\n let stackLength = stack.length;\n\n while (currentIndex < stackLength) {\n const [key, currObservableData, newData] = stack[currentIndex];\n const newValue = newData[key];\n const currValue = currObservableData[key];\n\n currentIndex++;\n\n if (key in newData) {\n if (typeGuard.isObject(newValue) && typeGuard.isObject(currValue)) {\n const newValueKeys = Object.keys(newValue);\n\n Object.keys(currValue).forEach((childKey) => {\n if (!(childKey in newValue)) {\n delete currObservableData[key][childKey];\n }\n });\n\n newValueKeys.forEach((childKey) => {\n const length = stack.push([\n childKey,\n currObservableData[key],\n newValue,\n ]);\n stackLength = length;\n });\n } else if (newValue !== currValue) {\n currObservableData[key] = newValue;\n }\n } else {\n delete currObservableData[key];\n }\n }\n\n Object.keys(newData).forEach((newDataKey) => {\n if (!this.data[newDataKey]) {\n // @ts-expect-error\n this.data[newDataKey] = newData[newDataKey];\n }\n });\n }\n}\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * Typed access to MobX **internal administration** (`$mobx`) for advanced tooling, migration scripts,\n * or introspection. Prefer public MobX APIs in application code; reach for this when you must align\n * with library internals or patch behavior at the administration layer.\n *\n * ## Usage\n *\n * ```ts\n * import { getMobxAdministration } from \"yummies/mobx\";\n * ```\n */\n\nimport { $mobx, type AnnotationMapEntry } from 'mobx';\nimport type { AnyObject } from 'yummies/types';\n\ntype ObservableObjectAdministration = Parameters<\n Exclude<AnnotationMapEntry, boolean>['make_']\n>[0];\n\n/**\n * Returns the internal MobX administration object associated with an observable target.\n *\n * @param context Observable object instance.\n * @returns MobX administration internals stored under `$mobx`.\n *\n * @example\n * ```ts\n * const admin = getMobxAdministration(store);\n * admin.name_;\n * ```\n *\n * @example\n * ```ts\n * const values = getMobxAdministration(formState).values_;\n * ```\n */\nexport const getMobxAdministration = (\n context: AnyObject,\n): ObservableObjectAdministration => context[$mobx];\n","/**\n * ---header-docs-section---\n * # yummies/mobx\n *\n * ## Description\n *\n * **Lazy subscriptions** tied to MobX observation: start work when the first reaction observes\n * tracked keys, stop when nothing listens anymore (optionally after a delay). Ideal for polling,\n * WebSocket feeds, or expensive caches that should idle when the UI is not mounted.\n *\n * ## Usage\n *\n * ```ts\n * import { lazyObserve } from \"yummies/mobx\";\n * ```\n */\n\nimport { onBecomeObserved, onBecomeUnobserved } from 'mobx';\n\n/**\n * Starts side effects only while one or more MobX observables are being observed.\n *\n * When the first property becomes observed, `onStart` is called. When all tracked\n * properties become unobserved, `onEnd` is called with the value returned by\n * `onStart`. Cleanup can be delayed via `endDelay`.\n *\n * It uses MobX `onBecomeObserved` and `onBecomeUnobserved` hooks to perform\n * lazy subscription management.\n *\n * @template TMetaData Data returned from `onStart` and forwarded to `onEnd`.\n * @param config Configuration for tracked properties and lifecycle callbacks.\n * @returns Cleanup function that clears the tracked state and runs `onEnd`.\n *\n * @example\n * ```ts\n * const stop = lazyObserve({\n * context: store,\n * property: 'items',\n * onStart: () => api.subscribe(),\n * onEnd: (subscription) => subscription.unsubscribe(),\n * });\n * ```\n *\n * @example\n * ```ts\n * lazyObserve({\n * property: [boxA, boxB],\n * onStart: () => console.log('observed'),\n * endDelay: 300,\n * });\n * ```\n */\nexport const lazyObserve = <TMetaData = void>({\n context,\n property,\n onStart,\n onEnd,\n endDelay = false,\n}: {\n context?: any;\n property: any | any[];\n onStart?: () => TMetaData;\n onEnd?: (metaData: TMetaData, cleanupFn: VoidFunction) => void;\n endDelay?: number | false;\n}) => {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let metaData: TMetaData | undefined;\n const observingProps = new Set<string>();\n const properties = Array.isArray(property) ? property : [property];\n\n const cleanup = () => {\n observingProps.clear();\n\n if (endDelay === false) {\n onEnd?.(metaData!, cleanup);\n metaData = undefined;\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n timeoutId = setTimeout(() => {\n onEnd?.(metaData!, cleanup);\n timeoutId = undefined;\n metaData = undefined;\n }, endDelay);\n };\n\n const start = (property: string) => {\n const isAlreadyObserving = observingProps.size > 0;\n observingProps.add(property);\n\n if (isAlreadyObserving) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n metaData = onStart?.();\n };\n\n const stop = (property: string) => {\n const isAlreadyNotObserving = !observingProps.size;\n\n observingProps.delete(property);\n\n const isObserving = observingProps.size > 0;\n\n if (isAlreadyNotObserving || isObserving) {\n return;\n }\n\n cleanup();\n };\n\n properties.forEach((property) => {\n if (context) {\n onBecomeObserved(context, property, () => start(property));\n onBecomeUnobserved(context, property, () => stop(property));\n } else {\n onBecomeObserved(property, () => start(property));\n onBecomeUnobserved(property, () => stop(property));\n }\n });\n\n return cleanup;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,mBACX,SACA,kBACA,kBACG;AACH,KAAI,eAAe;AACjB,mBAAiB,SAAS,CAAC,YAAY,GAAG,YAAY;AACpD,UAAO,SAAS,UAAU;AAExB,eAAW,SAAS,MAAM;KAC1B;IACF;AAEF,iBAAe,QAAQ;QAClB;EACL,MAAM,oBAA+B,EAAE;AAEvC,mBAAiB,SAAS,CAAC,YAAY,GAAG,YAAY;AACpD,UAAO,SAAS,UAAU;AACxB,sBAAkB,SAAS;KAC3B;IACF;AAEF,iBAAe,SAAS,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpB9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60 * 60,
8
- day: 1e3 * 60 * 60 * 24,
9
- week: 1e3 * 60 * 60 * 24 * 7
2
+ //#region src/ms.ts
3
+ /**
4
+ * ---header-docs-section---
5
+ * # yummies/ms
6
+ *
7
+ * ## Description
8
+ *
9
+ * Converts human-friendly time units (seconds, minutes, hours, days, weeks) to **milliseconds** for
10
+ * timers, animations, and `dayjs`-style math. The `unitsToMs` map is shared across the library so
11
+ * delays and durations stay consistent instead of scattering `* 1000` literals through the code.
12
+ *
13
+ * ## Usage
14
+ *
15
+ * ```ts
16
+ * import { ms } from "yummies/ms";
17
+ * ```
18
+ */
19
+ var unitsToMs = {
20
+ ms: 1,
21
+ sec: 1e3,
22
+ min: 1e3 * 60,
23
+ hour: 1e3 * 60 * 60,
24
+ day: 1e3 * 60 * 60 * 24,
25
+ week: 1e3 * 60 * 60 * 24 * 7
10
26
  };
11
- const ms = (value, unit = "ms") => value * unitsToMs[unit];
27
+ /**
28
+ * Converts a value in the specified unit to milliseconds.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * ms(1, 'min') // 60_000
33
+ * ms(30, 'sec') // 30_000
34
+ * ```
35
+ */
36
+ var ms = (value, unit = "ms") => value * unitsToMs[unit];
37
+ //#endregion
12
38
  exports.ms = ms;
13
39
  exports.unitsToMs = unitsToMs;
14
- //# sourceMappingURL=ms.cjs.map
40
+
41
+ //# sourceMappingURL=ms.cjs.map
package/ms.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ms.cjs","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Converts a value in the specified unit to milliseconds.\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":[],"mappings":";;AAAO,MAAM,YAAY;AAAA,EACvB,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK,MAAO;AAAA,EACZ,MAAM,MAAO,KAAK;AAAA,EAClB,KAAK,MAAO,KAAK,KAAK;AAAA,EACtB,MAAM,MAAO,KAAK,KAAK,KAAK;AAC9B;AAWO,MAAM,KAAK,CAAC,OAAe,OAA+B,SAC/D,QAAQ,UAAU,IAAI;;;"}
1
+ {"version":3,"file":"ms.cjs","names":[],"sources":["../src/ms.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/ms\n *\n * ## Description\n *\n * Converts human-friendly time units (seconds, minutes, hours, days, weeks) to **milliseconds** for\n * timers, animations, and `dayjs`-style math. The `unitsToMs` map is shared across the library so\n * delays and durations stay consistent instead of scattering `* 1000` literals through the code.\n *\n * ## Usage\n *\n * ```ts\n * import { ms } from \"yummies/ms\";\n * ```\n */\n\nexport const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Converts a value in the specified unit to milliseconds.\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAa,YAAY;CACvB,IAAI;CACJ,KAAK;CACL,KAAK,MAAO;CACZ,MAAM,MAAO,KAAK;CAClB,KAAK,MAAO,KAAK,KAAK;CACtB,MAAM,MAAO,KAAK,KAAK,KAAK;CAC7B;;;;;;;;;;AAWD,IAAa,MAAM,OAAe,OAA+B,SAC/D,QAAQ,UAAU"}
package/ms.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ /**
2
+ * ---header-docs-section---
3
+ * # yummies/ms
4
+ *
5
+ * ## Description
6
+ *
7
+ * Converts human-friendly time units (seconds, minutes, hours, days, weeks) to **milliseconds** for
8
+ * timers, animations, and `dayjs`-style math. The `unitsToMs` map is shared across the library so
9
+ * delays and durations stay consistent instead of scattering `* 1000` literals through the code.
10
+ *
11
+ * ## Usage
12
+ *
13
+ * ```ts
14
+ * import { ms } from "yummies/ms";
15
+ * ```
16
+ */
1
17
  declare const unitsToMs: {
2
18
  readonly ms: 1;
3
19
  readonly sec: 1000;
package/ms.js CHANGED
@@ -1,14 +1,39 @@
1
- const unitsToMs = {
2
- ms: 1,
3
- sec: 1e3,
4
- min: 1e3 * 60,
5
- hour: 1e3 * 60 * 60,
6
- day: 1e3 * 60 * 60 * 24,
7
- week: 1e3 * 60 * 60 * 24 * 7
1
+ //#region src/ms.ts
2
+ /**
3
+ * ---header-docs-section---
4
+ * # yummies/ms
5
+ *
6
+ * ## Description
7
+ *
8
+ * Converts human-friendly time units (seconds, minutes, hours, days, weeks) to **milliseconds** for
9
+ * timers, animations, and `dayjs`-style math. The `unitsToMs` map is shared across the library so
10
+ * delays and durations stay consistent instead of scattering `* 1000` literals through the code.
11
+ *
12
+ * ## Usage
13
+ *
14
+ * ```ts
15
+ * import { ms } from "yummies/ms";
16
+ * ```
17
+ */
18
+ var unitsToMs = {
19
+ ms: 1,
20
+ sec: 1e3,
21
+ min: 1e3 * 60,
22
+ hour: 1e3 * 60 * 60,
23
+ day: 1e3 * 60 * 60 * 24,
24
+ week: 1e3 * 60 * 60 * 24 * 7
8
25
  };
9
- const ms = (value, unit = "ms") => value * unitsToMs[unit];
10
- export {
11
- ms,
12
- unitsToMs
13
- };
14
- //# sourceMappingURL=ms.js.map
26
+ /**
27
+ * Converts a value in the specified unit to milliseconds.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * ms(1, 'min') // 60_000
32
+ * ms(30, 'sec') // 30_000
33
+ * ```
34
+ */
35
+ var ms = (value, unit = "ms") => value * unitsToMs[unit];
36
+ //#endregion
37
+ export { ms, unitsToMs };
38
+
39
+ //# sourceMappingURL=ms.js.map
package/ms.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ms.js","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Converts a value in the specified unit to milliseconds.\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":[],"mappings":"AAAO,MAAM,YAAY;AAAA,EACvB,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK,MAAO;AAAA,EACZ,MAAM,MAAO,KAAK;AAAA,EAClB,KAAK,MAAO,KAAK,KAAK;AAAA,EACtB,MAAM,MAAO,KAAK,KAAK,KAAK;AAC9B;AAWO,MAAM,KAAK,CAAC,OAAe,OAA+B,SAC/D,QAAQ,UAAU,IAAI;"}
1
+ {"version":3,"file":"ms.js","names":[],"sources":["../src/ms.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/ms\n *\n * ## Description\n *\n * Converts human-friendly time units (seconds, minutes, hours, days, weeks) to **milliseconds** for\n * timers, animations, and `dayjs`-style math. The `unitsToMs` map is shared across the library so\n * delays and durations stay consistent instead of scattering `* 1000` literals through the code.\n *\n * ## Usage\n *\n * ```ts\n * import { ms } from \"yummies/ms\";\n * ```\n */\n\nexport const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Converts a value in the specified unit to milliseconds.\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,YAAY;CACvB,IAAI;CACJ,KAAK;CACL,KAAK,MAAO;CACZ,MAAM,MAAO,KAAK;CAClB,KAAK,MAAO,KAAK,KAAK;CACtB,MAAM,MAAO,KAAK,KAAK,KAAK;CAC7B;;;;;;;;;;AAWD,IAAa,MAAM,OAAe,OAA+B,SAC/D,QAAQ,UAAU"}
package/number.cjs CHANGED
@@ -1,11 +1,33 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/number.ts
3
+ /**
4
+ * ---header-docs-section---
5
+ * # yummies/number
6
+ *
7
+ * ## Description
8
+ *
9
+ * Numeric rounding that avoids classic floating-point artifacts (`191.212999…`) without paying for
10
+ * string round-trips in hot paths. Use when formatting prices, charts, or sliders where a fixed
11
+ * decimal count must be stable for display and comparisons.
12
+ *
13
+ * ## Usage
14
+ *
15
+ * ```ts
16
+ * import { round } from "yummies/number";
17
+ * ```
18
+ */
19
+ /**
20
+ * Works like `parseFloat(number.toFixed(4))` but performance better
21
+ *
22
+ * @example
23
+ * round(191.212999999999999999999999, 4) // 191.213
24
+ */
3
25
  function round(value, decimalPlaces = 0) {
4
- if (!decimalPlaces) {
5
- return Math.round(value);
6
- }
7
- const factor = 10 ** decimalPlaces;
8
- return Math.round(value * factor) / factor;
26
+ if (!decimalPlaces) return Math.round(value);
27
+ const factor = 10 ** decimalPlaces;
28
+ return Math.round(value * factor) / factor;
9
29
  }
30
+ //#endregion
10
31
  exports.round = round;
11
- //# sourceMappingURL=number.cjs.map
32
+
33
+ //# sourceMappingURL=number.cjs.map
package/number.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"number.cjs","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":[],"mappings":";;AAMO,SAAS,MAAM,OAAe,gBAAwB,GAAW;AACtE,MAAI,CAAC,eAAe;AAClB,WAAO,KAAK,MAAM,KAAK;AAAA,EACzB;AAEA,QAAM,SAAS,MAAM;AACrB,SAAO,KAAK,MAAM,QAAQ,MAAM,IAAI;AACtC;;"}
1
+ {"version":3,"file":"number.cjs","names":[],"sources":["../src/number.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/number\n *\n * ## Description\n *\n * Numeric rounding that avoids classic floating-point artifacts (`191.212999…`) without paying for\n * string round-trips in hot paths. Use when formatting prices, charts, or sliders where a fixed\n * decimal count must be stable for display and comparisons.\n *\n * ## Usage\n *\n * ```ts\n * import { round } from \"yummies/number\";\n * ```\n */\n\n/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,MAAM,OAAe,gBAAwB,GAAW;AACtE,KAAI,CAAC,cACH,QAAO,KAAK,MAAM,MAAM;CAG1B,MAAM,SAAS,MAAM;AACrB,QAAO,KAAK,MAAM,QAAQ,OAAO,GAAG"}
package/number.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ /**
2
+ * ---header-docs-section---
3
+ * # yummies/number
4
+ *
5
+ * ## Description
6
+ *
7
+ * Numeric rounding that avoids classic floating-point artifacts (`191.212999…`) without paying for
8
+ * string round-trips in hot paths. Use when formatting prices, charts, or sliders where a fixed
9
+ * decimal count must be stable for display and comparisons.
10
+ *
11
+ * ## Usage
12
+ *
13
+ * ```ts
14
+ * import { round } from "yummies/number";
15
+ * ```
16
+ */
1
17
  /**
2
18
  * Works like `parseFloat(number.toFixed(4))` but performance better
3
19
  *
package/number.js CHANGED
@@ -1,11 +1,32 @@
1
+ //#region src/number.ts
2
+ /**
3
+ * ---header-docs-section---
4
+ * # yummies/number
5
+ *
6
+ * ## Description
7
+ *
8
+ * Numeric rounding that avoids classic floating-point artifacts (`191.212999…`) without paying for
9
+ * string round-trips in hot paths. Use when formatting prices, charts, or sliders where a fixed
10
+ * decimal count must be stable for display and comparisons.
11
+ *
12
+ * ## Usage
13
+ *
14
+ * ```ts
15
+ * import { round } from "yummies/number";
16
+ * ```
17
+ */
18
+ /**
19
+ * Works like `parseFloat(number.toFixed(4))` but performance better
20
+ *
21
+ * @example
22
+ * round(191.212999999999999999999999, 4) // 191.213
23
+ */
1
24
  function round(value, decimalPlaces = 0) {
2
- if (!decimalPlaces) {
3
- return Math.round(value);
4
- }
5
- const factor = 10 ** decimalPlaces;
6
- return Math.round(value * factor) / factor;
25
+ if (!decimalPlaces) return Math.round(value);
26
+ const factor = 10 ** decimalPlaces;
27
+ return Math.round(value * factor) / factor;
7
28
  }
8
- export {
9
- round
10
- };
11
- //# sourceMappingURL=number.js.map
29
+ //#endregion
30
+ export { round };
31
+
32
+ //# sourceMappingURL=number.js.map
package/number.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":[],"mappings":"AAMO,SAAS,MAAM,OAAe,gBAAwB,GAAW;AACtE,MAAI,CAAC,eAAe;AAClB,WAAO,KAAK,MAAM,KAAK;AAAA,EACzB;AAEA,QAAM,SAAS,MAAM;AACrB,SAAO,KAAK,MAAM,QAAQ,MAAM,IAAI;AACtC;"}
1
+ {"version":3,"file":"number.js","names":[],"sources":["../src/number.ts"],"sourcesContent":["/**\n * ---header-docs-section---\n * # yummies/number\n *\n * ## Description\n *\n * Numeric rounding that avoids classic floating-point artifacts (`191.212999…`) without paying for\n * string round-trips in hot paths. Use when formatting prices, charts, or sliders where a fixed\n * decimal count must be stable for display and comparisons.\n *\n * ## Usage\n *\n * ```ts\n * import { round } from \"yummies/number\";\n * ```\n */\n\n/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,MAAM,OAAe,gBAAwB,GAAW;AACtE,KAAI,CAAC,cACH,QAAO,KAAK,MAAM,MAAM;CAG1B,MAAM,SAAS,MAAM;AACrB,QAAO,KAAK,MAAM,QAAQ,OAAO,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yummies",
3
- "version": "7.11.0",
3
+ "version": "7.13.0",
4
4
  "keywords": [
5
5
  "javascript",
6
6
  "typescript",
@@ -12,7 +12,7 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/js2me/yummies/issues"
14
14
  },
15
- "homepage": "https://github.com/js2me/yummies",
15
+ "homepage": "https://js2me.github.io/yummies/api/async/",
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "git://github.com/js2me/yummies"
@@ -35,7 +35,7 @@
35
35
  "clsx": "^2.1.1",
36
36
  "dayjs": "^1.11.20",
37
37
  "dompurify": "^3.3.3",
38
- "nanoid": "^5.1.6",
38
+ "nanoid": "^5.1.7",
39
39
  "tailwind-merge": "^3.5.0"
40
40
  },
41
41
  "type": "module",
@@ -46,6 +46,14 @@
46
46
  "require": "./async.cjs",
47
47
  "default": "./async.js"
48
48
  },
49
+ "./chunk-CVq3Gv4J": {
50
+ "require": "./chunk-CVq3Gv4J.cjs",
51
+ "default": "./chunk-CVq3Gv4J.cjs"
52
+ },
53
+ "./chunk-YKewjYmz": {
54
+ "import": "./chunk-YKewjYmz.js",
55
+ "default": "./chunk-YKewjYmz.js"
56
+ },
49
57
  "./common": {
50
58
  "types": "./common.d.ts",
51
59
  "import": "./common.js",
package/parser.cjs CHANGED
@@ -1,69 +1,122 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const format = require("yummies/format");
4
- const typeGuard = require("yummies/type-guard");
5
- const number = (input, userSettings) => {
6
- const settings = {
7
- ...number.defaultSettings,
8
- ...userSettings
9
- };
10
- const fallback = "fallback" in settings ? settings.fallback : 0;
11
- let result;
12
- if (typeGuard.typeGuard.isNumber(input)) {
13
- result = input;
14
- } else if (typeGuard.typeGuard.isString(input)) {
15
- const formattedInput = format.format.skipSpaces(input).replace(",", ".");
16
- if (formattedInput === "") {
17
- result = fallback;
18
- } else {
19
- result = Number(formattedInput);
20
- }
21
- } else {
22
- result = fallback;
23
- }
24
- if (typeGuard.typeGuard.isNumber(result)) {
25
- if (settings?.clamped != null) {
26
- result = Math.max(
27
- settings.clamped[0] ?? -Infinity,
28
- Math.min(result, settings.clamped[1] ?? Infinity)
29
- );
30
- }
31
- if (settings?.ceil != null) {
32
- result = Math.ceil(result);
33
- }
34
- if (settings?.floor != null) {
35
- result = Math.floor(result);
36
- }
37
- if (settings?.digits != null) {
38
- result = +result.toFixed(settings.digits);
39
- }
40
- return result;
41
- } else {
42
- return fallback;
43
- }
2
+ const require_chunk = require("./chunk-CVq3Gv4J.cjs");
3
+ let yummies_type_guard = require("yummies/type-guard");
4
+ let yummies_format = require("yummies/format");
5
+ //#region src/parser/number.ts
6
+ /**
7
+ * Parses a number from raw input and optionally clamps, rounds or limits
8
+ * fractional digits.
9
+ *
10
+ * Strings are normalized by removing spaces and replacing `,` with `.` before
11
+ * parsing. Invalid inputs return the configured fallback.
12
+ *
13
+ * @template TFallback Fallback value type returned when parsing fails.
14
+ * @param input Raw value to parse.
15
+ * @param userSettings Parser settings merged with `number.defaultSettings`.
16
+ * @returns Parsed number or fallback value.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * number('1 234,5'); // 1234.5
21
+ * ```
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * number('bad', { fallback: 0 }); // 0
26
+ * ```
27
+ */
28
+ var number = (input, userSettings) => {
29
+ const settings = {
30
+ ...number.defaultSettings,
31
+ ...userSettings
32
+ };
33
+ const fallback = "fallback" in settings ? settings.fallback : 0;
34
+ let result;
35
+ if (yummies_type_guard.typeGuard.isNumber(input)) result = input;
36
+ else if (yummies_type_guard.typeGuard.isString(input)) {
37
+ const formattedInput = yummies_format.format.skipSpaces(input).replace(",", ".");
38
+ if (formattedInput === "") result = fallback;
39
+ else result = Number(formattedInput);
40
+ } else result = fallback;
41
+ if (yummies_type_guard.typeGuard.isNumber(result)) {
42
+ if (settings?.clamped != null) result = Math.max(settings.clamped[0] ?? -Infinity, Math.min(result, settings.clamped[1] ?? Infinity));
43
+ if (settings?.ceil != null) result = Math.ceil(result);
44
+ if (settings?.floor != null) result = Math.floor(result);
45
+ if (settings?.digits != null) result = +result.toFixed(settings.digits);
46
+ return result;
47
+ } else return fallback;
44
48
  };
45
49
  number.defaultSettings = {};
46
- const percent = (value, maxValue, settings) => {
47
- return number(Number(value) / Number(maxValue) * 100, settings);
50
+ //#endregion
51
+ //#region src/parser/percent.ts
52
+ /**
53
+ * Converts a value into a percentage of `maxValue` and parses the result with
54
+ * the shared numeric parser.
55
+ *
56
+ * @template TFallback Fallback value type returned when parsing fails.
57
+ * @param value Current value.
58
+ * @param maxValue Maximum value representing `100%`.
59
+ * @param settings Numeric parser settings for the computed percentage.
60
+ * @returns Parsed percentage or fallback value.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * percent(25, 200); // 12.5
65
+ * ```
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * percent('bad', 100, { fallback: 0 }); // 0
70
+ * ```
71
+ */
72
+ var percent = (value, maxValue, settings) => {
73
+ return number(Number(value) / Number(maxValue) * 100, settings);
48
74
  };
49
- const string = (input, settings) => {
50
- const fallback = settings && "fallback" in settings ? settings.fallback : "";
51
- if (input == null) {
52
- return fallback;
53
- }
54
- if (typeGuard.typeGuard.isObject(input)) {
55
- if (settings?.prettyJson) {
56
- return JSON.stringify(input, null, 2);
57
- }
58
- return JSON.stringify(input);
59
- }
60
- return String(input);
75
+ //#endregion
76
+ //#region src/parser/string.ts
77
+ /**
78
+ * Converts arbitrary input into a string representation.
79
+ *
80
+ * Objects are serialized with `JSON.stringify`, optionally pretty-printed, and
81
+ * nullish values resolve to the configured fallback.
82
+ *
83
+ * @template TFallback Fallback value type returned for nullish input.
84
+ * @param input Raw value to stringify.
85
+ * @param settings String conversion settings.
86
+ * @returns Stringified input or fallback value.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * string(123); // '123'
91
+ * ```
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * string({ id: 1 }, { prettyJson: true });
96
+ * ```
97
+ */
98
+ var string = (input, settings) => {
99
+ const fallback = settings && "fallback" in settings ? settings.fallback : "";
100
+ if (input == null) return fallback;
101
+ if (yummies_type_guard.typeGuard.isObject(input)) {
102
+ if (settings?.prettyJson) return JSON.stringify(input, null, 2);
103
+ return JSON.stringify(input);
104
+ }
105
+ return String(input);
61
106
  };
62
- const _exports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
63
- __proto__: null,
64
- number,
65
- percent,
66
- string
67
- }, Symbol.toStringTag, { value: "Module" }));
68
- exports.parser = _exports;
69
- //# sourceMappingURL=parser.cjs.map
107
+ //#endregion
108
+ //#region src/parser/_exports.ts
109
+ var _exports_exports = /* @__PURE__ */ require_chunk.__exportAll({
110
+ number: () => number,
111
+ percent: () => percent,
112
+ string: () => string
113
+ });
114
+ //#endregion
115
+ Object.defineProperty(exports, "parser", {
116
+ enumerable: true,
117
+ get: function() {
118
+ return _exports_exports;
119
+ }
120
+ });
121
+
122
+ //# sourceMappingURL=parser.cjs.map
package/parser.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"parser.cjs","sources":["../src/parser/number.ts","../src/parser/percent.ts","../src/parser/string.ts"],"sourcesContent":["import { format } from 'yummies/format';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nexport interface NumberParserSettings<TFallback = number> {\n digits?: number;\n fallback?: TFallback;\n /**\n * Round to upper boundary\n * 5.1 -> 6\n */\n ceil?: boolean;\n /**\n * Round to bottom boundary\n * 5.9 -> 5\n */\n floor?: boolean;\n clamped?: [min?: Maybe<number>, max?: Maybe<number>];\n}\n\n/**\n * Parses a number from raw input and optionally clamps, rounds or limits\n * fractional digits.\n *\n * Strings are normalized by removing spaces and replacing `,` with `.` before\n * parsing. Invalid inputs return the configured fallback.\n *\n * @template TFallback Fallback value type returned when parsing fails.\n * @param input Raw value to parse.\n * @param userSettings Parser settings merged with `number.defaultSettings`.\n * @returns Parsed number or fallback value.\n *\n * @example\n * ```ts\n * number('1 234,5'); // 1234.5\n * ```\n *\n * @example\n * ```ts\n * number('bad', { fallback: 0 }); // 0\n * ```\n */\nexport const number = <TFallback = number>(\n input: Maybe<unknown>,\n userSettings?: Maybe<NumberParserSettings<TFallback>>,\n): number | TFallback => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const fallback = (\n 'fallback' in settings ? settings.fallback : 0\n ) as TFallback;\n\n let result: number;\n\n if (typeGuard.isNumber(input)) {\n result = input;\n } else if (typeGuard.isString(input)) {\n const formattedInput = format.skipSpaces(input).replace(',', '.');\n if (formattedInput === '') {\n result = fallback as any;\n } else {\n result = Number(formattedInput);\n }\n } else {\n result = fallback as any;\n }\n\n if (typeGuard.isNumber(result)) {\n if (settings?.clamped != null) {\n result = Math.max(\n settings.clamped[0] ?? -Infinity,\n Math.min(result, settings.clamped[1] ?? Infinity),\n );\n }\n\n if (settings?.ceil != null) {\n result = Math.ceil(result);\n }\n\n if (settings?.floor != null) {\n result = Math.floor(result);\n }\n\n if (settings?.digits != null) {\n result = +result.toFixed(settings.digits);\n }\n\n return result;\n } else {\n return fallback;\n }\n};\n\nnumber.defaultSettings = {} as NumberParserSettings;\n","import type { Maybe } from 'yummies/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\n/**\n * Converts a value into a percentage of `maxValue` and parses the result with\n * the shared numeric parser.\n *\n * @template TFallback Fallback value type returned when parsing fails.\n * @param value Current value.\n * @param maxValue Maximum value representing `100%`.\n * @param settings Numeric parser settings for the computed percentage.\n * @returns Parsed percentage or fallback value.\n *\n * @example\n * ```ts\n * percent(25, 200); // 12.5\n * ```\n *\n * @example\n * ```ts\n * percent('bad', 100, { fallback: 0 }); // 0\n * ```\n */\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\n/**\n * Converts arbitrary input into a string representation.\n *\n * Objects are serialized with `JSON.stringify`, optionally pretty-printed, and\n * nullish values resolve to the configured fallback.\n *\n * @template TFallback Fallback value type returned for nullish input.\n * @param input Raw value to stringify.\n * @param settings String conversion settings.\n * @returns Stringified input or fallback value.\n *\n * @example\n * ```ts\n * string(123); // '123'\n * ```\n *\n * @example\n * ```ts\n * string({ id: 1 }, { prettyJson: true });\n * ```\n */\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n"],"names":["typeGuard","format"],"mappings":";;;;AA0CO,MAAM,SAAS,CACpB,OACA,iBACuB;AACvB,QAAM,WAAW;AAAA,IACf,GAAG,OAAO;AAAA,IACV,GAAG;AAAA,EAAA;AAGL,QAAM,WACJ,cAAc,WAAW,SAAS,WAAW;AAG/C,MAAI;AAEJ,MAAIA,UAAAA,UAAU,SAAS,KAAK,GAAG;AAC7B,aAAS;AAAA,EACX,WAAWA,UAAAA,UAAU,SAAS,KAAK,GAAG;AACpC,UAAM,iBAAiBC,OAAAA,OAAO,WAAW,KAAK,EAAE,QAAQ,KAAK,GAAG;AAChE,QAAI,mBAAmB,IAAI;AACzB,eAAS;AAAA,IACX,OAAO;AACL,eAAS,OAAO,cAAc;AAAA,IAChC;AAAA,EACF,OAAO;AACL,aAAS;AAAA,EACX;AAEA,MAAID,UAAAA,UAAU,SAAS,MAAM,GAAG;AAC9B,QAAI,UAAU,WAAW,MAAM;AAC7B,eAAS,KAAK;AAAA,QACZ,SAAS,QAAQ,CAAC,KAAK;AAAA,QACvB,KAAK,IAAI,QAAQ,SAAS,QAAQ,CAAC,KAAK,QAAQ;AAAA,MAAA;AAAA,IAEpD;AAEA,QAAI,UAAU,QAAQ,MAAM;AAC1B,eAAS,KAAK,KAAK,MAAM;AAAA,IAC3B;AAEA,QAAI,UAAU,SAAS,MAAM;AAC3B,eAAS,KAAK,MAAM,MAAM;AAAA,IAC5B;AAEA,QAAI,UAAU,UAAU,MAAM;AAC5B,eAAS,CAAC,OAAO,QAAQ,SAAS,MAAM;AAAA,IAC1C;AAEA,WAAO;AAAA,EACT,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAEA,OAAO,kBAAkB,CAAA;ACxElB,MAAM,UAAU,CACrB,OACA,UACA,aACG;AACH,SAAO,OAAmB,OAAO,KAAK,IAAI,OAAO,QAAQ,IAAK,KAAK,QAAQ;AAC7E;ACDO,MAAM,SAAS,CACpB,OACA,aACuB;AACvB,QAAM,WACJ,YAAY,cAAc,WAAY,SAAS,WAAyB;AAE1E,MAAI,SAAS,MAAM;AACjB,WAAO;AAAA,EACT;AAEA,MAAIA,UAAAA,UAAU,SAAS,KAAK,GAAG;AAC7B,QAAI,UAAU,YAAY;AACxB,aAAO,KAAK,UAAU,OAAO,MAAM,CAAC;AAAA,IACtC;AAEA,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AAEA,SAAO,OAAO,KAAK;AACrB;;;;;;;;"}
1
+ {"version":3,"file":"parser.cjs","names":[],"sources":["../src/parser/number.ts","../src/parser/percent.ts","../src/parser/string.ts","../src/parser/_exports.ts"],"sourcesContent":["import { format } from 'yummies/format';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nexport interface NumberParserSettings<TFallback = number> {\n digits?: number;\n fallback?: TFallback;\n /**\n * Round to upper boundary\n * 5.1 -> 6\n */\n ceil?: boolean;\n /**\n * Round to bottom boundary\n * 5.9 -> 5\n */\n floor?: boolean;\n clamped?: [min?: Maybe<number>, max?: Maybe<number>];\n}\n\n/**\n * Parses a number from raw input and optionally clamps, rounds or limits\n * fractional digits.\n *\n * Strings are normalized by removing spaces and replacing `,` with `.` before\n * parsing. Invalid inputs return the configured fallback.\n *\n * @template TFallback Fallback value type returned when parsing fails.\n * @param input Raw value to parse.\n * @param userSettings Parser settings merged with `number.defaultSettings`.\n * @returns Parsed number or fallback value.\n *\n * @example\n * ```ts\n * number('1 234,5'); // 1234.5\n * ```\n *\n * @example\n * ```ts\n * number('bad', { fallback: 0 }); // 0\n * ```\n */\nexport const number = <TFallback = number>(\n input: Maybe<unknown>,\n userSettings?: Maybe<NumberParserSettings<TFallback>>,\n): number | TFallback => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const fallback = (\n 'fallback' in settings ? settings.fallback : 0\n ) as TFallback;\n\n let result: number;\n\n if (typeGuard.isNumber(input)) {\n result = input;\n } else if (typeGuard.isString(input)) {\n const formattedInput = format.skipSpaces(input).replace(',', '.');\n if (formattedInput === '') {\n result = fallback as any;\n } else {\n result = Number(formattedInput);\n }\n } else {\n result = fallback as any;\n }\n\n if (typeGuard.isNumber(result)) {\n if (settings?.clamped != null) {\n result = Math.max(\n settings.clamped[0] ?? -Infinity,\n Math.min(result, settings.clamped[1] ?? Infinity),\n );\n }\n\n if (settings?.ceil != null) {\n result = Math.ceil(result);\n }\n\n if (settings?.floor != null) {\n result = Math.floor(result);\n }\n\n if (settings?.digits != null) {\n result = +result.toFixed(settings.digits);\n }\n\n return result;\n } else {\n return fallback;\n }\n};\n\nnumber.defaultSettings = {} as NumberParserSettings;\n","import type { Maybe } from 'yummies/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\n/**\n * Converts a value into a percentage of `maxValue` and parses the result with\n * the shared numeric parser.\n *\n * @template TFallback Fallback value type returned when parsing fails.\n * @param value Current value.\n * @param maxValue Maximum value representing `100%`.\n * @param settings Numeric parser settings for the computed percentage.\n * @returns Parsed percentage or fallback value.\n *\n * @example\n * ```ts\n * percent(25, 200); // 12.5\n * ```\n *\n * @example\n * ```ts\n * percent('bad', 100, { fallback: 0 }); // 0\n * ```\n */\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\n/**\n * Converts arbitrary input into a string representation.\n *\n * Objects are serialized with `JSON.stringify`, optionally pretty-printed, and\n * nullish values resolve to the configured fallback.\n *\n * @template TFallback Fallback value type returned for nullish input.\n * @param input Raw value to stringify.\n * @param settings String conversion settings.\n * @returns Stringified input or fallback value.\n *\n * @example\n * ```ts\n * string(123); // '123'\n * ```\n *\n * @example\n * ```ts\n * string({ id: 1 }, { prettyJson: true });\n * ```\n */\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n","/**\n * ---header-docs-section---\n * # yummies/parser\n *\n * ## Description\n *\n * Parsers for user-entered **numbers, percents, and strings** with tolerant input and typed\n * results. Use when normalizing form values, query params, or CSV-like text before validation\n * schemas run, without duplicating regex and `parseFloat` edge cases in every feature module.\n *\n * ## Usage\n *\n * ```ts\n * import { parser } from \"yummies/parser\";\n * ```\n */\n\nexport * from './number.js';\nexport * from './percent.js';\nexport * from './string.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,UACX,OACA,iBACuB;CACvB,MAAM,WAAW;EACf,GAAG,OAAO;EACV,GAAG;EACJ;CAED,MAAM,WACJ,cAAc,WAAW,SAAS,WAAW;CAG/C,IAAI;AAEJ,KAAI,mBAAA,UAAU,SAAS,MAAM,CAC3B,UAAS;UACA,mBAAA,UAAU,SAAS,MAAM,EAAE;EACpC,MAAM,iBAAiB,eAAA,OAAO,WAAW,MAAM,CAAC,QAAQ,KAAK,IAAI;AACjE,MAAI,mBAAmB,GACrB,UAAS;MAET,UAAS,OAAO,eAAe;OAGjC,UAAS;AAGX,KAAI,mBAAA,UAAU,SAAS,OAAO,EAAE;AAC9B,MAAI,UAAU,WAAW,KACvB,UAAS,KAAK,IACZ,SAAS,QAAQ,MAAM,WACvB,KAAK,IAAI,QAAQ,SAAS,QAAQ,MAAM,SAAS,CAClD;AAGH,MAAI,UAAU,QAAQ,KACpB,UAAS,KAAK,KAAK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