yummies 5.4.4 → 5.4.6
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/workflows/main.yml +34 -0
- package/.github/workflows/version-or-publish.yml +45 -0
- package/.nvmrc +1 -0
- package/.vscode/settings.json +19 -0
- package/CHANGELOG.md +215 -0
- package/CONTRIBUTING.md +8 -0
- package/Makefile +7 -0
- package/assets/logo.png +0 -0
- package/assets/logo.pxz +0 -0
- package/biome.json +3 -0
- package/commitfmt.toml +18 -0
- package/lefthook.yml +14 -0
- package/package.json +3 -389
- package/scripts/post-build.ts +71 -0
- package/src/async.ts +86 -0
- package/src/common.ts +26 -0
- package/src/complex/counter.test.ts +41 -0
- package/src/complex/counter.ts +40 -0
- package/src/complex/global-config.ts +55 -0
- package/src/complex/index.ts +3 -0
- package/src/complex/modules-factory.ts +65 -0
- package/src/cookie.ts +11 -0
- package/src/css.ts +60 -0
- package/src/data.test.ts +99 -0
- package/src/data.ts +65 -0
- package/src/date-time.test.ts +119 -0
- package/src/date-time.ts +236 -0
- package/src/device.ts +42 -0
- package/src/encodings.ts +270 -0
- package/src/errors.ts +40 -0
- package/src/file.ts +25 -0
- package/src/format/_exports.ts +4 -0
- package/{dist/format/constants.js → src/format/constants.ts} +2 -0
- package/{dist/format/index.js → src/format/index.ts} +2 -1
- package/src/format/number.test.ts +16 -0
- package/src/format/number.ts +96 -0
- package/src/format/percent.ts +40 -0
- package/src/format/skip-spaces.ts +4 -0
- package/src/html.ts +238 -0
- package/{dist/id.js → src/id.ts} +16 -6
- package/src/imports.ts +52 -0
- package/src/math.ts +20 -0
- package/src/media.ts +134 -0
- package/src/mobx/apply-observable.ts +20 -0
- package/src/mobx/create-enhanced-atom.ts +28 -0
- package/src/mobx/deep-observable-struct.test.ts +69 -0
- package/src/mobx/deep-observable-struct.ts +69 -0
- package/src/mobx/get-mobx-administration.ts +10 -0
- package/src/mobx/index.ts +5 -0
- package/src/mobx/lazy-observe.ts +59 -0
- package/src/ms.ts +20 -0
- package/src/number.ts +14 -0
- package/src/parser/_exports.ts +3 -0
- package/{dist/parser/index.js → src/parser/index.ts} +2 -1
- package/src/parser/number.test.ts +38 -0
- package/src/parser/number.ts +73 -0
- package/src/parser/percent.ts +11 -0
- package/src/parser/string.ts +29 -0
- package/src/price.ts +33 -0
- package/src/random.ts +27 -0
- package/src/react/hooks/index.ts +21 -0
- package/src/react/hooks/use-abort-controller.ts +15 -0
- package/src/react/hooks/use-abort-signal.ts +5 -0
- package/src/react/hooks/use-click-outside.ts +27 -0
- package/{dist/react/hooks/use-constant.js → src/react/hooks/use-constant.ts} +9 -6
- package/{dist/react/hooks/use-define-ref.js → src/react/hooks/use-define-ref.ts} +10 -7
- package/src/react/hooks/use-element-ref.ts +11 -0
- package/src/react/hooks/use-event-listener.ts +29 -0
- package/src/react/hooks/use-event.ts +23 -0
- package/src/react/hooks/use-flag.ts +27 -0
- package/src/react/hooks/use-force-update.ts +9 -0
- package/src/react/hooks/use-initial-height.ts +16 -0
- package/{dist/react/hooks/use-instance.js → src/react/hooks/use-instance.ts} +31 -9
- package/src/react/hooks/use-intersection-observer.ts +18 -0
- package/src/react/hooks/use-last-defined-value.ts +9 -0
- package/src/react/hooks/use-last-value-ref.ts +11 -0
- package/src/react/hooks/use-life-cycle.ts +17 -0
- package/src/react/hooks/use-resize-observer.ts +14 -0
- package/src/react/hooks/use-sync-ref.ts +7 -0
- package/src/react/hooks/use-toggle.ts +9 -0
- package/src/react/hooks/use-value.ts +10 -0
- package/src/react/hooks/use-visibility-state.ts +19 -0
- package/src/react/index.ts +1 -0
- package/src/sound.ts +15 -0
- package/src/storage.ts +137 -0
- package/src/text.test.ts +91 -0
- package/src/text.ts +60 -0
- package/src/type-guard/_exports.ts +154 -0
- package/src/type-guard/index.test.ts +127 -0
- package/{dist/type-guard/index.js → src/type-guard/index.ts} +2 -1
- package/src/vibrate.ts +8 -0
- package/tsconfig.json +26 -0
- package/tsconfig.test.json +33 -0
- package/vitest.config.ts +20 -0
- package/dist/async.cjs +0 -70
- package/dist/async.d.cts +0 -28
- package/dist/async.d.cts.map +0 -1
- package/dist/async.d.ts +0 -28
- package/dist/async.d.ts.map +0 -1
- package/dist/async.js +0 -62
- package/dist/common.cjs +0 -18
- package/dist/common.d.cts +0 -15
- package/dist/common.d.cts.map +0 -1
- package/dist/common.d.ts +0 -15
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -14
- package/dist/complex/counter.cjs +0 -21
- package/dist/complex/counter.d.cts +0 -15
- package/dist/complex/counter.d.cts.map +0 -1
- package/dist/complex/counter.d.ts +0 -15
- package/dist/complex/counter.d.ts.map +0 -1
- package/dist/complex/counter.js +0 -17
- package/dist/complex/global-config.cjs +0 -46
- package/dist/complex/global-config.d.cts +0 -11
- package/dist/complex/global-config.d.cts.map +0 -1
- package/dist/complex/global-config.d.ts +0 -11
- package/dist/complex/global-config.d.ts.map +0 -1
- package/dist/complex/global-config.js +0 -41
- package/dist/complex/index.cjs +0 -19
- package/dist/complex/index.d.cts +0 -4
- package/dist/complex/index.d.cts.map +0 -1
- package/dist/complex/index.d.ts +0 -4
- package/dist/complex/index.d.ts.map +0 -1
- package/dist/complex/index.js +0 -3
- package/dist/complex/modules-factory.cjs +0 -50
- package/dist/complex/modules-factory.d.cts +0 -49
- package/dist/complex/modules-factory.d.cts.map +0 -1
- package/dist/complex/modules-factory.d.ts +0 -49
- package/dist/complex/modules-factory.d.ts.map +0 -1
- package/dist/complex/modules-factory.js +0 -46
- package/dist/cookie.cjs +0 -13
- package/dist/cookie.d.cts +0 -3
- package/dist/cookie.d.cts.map +0 -1
- package/dist/cookie.d.ts +0 -3
- package/dist/cookie.d.ts.map +0 -1
- package/dist/cookie.js +0 -9
- package/dist/css.cjs +0 -28
- package/dist/css.d.cts +0 -36
- package/dist/css.d.cts.map +0 -1
- package/dist/css.d.ts +0 -36
- package/dist/css.d.ts.map +0 -1
- package/dist/css.js +0 -20
- package/dist/data.cjs +0 -58
- package/dist/data.d.cts +0 -4
- package/dist/data.d.cts.map +0 -1
- package/dist/data.d.ts +0 -4
- package/dist/data.d.ts.map +0 -1
- package/dist/data.js +0 -52
- package/dist/date-time.cjs +0 -171
- package/dist/date-time.d.cts +0 -28
- package/dist/date-time.d.cts.map +0 -1
- package/dist/date-time.d.ts +0 -28
- package/dist/date-time.d.ts.map +0 -1
- package/dist/date-time.js +0 -160
- package/dist/device.cjs +0 -28
- package/dist/device.d.cts +0 -8
- package/dist/device.d.cts.map +0 -1
- package/dist/device.d.ts +0 -8
- package/dist/device.d.ts.map +0 -1
- package/dist/device.js +0 -21
- package/dist/encodings.cjs +0 -270
- package/dist/encodings.d.cts +0 -2
- package/dist/encodings.d.cts.map +0 -1
- package/dist/encodings.d.ts +0 -2
- package/dist/encodings.d.ts.map +0 -1
- package/dist/encodings.js +0 -267
- package/dist/errors.cjs +0 -34
- package/dist/errors.d.cts +0 -19
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts +0 -19
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -30
- package/dist/file.cjs +0 -29
- package/dist/file.d.cts +0 -3
- package/dist/file.d.cts.map +0 -1
- package/dist/file.d.ts +0 -3
- package/dist/file.d.ts.map +0 -1
- package/dist/file.js +0 -24
- package/dist/format/_exports.cjs +0 -20
- package/dist/format/_exports.d.cts +0 -5
- package/dist/format/_exports.d.cts.map +0 -1
- package/dist/format/_exports.d.ts +0 -5
- package/dist/format/_exports.d.ts.map +0 -1
- package/dist/format/_exports.js +0 -4
- package/dist/format/constants.cjs +0 -6
- package/dist/format/constants.d.cts +0 -4
- package/dist/format/constants.d.cts.map +0 -1
- package/dist/format/constants.d.ts +0 -4
- package/dist/format/constants.d.ts.map +0 -1
- package/dist/format/index.cjs +0 -40
- package/dist/format/index.d.cts +0 -3
- package/dist/format/index.d.cts.map +0 -1
- package/dist/format/index.d.ts +0 -3
- package/dist/format/index.d.ts.map +0 -1
- package/dist/format/number.cjs +0 -48
- package/dist/format/number.d.cts +0 -36
- package/dist/format/number.d.cts.map +0 -1
- package/dist/format/number.d.ts +0 -36
- package/dist/format/number.d.ts.map +0 -1
- package/dist/format/number.js +0 -44
- package/dist/format/percent.cjs +0 -27
- package/dist/format/percent.d.cts +0 -15
- package/dist/format/percent.d.cts.map +0 -1
- package/dist/format/percent.d.ts +0 -15
- package/dist/format/percent.d.ts.map +0 -1
- package/dist/format/percent.js +0 -23
- package/dist/format/skip-spaces.cjs +0 -8
- package/dist/format/skip-spaces.d.cts +0 -5
- package/dist/format/skip-spaces.d.cts.map +0 -1
- package/dist/format/skip-spaces.d.ts +0 -5
- package/dist/format/skip-spaces.d.ts.map +0 -1
- package/dist/format/skip-spaces.js +0 -4
- package/dist/html.cjs +0 -202
- package/dist/html.d.cts +0 -44
- package/dist/html.d.cts.map +0 -1
- package/dist/html.d.ts +0 -44
- package/dist/html.d.ts.map +0 -1
- package/dist/html.js +0 -182
- package/dist/id.cjs +0 -76
- package/dist/id.d.cts +0 -63
- package/dist/id.d.cts.map +0 -1
- package/dist/id.d.ts +0 -63
- package/dist/id.d.ts.map +0 -1
- package/dist/imports.cjs +0 -45
- package/dist/imports.d.cts +0 -15
- package/dist/imports.d.cts.map +0 -1
- package/dist/imports.d.ts +0 -15
- package/dist/imports.d.ts.map +0 -1
- package/dist/imports.js +0 -40
- package/dist/math.cjs +0 -23
- package/dist/math.d.cts +0 -13
- package/dist/math.d.cts.map +0 -1
- package/dist/math.d.ts +0 -13
- package/dist/math.d.ts.map +0 -1
- package/dist/math.js +0 -17
- package/dist/media.cjs +0 -115
- package/dist/media.d.cts +0 -20
- package/dist/media.d.cts.map +0 -1
- package/dist/media.d.ts +0 -20
- package/dist/media.d.ts.map +0 -1
- package/dist/media.js +0 -103
- package/dist/mobx/apply-observable.cjs +0 -16
- package/dist/mobx/apply-observable.d.cts +0 -4
- package/dist/mobx/apply-observable.d.cts.map +0 -1
- package/dist/mobx/apply-observable.d.ts +0 -4
- package/dist/mobx/apply-observable.d.ts.map +0 -1
- package/dist/mobx/apply-observable.js +0 -12
- package/dist/mobx/create-enhanced-atom.cjs +0 -16
- package/dist/mobx/create-enhanced-atom.d.cts +0 -11
- package/dist/mobx/create-enhanced-atom.d.cts.map +0 -1
- package/dist/mobx/create-enhanced-atom.d.ts +0 -11
- package/dist/mobx/create-enhanced-atom.d.ts.map +0 -1
- package/dist/mobx/create-enhanced-atom.js +0 -12
- package/dist/mobx/deep-observable-struct.cjs +0 -61
- package/dist/mobx/deep-observable-struct.d.cts +0 -7
- package/dist/mobx/deep-observable-struct.d.cts.map +0 -1
- package/dist/mobx/deep-observable-struct.d.ts +0 -7
- package/dist/mobx/deep-observable-struct.d.ts.map +0 -1
- package/dist/mobx/deep-observable-struct.js +0 -57
- package/dist/mobx/get-mobx-administration.cjs +0 -6
- package/dist/mobx/get-mobx-administration.d.cts +0 -6
- package/dist/mobx/get-mobx-administration.d.cts.map +0 -1
- package/dist/mobx/get-mobx-administration.d.ts +0 -6
- package/dist/mobx/get-mobx-administration.d.ts.map +0 -1
- package/dist/mobx/get-mobx-administration.js +0 -2
- package/dist/mobx/index.cjs +0 -21
- package/dist/mobx/index.d.cts +0 -6
- package/dist/mobx/index.d.cts.map +0 -1
- package/dist/mobx/index.d.ts +0 -6
- package/dist/mobx/index.d.ts.map +0 -1
- package/dist/mobx/index.js +0 -5
- package/dist/mobx/lazy-observe.cjs +0 -47
- package/dist/mobx/lazy-observe.d.cts +0 -8
- package/dist/mobx/lazy-observe.d.cts.map +0 -1
- package/dist/mobx/lazy-observe.d.ts +0 -8
- package/dist/mobx/lazy-observe.d.ts.map +0 -1
- package/dist/mobx/lazy-observe.js +0 -43
- package/dist/ms.cjs +0 -22
- package/dist/ms.d.cts +0 -19
- package/dist/ms.d.cts.map +0 -1
- package/dist/ms.d.ts +0 -19
- package/dist/ms.d.ts.map +0 -1
- package/dist/ms.js +0 -18
- package/dist/number.cjs +0 -16
- package/dist/number.d.cts +0 -8
- package/dist/number.d.cts.map +0 -1
- package/dist/number.d.ts +0 -8
- package/dist/number.d.ts.map +0 -1
- package/dist/number.js +0 -13
- package/dist/parser/_exports.cjs +0 -19
- package/dist/parser/_exports.d.cts +0 -4
- package/dist/parser/_exports.d.cts.map +0 -1
- package/dist/parser/_exports.d.ts +0 -4
- package/dist/parser/_exports.d.ts.map +0 -1
- package/dist/parser/_exports.js +0 -3
- package/dist/parser/index.cjs +0 -40
- package/dist/parser/index.d.cts +0 -3
- package/dist/parser/index.d.cts.map +0 -1
- package/dist/parser/index.d.ts +0 -3
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/number.cjs +0 -48
- package/dist/parser/number.d.cts +0 -21
- package/dist/parser/number.d.cts.map +0 -1
- package/dist/parser/number.d.ts +0 -21
- package/dist/parser/number.d.ts.map +0 -1
- package/dist/parser/number.js +0 -44
- package/dist/parser/percent.cjs +0 -8
- package/dist/parser/percent.d.cts +0 -4
- package/dist/parser/percent.d.cts.map +0 -1
- package/dist/parser/percent.d.ts +0 -4
- package/dist/parser/percent.d.ts.map +0 -1
- package/dist/parser/percent.js +0 -4
- package/dist/parser/string.cjs +0 -18
- package/dist/parser/string.d.cts +0 -7
- package/dist/parser/string.d.cts.map +0 -1
- package/dist/parser/string.d.ts +0 -7
- package/dist/parser/string.d.ts.map +0 -1
- package/dist/parser/string.js +0 -14
- package/dist/price.cjs +0 -21
- package/dist/price.d.cts +0 -6
- package/dist/price.d.cts.map +0 -1
- package/dist/price.d.ts +0 -6
- package/dist/price.d.ts.map +0 -1
- package/dist/price.js +0 -17
- package/dist/random.cjs +0 -25
- package/dist/random.d.cts +0 -9
- package/dist/random.d.cts.map +0 -1
- package/dist/random.d.ts +0 -9
- package/dist/random.d.ts.map +0 -1
- package/dist/random.js +0 -14
- package/dist/react/hooks/index.cjs +0 -37
- package/dist/react/hooks/index.d.cts +0 -22
- package/dist/react/hooks/index.d.cts.map +0 -1
- package/dist/react/hooks/index.d.ts +0 -22
- package/dist/react/hooks/index.d.ts.map +0 -1
- package/dist/react/hooks/index.js +0 -21
- package/dist/react/hooks/use-abort-controller.cjs +0 -15
- package/dist/react/hooks/use-abort-controller.d.cts +0 -2
- package/dist/react/hooks/use-abort-controller.d.cts.map +0 -1
- package/dist/react/hooks/use-abort-controller.d.ts +0 -2
- package/dist/react/hooks/use-abort-controller.d.ts.map +0 -1
- package/dist/react/hooks/use-abort-controller.js +0 -11
- package/dist/react/hooks/use-abort-signal.cjs +0 -8
- package/dist/react/hooks/use-abort-signal.d.cts +0 -2
- package/dist/react/hooks/use-abort-signal.d.cts.map +0 -1
- package/dist/react/hooks/use-abort-signal.d.ts +0 -2
- package/dist/react/hooks/use-abort-signal.d.ts.map +0 -1
- package/dist/react/hooks/use-abort-signal.js +0 -4
- package/dist/react/hooks/use-click-outside.cjs +0 -17
- package/dist/react/hooks/use-click-outside.d.cts +0 -9
- package/dist/react/hooks/use-click-outside.d.cts.map +0 -1
- package/dist/react/hooks/use-click-outside.d.ts +0 -9
- package/dist/react/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/react/hooks/use-click-outside.js +0 -13
- package/dist/react/hooks/use-constant.cjs +0 -19
- package/dist/react/hooks/use-constant.d.cts +0 -9
- package/dist/react/hooks/use-constant.d.cts.map +0 -1
- package/dist/react/hooks/use-constant.d.ts +0 -9
- package/dist/react/hooks/use-constant.d.ts.map +0 -1
- package/dist/react/hooks/use-define-ref.cjs +0 -19
- package/dist/react/hooks/use-define-ref.d.cts +0 -10
- package/dist/react/hooks/use-define-ref.d.cts.map +0 -1
- package/dist/react/hooks/use-define-ref.d.ts +0 -10
- package/dist/react/hooks/use-define-ref.d.ts.map +0 -1
- package/dist/react/hooks/use-element-ref.cjs +0 -12
- package/dist/react/hooks/use-element-ref.d.cts +0 -2
- package/dist/react/hooks/use-element-ref.d.cts.map +0 -1
- package/dist/react/hooks/use-element-ref.d.ts +0 -2
- package/dist/react/hooks/use-element-ref.d.ts.map +0 -1
- package/dist/react/hooks/use-element-ref.js +0 -8
- package/dist/react/hooks/use-event-listener.cjs +0 -17
- package/dist/react/hooks/use-event-listener.d.cts +0 -8
- package/dist/react/hooks/use-event-listener.d.cts.map +0 -1
- package/dist/react/hooks/use-event-listener.d.ts +0 -8
- package/dist/react/hooks/use-event-listener.d.ts.map +0 -1
- package/dist/react/hooks/use-event-listener.js +0 -13
- package/dist/react/hooks/use-event.cjs +0 -23
- package/dist/react/hooks/use-event.d.cts +0 -3
- package/dist/react/hooks/use-event.d.cts.map +0 -1
- package/dist/react/hooks/use-event.d.ts +0 -3
- package/dist/react/hooks/use-event.d.ts.map +0 -1
- package/dist/react/hooks/use-event.js +0 -19
- package/dist/react/hooks/use-flag.cjs +0 -19
- package/dist/react/hooks/use-flag.d.cts +0 -8
- package/dist/react/hooks/use-flag.d.cts.map +0 -1
- package/dist/react/hooks/use-flag.d.ts +0 -8
- package/dist/react/hooks/use-flag.d.ts.map +0 -1
- package/dist/react/hooks/use-flag.js +0 -15
- package/dist/react/hooks/use-force-update.cjs +0 -11
- package/dist/react/hooks/use-force-update.d.cts +0 -2
- package/dist/react/hooks/use-force-update.d.cts.map +0 -1
- package/dist/react/hooks/use-force-update.d.ts +0 -2
- package/dist/react/hooks/use-force-update.d.ts.map +0 -1
- package/dist/react/hooks/use-force-update.js +0 -7
- package/dist/react/hooks/use-initial-height.cjs +0 -15
- package/dist/react/hooks/use-initial-height.d.cts +0 -5
- package/dist/react/hooks/use-initial-height.d.cts.map +0 -1
- package/dist/react/hooks/use-initial-height.d.ts +0 -5
- package/dist/react/hooks/use-initial-height.d.ts.map +0 -1
- package/dist/react/hooks/use-initial-height.js +0 -11
- package/dist/react/hooks/use-instance.cjs +0 -31
- package/dist/react/hooks/use-instance.d.cts +0 -27
- package/dist/react/hooks/use-instance.d.cts.map +0 -1
- package/dist/react/hooks/use-instance.d.ts +0 -27
- package/dist/react/hooks/use-instance.d.ts.map +0 -1
- package/dist/react/hooks/use-intersection-observer.cjs +0 -14
- package/dist/react/hooks/use-intersection-observer.d.cts +0 -2
- package/dist/react/hooks/use-intersection-observer.d.cts.map +0 -1
- package/dist/react/hooks/use-intersection-observer.d.ts +0 -2
- package/dist/react/hooks/use-intersection-observer.d.ts.map +0 -1
- package/dist/react/hooks/use-intersection-observer.js +0 -10
- package/dist/react/hooks/use-last-defined-value.cjs +0 -12
- package/dist/react/hooks/use-last-defined-value.d.cts +0 -2
- package/dist/react/hooks/use-last-defined-value.d.cts.map +0 -1
- package/dist/react/hooks/use-last-defined-value.d.ts +0 -2
- package/dist/react/hooks/use-last-defined-value.d.ts.map +0 -1
- package/dist/react/hooks/use-last-defined-value.js +0 -8
- package/dist/react/hooks/use-last-value-ref.cjs +0 -12
- package/dist/react/hooks/use-last-value-ref.d.cts +0 -2
- package/dist/react/hooks/use-last-value-ref.d.cts.map +0 -1
- package/dist/react/hooks/use-last-value-ref.d.ts +0 -2
- package/dist/react/hooks/use-last-value-ref.d.ts.map +0 -1
- package/dist/react/hooks/use-last-value-ref.js +0 -8
- package/dist/react/hooks/use-life-cycle.cjs +0 -14
- package/dist/react/hooks/use-life-cycle.d.cts +0 -5
- package/dist/react/hooks/use-life-cycle.d.cts.map +0 -1
- package/dist/react/hooks/use-life-cycle.d.ts +0 -5
- package/dist/react/hooks/use-life-cycle.d.ts.map +0 -1
- package/dist/react/hooks/use-life-cycle.js +0 -10
- package/dist/react/hooks/use-resize-observer.cjs +0 -15
- package/dist/react/hooks/use-resize-observer.d.cts +0 -2
- package/dist/react/hooks/use-resize-observer.d.cts.map +0 -1
- package/dist/react/hooks/use-resize-observer.d.ts +0 -2
- package/dist/react/hooks/use-resize-observer.d.ts.map +0 -1
- package/dist/react/hooks/use-resize-observer.js +0 -11
- package/dist/react/hooks/use-sync-ref.cjs +0 -10
- package/dist/react/hooks/use-sync-ref.d.cts +0 -2
- package/dist/react/hooks/use-sync-ref.d.cts.map +0 -1
- package/dist/react/hooks/use-sync-ref.d.ts +0 -2
- package/dist/react/hooks/use-sync-ref.d.ts.map +0 -1
- package/dist/react/hooks/use-sync-ref.js +0 -6
- package/dist/react/hooks/use-toggle.cjs +0 -10
- package/dist/react/hooks/use-toggle.d.cts +0 -2
- package/dist/react/hooks/use-toggle.d.cts.map +0 -1
- package/dist/react/hooks/use-toggle.d.ts +0 -2
- package/dist/react/hooks/use-toggle.d.ts.map +0 -1
- package/dist/react/hooks/use-toggle.js +0 -6
- package/dist/react/hooks/use-value.cjs +0 -12
- package/dist/react/hooks/use-value.d.cts +0 -5
- package/dist/react/hooks/use-value.d.cts.map +0 -1
- package/dist/react/hooks/use-value.d.ts +0 -5
- package/dist/react/hooks/use-value.d.ts.map +0 -1
- package/dist/react/hooks/use-value.js +0 -8
- package/dist/react/hooks/use-visibility-state.cjs +0 -18
- package/dist/react/hooks/use-visibility-state.d.cts +0 -2
- package/dist/react/hooks/use-visibility-state.d.cts.map +0 -1
- package/dist/react/hooks/use-visibility-state.d.ts +0 -2
- package/dist/react/hooks/use-visibility-state.d.ts.map +0 -1
- package/dist/react/hooks/use-visibility-state.js +0 -14
- package/dist/react/index.cjs +0 -17
- package/dist/react/index.d.cts +0 -2
- package/dist/react/index.d.cts.map +0 -1
- package/dist/react/index.d.ts +0 -2
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -1
- package/dist/sound.cjs +0 -16
- package/dist/sound.d.cts +0 -7
- package/dist/sound.d.cts.map +0 -1
- package/dist/sound.d.ts +0 -7
- package/dist/sound.d.ts.map +0 -1
- package/dist/sound.js +0 -12
- package/dist/storage.cjs +0 -48
- package/dist/storage.d.cts +0 -39
- package/dist/storage.d.cts.map +0 -1
- package/dist/storage.d.ts +0 -39
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -43
- package/dist/text.cjs +0 -53
- package/dist/text.d.cts +0 -15
- package/dist/text.d.cts.map +0 -1
- package/dist/text.d.ts +0 -15
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -48
- package/dist/type-guard/_exports.cjs +0 -129
- package/dist/type-guard/_exports.d.cts +0 -86
- package/dist/type-guard/_exports.d.cts.map +0 -1
- package/dist/type-guard/_exports.d.ts +0 -86
- package/dist/type-guard/_exports.d.ts.map +0 -1
- package/dist/type-guard/_exports.js +0 -125
- package/dist/type-guard/index.cjs +0 -40
- package/dist/type-guard/index.d.cts +0 -3
- package/dist/type-guard/index.d.cts.map +0 -1
- package/dist/type-guard/index.d.ts +0 -3
- package/dist/type-guard/index.d.ts.map +0 -1
- package/dist/utils/types.cjs +0 -2
- package/dist/utils/types.d.cts +0 -395
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.ts +0 -395
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/types.js +0 -1
- package/dist/vibrate.cjs +0 -12
- package/dist/vibrate.d.cts +0 -5
- package/dist/vibrate.d.cts.map +0 -1
- package/dist/vibrate.d.ts +0 -5
- package/dist/vibrate.d.ts.map +0 -1
- package/dist/vibrate.js +0 -8
- package/utility-types.d.ts +0 -395
package/dist/date-time.cjs
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
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.timeDuration = exports.changeDate = exports.dayTimeDuration = exports.formatDate = void 0;
|
|
7
|
-
exports.getFormatDuration = getFormatDuration;
|
|
8
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
|
-
const duration_js_1 = __importDefault(require("dayjs/plugin/duration.js"));
|
|
10
|
-
const relativeTime_js_1 = __importDefault(require("dayjs/plugin/relativeTime.js"));
|
|
11
|
-
const index_js_1 = require("./format/index.cjs");
|
|
12
|
-
const ms_js_1 = require("./ms.cjs");
|
|
13
|
-
const text_js_1 = require("./text.cjs");
|
|
14
|
-
const index_js_2 = require("./type-guard/index.cjs");
|
|
15
|
-
require("dayjs/locale/ru.js");
|
|
16
|
-
dayjs_1.default.extend(relativeTime_js_1.default);
|
|
17
|
-
dayjs_1.default.extend(duration_js_1.default);
|
|
18
|
-
dayjs_1.default.locale('ru');
|
|
19
|
-
const toLibFormat = (value, asTime) => {
|
|
20
|
-
if (index_js_2.typeGuard.isNumber(value)) {
|
|
21
|
-
if (asTime) {
|
|
22
|
-
return dayjs_1.default.duration(value);
|
|
23
|
-
}
|
|
24
|
-
return (0, dayjs_1.default)(value);
|
|
25
|
-
}
|
|
26
|
-
else if (dayjs_1.default.isDayjs(value)) {
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return (0, dayjs_1.default)(value);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const formatDate = (value, settings) => {
|
|
34
|
-
const dateFormat = settings?.format;
|
|
35
|
-
const datePattern = settings?.pattern;
|
|
36
|
-
const asTime = settings?.asTime;
|
|
37
|
-
value = toLibFormat(value, asTime);
|
|
38
|
-
if (index_js_2.typeGuard.isUndefined(value) || !value.isValid()) {
|
|
39
|
-
return index_js_1.format.NO_VALUE;
|
|
40
|
-
}
|
|
41
|
-
if (datePattern) {
|
|
42
|
-
return value.format(datePattern);
|
|
43
|
-
}
|
|
44
|
-
switch (dateFormat) {
|
|
45
|
-
case 'human': {
|
|
46
|
-
return value.fromNow();
|
|
47
|
-
}
|
|
48
|
-
case 'spent-time': {
|
|
49
|
-
return value.fromNow(true);
|
|
50
|
-
}
|
|
51
|
-
case 'full': {
|
|
52
|
-
return value.format('DD MMM YYYY HH:mm:ss');
|
|
53
|
-
}
|
|
54
|
-
case 'short': {
|
|
55
|
-
return value.format('DD MMM HH:mm');
|
|
56
|
-
}
|
|
57
|
-
case 'time': {
|
|
58
|
-
return value.format('HH:mm:ss');
|
|
59
|
-
}
|
|
60
|
-
case 'time-short': {
|
|
61
|
-
return value.format('HH:mm');
|
|
62
|
-
}
|
|
63
|
-
case 'day': {
|
|
64
|
-
return value.format('DD MMM YYYY');
|
|
65
|
-
}
|
|
66
|
-
case 'month': {
|
|
67
|
-
return value.format('MMMM YYYY');
|
|
68
|
-
}
|
|
69
|
-
default: {
|
|
70
|
-
return value.format('DD.MM.YYYY');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
exports.formatDate = formatDate;
|
|
75
|
-
const dayTimeDuration = (timeInMs) => {
|
|
76
|
-
let left = Math.max(timeInMs, 0);
|
|
77
|
-
const days = Math.floor(left / ms_js_1.unitsToMs.day);
|
|
78
|
-
left = left % ms_js_1.unitsToMs.day;
|
|
79
|
-
const hours = Math.floor(left / ms_js_1.unitsToMs.hour);
|
|
80
|
-
left = left % ms_js_1.unitsToMs.hour;
|
|
81
|
-
const minutes = Math.floor(left / ms_js_1.unitsToMs.min);
|
|
82
|
-
left = left % ms_js_1.unitsToMs.min;
|
|
83
|
-
const seconds = Math.floor(left / ms_js_1.unitsToMs.sec);
|
|
84
|
-
left = left % ms_js_1.unitsToMs.sec;
|
|
85
|
-
const milliseconds = Math.floor(left);
|
|
86
|
-
return {
|
|
87
|
-
days,
|
|
88
|
-
hours,
|
|
89
|
-
minutes,
|
|
90
|
-
seconds,
|
|
91
|
-
milliseconds,
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
exports.dayTimeDuration = dayTimeDuration;
|
|
95
|
-
const changeDate = (date, ...args) => {
|
|
96
|
-
let wrappedDate = toLibFormat(date);
|
|
97
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
98
|
-
const amount = args[i];
|
|
99
|
-
const unit = args[i + 1];
|
|
100
|
-
if (unit != null) {
|
|
101
|
-
wrappedDate = wrappedDate.add(amount, unit);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return wrappedDate.toDate();
|
|
105
|
-
};
|
|
106
|
-
exports.changeDate = changeDate;
|
|
107
|
-
const timeDuration = (timeInMs) => {
|
|
108
|
-
const { days, hours, milliseconds, minutes, seconds } = (0, exports.dayTimeDuration)(timeInMs);
|
|
109
|
-
return {
|
|
110
|
-
hours: hours + ms_js_1.unitsToMs.day * days,
|
|
111
|
-
milliseconds,
|
|
112
|
-
minutes,
|
|
113
|
-
seconds,
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
exports.timeDuration = timeDuration;
|
|
117
|
-
const durationFormatLabels = {
|
|
118
|
-
days: { compact: 'д', full: ['день', 'дня', 'дней'] },
|
|
119
|
-
hours: { compact: 'ч', full: ['час', 'часа', 'часов'] },
|
|
120
|
-
minutes: { compact: 'мин', full: ['минута', 'минуты', 'минут'] },
|
|
121
|
-
seconds: { compact: 'сек', full: ['секунда', 'секунды', 'секунд'] },
|
|
122
|
-
};
|
|
123
|
-
function getFormatDuration(...args) {
|
|
124
|
-
let compact = false;
|
|
125
|
-
let diff = 0;
|
|
126
|
-
if (args[0] instanceof Date) {
|
|
127
|
-
const startedDate = (0, dayjs_1.default)(args[0]);
|
|
128
|
-
const endedDate = (0, dayjs_1.default)(args[1]);
|
|
129
|
-
diff = endedDate.diff(startedDate, 'ms');
|
|
130
|
-
compact = args[2] === true;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
diff = args[0];
|
|
134
|
-
compact = args[1] === true;
|
|
135
|
-
}
|
|
136
|
-
const { days, hours, minutes, seconds } = (0, exports.dayTimeDuration)(diff);
|
|
137
|
-
const formattedParts = [];
|
|
138
|
-
if (days) {
|
|
139
|
-
if (compact) {
|
|
140
|
-
formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
formattedParts.push(`${days} ${(0, text_js_1.declension)(days, durationFormatLabels.days.full)}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (hours) {
|
|
147
|
-
if (compact) {
|
|
148
|
-
formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
formattedParts.push(`${hours} ${(0, text_js_1.declension)(hours, durationFormatLabels.hours.full)}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (minutes) {
|
|
155
|
-
if (compact) {
|
|
156
|
-
formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
formattedParts.push(`${minutes} ${(0, text_js_1.declension)(minutes, durationFormatLabels.minutes.full)}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (seconds) {
|
|
163
|
-
if (compact) {
|
|
164
|
-
formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
formattedParts.push(`${seconds} ${(0, text_js_1.declension)(seconds, durationFormatLabels.seconds.full)}`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return formattedParts.join(' ');
|
|
171
|
-
}
|
package/dist/date-time.d.cts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Dayjs, type ManipulateType } from 'dayjs';
|
|
2
|
-
import type { Maybe } from "./utils/types.cjs";
|
|
3
|
-
import 'dayjs/locale/ru.js';
|
|
4
|
-
export type RawDateToFormat = Date | string | number | Dayjs;
|
|
5
|
-
export declare const formatDate: (value: Maybe<RawDateToFormat>, settings?: Maybe<{
|
|
6
|
-
format?: "human" | "full" | "short" | "day" | "day-only" | "date" | "month" | "spent-time" | "time" | "time-short";
|
|
7
|
-
pattern?: string;
|
|
8
|
-
asTime?: boolean;
|
|
9
|
-
}>) => string;
|
|
10
|
-
export declare const dayTimeDuration: (timeInMs: number) => {
|
|
11
|
-
days: number;
|
|
12
|
-
hours: number;
|
|
13
|
-
minutes: number;
|
|
14
|
-
seconds: number;
|
|
15
|
-
milliseconds: number;
|
|
16
|
-
};
|
|
17
|
-
type DateChangeParam = [amount: number, unit?: Maybe<ManipulateType>];
|
|
18
|
-
export declare const changeDate: (date: Maybe<RawDateToFormat>, ...args: [...DateChangeParam, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>]) => Date;
|
|
19
|
-
export declare const timeDuration: (timeInMs: number) => {
|
|
20
|
-
hours: number;
|
|
21
|
-
milliseconds: number;
|
|
22
|
-
minutes: number;
|
|
23
|
-
seconds: number;
|
|
24
|
-
};
|
|
25
|
-
export declare function getFormatDuration(dateA: Date, dateB: Date, compact?: boolean): string;
|
|
26
|
-
export declare function getFormatDuration(ms: number, compact?: boolean): string;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=date-time.d.ts.map
|
package/dist/date-time.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.d.ts","sourceRoot":"","sources":["../src/date-time.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,KAAK,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ/D,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAyB;AAE9C,OAAO,oBAAoB,CAAC;AAsB5B,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,eAAO,MAAM,UAAU,GACrB,OAAO,KAAK,CAAC,eAAe,CAAC,EAC7B,WAAW,KAAK,CAAC;IACf,MAAM,CAAC,EACH,OAAO,GACP,MAAM,GACN,OAAO,GACP,KAAK,GACL,UAAU,GACV,MAAM,GACN,OAAO,GACP,YAAY,GACZ,MAAM,GACN,YAAY,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,WA6CH,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM;;;;;;CAwB/C,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAEtE,eAAO,MAAM,UAAU,GACrB,MAAM,KAAK,CAAC,eAAe,CAAC,EAC5B,GAAG,MAAM,CACP,GAAG,eAAe,EAClB,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,CAC5B,SAaF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM;;;;;CAU5C,CAAC;AASF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAAC;AACV,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC"}
|
package/dist/date-time.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Dayjs, type ManipulateType } from 'dayjs';
|
|
2
|
-
import type { Maybe } from "./utils/types.js";
|
|
3
|
-
import 'dayjs/locale/ru.js';
|
|
4
|
-
export type RawDateToFormat = Date | string | number | Dayjs;
|
|
5
|
-
export declare const formatDate: (value: Maybe<RawDateToFormat>, settings?: Maybe<{
|
|
6
|
-
format?: "human" | "full" | "short" | "day" | "day-only" | "date" | "month" | "spent-time" | "time" | "time-short";
|
|
7
|
-
pattern?: string;
|
|
8
|
-
asTime?: boolean;
|
|
9
|
-
}>) => string;
|
|
10
|
-
export declare const dayTimeDuration: (timeInMs: number) => {
|
|
11
|
-
days: number;
|
|
12
|
-
hours: number;
|
|
13
|
-
minutes: number;
|
|
14
|
-
seconds: number;
|
|
15
|
-
milliseconds: number;
|
|
16
|
-
};
|
|
17
|
-
type DateChangeParam = [amount: number, unit?: Maybe<ManipulateType>];
|
|
18
|
-
export declare const changeDate: (date: Maybe<RawDateToFormat>, ...args: [...DateChangeParam, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>, ...Partial<DateChangeParam>]) => Date;
|
|
19
|
-
export declare const timeDuration: (timeInMs: number) => {
|
|
20
|
-
hours: number;
|
|
21
|
-
milliseconds: number;
|
|
22
|
-
minutes: number;
|
|
23
|
-
seconds: number;
|
|
24
|
-
};
|
|
25
|
-
export declare function getFormatDuration(dateA: Date, dateB: Date, compact?: boolean): string;
|
|
26
|
-
export declare function getFormatDuration(ms: number, compact?: boolean): string;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=date-time.d.ts.map
|
package/dist/date-time.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.d.ts","sourceRoot":"","sources":["../src/date-time.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,KAAK,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ/D,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB;AAE9C,OAAO,oBAAoB,CAAC;AAsB5B,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,eAAO,MAAM,UAAU,GACrB,OAAO,KAAK,CAAC,eAAe,CAAC,EAC7B,WAAW,KAAK,CAAC;IACf,MAAM,CAAC,EACH,OAAO,GACP,MAAM,GACN,OAAO,GACP,KAAK,GACL,UAAU,GACV,MAAM,GACN,OAAO,GACP,YAAY,GACZ,MAAM,GACN,YAAY,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,WA6CH,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM;;;;;;CAwB/C,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAEtE,eAAO,MAAM,UAAU,GACrB,MAAM,KAAK,CAAC,eAAe,CAAC,EAC5B,GAAG,MAAM,CACP,GAAG,eAAe,EAClB,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,EAC3B,GAAG,OAAO,CAAC,eAAe,CAAC,CAC5B,SAaF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM;;;;;CAU5C,CAAC;AASF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAAC;AACV,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC"}
|
package/dist/date-time.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import duration from 'dayjs/plugin/duration.js';
|
|
3
|
-
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
4
|
-
import { format } from "./format/index.js";
|
|
5
|
-
import { unitsToMs } from "./ms.js";
|
|
6
|
-
import { declension } from "./text.js";
|
|
7
|
-
import { typeGuard } from "./type-guard/index.js";
|
|
8
|
-
import 'dayjs/locale/ru.js';
|
|
9
|
-
dayjs.extend(relativeTime);
|
|
10
|
-
dayjs.extend(duration);
|
|
11
|
-
dayjs.locale('ru');
|
|
12
|
-
const toLibFormat = (value, asTime) => {
|
|
13
|
-
if (typeGuard.isNumber(value)) {
|
|
14
|
-
if (asTime) {
|
|
15
|
-
return dayjs.duration(value);
|
|
16
|
-
}
|
|
17
|
-
return dayjs(value);
|
|
18
|
-
}
|
|
19
|
-
else if (dayjs.isDayjs(value)) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return dayjs(value);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export const formatDate = (value, settings) => {
|
|
27
|
-
const dateFormat = settings?.format;
|
|
28
|
-
const datePattern = settings?.pattern;
|
|
29
|
-
const asTime = settings?.asTime;
|
|
30
|
-
value = toLibFormat(value, asTime);
|
|
31
|
-
if (typeGuard.isUndefined(value) || !value.isValid()) {
|
|
32
|
-
return format.NO_VALUE;
|
|
33
|
-
}
|
|
34
|
-
if (datePattern) {
|
|
35
|
-
return value.format(datePattern);
|
|
36
|
-
}
|
|
37
|
-
switch (dateFormat) {
|
|
38
|
-
case 'human': {
|
|
39
|
-
return value.fromNow();
|
|
40
|
-
}
|
|
41
|
-
case 'spent-time': {
|
|
42
|
-
return value.fromNow(true);
|
|
43
|
-
}
|
|
44
|
-
case 'full': {
|
|
45
|
-
return value.format('DD MMM YYYY HH:mm:ss');
|
|
46
|
-
}
|
|
47
|
-
case 'short': {
|
|
48
|
-
return value.format('DD MMM HH:mm');
|
|
49
|
-
}
|
|
50
|
-
case 'time': {
|
|
51
|
-
return value.format('HH:mm:ss');
|
|
52
|
-
}
|
|
53
|
-
case 'time-short': {
|
|
54
|
-
return value.format('HH:mm');
|
|
55
|
-
}
|
|
56
|
-
case 'day': {
|
|
57
|
-
return value.format('DD MMM YYYY');
|
|
58
|
-
}
|
|
59
|
-
case 'month': {
|
|
60
|
-
return value.format('MMMM YYYY');
|
|
61
|
-
}
|
|
62
|
-
default: {
|
|
63
|
-
return value.format('DD.MM.YYYY');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
export const dayTimeDuration = (timeInMs) => {
|
|
68
|
-
let left = Math.max(timeInMs, 0);
|
|
69
|
-
const days = Math.floor(left / unitsToMs.day);
|
|
70
|
-
left = left % unitsToMs.day;
|
|
71
|
-
const hours = Math.floor(left / unitsToMs.hour);
|
|
72
|
-
left = left % unitsToMs.hour;
|
|
73
|
-
const minutes = Math.floor(left / unitsToMs.min);
|
|
74
|
-
left = left % unitsToMs.min;
|
|
75
|
-
const seconds = Math.floor(left / unitsToMs.sec);
|
|
76
|
-
left = left % unitsToMs.sec;
|
|
77
|
-
const milliseconds = Math.floor(left);
|
|
78
|
-
return {
|
|
79
|
-
days,
|
|
80
|
-
hours,
|
|
81
|
-
minutes,
|
|
82
|
-
seconds,
|
|
83
|
-
milliseconds,
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
export const changeDate = (date, ...args) => {
|
|
87
|
-
let wrappedDate = toLibFormat(date);
|
|
88
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
89
|
-
const amount = args[i];
|
|
90
|
-
const unit = args[i + 1];
|
|
91
|
-
if (unit != null) {
|
|
92
|
-
wrappedDate = wrappedDate.add(amount, unit);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return wrappedDate.toDate();
|
|
96
|
-
};
|
|
97
|
-
export const timeDuration = (timeInMs) => {
|
|
98
|
-
const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
|
|
99
|
-
return {
|
|
100
|
-
hours: hours + unitsToMs.day * days,
|
|
101
|
-
milliseconds,
|
|
102
|
-
minutes,
|
|
103
|
-
seconds,
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
const durationFormatLabels = {
|
|
107
|
-
days: { compact: 'д', full: ['день', 'дня', 'дней'] },
|
|
108
|
-
hours: { compact: 'ч', full: ['час', 'часа', 'часов'] },
|
|
109
|
-
minutes: { compact: 'мин', full: ['минута', 'минуты', 'минут'] },
|
|
110
|
-
seconds: { compact: 'сек', full: ['секунда', 'секунды', 'секунд'] },
|
|
111
|
-
};
|
|
112
|
-
export function getFormatDuration(...args) {
|
|
113
|
-
let compact = false;
|
|
114
|
-
let diff = 0;
|
|
115
|
-
if (args[0] instanceof Date) {
|
|
116
|
-
const startedDate = dayjs(args[0]);
|
|
117
|
-
const endedDate = dayjs(args[1]);
|
|
118
|
-
diff = endedDate.diff(startedDate, 'ms');
|
|
119
|
-
compact = args[2] === true;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
diff = args[0];
|
|
123
|
-
compact = args[1] === true;
|
|
124
|
-
}
|
|
125
|
-
const { days, hours, minutes, seconds } = dayTimeDuration(diff);
|
|
126
|
-
const formattedParts = [];
|
|
127
|
-
if (days) {
|
|
128
|
-
if (compact) {
|
|
129
|
-
formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
formattedParts.push(`${days} ${declension(days, durationFormatLabels.days.full)}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (hours) {
|
|
136
|
-
if (compact) {
|
|
137
|
-
formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
formattedParts.push(`${hours} ${declension(hours, durationFormatLabels.hours.full)}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (minutes) {
|
|
144
|
-
if (compact) {
|
|
145
|
-
formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
formattedParts.push(`${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (seconds) {
|
|
152
|
-
if (compact) {
|
|
153
|
-
formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
formattedParts.push(`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return formattedParts.join(' ');
|
|
160
|
-
}
|
package/dist/device.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTouchDevice = exports.isTabletDevice = exports.isMobileDevice = exports.checkIsTouchDevice = exports.checkIsTabletDevice = exports.checkIsMobileDevice = exports.getUserAgent = void 0;
|
|
4
|
-
const getUserAgent = () => (navigator.userAgent ||
|
|
5
|
-
navigator.vendor ||
|
|
6
|
-
// @ts-expect-error skip opera
|
|
7
|
-
globalThis.opera ||
|
|
8
|
-
'').toLowerCase();
|
|
9
|
-
exports.getUserAgent = getUserAgent;
|
|
10
|
-
const checkIsMobileDevice = () => {
|
|
11
|
-
const userAgent = (0, exports.getUserAgent)();
|
|
12
|
-
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent || '') ||
|
|
13
|
-
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test((userAgent || '').slice(0, 4))) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
};
|
|
18
|
-
exports.checkIsMobileDevice = checkIsMobileDevice;
|
|
19
|
-
const checkIsTabletDevice = () => {
|
|
20
|
-
const userAgent = (0, exports.getUserAgent)();
|
|
21
|
-
return /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent);
|
|
22
|
-
};
|
|
23
|
-
exports.checkIsTabletDevice = checkIsTabletDevice;
|
|
24
|
-
const checkIsTouchDevice = () => (0, exports.checkIsMobileDevice)() || (0, exports.checkIsTabletDevice)();
|
|
25
|
-
exports.checkIsTouchDevice = checkIsTouchDevice;
|
|
26
|
-
exports.isMobileDevice = (0, exports.checkIsMobileDevice)();
|
|
27
|
-
exports.isTabletDevice = (0, exports.checkIsTabletDevice)();
|
|
28
|
-
exports.isTouchDevice = exports.isMobileDevice || exports.isTabletDevice;
|
package/dist/device.d.cts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const getUserAgent: () => any;
|
|
2
|
-
export declare const checkIsMobileDevice: () => boolean;
|
|
3
|
-
export declare const checkIsTabletDevice: () => boolean;
|
|
4
|
-
export declare const checkIsTouchDevice: () => boolean;
|
|
5
|
-
export declare const isMobileDevice: boolean;
|
|
6
|
-
export declare const isTabletDevice: boolean;
|
|
7
|
-
export declare const isTouchDevice: boolean;
|
|
8
|
-
//# sourceMappingURL=device.d.ts.map
|
package/dist/device.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAOR,CAAC;AAElB,eAAO,MAAM,mBAAmB,eAe/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAM/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,eACiB,CAAC;AAEjD,eAAO,MAAM,cAAc,SAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc,SAAwB,CAAC;AAEpD,eAAO,MAAM,aAAa,SAAmC,CAAC"}
|
package/dist/device.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const getUserAgent: () => any;
|
|
2
|
-
export declare const checkIsMobileDevice: () => boolean;
|
|
3
|
-
export declare const checkIsTabletDevice: () => boolean;
|
|
4
|
-
export declare const checkIsTouchDevice: () => boolean;
|
|
5
|
-
export declare const isMobileDevice: boolean;
|
|
6
|
-
export declare const isTabletDevice: boolean;
|
|
7
|
-
export declare const isTouchDevice: boolean;
|
|
8
|
-
//# sourceMappingURL=device.d.ts.map
|
package/dist/device.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAOR,CAAC;AAElB,eAAO,MAAM,mBAAmB,eAe/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAM/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,eACiB,CAAC;AAEjD,eAAO,MAAM,cAAc,SAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc,SAAwB,CAAC;AAEpD,eAAO,MAAM,aAAa,SAAmC,CAAC"}
|
package/dist/device.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const getUserAgent = () => (navigator.userAgent ||
|
|
2
|
-
navigator.vendor ||
|
|
3
|
-
// @ts-expect-error skip opera
|
|
4
|
-
globalThis.opera ||
|
|
5
|
-
'').toLowerCase();
|
|
6
|
-
export const checkIsMobileDevice = () => {
|
|
7
|
-
const userAgent = getUserAgent();
|
|
8
|
-
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent || '') ||
|
|
9
|
-
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test((userAgent || '').slice(0, 4))) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
return false;
|
|
13
|
-
};
|
|
14
|
-
export const checkIsTabletDevice = () => {
|
|
15
|
-
const userAgent = getUserAgent();
|
|
16
|
-
return /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent);
|
|
17
|
-
};
|
|
18
|
-
export const checkIsTouchDevice = () => checkIsMobileDevice() || checkIsTabletDevice();
|
|
19
|
-
export const isMobileDevice = checkIsMobileDevice();
|
|
20
|
-
export const isTabletDevice = checkIsTabletDevice();
|
|
21
|
-
export const isTouchDevice = isMobileDevice || isTabletDevice;
|