yummies 5.3.1 → 5.4.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.
- package/dist/async.cjs +70 -0
- package/dist/async.d.ts +28 -0
- package/dist/async.d.ts.map +1 -0
- package/dist/common.cjs +18 -0
- package/dist/common.d.cts +15 -0
- package/dist/common.d.cts.map +1 -0
- package/{common.d.ts → dist/common.d.ts} +1 -1
- package/dist/common.d.ts.map +1 -0
- package/dist/complex/counter.cjs +21 -0
- package/dist/complex/counter.d.ts +15 -0
- package/dist/complex/counter.d.ts.map +1 -0
- package/dist/complex/global-config.cjs +46 -0
- package/dist/complex/global-config.d.cts +11 -0
- package/dist/complex/global-config.d.cts.map +1 -0
- package/{complex → dist/complex}/global-config.d.ts +1 -1
- package/dist/complex/global-config.d.ts.map +1 -0
- package/dist/complex/index.cjs +19 -0
- package/dist/complex/index.d.cts +4 -0
- package/dist/complex/index.d.cts.map +1 -0
- package/dist/complex/index.d.ts +4 -0
- package/dist/complex/index.d.ts.map +1 -0
- package/dist/complex/index.js +3 -0
- package/dist/complex/modules-factory.cjs +50 -0
- package/dist/complex/modules-factory.d.cts +49 -0
- package/dist/complex/modules-factory.d.cts.map +1 -0
- package/{complex → dist/complex}/modules-factory.d.ts +1 -1
- package/dist/complex/modules-factory.d.ts.map +1 -0
- package/dist/cookie.cjs +13 -0
- package/dist/cookie.d.cts +3 -0
- package/dist/cookie.d.cts.map +1 -0
- package/dist/cookie.d.ts +3 -0
- package/{cookie.d.ts.map → dist/cookie.d.ts.map} +1 -1
- package/dist/data.cjs +58 -0
- package/dist/data.d.ts +4 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/date-time.cjs +171 -0
- package/dist/date-time.d.cts +28 -0
- package/dist/date-time.d.cts.map +1 -0
- package/{date-time.d.ts → dist/date-time.d.ts} +1 -1
- package/dist/date-time.d.ts.map +1 -0
- package/{date-time.js → dist/date-time.js} +4 -4
- package/dist/device.cjs +28 -0
- package/dist/device.d.ts +8 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/encodings.cjs +270 -0
- package/dist/encodings.d.ts +2 -0
- package/dist/encodings.d.ts.map +1 -0
- package/dist/errors.cjs +34 -0
- package/dist/errors.d.cts +19 -0
- package/dist/errors.d.cts.map +1 -0
- package/{errors.d.ts → dist/errors.d.ts} +1 -1
- package/dist/errors.d.ts.map +1 -0
- package/{errors.js → dist/errors.js} +1 -1
- package/dist/file.cjs +29 -0
- package/dist/file.d.ts +3 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/format/_exports.cjs +20 -0
- package/dist/format/_exports.d.cts +5 -0
- package/dist/format/_exports.d.cts.map +1 -0
- package/dist/format/_exports.d.ts +5 -0
- package/dist/format/_exports.d.ts.map +1 -0
- package/dist/format/_exports.js +4 -0
- package/dist/format/constants.cjs +6 -0
- package/dist/format/constants.d.ts +4 -0
- package/dist/format/constants.d.ts.map +1 -0
- package/dist/format/index.cjs +40 -0
- package/dist/format/index.d.cts +3 -0
- package/dist/format/index.d.cts.map +1 -0
- package/dist/format/index.d.ts +3 -0
- package/{format → dist/format}/index.d.ts.map +1 -1
- package/{format → dist/format}/index.js +1 -1
- package/dist/format/number.cjs +48 -0
- package/dist/format/number.d.cts +36 -0
- package/dist/format/number.d.cts.map +1 -0
- package/{format → dist/format}/number.d.ts +1 -1
- package/dist/format/number.d.ts.map +1 -0
- package/{format → dist/format}/number.js +3 -3
- package/dist/format/percent.cjs +27 -0
- package/dist/format/percent.d.cts +15 -0
- package/dist/format/percent.d.cts.map +1 -0
- package/{format → dist/format}/percent.d.ts +2 -2
- package/dist/format/percent.d.ts.map +1 -0
- package/{format → dist/format}/percent.js +3 -3
- package/dist/format/skip-spaces.cjs +8 -0
- package/dist/format/skip-spaces.d.ts +5 -0
- package/dist/format/skip-spaces.d.ts.map +1 -0
- package/dist/html.cjs +202 -0
- package/dist/html.d.cts +44 -0
- package/dist/html.d.cts.map +1 -0
- package/{html.d.ts → dist/html.d.ts} +1 -1
- package/dist/html.d.ts.map +1 -0
- package/{html.js → dist/html.js} +1 -1
- package/dist/id.cjs +76 -0
- package/dist/id.d.ts +63 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/imports.cjs +45 -0
- package/dist/imports.d.ts +15 -0
- package/dist/imports.d.ts.map +1 -0
- package/{imports.js → dist/imports.js} +1 -1
- package/dist/math.cjs +23 -0
- package/dist/math.d.cts +13 -0
- package/dist/math.d.cts.map +1 -0
- package/{math.d.ts → dist/math.d.ts} +1 -1
- package/dist/math.d.ts.map +1 -0
- package/dist/media.cjs +115 -0
- package/dist/media.d.ts +20 -0
- package/dist/media.d.ts.map +1 -0
- package/{media.js → dist/media.js} +1 -1
- package/dist/mobx/apply-observable.cjs +16 -0
- package/dist/mobx/apply-observable.d.cts +4 -0
- package/dist/mobx/apply-observable.d.cts.map +1 -0
- package/{mobx → dist/mobx}/apply-observable.d.ts +1 -1
- package/dist/mobx/apply-observable.d.ts.map +1 -0
- package/dist/mobx/create-enhanced-atom.cjs +16 -0
- package/dist/mobx/create-enhanced-atom.d.cts +11 -0
- package/dist/mobx/create-enhanced-atom.d.cts.map +1 -0
- package/{mobx → dist/mobx}/create-enhanced-atom.d.ts +1 -1
- package/dist/mobx/create-enhanced-atom.d.ts.map +1 -0
- package/{mobx → dist/mobx}/create-enhanced-atom.js +2 -2
- package/dist/mobx/deep-observable-struct.cjs +61 -0
- package/dist/mobx/deep-observable-struct.d.cts +7 -0
- package/dist/mobx/deep-observable-struct.d.cts.map +1 -0
- package/{mobx → dist/mobx}/deep-observable-struct.d.ts +1 -1
- package/dist/mobx/deep-observable-struct.d.ts.map +1 -0
- package/{mobx → dist/mobx}/deep-observable-struct.js +1 -1
- package/dist/mobx/get-mobx-administration.cjs +6 -0
- package/dist/mobx/get-mobx-administration.d.cts +6 -0
- package/dist/mobx/get-mobx-administration.d.cts.map +1 -0
- package/{mobx → dist/mobx}/get-mobx-administration.d.ts +1 -1
- package/dist/mobx/get-mobx-administration.d.ts.map +1 -0
- package/dist/mobx/index.cjs +21 -0
- package/dist/mobx/index.d.cts +6 -0
- package/dist/mobx/index.d.cts.map +1 -0
- package/dist/mobx/index.d.ts +6 -0
- package/dist/mobx/index.d.ts.map +1 -0
- package/dist/mobx/index.js +5 -0
- package/dist/mobx/lazy-observe.cjs +47 -0
- package/dist/mobx/lazy-observe.d.ts +8 -0
- package/dist/mobx/lazy-observe.d.ts.map +1 -0
- package/dist/ms.cjs +22 -0
- package/dist/ms.d.ts +19 -0
- package/dist/ms.d.ts.map +1 -0
- package/dist/number.cjs +16 -0
- package/dist/number.d.ts +8 -0
- package/dist/number.d.ts.map +1 -0
- package/dist/parser/_exports.cjs +19 -0
- package/dist/parser/_exports.d.cts +4 -0
- package/dist/parser/_exports.d.cts.map +1 -0
- package/dist/parser/_exports.d.ts +4 -0
- package/dist/parser/_exports.d.ts.map +1 -0
- package/dist/parser/_exports.js +3 -0
- package/dist/parser/index.cjs +40 -0
- package/dist/parser/index.d.cts +3 -0
- package/dist/parser/index.d.cts.map +1 -0
- package/dist/parser/index.d.ts +3 -0
- package/{parser → dist/parser}/index.d.ts.map +1 -1
- package/{parser → dist/parser}/index.js +1 -1
- package/dist/parser/number.cjs +48 -0
- package/dist/parser/number.d.cts +21 -0
- package/dist/parser/number.d.cts.map +1 -0
- package/{parser → dist/parser}/number.d.ts +1 -1
- package/dist/parser/number.d.ts.map +1 -0
- package/{parser → dist/parser}/number.js +2 -2
- package/dist/parser/percent.cjs +8 -0
- package/dist/parser/percent.d.cts +4 -0
- package/dist/parser/percent.d.cts.map +1 -0
- package/{parser → dist/parser}/percent.d.ts +2 -2
- package/dist/parser/percent.d.ts.map +1 -0
- package/{parser → dist/parser}/percent.js +1 -1
- package/dist/parser/string.cjs +18 -0
- package/dist/parser/string.d.cts +7 -0
- package/dist/parser/string.d.cts.map +1 -0
- package/{parser → dist/parser}/string.d.ts +1 -1
- package/dist/parser/string.d.ts.map +1 -0
- package/{parser → dist/parser}/string.js +1 -1
- package/dist/price.cjs +21 -0
- package/dist/price.d.ts +6 -0
- package/dist/price.d.ts.map +1 -0
- package/dist/random.cjs +25 -0
- package/dist/random.d.ts +9 -0
- package/dist/random.d.ts.map +1 -0
- package/dist/react/hooks/index.cjs +37 -0
- package/dist/react/hooks/index.d.cts +22 -0
- package/dist/react/hooks/index.d.cts.map +1 -0
- package/dist/react/hooks/index.d.ts +22 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/index.js +21 -0
- package/dist/react/hooks/use-abort-controller.cjs +15 -0
- package/dist/react/hooks/use-abort-controller.d.ts +2 -0
- package/dist/react/hooks/use-abort-controller.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-abort-controller.js +1 -1
- package/dist/react/hooks/use-abort-signal.cjs +8 -0
- package/dist/react/hooks/use-abort-signal.d.ts +2 -0
- package/dist/react/hooks/use-abort-signal.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-abort-signal.js +1 -1
- package/dist/react/hooks/use-click-outside.cjs +17 -0
- package/dist/react/hooks/use-click-outside.d.ts +9 -0
- package/dist/react/hooks/use-click-outside.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-click-outside.js +1 -1
- package/dist/react/hooks/use-constant.cjs +19 -0
- package/dist/react/hooks/use-constant.d.ts +9 -0
- package/dist/react/hooks/use-constant.d.ts.map +1 -0
- package/dist/react/hooks/use-define-ref.cjs +19 -0
- package/dist/react/hooks/use-define-ref.d.ts +10 -0
- package/dist/react/hooks/use-define-ref.d.ts.map +1 -0
- package/dist/react/hooks/use-element-ref.cjs +12 -0
- package/dist/react/hooks/use-element-ref.d.ts +2 -0
- package/dist/react/hooks/use-element-ref.d.ts.map +1 -0
- package/dist/react/hooks/use-event-listener.cjs +17 -0
- package/dist/react/hooks/use-event-listener.d.ts +8 -0
- package/dist/react/hooks/use-event-listener.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-event-listener.js +1 -1
- package/dist/react/hooks/use-event.cjs +23 -0
- package/dist/react/hooks/use-event.d.cts +3 -0
- package/dist/react/hooks/use-event.d.cts.map +1 -0
- package/dist/react/hooks/use-event.d.ts +3 -0
- package/{react → dist/react}/hooks/use-event.d.ts.map +1 -1
- package/dist/react/hooks/use-flag.cjs +19 -0
- package/dist/react/hooks/use-flag.d.ts +8 -0
- package/dist/react/hooks/use-flag.d.ts.map +1 -0
- package/dist/react/hooks/use-force-update.cjs +11 -0
- package/dist/react/hooks/use-force-update.d.ts +2 -0
- package/dist/react/hooks/use-force-update.d.ts.map +1 -0
- package/dist/react/hooks/use-initial-height.cjs +15 -0
- package/dist/react/hooks/use-initial-height.d.ts +5 -0
- package/dist/react/hooks/use-initial-height.d.ts.map +1 -0
- package/dist/react/hooks/use-instance.cjs +31 -0
- package/dist/react/hooks/use-instance.d.ts +27 -0
- package/dist/react/hooks/use-instance.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-instance.js +2 -2
- package/dist/react/hooks/use-intersection-observer.cjs +14 -0
- package/dist/react/hooks/use-intersection-observer.d.ts +2 -0
- package/dist/react/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/react/hooks/use-last-defined-value.cjs +12 -0
- package/dist/react/hooks/use-last-defined-value.d.ts +2 -0
- package/dist/react/hooks/use-last-defined-value.d.ts.map +1 -0
- package/dist/react/hooks/use-last-value-ref.cjs +12 -0
- package/dist/react/hooks/use-last-value-ref.d.ts +2 -0
- package/dist/react/hooks/use-last-value-ref.d.ts.map +1 -0
- package/dist/react/hooks/use-life-cycle.cjs +14 -0
- package/dist/react/hooks/use-life-cycle.d.ts +5 -0
- package/dist/react/hooks/use-life-cycle.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-life-cycle.js +1 -1
- package/dist/react/hooks/use-resize-observer.cjs +15 -0
- package/dist/react/hooks/use-resize-observer.d.ts +2 -0
- package/dist/react/hooks/use-resize-observer.d.ts.map +1 -0
- package/{react → dist/react}/hooks/use-resize-observer.js +1 -1
- package/dist/react/hooks/use-sync-ref.cjs +10 -0
- package/dist/react/hooks/use-sync-ref.d.ts +2 -0
- package/dist/react/hooks/use-sync-ref.d.ts.map +1 -0
- package/dist/react/hooks/use-toggle.cjs +10 -0
- package/dist/react/hooks/use-toggle.d.ts +2 -0
- package/dist/react/hooks/use-toggle.d.ts.map +1 -0
- package/dist/react/hooks/use-value.cjs +12 -0
- package/dist/react/hooks/use-value.d.ts +5 -0
- package/dist/react/hooks/use-value.d.ts.map +1 -0
- package/dist/react/hooks/use-visibility-state.cjs +18 -0
- package/dist/react/hooks/use-visibility-state.d.ts +2 -0
- package/dist/react/hooks/use-visibility-state.d.ts.map +1 -0
- package/dist/react/index.cjs +17 -0
- package/dist/react/index.d.cts +2 -0
- package/dist/react/index.d.cts.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +1 -0
- package/dist/sound.cjs +16 -0
- package/dist/sound.d.ts +7 -0
- package/dist/sound.d.ts.map +1 -0
- package/dist/storage.cjs +48 -0
- package/dist/storage.d.ts +39 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/text.cjs +53 -0
- package/dist/text.d.ts +15 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/type-guard/_exports.cjs +129 -0
- package/dist/type-guard/_exports.d.cts +86 -0
- package/dist/type-guard/_exports.d.cts.map +1 -0
- package/{type-guard → dist/type-guard}/_exports.d.ts +1 -1
- package/dist/type-guard/_exports.d.ts.map +1 -0
- package/dist/type-guard/index.cjs +40 -0
- package/dist/type-guard/index.d.cts +3 -0
- package/dist/type-guard/index.d.cts.map +1 -0
- package/dist/type-guard/index.d.ts +3 -0
- package/{type-guard → dist/type-guard}/index.d.ts.map +1 -1
- package/{type-guard → dist/type-guard}/index.js +1 -1
- package/dist/utils/types.cjs +2 -0
- package/dist/utils/types.d.ts +395 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/vibrate.cjs +12 -0
- package/dist/vibrate.d.ts +5 -0
- package/dist/vibrate.d.ts.map +1 -0
- package/package.json +149 -356
- package/assets/logo.png +0 -0
- package/assets/logo.pxz +0 -0
- package/common.d.ts.map +0 -1
- package/complex/global-config.d.ts.map +0 -1
- package/complex/index.d.ts +0 -4
- package/complex/index.d.ts.map +0 -1
- package/complex/index.js +0 -3
- package/complex/modules-factory.d.ts.map +0 -1
- package/cookie.d.ts +0 -3
- package/css.d.ts +0 -36
- package/css.d.ts.map +0 -1
- package/css.js +0 -20
- package/date-time.d.ts.map +0 -1
- package/errors.d.ts.map +0 -1
- package/format/_exports.d.ts +0 -5
- package/format/_exports.d.ts.map +0 -1
- package/format/_exports.js +0 -4
- package/format/index.d.ts +0 -3
- package/format/number.d.ts.map +0 -1
- package/format/percent.d.ts.map +0 -1
- package/html.d.ts.map +0 -1
- package/math.d.ts.map +0 -1
- package/mobx/apply-observable.d.ts.map +0 -1
- package/mobx/create-enhanced-atom.d.ts.map +0 -1
- package/mobx/deep-observable-struct.d.ts.map +0 -1
- package/mobx/get-mobx-administration.d.ts.map +0 -1
- package/mobx/index.d.ts +0 -6
- package/mobx/index.d.ts.map +0 -1
- package/mobx/index.js +0 -5
- package/parser/_exports.d.ts +0 -4
- package/parser/_exports.d.ts.map +0 -1
- package/parser/_exports.js +0 -3
- package/parser/index.d.ts +0 -3
- package/parser/number.d.ts.map +0 -1
- package/parser/percent.d.ts.map +0 -1
- package/parser/string.d.ts.map +0 -1
- package/react/hooks/index.d.ts +0 -22
- package/react/hooks/index.d.ts.map +0 -1
- package/react/hooks/index.js +0 -21
- package/react/hooks/use-event.d.ts +0 -3
- package/react/index.d.ts +0 -2
- package/react/index.d.ts.map +0 -1
- package/react/index.js +0 -1
- package/type-guard/_exports.d.ts.map +0 -1
- package/type-guard/index.d.ts +0 -3
- /package/{async.d.ts → dist/async.d.cts} +0 -0
- /package/{async.d.ts.map → dist/async.d.cts.map} +0 -0
- /package/{async.js → dist/async.js} +0 -0
- /package/{common.js → dist/common.js} +0 -0
- /package/{complex/counter.d.ts → dist/complex/counter.d.cts} +0 -0
- /package/{complex/counter.d.ts.map → dist/complex/counter.d.cts.map} +0 -0
- /package/{complex → dist/complex}/counter.js +0 -0
- /package/{complex → dist/complex}/global-config.js +0 -0
- /package/{complex → dist/complex}/modules-factory.js +0 -0
- /package/{cookie.js → dist/cookie.js} +0 -0
- /package/{data.d.ts → dist/data.d.cts} +0 -0
- /package/{data.d.ts.map → dist/data.d.cts.map} +0 -0
- /package/{data.js → dist/data.js} +0 -0
- /package/{device.d.ts → dist/device.d.cts} +0 -0
- /package/{device.d.ts.map → dist/device.d.cts.map} +0 -0
- /package/{device.js → dist/device.js} +0 -0
- /package/{encodings.d.ts → dist/encodings.d.cts} +0 -0
- /package/{encodings.d.ts.map → dist/encodings.d.cts.map} +0 -0
- /package/{encodings.js → dist/encodings.js} +0 -0
- /package/{file.d.ts → dist/file.d.cts} +0 -0
- /package/{file.d.ts.map → dist/file.d.cts.map} +0 -0
- /package/{file.js → dist/file.js} +0 -0
- /package/{format/constants.d.ts → dist/format/constants.d.cts} +0 -0
- /package/{format/constants.d.ts.map → dist/format/constants.d.cts.map} +0 -0
- /package/{format → dist/format}/constants.js +0 -0
- /package/{format/skip-spaces.d.ts → dist/format/skip-spaces.d.cts} +0 -0
- /package/{format/skip-spaces.d.ts.map → dist/format/skip-spaces.d.cts.map} +0 -0
- /package/{format → dist/format}/skip-spaces.js +0 -0
- /package/{id.d.ts → dist/id.d.cts} +0 -0
- /package/{id.d.ts.map → dist/id.d.cts.map} +0 -0
- /package/{id.js → dist/id.js} +0 -0
- /package/{imports.d.ts → dist/imports.d.cts} +0 -0
- /package/{imports.d.ts.map → dist/imports.d.cts.map} +0 -0
- /package/{math.js → dist/math.js} +0 -0
- /package/{media.d.ts → dist/media.d.cts} +0 -0
- /package/{media.d.ts.map → dist/media.d.cts.map} +0 -0
- /package/{mobx → dist/mobx}/apply-observable.js +0 -0
- /package/{mobx → dist/mobx}/get-mobx-administration.js +0 -0
- /package/{mobx/lazy-observe.d.ts → dist/mobx/lazy-observe.d.cts} +0 -0
- /package/{mobx/lazy-observe.d.ts.map → dist/mobx/lazy-observe.d.cts.map} +0 -0
- /package/{mobx → dist/mobx}/lazy-observe.js +0 -0
- /package/{ms.d.ts → dist/ms.d.cts} +0 -0
- /package/{ms.d.ts.map → dist/ms.d.cts.map} +0 -0
- /package/{ms.js → dist/ms.js} +0 -0
- /package/{number.d.ts → dist/number.d.cts} +0 -0
- /package/{number.d.ts.map → dist/number.d.cts.map} +0 -0
- /package/{number.js → dist/number.js} +0 -0
- /package/{price.d.ts → dist/price.d.cts} +0 -0
- /package/{price.d.ts.map → dist/price.d.cts.map} +0 -0
- /package/{price.js → dist/price.js} +0 -0
- /package/{random.d.ts → dist/random.d.cts} +0 -0
- /package/{random.d.ts.map → dist/random.d.cts.map} +0 -0
- /package/{random.js → dist/random.js} +0 -0
- /package/{react/hooks/use-abort-controller.d.ts → dist/react/hooks/use-abort-controller.d.cts} +0 -0
- /package/{react/hooks/use-abort-controller.d.ts.map → dist/react/hooks/use-abort-controller.d.cts.map} +0 -0
- /package/{react/hooks/use-abort-signal.d.ts → dist/react/hooks/use-abort-signal.d.cts} +0 -0
- /package/{react/hooks/use-abort-signal.d.ts.map → dist/react/hooks/use-abort-signal.d.cts.map} +0 -0
- /package/{react/hooks/use-click-outside.d.ts → dist/react/hooks/use-click-outside.d.cts} +0 -0
- /package/{react/hooks/use-click-outside.d.ts.map → dist/react/hooks/use-click-outside.d.cts.map} +0 -0
- /package/{react/hooks/use-constant.d.ts → dist/react/hooks/use-constant.d.cts} +0 -0
- /package/{react/hooks/use-constant.d.ts.map → dist/react/hooks/use-constant.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-constant.js +0 -0
- /package/{react/hooks/use-define-ref.d.ts → dist/react/hooks/use-define-ref.d.cts} +0 -0
- /package/{react/hooks/use-define-ref.d.ts.map → dist/react/hooks/use-define-ref.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-define-ref.js +0 -0
- /package/{react/hooks/use-element-ref.d.ts → dist/react/hooks/use-element-ref.d.cts} +0 -0
- /package/{react/hooks/use-element-ref.d.ts.map → dist/react/hooks/use-element-ref.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-element-ref.js +0 -0
- /package/{react/hooks/use-event-listener.d.ts → dist/react/hooks/use-event-listener.d.cts} +0 -0
- /package/{react/hooks/use-event-listener.d.ts.map → dist/react/hooks/use-event-listener.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-event.js +0 -0
- /package/{react/hooks/use-flag.d.ts → dist/react/hooks/use-flag.d.cts} +0 -0
- /package/{react/hooks/use-flag.d.ts.map → dist/react/hooks/use-flag.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-flag.js +0 -0
- /package/{react/hooks/use-force-update.d.ts → dist/react/hooks/use-force-update.d.cts} +0 -0
- /package/{react/hooks/use-force-update.d.ts.map → dist/react/hooks/use-force-update.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-force-update.js +0 -0
- /package/{react/hooks/use-initial-height.d.ts → dist/react/hooks/use-initial-height.d.cts} +0 -0
- /package/{react/hooks/use-initial-height.d.ts.map → dist/react/hooks/use-initial-height.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-initial-height.js +0 -0
- /package/{react/hooks/use-instance.d.ts → dist/react/hooks/use-instance.d.cts} +0 -0
- /package/{react/hooks/use-instance.d.ts.map → dist/react/hooks/use-instance.d.cts.map} +0 -0
- /package/{react/hooks/use-intersection-observer.d.ts → dist/react/hooks/use-intersection-observer.d.cts} +0 -0
- /package/{react/hooks/use-intersection-observer.d.ts.map → dist/react/hooks/use-intersection-observer.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-intersection-observer.js +0 -0
- /package/{react/hooks/use-last-defined-value.d.ts → dist/react/hooks/use-last-defined-value.d.cts} +0 -0
- /package/{react/hooks/use-last-defined-value.d.ts.map → dist/react/hooks/use-last-defined-value.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-last-defined-value.js +0 -0
- /package/{react/hooks/use-last-value-ref.d.ts → dist/react/hooks/use-last-value-ref.d.cts} +0 -0
- /package/{react/hooks/use-last-value-ref.d.ts.map → dist/react/hooks/use-last-value-ref.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-last-value-ref.js +0 -0
- /package/{react/hooks/use-life-cycle.d.ts → dist/react/hooks/use-life-cycle.d.cts} +0 -0
- /package/{react/hooks/use-life-cycle.d.ts.map → dist/react/hooks/use-life-cycle.d.cts.map} +0 -0
- /package/{react/hooks/use-resize-observer.d.ts → dist/react/hooks/use-resize-observer.d.cts} +0 -0
- /package/{react/hooks/use-resize-observer.d.ts.map → dist/react/hooks/use-resize-observer.d.cts.map} +0 -0
- /package/{react/hooks/use-sync-ref.d.ts → dist/react/hooks/use-sync-ref.d.cts} +0 -0
- /package/{react/hooks/use-sync-ref.d.ts.map → dist/react/hooks/use-sync-ref.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-sync-ref.js +0 -0
- /package/{react/hooks/use-toggle.d.ts → dist/react/hooks/use-toggle.d.cts} +0 -0
- /package/{react/hooks/use-toggle.d.ts.map → dist/react/hooks/use-toggle.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-toggle.js +0 -0
- /package/{react/hooks/use-value.d.ts → dist/react/hooks/use-value.d.cts} +0 -0
- /package/{react/hooks/use-value.d.ts.map → dist/react/hooks/use-value.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-value.js +0 -0
- /package/{react/hooks/use-visibility-state.d.ts → dist/react/hooks/use-visibility-state.d.cts} +0 -0
- /package/{react/hooks/use-visibility-state.d.ts.map → dist/react/hooks/use-visibility-state.d.cts.map} +0 -0
- /package/{react → dist/react}/hooks/use-visibility-state.js +0 -0
- /package/{sound.d.ts → dist/sound.d.cts} +0 -0
- /package/{sound.d.ts.map → dist/sound.d.cts.map} +0 -0
- /package/{sound.js → dist/sound.js} +0 -0
- /package/{storage.d.ts → dist/storage.d.cts} +0 -0
- /package/{storage.d.ts.map → dist/storage.d.cts.map} +0 -0
- /package/{storage.js → dist/storage.js} +0 -0
- /package/{text.d.ts → dist/text.d.cts} +0 -0
- /package/{text.d.ts.map → dist/text.d.cts.map} +0 -0
- /package/{text.js → dist/text.js} +0 -0
- /package/{type-guard → dist/type-guard}/_exports.js +0 -0
- /package/{utility-types.d.ts → dist/utility-types.d.ts} +0 -0
- /package/{utils/types.d.ts → dist/utils/types.d.cts} +0 -0
- /package/{utils/types.d.ts.map → dist/utils/types.d.cts.map} +0 -0
- /package/{utils → dist/utils}/types.js +0 -0
- /package/{vibrate.d.ts → dist/vibrate.d.cts} +0 -0
- /package/{vibrate.d.ts.map → dist/vibrate.d.cts.map} +0 -0
- /package/{vibrate.js → dist/vibrate.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants.cjs"), exports);
|
|
18
|
+
__exportStar(require("./number.cjs"), exports);
|
|
19
|
+
__exportStar(require("./percent.cjs"), exports);
|
|
20
|
+
__exportStar(require("./skip-spaces.cjs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/format/_exports.ts"],"names":[],"mappings":"AAAA,gCAA+B;AAC/B,6BAA4B;AAC5B,8BAA6B;AAC7B,kCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/format/_exports.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4BAA4B;AAC5B,6BAA6B;AAC7B,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/format/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,WAAM,CAAC;AAE5B,eAAO,MAAM,MAAM,MAAM,CAAC;AAE1B,eAAO,MAAM,QAAQ,WAAM,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.format = void 0;
|
|
37
|
+
// This way is more treeshakable than collecting
|
|
38
|
+
// it into one exportable object export const format
|
|
39
|
+
const format = __importStar(require("./_exports.cjs"));
|
|
40
|
+
exports.format = format;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,uBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,sBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.number = void 0;
|
|
4
|
+
const number_js_1 = require("../parser/number.cjs");
|
|
5
|
+
const index_js_1 = require("../type-guard/index.cjs");
|
|
6
|
+
const constants_js_1 = require("./constants.cjs");
|
|
7
|
+
const number = (rawValue, userSettings) => {
|
|
8
|
+
const settings = {
|
|
9
|
+
...exports.number.defaultSettings,
|
|
10
|
+
...userSettings,
|
|
11
|
+
};
|
|
12
|
+
const digits = settings.digits ?? 0;
|
|
13
|
+
const cutZeros = settings?.cutZeros ?? false;
|
|
14
|
+
const delimiter = settings.delimiter ?? ' ';
|
|
15
|
+
const postfix = settings.postfix ?? '';
|
|
16
|
+
const emptyText = settings.emptyText ?? constants_js_1.NO_VALUE;
|
|
17
|
+
const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;
|
|
18
|
+
let value;
|
|
19
|
+
if (index_js_1.typeGuard.isString(rawValue)) {
|
|
20
|
+
value = (0, number_js_1.number)(value, { fallback: undefined });
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
value = rawValue;
|
|
24
|
+
}
|
|
25
|
+
if (index_js_1.typeGuard.isNumber(value)) {
|
|
26
|
+
let raw = `${value}`;
|
|
27
|
+
if (digits !== false) {
|
|
28
|
+
raw = value.toFixed(digits);
|
|
29
|
+
}
|
|
30
|
+
if (cutZeros) {
|
|
31
|
+
raw = `${+raw}`;
|
|
32
|
+
}
|
|
33
|
+
const [integerPart, decimalPart] = raw.split('.', 2);
|
|
34
|
+
let formattedIntegerPart = integerPart;
|
|
35
|
+
let formattedDecimalPart = '';
|
|
36
|
+
if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {
|
|
37
|
+
formattedDecimalPart = `.${decimalPart}`;
|
|
38
|
+
}
|
|
39
|
+
const rgx = /(\d+)(\d{3})/;
|
|
40
|
+
while (rgx.test(formattedIntegerPart) && delimiter) {
|
|
41
|
+
formattedIntegerPart = formattedIntegerPart.replace(rgx, `$1${delimiter}$2`);
|
|
42
|
+
}
|
|
43
|
+
return formattedIntegerPart + formattedDecimalPart + postfix;
|
|
44
|
+
}
|
|
45
|
+
return emptyText;
|
|
46
|
+
};
|
|
47
|
+
exports.number = number;
|
|
48
|
+
exports.number.defaultSettings = {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Maybe } from "../utils/types.cjs";
|
|
2
|
+
export interface NumberFormatSettings {
|
|
3
|
+
delimiter?: string;
|
|
4
|
+
/**
|
|
5
|
+
* digitsOnlyForFloat - Show digits after decimal point only if they are not zeros after converting to number.
|
|
6
|
+
* Example: "0.00" -> "0", "0.10" -> "0.1", but "0.003" -> "0.003"
|
|
7
|
+
*
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
digitsOnlyForFloat?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Text which will be returned if the value is undefined, null, NaN, Infinity or empty string.
|
|
13
|
+
* Example: "–" will be returned if the value is undefined and emptyText is "–".
|
|
14
|
+
*/
|
|
15
|
+
emptyText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Text to append to the end of the formatted number.
|
|
18
|
+
* Example: if value is 1000 and postfix is "₽", result will be "1 000₽".
|
|
19
|
+
*/
|
|
20
|
+
postfix?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Fixed number of digits after the decimal point (number.toFixed() method)
|
|
23
|
+
* If set to false, the truncation is ignored!
|
|
24
|
+
*/
|
|
25
|
+
digits?: number | false;
|
|
26
|
+
/**
|
|
27
|
+
* Remove trailing zeros from the end of the number
|
|
28
|
+
* Example: 0.010000000000000000000000000000000000000000000 -> 0.01
|
|
29
|
+
*/
|
|
30
|
+
cutZeros?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const number: {
|
|
33
|
+
(rawValue: Maybe<string | number>, userSettings?: Maybe<NumberFormatSettings>): string;
|
|
34
|
+
defaultSettings: NumberFormatSettings;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/format/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,2BAA0B;AAI/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM;eACP,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,iBACjB,KAAK,CAAC,oBAAoB,CAAC,GACzC,MAAM;;CAqDR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/format/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAA0B;AAI/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM;eACP,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,iBACjB,KAAK,CAAC,oBAAoB,CAAC,GACzC,MAAM;;CAqDR,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { number as toNumber } from
|
|
2
|
-
import { typeGuard } from
|
|
3
|
-
import { NO_VALUE } from
|
|
1
|
+
import { number as toNumber } from "../parser/number.js";
|
|
2
|
+
import { typeGuard } from "../type-guard/index.js";
|
|
3
|
+
import { NO_VALUE } from "./constants.js";
|
|
4
4
|
export const number = (rawValue, userSettings) => {
|
|
5
5
|
const settings = {
|
|
6
6
|
...number.defaultSettings,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.percent = void 0;
|
|
4
|
+
const number_js_1 = require("../parser/number.cjs");
|
|
5
|
+
const index_js_1 = require("../type-guard/index.cjs");
|
|
6
|
+
const constants_js_1 = require("./constants.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* 100 -> 100%
|
|
9
|
+
* 99.123214412 -> 99.12%
|
|
10
|
+
* 99.123214412 -> 99,12%
|
|
11
|
+
*/
|
|
12
|
+
const percent = (value, settings) => {
|
|
13
|
+
const numericValue = (0, number_js_1.number)(value, {
|
|
14
|
+
...settings,
|
|
15
|
+
digits: settings?.digits ?? 2,
|
|
16
|
+
fallback: Number.NaN,
|
|
17
|
+
});
|
|
18
|
+
if (index_js_1.typeGuard.isNumber(numericValue)) {
|
|
19
|
+
const divider = settings?.divider ?? '.';
|
|
20
|
+
const formattedPercent = divider === '.' ? numericValue : `${numericValue}`.replace('.', divider);
|
|
21
|
+
return `${formattedPercent}${settings?.delimiter ?? ''}${settings?.symbol ?? '%'}`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return settings?.emptyText ?? constants_js_1.NO_VALUE;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.percent = percent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type NumberParserSettings } from "../parser/number.cjs";
|
|
2
|
+
import type { Maybe } from "../utils/types.cjs";
|
|
3
|
+
export interface PercentFormatSettings extends Omit<NumberParserSettings, 'fallback'> {
|
|
4
|
+
divider?: string;
|
|
5
|
+
delimiter?: string;
|
|
6
|
+
symbol?: string;
|
|
7
|
+
emptyText?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 100 -> 100%
|
|
11
|
+
* 99.123214412 -> 99.12%
|
|
12
|
+
* 99.123214412 -> 99,12%
|
|
13
|
+
*/
|
|
14
|
+
export declare const percent: (value: Maybe<number | string>, settings?: PercentFormatSettings) => string;
|
|
15
|
+
//# sourceMappingURL=percent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/format/percent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAU,6BAA4B;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,2BAA0B;AAI/C,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,qBAAqB,WAkBjC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type NumberParserSettings } from
|
|
2
|
-
import type { Maybe } from
|
|
1
|
+
import { type NumberParserSettings } from "../parser/number.js";
|
|
2
|
+
import type { Maybe } from "../utils/types.js";
|
|
3
3
|
export interface PercentFormatSettings extends Omit<NumberParserSettings, 'fallback'> {
|
|
4
4
|
divider?: string;
|
|
5
5
|
delimiter?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/format/percent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAU,4BAA4B;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,0BAA0B;AAI/C,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,qBAAqB,WAkBjC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { number } from
|
|
2
|
-
import { typeGuard } from
|
|
3
|
-
import { NO_VALUE } from
|
|
1
|
+
import { number } from "../parser/number.js";
|
|
2
|
+
import { typeGuard } from "../type-guard/index.js";
|
|
3
|
+
import { NO_VALUE } from "./constants.js";
|
|
4
4
|
/**
|
|
5
5
|
* 100 -> 100%
|
|
6
6
|
* 99.123214412 -> 99.12%
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-spaces.d.ts","sourceRoot":"","sources":["../../src/format/skip-spaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,WAAgC,CAAC"}
|
package/dist/html.cjs
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isPrefersLightTheme = exports.isPrefersDarkTheme = exports.calcScrollbarWidth = exports.startViewTransitionSafety = exports.checkElementHasParent = exports.sanitizeHtml = exports.globalScrollIntoViewForY = exports.skipEvent = exports.collectOffsetTop = exports.downloadUsingAnchor = exports.getComputedColor = void 0;
|
|
7
|
+
exports.wrapTextToTagLink = wrapTextToTagLink;
|
|
8
|
+
exports.getElementInnerHeight = getElementInnerHeight;
|
|
9
|
+
exports.getElementInnerWidth = getElementInnerWidth;
|
|
10
|
+
const dompurify_1 = __importDefault(require("dompurify"));
|
|
11
|
+
const media_js_1 = require("./media.cjs");
|
|
12
|
+
/**
|
|
13
|
+
* Вытаскивает RGB из любого цвета
|
|
14
|
+
*
|
|
15
|
+
* Не рекомендуется к использованию так как вызывает reflow
|
|
16
|
+
*/
|
|
17
|
+
const getComputedColor = (color) => {
|
|
18
|
+
if (!color)
|
|
19
|
+
return null;
|
|
20
|
+
const d = document.createElement('div');
|
|
21
|
+
d.style.color = color;
|
|
22
|
+
document.body.append(d);
|
|
23
|
+
const rgbcolor = globalThis.getComputedStyle(d).color;
|
|
24
|
+
const match = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(rgbcolor);
|
|
25
|
+
d.remove();
|
|
26
|
+
if (!match)
|
|
27
|
+
return null;
|
|
28
|
+
return `${match[1]}, ${match[2]}, ${match[3]}`;
|
|
29
|
+
};
|
|
30
|
+
exports.getComputedColor = getComputedColor;
|
|
31
|
+
const downloadUsingAnchor = (urlOrBlob, fileName) => {
|
|
32
|
+
const url = (0, media_js_1.blobToUrl)(urlOrBlob);
|
|
33
|
+
const a = document.createElement('a');
|
|
34
|
+
a.href = url;
|
|
35
|
+
a.download = fileName ?? 'file';
|
|
36
|
+
a.target = '_blank';
|
|
37
|
+
document.body.append(a);
|
|
38
|
+
a.click();
|
|
39
|
+
a.remove();
|
|
40
|
+
};
|
|
41
|
+
exports.downloadUsingAnchor = downloadUsingAnchor;
|
|
42
|
+
/**
|
|
43
|
+
* Surrounds string in an anchor tag
|
|
44
|
+
*/
|
|
45
|
+
function wrapTextToTagLink(link) {
|
|
46
|
+
const descr = String(link).replace(/^(https?:\/{0,2})?(w{3}\.)?/, 'www.');
|
|
47
|
+
if (!/^https?:\/{2}/.test(link))
|
|
48
|
+
link = `http://${link}`;
|
|
49
|
+
return `<a href=${link} target="_blank">${descr}</a>`;
|
|
50
|
+
}
|
|
51
|
+
const collectOffsetTop = (element) => {
|
|
52
|
+
let offsetTop = 0;
|
|
53
|
+
let node = element;
|
|
54
|
+
while (node != null) {
|
|
55
|
+
offsetTop += node.offsetTop;
|
|
56
|
+
node = node.parentElement;
|
|
57
|
+
}
|
|
58
|
+
return offsetTop;
|
|
59
|
+
};
|
|
60
|
+
exports.collectOffsetTop = collectOffsetTop;
|
|
61
|
+
const skipEvent = (e) => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
exports.skipEvent = skipEvent;
|
|
67
|
+
const globalScrollIntoViewForY = (node) => {
|
|
68
|
+
const scrollContainer = document.body;
|
|
69
|
+
const pageHeight = window.innerHeight;
|
|
70
|
+
const nodeBounding = node.getBoundingClientRect();
|
|
71
|
+
const scrollPagesCount = scrollContainer.scrollHeight / pageHeight;
|
|
72
|
+
const scrollPageNumber = Math.min(Math.max(nodeBounding.top / pageHeight, 1), scrollPagesCount);
|
|
73
|
+
window.scroll({
|
|
74
|
+
top: scrollPageNumber * pageHeight,
|
|
75
|
+
behavior: 'smooth',
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
exports.globalScrollIntoViewForY = globalScrollIntoViewForY;
|
|
79
|
+
const sanitizeDefaults = {
|
|
80
|
+
ALLOWED_TAGS: [
|
|
81
|
+
'a',
|
|
82
|
+
'article',
|
|
83
|
+
'b',
|
|
84
|
+
'blockquote',
|
|
85
|
+
'br',
|
|
86
|
+
'caption',
|
|
87
|
+
'code',
|
|
88
|
+
'del',
|
|
89
|
+
'details',
|
|
90
|
+
'div',
|
|
91
|
+
'em',
|
|
92
|
+
'h1',
|
|
93
|
+
'h2',
|
|
94
|
+
'h3',
|
|
95
|
+
'h4',
|
|
96
|
+
'h5',
|
|
97
|
+
'h6',
|
|
98
|
+
'hr',
|
|
99
|
+
'i',
|
|
100
|
+
'img',
|
|
101
|
+
'ins',
|
|
102
|
+
'kbd',
|
|
103
|
+
'li',
|
|
104
|
+
'main',
|
|
105
|
+
'ol',
|
|
106
|
+
'p',
|
|
107
|
+
'pre',
|
|
108
|
+
'section',
|
|
109
|
+
'span',
|
|
110
|
+
'strong',
|
|
111
|
+
'sub',
|
|
112
|
+
'summary',
|
|
113
|
+
'sup',
|
|
114
|
+
'table',
|
|
115
|
+
'tbody',
|
|
116
|
+
'td',
|
|
117
|
+
'th',
|
|
118
|
+
'thead',
|
|
119
|
+
'tr',
|
|
120
|
+
'u',
|
|
121
|
+
'ul',
|
|
122
|
+
],
|
|
123
|
+
ALLOWED_ATTR: ['href', 'target', 'name', 'src', 'class'],
|
|
124
|
+
};
|
|
125
|
+
const sanitizeHtml = (html, config) => {
|
|
126
|
+
return dompurify_1.default.sanitize(html || '', {
|
|
127
|
+
...sanitizeDefaults,
|
|
128
|
+
...config,
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
exports.sanitizeHtml = sanitizeHtml;
|
|
132
|
+
const checkElementHasParent = (element, parent) => {
|
|
133
|
+
let node = element;
|
|
134
|
+
if (!parent)
|
|
135
|
+
return false;
|
|
136
|
+
while (node != null) {
|
|
137
|
+
if (node === parent) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
node = node.parentElement;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
};
|
|
146
|
+
exports.checkElementHasParent = checkElementHasParent;
|
|
147
|
+
/**
|
|
148
|
+
* Executes a function within a view transition if supported by the browser.
|
|
149
|
+
*
|
|
150
|
+
* @param {VoidFunction} fn - The function to be executed.
|
|
151
|
+
* @returns {ViewTransition} - The result of the executed function.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
|
|
154
|
+
*/
|
|
155
|
+
const startViewTransitionSafety = (fn, params) => {
|
|
156
|
+
if (document.startViewTransition && !params?.disabled) {
|
|
157
|
+
return document.startViewTransition(fn);
|
|
158
|
+
}
|
|
159
|
+
fn();
|
|
160
|
+
};
|
|
161
|
+
exports.startViewTransitionSafety = startViewTransitionSafety;
|
|
162
|
+
/**
|
|
163
|
+
* Вычисляет размер скроллбара
|
|
164
|
+
*/
|
|
165
|
+
const calcScrollbarWidth = () => {
|
|
166
|
+
const outer = document.createElement('div');
|
|
167
|
+
outer.style.visibility = 'hidden';
|
|
168
|
+
outer.style.width = '100px';
|
|
169
|
+
outer.style.overflow = 'scroll';
|
|
170
|
+
document.body.append(outer);
|
|
171
|
+
const inner = document.createElement('div');
|
|
172
|
+
inner.style.width = '100%';
|
|
173
|
+
outer.append(inner);
|
|
174
|
+
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
175
|
+
outer.parentNode?.removeChild(outer);
|
|
176
|
+
return scrollbarWidth;
|
|
177
|
+
};
|
|
178
|
+
exports.calcScrollbarWidth = calcScrollbarWidth;
|
|
179
|
+
/**
|
|
180
|
+
* Calculates the inner height of an HTML element, accounting for padding.
|
|
181
|
+
*/
|
|
182
|
+
function getElementInnerHeight(element) {
|
|
183
|
+
const { clientHeight } = element;
|
|
184
|
+
const { paddingTop, paddingBottom } = getComputedStyle(element);
|
|
185
|
+
return (clientHeight -
|
|
186
|
+
Number.parseFloat(paddingTop) -
|
|
187
|
+
Number.parseFloat(paddingBottom));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Calculates the inner width of an HTML element, accounting for padding.
|
|
191
|
+
*/
|
|
192
|
+
function getElementInnerWidth(el) {
|
|
193
|
+
const { clientWidth } = el;
|
|
194
|
+
const { paddingLeft, paddingRight } = getComputedStyle(el);
|
|
195
|
+
return (clientWidth -
|
|
196
|
+
Number.parseFloat(paddingLeft) -
|
|
197
|
+
Number.parseFloat(paddingRight));
|
|
198
|
+
}
|
|
199
|
+
const isPrefersDarkTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches;
|
|
200
|
+
exports.isPrefersDarkTheme = isPrefersDarkTheme;
|
|
201
|
+
const isPrefersLightTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: light)')?.matches;
|
|
202
|
+
exports.isPrefersLightTheme = isPrefersLightTheme;
|
package/dist/html.d.cts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Config as DOMPurifyConfig } from 'dompurify';
|
|
2
|
+
import type { Maybe } from "./utils/types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Вытаскивает RGB из любого цвета
|
|
5
|
+
*
|
|
6
|
+
* Не рекомендуется к использованию так как вызывает reflow
|
|
7
|
+
*/
|
|
8
|
+
export declare const getComputedColor: (color?: string) => string | null;
|
|
9
|
+
export declare const downloadUsingAnchor: (urlOrBlob: string | Blob, fileName?: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Surrounds string in an anchor tag
|
|
12
|
+
*/
|
|
13
|
+
export declare function wrapTextToTagLink(link: string): string;
|
|
14
|
+
export declare const collectOffsetTop: (element: HTMLElement | null) => number;
|
|
15
|
+
export declare const skipEvent: (e: Event) => boolean;
|
|
16
|
+
export declare const globalScrollIntoViewForY: (node: HTMLElement) => void;
|
|
17
|
+
export declare const sanitizeHtml: (html: Maybe<string>, config?: DOMPurifyConfig) => string;
|
|
18
|
+
export declare const checkElementHasParent: (element: HTMLElement | null, parent: Maybe<HTMLElement>) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Executes a function within a view transition if supported by the browser.
|
|
21
|
+
*
|
|
22
|
+
* @param {VoidFunction} fn - The function to be executed.
|
|
23
|
+
* @returns {ViewTransition} - The result of the executed function.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
|
|
26
|
+
*/
|
|
27
|
+
export declare const startViewTransitionSafety: (fn: VoidFunction, params?: {
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}) => ViewTransition | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Вычисляет размер скроллбара
|
|
32
|
+
*/
|
|
33
|
+
export declare const calcScrollbarWidth: () => number;
|
|
34
|
+
/**
|
|
35
|
+
* Calculates the inner height of an HTML element, accounting for padding.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getElementInnerHeight(element: HTMLElement): number;
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the inner width of an HTML element, accounting for padding.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getElementInnerWidth(el: HTMLElement): number;
|
|
42
|
+
export declare const isPrefersDarkTheme: () => boolean;
|
|
43
|
+
export declare const isPrefersLightTheme: () => boolean;
|
|
44
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,KAAK,MAAM,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAyB;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,GAAG,IAAI,EACxB,WAAW,MAAM,SAgBlB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAI7C;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,GAAG,IAAI,WAU3D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,GAAG,KAAK,YAKjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,MAAM,WAAW,SAezD,CAAC;AAiDF,eAAO,MAAM,YAAY,GAAI,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,WAKzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,GAAG,IAAI,EAC3B,QAAQ,KAAK,CAAC,WAAW,CAAC,YAe3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,IAAI,YAAY,EAChB,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,+BAMhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,cAmB9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,UAQzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,UAQnD;AAED,eAAO,MAAM,kBAAkB,eACqC,CAAC;AAErE,eAAO,MAAM,mBAAmB,eACqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,KAAK,MAAM,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,GAAG,IAAI,EACxB,WAAW,MAAM,SAgBlB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAI7C;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,GAAG,IAAI,WAU3D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,GAAG,KAAK,YAKjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,MAAM,WAAW,SAezD,CAAC;AAiDF,eAAO,MAAM,YAAY,GAAI,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,WAKzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,GAAG,IAAI,EAC3B,QAAQ,KAAK,CAAC,WAAW,CAAC,YAe3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,IAAI,YAAY,EAChB,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,+BAMhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,cAmB9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,UAQzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,UAQnD;AAED,eAAO,MAAM,kBAAkB,eACqC,CAAC;AAErE,eAAO,MAAM,mBAAmB,eACqC,CAAC"}
|
package/{html.js → dist/html.js}
RENAMED