yummies 5.4.5 → 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/utils/types.cjs +0 -2
- package/utils/types.d.cts +0 -395
- package/utils/types.d.cts.map +0 -1
- package/utils/types.d.ts +0 -395
- package/utils/types.d.ts.map +0 -1
- package/utils/types.js +0 -1
package/dist/html.cjs
DELETED
|
@@ -1,202 +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.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
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
package/dist/html.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/html.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type Config as DOMPurifyConfig } from 'dompurify';
|
|
2
|
-
import type { Maybe } from "./utils/types.js";
|
|
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
|
package/dist/html.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/dist/html.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import DOMPurify from 'dompurify';
|
|
2
|
-
import { blobToUrl } from "./media.js";
|
|
3
|
-
/**
|
|
4
|
-
* Вытаскивает RGB из любого цвета
|
|
5
|
-
*
|
|
6
|
-
* Не рекомендуется к использованию так как вызывает reflow
|
|
7
|
-
*/
|
|
8
|
-
export const getComputedColor = (color) => {
|
|
9
|
-
if (!color)
|
|
10
|
-
return null;
|
|
11
|
-
const d = document.createElement('div');
|
|
12
|
-
d.style.color = color;
|
|
13
|
-
document.body.append(d);
|
|
14
|
-
const rgbcolor = globalThis.getComputedStyle(d).color;
|
|
15
|
-
const match = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(rgbcolor);
|
|
16
|
-
d.remove();
|
|
17
|
-
if (!match)
|
|
18
|
-
return null;
|
|
19
|
-
return `${match[1]}, ${match[2]}, ${match[3]}`;
|
|
20
|
-
};
|
|
21
|
-
export const downloadUsingAnchor = (urlOrBlob, fileName) => {
|
|
22
|
-
const url = blobToUrl(urlOrBlob);
|
|
23
|
-
const a = document.createElement('a');
|
|
24
|
-
a.href = url;
|
|
25
|
-
a.download = fileName ?? 'file';
|
|
26
|
-
a.target = '_blank';
|
|
27
|
-
document.body.append(a);
|
|
28
|
-
a.click();
|
|
29
|
-
a.remove();
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Surrounds string in an anchor tag
|
|
33
|
-
*/
|
|
34
|
-
export function wrapTextToTagLink(link) {
|
|
35
|
-
const descr = String(link).replace(/^(https?:\/{0,2})?(w{3}\.)?/, 'www.');
|
|
36
|
-
if (!/^https?:\/{2}/.test(link))
|
|
37
|
-
link = `http://${link}`;
|
|
38
|
-
return `<a href=${link} target="_blank">${descr}</a>`;
|
|
39
|
-
}
|
|
40
|
-
export const collectOffsetTop = (element) => {
|
|
41
|
-
let offsetTop = 0;
|
|
42
|
-
let node = element;
|
|
43
|
-
while (node != null) {
|
|
44
|
-
offsetTop += node.offsetTop;
|
|
45
|
-
node = node.parentElement;
|
|
46
|
-
}
|
|
47
|
-
return offsetTop;
|
|
48
|
-
};
|
|
49
|
-
export const skipEvent = (e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
return false;
|
|
53
|
-
};
|
|
54
|
-
export const globalScrollIntoViewForY = (node) => {
|
|
55
|
-
const scrollContainer = document.body;
|
|
56
|
-
const pageHeight = window.innerHeight;
|
|
57
|
-
const nodeBounding = node.getBoundingClientRect();
|
|
58
|
-
const scrollPagesCount = scrollContainer.scrollHeight / pageHeight;
|
|
59
|
-
const scrollPageNumber = Math.min(Math.max(nodeBounding.top / pageHeight, 1), scrollPagesCount);
|
|
60
|
-
window.scroll({
|
|
61
|
-
top: scrollPageNumber * pageHeight,
|
|
62
|
-
behavior: 'smooth',
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const sanitizeDefaults = {
|
|
66
|
-
ALLOWED_TAGS: [
|
|
67
|
-
'a',
|
|
68
|
-
'article',
|
|
69
|
-
'b',
|
|
70
|
-
'blockquote',
|
|
71
|
-
'br',
|
|
72
|
-
'caption',
|
|
73
|
-
'code',
|
|
74
|
-
'del',
|
|
75
|
-
'details',
|
|
76
|
-
'div',
|
|
77
|
-
'em',
|
|
78
|
-
'h1',
|
|
79
|
-
'h2',
|
|
80
|
-
'h3',
|
|
81
|
-
'h4',
|
|
82
|
-
'h5',
|
|
83
|
-
'h6',
|
|
84
|
-
'hr',
|
|
85
|
-
'i',
|
|
86
|
-
'img',
|
|
87
|
-
'ins',
|
|
88
|
-
'kbd',
|
|
89
|
-
'li',
|
|
90
|
-
'main',
|
|
91
|
-
'ol',
|
|
92
|
-
'p',
|
|
93
|
-
'pre',
|
|
94
|
-
'section',
|
|
95
|
-
'span',
|
|
96
|
-
'strong',
|
|
97
|
-
'sub',
|
|
98
|
-
'summary',
|
|
99
|
-
'sup',
|
|
100
|
-
'table',
|
|
101
|
-
'tbody',
|
|
102
|
-
'td',
|
|
103
|
-
'th',
|
|
104
|
-
'thead',
|
|
105
|
-
'tr',
|
|
106
|
-
'u',
|
|
107
|
-
'ul',
|
|
108
|
-
],
|
|
109
|
-
ALLOWED_ATTR: ['href', 'target', 'name', 'src', 'class'],
|
|
110
|
-
};
|
|
111
|
-
export const sanitizeHtml = (html, config) => {
|
|
112
|
-
return DOMPurify.sanitize(html || '', {
|
|
113
|
-
...sanitizeDefaults,
|
|
114
|
-
...config,
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
export const checkElementHasParent = (element, parent) => {
|
|
118
|
-
let node = element;
|
|
119
|
-
if (!parent)
|
|
120
|
-
return false;
|
|
121
|
-
while (node != null) {
|
|
122
|
-
if (node === parent) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
node = node.parentElement;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Executes a function within a view transition if supported by the browser.
|
|
133
|
-
*
|
|
134
|
-
* @param {VoidFunction} fn - The function to be executed.
|
|
135
|
-
* @returns {ViewTransition} - The result of the executed function.
|
|
136
|
-
*
|
|
137
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
|
|
138
|
-
*/
|
|
139
|
-
export const startViewTransitionSafety = (fn, params) => {
|
|
140
|
-
if (document.startViewTransition && !params?.disabled) {
|
|
141
|
-
return document.startViewTransition(fn);
|
|
142
|
-
}
|
|
143
|
-
fn();
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Вычисляет размер скроллбара
|
|
147
|
-
*/
|
|
148
|
-
export const calcScrollbarWidth = () => {
|
|
149
|
-
const outer = document.createElement('div');
|
|
150
|
-
outer.style.visibility = 'hidden';
|
|
151
|
-
outer.style.width = '100px';
|
|
152
|
-
outer.style.overflow = 'scroll';
|
|
153
|
-
document.body.append(outer);
|
|
154
|
-
const inner = document.createElement('div');
|
|
155
|
-
inner.style.width = '100%';
|
|
156
|
-
outer.append(inner);
|
|
157
|
-
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
158
|
-
outer.parentNode?.removeChild(outer);
|
|
159
|
-
return scrollbarWidth;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Calculates the inner height of an HTML element, accounting for padding.
|
|
163
|
-
*/
|
|
164
|
-
export function getElementInnerHeight(element) {
|
|
165
|
-
const { clientHeight } = element;
|
|
166
|
-
const { paddingTop, paddingBottom } = getComputedStyle(element);
|
|
167
|
-
return (clientHeight -
|
|
168
|
-
Number.parseFloat(paddingTop) -
|
|
169
|
-
Number.parseFloat(paddingBottom));
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Calculates the inner width of an HTML element, accounting for padding.
|
|
173
|
-
*/
|
|
174
|
-
export function getElementInnerWidth(el) {
|
|
175
|
-
const { clientWidth } = el;
|
|
176
|
-
const { paddingLeft, paddingRight } = getComputedStyle(el);
|
|
177
|
-
return (clientWidth -
|
|
178
|
-
Number.parseFloat(paddingLeft) -
|
|
179
|
-
Number.parseFloat(paddingRight));
|
|
180
|
-
}
|
|
181
|
-
export const isPrefersDarkTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches;
|
|
182
|
-
export const isPrefersLightTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: light)')?.matches;
|
package/dist/id.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateStackBasedId = exports.generateLinearNumericId = exports.createLinearNumericIdGenerator = exports.generateNumericShortId = exports.generateNumericId = exports.generateShortId = exports.generateId = void 0;
|
|
4
|
-
const nanoid_1 = require("nanoid");
|
|
5
|
-
const DIGITS = '0123456789';
|
|
6
|
-
const LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';
|
|
7
|
-
const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
|
|
8
|
-
/**
|
|
9
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
10
|
-
* Размер 6
|
|
11
|
-
*/
|
|
12
|
-
exports.generateId = (0, nanoid_1.customAlphabet)(ALPHABET, 6);
|
|
13
|
-
/**
|
|
14
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
15
|
-
* Размер 4
|
|
16
|
-
*/
|
|
17
|
-
exports.generateShortId = (0, nanoid_1.customAlphabet)(ALPHABET, 4);
|
|
18
|
-
/**
|
|
19
|
-
* Использует алфавит 0123456789
|
|
20
|
-
* Размер 6
|
|
21
|
-
*/
|
|
22
|
-
exports.generateNumericId = (0, nanoid_1.customAlphabet)(DIGITS, 6);
|
|
23
|
-
/**
|
|
24
|
-
* Использует алфавит 0123456789
|
|
25
|
-
* Размер 4
|
|
26
|
-
*/
|
|
27
|
-
exports.generateNumericShortId = (0, nanoid_1.customAlphabet)(DIGITS, 4);
|
|
28
|
-
/**
|
|
29
|
-
* Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
34
|
-
* generateLinearNumericId() // '000000'
|
|
35
|
-
* generateLinearNumericId() // '000001'
|
|
36
|
-
* ...
|
|
37
|
-
* generateLinearNumericId() // '999999'
|
|
38
|
-
* generateLinearNumericId() // '1000000'
|
|
39
|
-
* ...
|
|
40
|
-
* generateLinearNumericId() // '9999999'
|
|
41
|
-
* generateLinearNumericId() // '10000000'
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @param size размер
|
|
45
|
-
* @returns {()=>string}
|
|
46
|
-
*/
|
|
47
|
-
const createLinearNumericIdGenerator = (size = 9) => {
|
|
48
|
-
let lastCount = 0;
|
|
49
|
-
return () => {
|
|
50
|
-
return (lastCount++).toString().padStart(size, '0');
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
exports.createLinearNumericIdGenerator = createLinearNumericIdGenerator;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* generateLinearNumericId() // '000000000'
|
|
59
|
-
* generateLinearNumericId() // '000000001'
|
|
60
|
-
* ...
|
|
61
|
-
* generateLinearNumericId() // '999999999'
|
|
62
|
-
* generateLinearNumericId() // '1000000000'
|
|
63
|
-
* ...
|
|
64
|
-
* generateLinearNumericId() // '9999999999'
|
|
65
|
-
* generateLinearNumericId() // '10000000000'
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
exports.generateLinearNumericId = (0, exports.createLinearNumericIdGenerator)();
|
|
70
|
-
/**
|
|
71
|
-
* Is not recommended to use.
|
|
72
|
-
*
|
|
73
|
-
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
74
|
-
*/
|
|
75
|
-
const generateStackBasedId = () => new Error().stack.split('\n').slice(1, 4).join('');
|
|
76
|
-
exports.generateStackBasedId = generateStackBasedId;
|
package/dist/id.d.cts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
3
|
-
* Размер 6
|
|
4
|
-
*/
|
|
5
|
-
export declare const generateId: (size?: number) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
8
|
-
* Размер 4
|
|
9
|
-
*/
|
|
10
|
-
export declare const generateShortId: (size?: number) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Использует алфавит 0123456789
|
|
13
|
-
* Размер 6
|
|
14
|
-
*/
|
|
15
|
-
export declare const generateNumericId: (size?: number) => string;
|
|
16
|
-
/**
|
|
17
|
-
* Использует алфавит 0123456789
|
|
18
|
-
* Размер 4
|
|
19
|
-
*/
|
|
20
|
-
export declare const generateNumericShortId: (size?: number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
27
|
-
* generateLinearNumericId() // '000000'
|
|
28
|
-
* generateLinearNumericId() // '000001'
|
|
29
|
-
* ...
|
|
30
|
-
* generateLinearNumericId() // '999999'
|
|
31
|
-
* generateLinearNumericId() // '1000000'
|
|
32
|
-
* ...
|
|
33
|
-
* generateLinearNumericId() // '9999999'
|
|
34
|
-
* generateLinearNumericId() // '10000000'
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @param size размер
|
|
38
|
-
* @returns {()=>string}
|
|
39
|
-
*/
|
|
40
|
-
export declare const createLinearNumericIdGenerator: (size?: number) => () => string;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* generateLinearNumericId() // '000000000'
|
|
46
|
-
* generateLinearNumericId() // '000000001'
|
|
47
|
-
* ...
|
|
48
|
-
* generateLinearNumericId() // '999999999'
|
|
49
|
-
* generateLinearNumericId() // '1000000000'
|
|
50
|
-
* ...
|
|
51
|
-
* generateLinearNumericId() // '9999999999'
|
|
52
|
-
* generateLinearNumericId() // '10000000000'
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
export declare const generateLinearNumericId: () => string;
|
|
57
|
-
/**
|
|
58
|
-
* Is not recommended to use.
|
|
59
|
-
*
|
|
60
|
-
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
61
|
-
*/
|
|
62
|
-
export declare const generateStackBasedId: () => string;
|
|
63
|
-
//# sourceMappingURL=id.d.ts.map
|
package/dist/id.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,UAAU,2BAA8B,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,eAAe,2BAA8B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2BAA4B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAM,MAAU,iBAK9D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,cAAmC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,cACoB,CAAC"}
|
package/dist/id.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
3
|
-
* Размер 6
|
|
4
|
-
*/
|
|
5
|
-
export declare const generateId: (size?: number) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
8
|
-
* Размер 4
|
|
9
|
-
*/
|
|
10
|
-
export declare const generateShortId: (size?: number) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Использует алфавит 0123456789
|
|
13
|
-
* Размер 6
|
|
14
|
-
*/
|
|
15
|
-
export declare const generateNumericId: (size?: number) => string;
|
|
16
|
-
/**
|
|
17
|
-
* Использует алфавит 0123456789
|
|
18
|
-
* Размер 4
|
|
19
|
-
*/
|
|
20
|
-
export declare const generateNumericShortId: (size?: number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
27
|
-
* generateLinearNumericId() // '000000'
|
|
28
|
-
* generateLinearNumericId() // '000001'
|
|
29
|
-
* ...
|
|
30
|
-
* generateLinearNumericId() // '999999'
|
|
31
|
-
* generateLinearNumericId() // '1000000'
|
|
32
|
-
* ...
|
|
33
|
-
* generateLinearNumericId() // '9999999'
|
|
34
|
-
* generateLinearNumericId() // '10000000'
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @param size размер
|
|
38
|
-
* @returns {()=>string}
|
|
39
|
-
*/
|
|
40
|
-
export declare const createLinearNumericIdGenerator: (size?: number) => () => string;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* generateLinearNumericId() // '000000000'
|
|
46
|
-
* generateLinearNumericId() // '000000001'
|
|
47
|
-
* ...
|
|
48
|
-
* generateLinearNumericId() // '999999999'
|
|
49
|
-
* generateLinearNumericId() // '1000000000'
|
|
50
|
-
* ...
|
|
51
|
-
* generateLinearNumericId() // '9999999999'
|
|
52
|
-
* generateLinearNumericId() // '10000000000'
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
export declare const generateLinearNumericId: () => string;
|
|
57
|
-
/**
|
|
58
|
-
* Is not recommended to use.
|
|
59
|
-
*
|
|
60
|
-
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
61
|
-
*/
|
|
62
|
-
export declare const generateStackBasedId: () => string;
|
|
63
|
-
//# sourceMappingURL=id.d.ts.map
|