@hkdigital/lib-core 0.3.1
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/README.md +149 -0
- package/dist/assets/autospuiten/car-paint-picker/army-green.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/electric-blue.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/lemon-yellow.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/opaque-purple.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/rusty.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/sunset-orange.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker/tomato-red.jpg +0 -0
- package/dist/assets/autospuiten/car-paint-picker.d.ts +17 -0
- package/dist/assets/autospuiten/car-paint-picker.js +41 -0
- package/dist/assets/autospuiten/labels.d.ts +7 -0
- package/dist/assets/autospuiten/labels.js +7 -0
- package/dist/classes/cache/IndexedDbCache.d.ts +216 -0
- package/dist/classes/cache/IndexedDbCache.js +1407 -0
- package/dist/classes/cache/MemoryResponseCache.d.ts +106 -0
- package/dist/classes/cache/MemoryResponseCache.js +138 -0
- package/dist/classes/cache/index.d.ts +3 -0
- package/dist/classes/cache/index.js +5 -0
- package/dist/classes/cache/typedef.d.ts +67 -0
- package/dist/classes/cache/typedef.js +41 -0
- package/dist/classes/data/IterableTree.d.ts +51 -0
- package/dist/classes/data/IterableTree.js +243 -0
- package/dist/classes/data/Selector.d.ts +30 -0
- package/dist/classes/data/Selector.js +190 -0
- package/dist/classes/data/index.d.ts +2 -0
- package/dist/classes/data/index.js +2 -0
- package/dist/classes/events/EventEmitter.d.ts +142 -0
- package/dist/classes/events/EventEmitter.js +275 -0
- package/dist/classes/events/index.d.ts +1 -0
- package/dist/classes/events/index.js +2 -0
- package/dist/classes/index.d.ts +4 -0
- package/dist/classes/index.js +4 -0
- package/dist/classes/logging/Logger.d.ts +78 -0
- package/dist/classes/logging/Logger.js +210 -0
- package/dist/classes/logging/constants.d.ts +12 -0
- package/dist/classes/logging/constants.js +16 -0
- package/dist/classes/logging/index.d.ts +2 -0
- package/dist/classes/logging/index.js +4 -0
- package/dist/classes/logging/typedef.d.ts +34 -0
- package/dist/classes/logging/typedef.js +17 -0
- package/dist/classes/promise/HkPromise.d.ts +121 -0
- package/dist/classes/promise/HkPromise.js +377 -0
- package/dist/classes/promise/index.d.ts +1 -0
- package/dist/classes/promise/index.js +1 -0
- package/dist/classes/services/ServiceBase.d.ts +163 -0
- package/dist/classes/services/ServiceBase.js +463 -0
- package/dist/classes/services/ServiceManager.d.ts +179 -0
- package/dist/classes/services/ServiceManager.js +614 -0
- package/dist/classes/services/index.d.ts +4 -0
- package/dist/classes/services/index.js +5 -0
- package/dist/classes/services/service-states.d.ts +159 -0
- package/dist/classes/services/service-states.js +205 -0
- package/dist/classes/services/typedef.d.ts +247 -0
- package/dist/classes/services/typedef.js +179 -0
- package/dist/classes/stores/SubscribersCount.d.ts +39 -0
- package/dist/classes/stores/SubscribersCount.js +107 -0
- package/dist/classes/stores/index.d.ts +1 -0
- package/dist/classes/stores/index.js +1 -0
- package/dist/classes/streams/LogTransformStream.d.ts +4 -0
- package/dist/classes/streams/LogTransformStream.js +19 -0
- package/dist/classes/streams/ServerEventsStore.d.ts +22 -0
- package/dist/classes/streams/ServerEventsStore.js +110 -0
- package/dist/classes/streams/TimeStampSource.d.ts +13 -0
- package/dist/classes/streams/TimeStampSource.js +26 -0
- package/dist/classes/streams/index.d.ts +3 -0
- package/dist/classes/streams/index.js +3 -0
- package/dist/classes/svelte/audio/AudioLoader.svelte.d.ts +30 -0
- package/dist/classes/svelte/audio/AudioLoader.svelte.js +58 -0
- package/dist/classes/svelte/audio/AudioScene.svelte.d.ts +74 -0
- package/dist/classes/svelte/audio/AudioScene.svelte.js +324 -0
- package/dist/classes/svelte/audio/mocks.d.ts +7 -0
- package/dist/classes/svelte/audio/mocks.js +35 -0
- package/dist/classes/svelte/finite-state-machine/FiniteStateMachine.svelte.d.ts +50 -0
- package/dist/classes/svelte/finite-state-machine/FiniteStateMachine.svelte.js +133 -0
- package/dist/classes/svelte/finite-state-machine/index.d.ts +1 -0
- package/dist/classes/svelte/finite-state-machine/index.js +1 -0
- package/dist/classes/svelte/image/ImageLoader.svelte.d.ts +19 -0
- package/dist/classes/svelte/image/ImageLoader.svelte.js +45 -0
- package/dist/classes/svelte/image/ImageScene.svelte.d.ts +78 -0
- package/dist/classes/svelte/image/ImageScene.svelte.js +249 -0
- package/dist/classes/svelte/image/ImageVariantsLoader.svelte.d.ts +43 -0
- package/dist/classes/svelte/image/ImageVariantsLoader.svelte.js +152 -0
- package/dist/classes/svelte/image/index.d.ts +2 -0
- package/dist/classes/svelte/image/index.js +4 -0
- package/dist/classes/svelte/image/mocks.d.ts +7 -0
- package/dist/classes/svelte/image/mocks.js +35 -0
- package/dist/classes/svelte/image/typedef.d.ts +16 -0
- package/dist/classes/svelte/image/typedef.js +8 -0
- package/dist/classes/svelte/index.d.ts +9 -0
- package/dist/classes/svelte/index.js +14 -0
- package/dist/classes/svelte/loading-state-machine/LoadingStateMachine.svelte.d.ts +12 -0
- package/dist/classes/svelte/loading-state-machine/LoadingStateMachine.svelte.js +109 -0
- package/dist/classes/svelte/loading-state-machine/constants.d.ts +12 -0
- package/dist/classes/svelte/loading-state-machine/constants.js +16 -0
- package/dist/classes/svelte/loading-state-machine/index.d.ts +2 -0
- package/dist/classes/svelte/loading-state-machine/index.js +3 -0
- package/dist/classes/svelte/network-loader/NetworkLoader.svelte.d.ts +91 -0
- package/dist/classes/svelte/network-loader/NetworkLoader.svelte.js +338 -0
- package/dist/classes/svelte/network-loader/constants.d.ts +2 -0
- package/dist/classes/svelte/network-loader/constants.js +3 -0
- package/dist/classes/svelte/network-loader/index.d.ts +2 -0
- package/dist/classes/svelte/network-loader/index.js +3 -0
- package/dist/classes/svelte/network-loader/mocks.d.ts +7 -0
- package/dist/classes/svelte/network-loader/mocks.js +30 -0
- package/dist/classes/svelte/network-loader/typedef.d.ts +7 -0
- package/dist/classes/svelte/network-loader/typedef.js +8 -0
- package/dist/components/area/HkArea.svelte +49 -0
- package/dist/components/area/HkArea.svelte.d.ts +26 -0
- package/dist/components/area/HkGridArea.svelte +77 -0
- package/dist/components/area/HkGridArea.svelte.d.ts +42 -0
- package/dist/components/area/index.d.ts +2 -0
- package/dist/components/area/index.js +2 -0
- package/dist/components/buttons/button/Button.svelte +82 -0
- package/dist/components/buttons/button/Button.svelte.d.ts +44 -0
- package/dist/components/buttons/button-icon-steeze/SteezeIconButton.svelte +30 -0
- package/dist/components/buttons/button-icon-steeze/SteezeIconButton.svelte.d.ts +16 -0
- package/dist/components/buttons/button-text/TextButton.svelte +21 -0
- package/dist/components/buttons/button-text/TextButton.svelte.d.ts +12 -0
- package/dist/components/buttons/index.d.ts +3 -0
- package/dist/components/buttons/index.js +3 -0
- package/dist/components/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +146 -0
- package/dist/components/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +6 -0
- package/dist/components/debug/index.d.ts +1 -0
- package/dist/components/debug/index.js +1 -0
- package/dist/components/drag-drop/DragController.d.ts +20 -0
- package/dist/components/drag-drop/DragController.js +44 -0
- package/dist/components/drag-drop/DragDropContext.svelte +111 -0
- package/dist/components/drag-drop/DragDropContext.svelte.d.ts +18 -0
- package/dist/components/drag-drop/Draggable.svelte +519 -0
- package/dist/components/drag-drop/Draggable.svelte.d.ts +95 -0
- package/dist/components/drag-drop/DropZone.svelte +258 -0
- package/dist/components/drag-drop/DropZone.svelte.d.ts +96 -0
- package/dist/components/drag-drop/DropZoneArea.svelte +119 -0
- package/dist/components/drag-drop/DropZoneArea.svelte.d.ts +90 -0
- package/dist/components/drag-drop/DropZoneList.svelte +125 -0
- package/dist/components/drag-drop/DropZoneList.svelte.d.ts +92 -0
- package/dist/components/drag-drop/actions.d.ts +9 -0
- package/dist/components/drag-drop/actions.js +26 -0
- package/dist/components/drag-drop/drag-state.svelte.d.ts +97 -0
- package/dist/components/drag-drop/drag-state.svelte.js +322 -0
- package/dist/components/drag-drop/index.d.ts +6 -0
- package/dist/components/drag-drop/index.js +7 -0
- package/dist/components/drag-drop/util.d.ts +0 -0
- package/dist/components/drag-drop/util.js +85 -0
- package/dist/components/hkdev/blocks/TextBlock.svelte +47 -0
- package/dist/components/hkdev/blocks/TextBlock.svelte.d.ts +24 -0
- package/dist/components/hkdev/buttons/CheckButton.svelte +63 -0
- package/dist/components/hkdev/buttons/CheckButton.svelte.d.ts +34 -0
- package/dist/components/icons/HkIcon.svelte +86 -0
- package/dist/components/icons/HkIcon.svelte.d.ts +22 -0
- package/dist/components/icons/HkTabIcon.svelte +116 -0
- package/dist/components/icons/HkTabIcon.svelte.d.ts +40 -0
- package/dist/components/icons/SteezeIcon.svelte +97 -0
- package/dist/components/icons/SteezeIcon.svelte.d.ts +22 -0
- package/dist/components/icons/index.d.ts +4 -0
- package/dist/components/icons/index.js +6 -0
- package/dist/components/icons/typedef.d.ts +13 -0
- package/dist/components/icons/typedef.js +16 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +2 -0
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/index.js +1 -0
- package/dist/components/inputs/text-input/TestTextInput.svelte__ +102 -0
- package/dist/components/inputs/text-input/TextInput.svelte +223 -0
- package/dist/components/inputs/text-input/TextInput.svelte.d.ts +56 -0
- package/dist/components/inputs/text-input/TextInput.svelte___ +83 -0
- package/dist/components/inputs/text-input/assets/IconInvalid.svelte +14 -0
- package/dist/components/inputs/text-input/assets/IconInvalid.svelte.d.ts +26 -0
- package/dist/components/inputs/text-input/assets/IconValid.svelte +12 -0
- package/dist/components/inputs/text-input/assets/IconValid.svelte.d.ts +26 -0
- package/dist/components/layout/grid-layers/GridLayers.svelte +63 -0
- package/dist/components/layout/grid-layers/GridLayers.svelte.d.ts +26 -0
- package/dist/components/layout/grid-layers/GridLayers.svelte__heightFrom__ +372 -0
- package/dist/components/layout/grid-layers/util.d.ts +19 -0
- package/dist/components/layout/grid-layers/util.js +74 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/panels/index.d.ts +1 -0
- package/dist/components/panels/index.js +1 -0
- package/dist/components/panels/panel/Panel.svelte +43 -0
- package/dist/components/panels/panel/Panel.svelte.d.ts +24 -0
- package/dist/components/rows/index.d.ts +2 -0
- package/dist/components/rows/index.js +3 -0
- package/dist/components/rows/panel-grid-row/PanelGridRow.svelte +104 -0
- package/dist/components/rows/panel-grid-row/PanelGridRow.svelte.d.ts +26 -0
- package/dist/components/rows/panel-row-2/PanelRow2.svelte +40 -0
- package/dist/components/rows/panel-row-2/PanelRow2.svelte.d.ts +26 -0
- package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +54 -0
- package/dist/components/tab-bar/HkTabBar.state.svelte.js +149 -0
- package/dist/components/tab-bar/HkTabBar.svelte +74 -0
- package/dist/components/tab-bar/HkTabBar.svelte.d.ts +34 -0
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +19 -0
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.js +93 -0
- package/dist/components/tab-bar/HkTabBarSelector.svelte +49 -0
- package/dist/components/tab-bar/HkTabBarSelector.svelte.d.ts +36 -0
- package/dist/components/tab-bar/index.d.ts +5 -0
- package/dist/components/tab-bar/index.js +17 -0
- package/dist/components/tab-bar/typedef.d.ts +8 -0
- package/dist/components/tab-bar/typedef.js +11 -0
- package/dist/config/imagetools-config.d.ts +26 -0
- package/dist/config/imagetools-config.js +189 -0
- package/dist/config/imagetools.d.ts +72 -0
- package/dist/constants/bases.d.ts +10 -0
- package/dist/constants/bases.js +13 -0
- package/dist/constants/errors/api.d.ts +10 -0
- package/dist/constants/errors/api.js +9 -0
- package/dist/constants/errors/generic.d.ts +20 -0
- package/dist/constants/errors/generic.js +20 -0
- package/dist/constants/errors/http.d.ts +16 -0
- package/dist/constants/errors/http.js +16 -0
- package/dist/constants/errors/index.d.ts +4 -0
- package/dist/constants/errors/index.js +4 -0
- package/dist/constants/errors/jwt.d.ts +8 -0
- package/dist/constants/errors/jwt.js +5 -0
- package/dist/constants/http/headers.d.ts +5 -0
- package/dist/constants/http/headers.js +6 -0
- package/dist/constants/http/index.d.ts +2 -0
- package/dist/constants/http/index.js +2 -0
- package/dist/constants/http/methods.d.ts +7 -0
- package/dist/constants/http/methods.js +14 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/mime/application.d.ts +3 -0
- package/dist/constants/mime/application.js +5 -0
- package/dist/constants/mime/audio.d.ts +10 -0
- package/dist/constants/mime/audio.js +13 -0
- package/dist/constants/mime/image.d.ts +3 -0
- package/dist/constants/mime/image.js +3 -0
- package/dist/constants/mime/index.d.ts +4 -0
- package/dist/constants/mime/index.js +4 -0
- package/dist/constants/mime/text.d.ts +2 -0
- package/dist/constants/mime/text.js +2 -0
- package/dist/constants/regexp/index.d.ts +3 -0
- package/dist/constants/regexp/index.js +31 -0
- package/dist/constants/regexp/inspiratie.js__ +95 -0
- package/dist/constants/regexp/text.d.ts +47 -0
- package/dist/constants/regexp/text.js +49 -0
- package/dist/constants/regexp/user.d.ts +6 -0
- package/dist/constants/regexp/user.js +33 -0
- package/dist/constants/regexp/web.d.ts +1 -0
- package/dist/constants/regexp/web.js +3 -0
- package/dist/constants/state-labels/drag-states.d.ts +5 -0
- package/dist/constants/state-labels/drag-states.js +6 -0
- package/dist/constants/state-labels/drop-states.d.ts +4 -0
- package/dist/constants/state-labels/drop-states.js +6 -0
- package/dist/constants/state-labels/input-states.d.ts +8 -0
- package/dist/constants/state-labels/input-states.js +11 -0
- package/dist/constants/state-labels/submit-states.d.ts +4 -0
- package/dist/constants/state-labels/submit-states.js +4 -0
- package/dist/constants/time.d.ts +18 -0
- package/dist/constants/time.js +28 -0
- package/dist/css/utilities.css +43 -0
- package/dist/design/design-config.d.ts +157 -0
- package/dist/design/design-config.js +73 -0
- package/dist/design/tailwind-theme-extend.d.ts +23 -0
- package/dist/design/tailwind-theme-extend.js +158 -0
- package/dist/features/button-group/ButtonGroup.svelte +82 -0
- package/dist/features/button-group/ButtonGroup.svelte.d.ts +34 -0
- package/dist/features/button-group/typedef.d.ts +7 -0
- package/dist/features/button-group/typedef.js +10 -0
- package/dist/features/compare-left-right/CompareLeftRight.svelte +179 -0
- package/dist/features/compare-left-right/CompareLeftRight.svelte.d.ts +18 -0
- package/dist/features/compare-left-right/index.d.ts +1 -0
- package/dist/features/compare-left-right/index.js +1 -0
- package/dist/features/game-box/GameBox.svelte +577 -0
- package/dist/features/game-box/GameBox.svelte.d.ts +140 -0
- package/dist/features/game-box/gamebox.util.d.ts +32 -0
- package/dist/features/game-box/gamebox.util.js +83 -0
- package/dist/features/hk-app-layout/HkAppLayout.state.svelte.d.ts +6 -0
- package/dist/features/hk-app-layout/HkAppLayout.state.svelte.js +25 -0
- package/dist/features/hk-app-layout/HkAppLayout.svelte +251 -0
- package/dist/features/hk-app-layout/HkAppLayout.svelte.d.ts +19 -0
- package/dist/features/image-box/ImageBox.svelte +210 -0
- package/dist/features/image-box/ImageBox.svelte.d.ts +38 -0
- package/dist/features/image-box/index.d.ts +4 -0
- package/dist/features/image-box/index.js +5 -0
- package/dist/features/image-box/typedef.d.ts +4 -0
- package/dist/features/image-box/typedef.js +32 -0
- package/dist/features/index.d.ts +11 -0
- package/dist/features/index.js +23 -0
- package/dist/features/presenter/ImageSlide.svelte +64 -0
- package/dist/features/presenter/ImageSlide.svelte.d.ts +36 -0
- package/dist/features/presenter/Presenter.state.svelte.d.ts +74 -0
- package/dist/features/presenter/Presenter.state.svelte.js +638 -0
- package/dist/features/presenter/Presenter.svelte +142 -0
- package/dist/features/presenter/Presenter.svelte.d.ts +18 -0
- package/dist/features/presenter/constants.d.ts +5 -0
- package/dist/features/presenter/constants.js +7 -0
- package/dist/features/presenter/index.d.ts +6 -0
- package/dist/features/presenter/index.js +10 -0
- package/dist/features/presenter/typedef.d.ts +92 -0
- package/dist/features/presenter/typedef.js +106 -0
- package/dist/features/presenter/util.d.ts +63 -0
- package/dist/features/presenter/util.js +210 -0
- package/dist/features/virtual-viewport/VirtualViewport.svelte +196 -0
- package/dist/features/virtual-viewport/VirtualViewport.svelte.d.ts +42 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/logging/adapters/console.d.ts +48 -0
- package/dist/logging/adapters/console.js +114 -0
- package/dist/logging/adapters/pino.d.ts +25 -0
- package/dist/logging/adapters/pino.js +60 -0
- package/dist/logging/constants.d.ts +1 -0
- package/dist/logging/constants.js +1 -0
- package/dist/logging/factories/client.d.ts +10 -0
- package/dist/logging/factories/client.js +21 -0
- package/dist/logging/factories/server.d.ts +10 -0
- package/dist/logging/factories/server.js +22 -0
- package/dist/logging/factories/universal.d.ts +9 -0
- package/dist/logging/factories/universal.js +23 -0
- package/dist/logging/index.d.ts +5 -0
- package/dist/logging/index.js +8 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/validate-url.d.ts +30 -0
- package/dist/schemas/validate-url.js +180 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/logger.d.ts +25 -0
- package/dist/server/logger.js +94 -0
- package/dist/states/index.d.ts +1 -0
- package/dist/states/index.js +1 -0
- package/dist/states/navigation.svelte.d.ts +23 -0
- package/dist/states/navigation.svelte.js +55 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.js +1 -0
- package/dist/stores/theme.d.ts +28 -0
- package/dist/stores/theme.js +80 -0
- package/dist/themes/hkdev/components/blocks/text-block.css +34 -0
- package/dist/themes/hkdev/components/boxes/game-box.css +11 -0
- package/dist/themes/hkdev/components/buttons/button-icon-steeze.css +22 -0
- package/dist/themes/hkdev/components/buttons/button-text.css +32 -0
- package/dist/themes/hkdev/components/buttons/button.css +146 -0
- package/dist/themes/hkdev/components/buttons/skip-button.css +5 -0
- package/dist/themes/hkdev/components/drag-drop/draggable.css +73 -0
- package/dist/themes/hkdev/components/drag-drop/drop-zone.css +58 -0
- package/dist/themes/hkdev/components/icons/icon-steeze.css +16 -0
- package/dist/themes/hkdev/components/inputs/text-input.css +102 -0
- package/dist/themes/hkdev/components/panels/panel.css +25 -0
- package/dist/themes/hkdev/components/rows/panel-grid-row.css +4 -0
- package/dist/themes/hkdev/components/rows/panel-row-2.css +5 -0
- package/dist/themes/hkdev/components.css +29 -0
- package/dist/themes/hkdev/debug.css +2 -0
- package/dist/themes/hkdev/global/layout.css +32 -0
- package/dist/themes/hkdev/global/on-colors.css +32 -0
- package/dist/themes/hkdev/globals.css +4 -0
- package/dist/themes/hkdev/responsive.css +12 -0
- package/dist/themes/hkdev/theme-ext.d.ts +4 -0
- package/dist/themes/hkdev/theme-ext.js +12 -0
- package/dist/themes/hkdev/theme.css +219 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +1 -0
- package/dist/typedef/context.d.ts +3 -0
- package/dist/typedef/context.js +6 -0
- package/dist/typedef/drag.d.ts +29 -0
- package/dist/typedef/drag.js +25 -0
- package/dist/typedef/drop.d.ts +15 -0
- package/dist/typedef/drop.js +12 -0
- package/dist/typedef/image.d.ts +12 -0
- package/dist/typedef/image.js +38 -0
- package/dist/typedef/index.d.ts +4 -0
- package/dist/typedef/index.js +4 -0
- package/dist/util/array/index.d.ts +183 -0
- package/dist/util/array/index.js +436 -0
- package/dist/util/bases/base58.d.ts +58 -0
- package/dist/util/bases/base58.js +262 -0
- package/dist/util/bases/index.d.ts +1 -0
- package/dist/util/bases/index.js +1 -0
- package/dist/util/compare/index.d.ts +68 -0
- package/dist/util/compare/index.js +247 -0
- package/dist/util/css/css-vars.d.ts +24 -0
- package/dist/util/css/css-vars.js +83 -0
- package/dist/util/css/index.d.ts +1 -0
- package/dist/util/css/index.js +1 -0
- package/dist/util/design-system/components/states.d.ts +15 -0
- package/dist/util/design-system/components/states.js +22 -0
- package/dist/util/design-system/css/clamp.d.ts +17 -0
- package/dist/util/design-system/css/clamp.js +66 -0
- package/dist/util/design-system/css/root-design-vars.d.ts +77 -0
- package/dist/util/design-system/css/root-design-vars.js +102 -0
- package/dist/util/design-system/index.d.ts +5 -0
- package/dist/util/design-system/index.js +5 -0
- package/dist/util/design-system/layout/scaling.d.ts +98 -0
- package/dist/util/design-system/layout/scaling.js +228 -0
- package/dist/util/design-system/skeleton.d.ts +41 -0
- package/dist/util/design-system/skeleton.js +208 -0
- package/dist/util/design-system/tailwind.d.ts +183 -0
- package/dist/util/design-system/tailwind.js +288 -0
- package/dist/util/env/index.d.ts +1 -0
- package/dist/util/env/index.js +9 -0
- package/dist/util/exceptions/index.d.ts +15 -0
- package/dist/util/exceptions/index.js +23 -0
- package/dist/util/expect/arrays.d.ts +30 -0
- package/dist/util/expect/arrays.js +47 -0
- package/dist/util/expect/index.d.ts +103 -0
- package/dist/util/expect/index.js +259 -0
- package/dist/util/expect/primitives.d.ts +30 -0
- package/dist/util/expect/primitives.js +55 -0
- package/dist/util/expect/url.d.ts +32 -0
- package/dist/util/expect/url.js +60 -0
- package/dist/util/function/index.d.ts +34 -0
- package/dist/util/function/index.js +218 -0
- package/dist/util/geo/index.d.ts +10 -0
- package/dist/util/geo/index.js +26 -0
- package/dist/util/http/caching.d.ts +28 -0
- package/dist/util/http/caching.js +263 -0
- package/dist/util/http/errors.d.ts +18 -0
- package/dist/util/http/errors.js +97 -0
- package/dist/util/http/headers.d.ts +40 -0
- package/dist/util/http/headers.js +75 -0
- package/dist/util/http/http-request.d.ts +267 -0
- package/dist/util/http/http-request.js +578 -0
- package/dist/util/http/index.d.ts +6 -0
- package/dist/util/http/index.js +22 -0
- package/dist/util/http/json-request.d.ts +84 -0
- package/dist/util/http/json-request.js +224 -0
- package/dist/util/http/mocks.d.ts +20 -0
- package/dist/util/http/mocks.js +65 -0
- package/dist/util/http/response.d.ts +125 -0
- package/dist/util/http/response.js +294 -0
- package/dist/util/http/test-data__/content-length-test-hkdigital-small.V4HfZyBQ.avif +0 -0
- package/dist/util/http/typedef.d.ts +184 -0
- package/dist/util/http/typedef.js +93 -0
- package/dist/util/http/url.d.ts +25 -0
- package/dist/util/http/url.js +52 -0
- package/dist/util/image/index.d.ts +25 -0
- package/dist/util/image/index.js +86 -0
- package/dist/util/index.d.ts +3 -0
- package/dist/util/index.js +3 -0
- package/dist/util/is/index.d.ts +68 -0
- package/dist/util/is/index.js +140 -0
- package/dist/util/iterate/index.d.ts +131 -0
- package/dist/util/iterate/index.js +234 -0
- package/dist/util/object/index.d.ts +326 -0
- package/dist/util/object/index.js +1361 -0
- package/dist/util/singleton/index.d.ts +34 -0
- package/dist/util/singleton/index.js +97 -0
- package/dist/util/string/array-path.d.ts +15 -0
- package/dist/util/string/array-path.js +75 -0
- package/dist/util/string/convert.d.ts +22 -0
- package/dist/util/string/convert.js +54 -0
- package/dist/util/string/fs.d.ts +55 -0
- package/dist/util/string/fs.js +226 -0
- package/dist/util/string/index.d.ts +5 -0
- package/dist/util/string/index.js +5 -0
- package/dist/util/string/interpolate.d.ts +22 -0
- package/dist/util/string/interpolate.js +61 -0
- package/dist/util/string/pad.d.ts +8 -0
- package/dist/util/string/pad.js +10 -0
- package/dist/util/svelte/index.d.ts +3 -0
- package/dist/util/svelte/index.js +4 -0
- package/dist/util/svelte/loading/loading-tracker.svelte.d.ts +31 -0
- package/dist/util/svelte/loading/loading-tracker.svelte.js +108 -0
- package/dist/util/svelte/observe/index.d.ts +10 -0
- package/dist/util/svelte/observe/index.js +49 -0
- package/dist/util/svelte/state-context/index.d.ts +18 -0
- package/dist/util/svelte/state-context/index.js +117 -0
- package/dist/util/svelte/wait/index.d.ts +15 -0
- package/dist/util/svelte/wait/index.js +38 -0
- package/dist/util/sveltekit/index.d.ts +1 -0
- package/dist/util/sveltekit/index.js +1 -0
- package/dist/util/sveltekit/route-folders/index.d.ts +28 -0
- package/dist/util/sveltekit/route-folders/index.js +101 -0
- package/dist/util/time/index.d.ts +108 -0
- package/dist/util/time/index.js +323 -0
- package/dist/util/unique/index.d.ts +81 -0
- package/dist/util/unique/index.js +249 -0
- package/dist/valibot/date.js__ +10 -0
- package/dist/valibot/index.d.ts +4 -0
- package/dist/valibot/index.js +9 -0
- package/dist/valibot/url.d.ts +26 -0
- package/dist/valibot/url.js +95 -0
- package/dist/valibot/user.d.ts +6 -0
- package/dist/valibot/user.js +23 -0
- package/dist/zod/all.d.ts +6 -0
- package/dist/zod/all.js +33 -0
- package/dist/zod/generic.d.ts +6 -0
- package/dist/zod/generic.js +11 -0
- package/dist/zod/javascript.d.ts +8 -0
- package/dist/zod/javascript.js +32 -0
- package/dist/zod/user.d.ts +9 -0
- package/dist/zod/user.js +16 -0
- package/dist/zod/web.d.ts +21 -0
- package/dist/zod/web.js +52 -0
- package/package.json +133 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { DetailedError } from "../../constants/errors/generic.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new Error from the error message and throws it with a reference
|
|
6
|
+
* to the originating Error
|
|
7
|
+
* - The originating Error is set as `cause` property
|
|
8
|
+
*
|
|
9
|
+
* @param {string} message - Additional message to prepend
|
|
10
|
+
* @param {Error|string} error - Original error
|
|
11
|
+
* @param {string|Object.<string, any>} details
|
|
12
|
+
*
|
|
13
|
+
* @throws {DetailedError}
|
|
14
|
+
* @returns {never} This function never returns
|
|
15
|
+
*/
|
|
16
|
+
export function rethrow(message, error, details ) {
|
|
17
|
+
if (!(error instanceof Error)) {
|
|
18
|
+
// Convert non-Error values to Error objects
|
|
19
|
+
error = new Error(String(error));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
throw new DetailedError(message, details, error );
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws a validation error if value is not an array of strings
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value
|
|
5
|
+
*/
|
|
6
|
+
export function stringArray(value: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Throws a validation error if value is not an array of objects
|
|
9
|
+
*
|
|
10
|
+
* @param {any} value
|
|
11
|
+
*/
|
|
12
|
+
export function objectArray(value: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* Throws an exception if the value is not an Array or the array is empty
|
|
15
|
+
*/
|
|
16
|
+
export function notEmptyArray(value: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Throws a validation error if value is not array like
|
|
19
|
+
* - Checks if the value is an object and has a property `length`
|
|
20
|
+
*
|
|
21
|
+
* @param {any} value
|
|
22
|
+
*/
|
|
23
|
+
export function arrayLike(value: any): void;
|
|
24
|
+
export { array_ as array };
|
|
25
|
+
/**
|
|
26
|
+
* Throws a validation error if value is not an array
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value
|
|
29
|
+
*/
|
|
30
|
+
declare function array_(value: any): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Throws a validation error if value is not an array
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value
|
|
7
|
+
*/
|
|
8
|
+
function array_(value) {
|
|
9
|
+
v.parse(v.instance(Array), value);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { array_ as array };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Throws a validation error if value is not an array of strings
|
|
16
|
+
*
|
|
17
|
+
* @param {any} value
|
|
18
|
+
*/
|
|
19
|
+
export function stringArray(value) {
|
|
20
|
+
v.parse(v.array(v.string()), value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Throws a validation error if value is not an array of objects
|
|
25
|
+
*
|
|
26
|
+
* @param {any} value
|
|
27
|
+
*/
|
|
28
|
+
export function objectArray(value) {
|
|
29
|
+
v.parse(v.array(v.looseObject({})), value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Throws an exception if the value is not an Array or the array is empty
|
|
34
|
+
*/
|
|
35
|
+
export function notEmptyArray(value) {
|
|
36
|
+
v.parse(v.pipe(v.instance(Array), v.nonEmpty()), value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Throws a validation error if value is not array like
|
|
41
|
+
* - Checks if the value is an object and has a property `length`
|
|
42
|
+
*
|
|
43
|
+
* @param {any} value
|
|
44
|
+
*/
|
|
45
|
+
export function arrayLike(value) {
|
|
46
|
+
v.parse(v.object({ length: v.number() }), value);
|
|
47
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws a validation error if value is not an Error instance
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value
|
|
5
|
+
*/
|
|
6
|
+
export function error_(value: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Expect a value not to be null
|
|
9
|
+
*
|
|
10
|
+
* @param {any} value
|
|
11
|
+
*/
|
|
12
|
+
export function notNull(value: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* Expect a value to be a boolean and true
|
|
15
|
+
*
|
|
16
|
+
* @param {any} value
|
|
17
|
+
*/
|
|
18
|
+
export function _true(value: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* Expect a positive number
|
|
21
|
+
*
|
|
22
|
+
* @param {any} value
|
|
23
|
+
*/
|
|
24
|
+
export function positiveNumber(value: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Throws a validation error if value is not a string
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value
|
|
29
|
+
*/
|
|
30
|
+
export function notEmptyString(value: any): void;
|
|
31
|
+
/**
|
|
32
|
+
* Throws a validation error if value is not iterable
|
|
33
|
+
*
|
|
34
|
+
* @param {any} value
|
|
35
|
+
*/
|
|
36
|
+
export function iterable(value: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Throws a validation error if value is not a a store (has not subscribe
|
|
39
|
+
* method)
|
|
40
|
+
*
|
|
41
|
+
* @param {any} value
|
|
42
|
+
*/
|
|
43
|
+
export function store(value: any): void;
|
|
44
|
+
/**
|
|
45
|
+
* Throws a validation error if value is not an object or the value
|
|
46
|
+
* is an array
|
|
47
|
+
*
|
|
48
|
+
* @param {any} value
|
|
49
|
+
*/
|
|
50
|
+
export function objectNoArray(value: any): void;
|
|
51
|
+
/**
|
|
52
|
+
* Throws a validation error if value is not an object or the value
|
|
53
|
+
* is a function
|
|
54
|
+
*
|
|
55
|
+
* @param {any} value
|
|
56
|
+
*/
|
|
57
|
+
export function objectNoFunction(value: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Throws a validation error if value is not an object or null
|
|
60
|
+
*
|
|
61
|
+
* @param {any} value
|
|
62
|
+
*/
|
|
63
|
+
export function objectOrNull(value: any): void;
|
|
64
|
+
/**
|
|
65
|
+
* Throws a validation error if value is not an array or Set
|
|
66
|
+
*
|
|
67
|
+
* @param {any} value
|
|
68
|
+
*/
|
|
69
|
+
export function arrayOrSet(value: any): void;
|
|
70
|
+
export * from "./arrays.js";
|
|
71
|
+
export * from "./primitives.js";
|
|
72
|
+
export * from "./url.js";
|
|
73
|
+
/**
|
|
74
|
+
* Throws a validation error if value is not an object
|
|
75
|
+
*
|
|
76
|
+
* @param {any} value
|
|
77
|
+
*/
|
|
78
|
+
declare function object_(value: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* Throws a validation error if value is not a function
|
|
81
|
+
*
|
|
82
|
+
* @param {any} value
|
|
83
|
+
*/
|
|
84
|
+
declare function function_(value: any): void;
|
|
85
|
+
/**
|
|
86
|
+
* Throws a validation error if value is not a Promise
|
|
87
|
+
*
|
|
88
|
+
* @param {any} value
|
|
89
|
+
*/
|
|
90
|
+
declare function promise_(value: any): void;
|
|
91
|
+
/**
|
|
92
|
+
* Throws a validation error if value is not a Map
|
|
93
|
+
*
|
|
94
|
+
* @param {any} value
|
|
95
|
+
*/
|
|
96
|
+
declare function map_(value: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* Throws a validation error if value is not a Set
|
|
99
|
+
*
|
|
100
|
+
* @param {any} value
|
|
101
|
+
*/
|
|
102
|
+
declare function set_(value: any): void;
|
|
103
|
+
export { object_ as object, function_ as function, _function as function, function_ as class, _class as class, promise_ as promise, map_ as map, set_ as set, error_ as error, _true as true, _true as true };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation functions that can be used as safe guards in your code
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* import * as expect from '<path>/expect.js';
|
|
7
|
+
*
|
|
8
|
+
* function logText( text )
|
|
9
|
+
* {
|
|
10
|
+
* expect.string( text );
|
|
11
|
+
* expect.true( 1 > 0 );
|
|
12
|
+
*
|
|
13
|
+
* console.log( text );
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* logText( 'Hello' );
|
|
17
|
+
* logText( 123 ); // <- Will throw an exception
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import * as v from 'valibot';
|
|
21
|
+
|
|
22
|
+
import { isObject } from '../is/index.js';
|
|
23
|
+
|
|
24
|
+
/** Internals */
|
|
25
|
+
|
|
26
|
+
const ObjectSchema = v.custom(isObject, `Invalid type: Expected object`);
|
|
27
|
+
|
|
28
|
+
/** Exports */
|
|
29
|
+
|
|
30
|
+
export * from './arrays.js';
|
|
31
|
+
export * from './primitives.js';
|
|
32
|
+
export * from './url.js';
|
|
33
|
+
|
|
34
|
+
// > Base objects
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Throws a validation error if value is not an object
|
|
38
|
+
*
|
|
39
|
+
* @param {any} value
|
|
40
|
+
*/
|
|
41
|
+
function object_(value) {
|
|
42
|
+
v.parse(ObjectSchema, value);
|
|
43
|
+
// v.parse(v.looseObject({}), value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { object_ as object };
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Throws a validation error if value is not a function
|
|
50
|
+
*
|
|
51
|
+
* @param {any} value
|
|
52
|
+
*/
|
|
53
|
+
function function_(value) {
|
|
54
|
+
v.parse(v.function(), value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { function_ as function };
|
|
58
|
+
|
|
59
|
+
export { function_ as class };
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Throws a validation error if value is not a Promise
|
|
63
|
+
*
|
|
64
|
+
* @param {any} value
|
|
65
|
+
*/
|
|
66
|
+
function promise_(value) {
|
|
67
|
+
v.parse(v.instance(Promise), value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { promise_ as promise };
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Throws a validation error if value is not a Map
|
|
74
|
+
*
|
|
75
|
+
* @param {any} value
|
|
76
|
+
*/
|
|
77
|
+
function map_(value) {
|
|
78
|
+
v.parse(v.instance(Map), value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { map_ as map };
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Throws a validation error if value is not a Set
|
|
85
|
+
*
|
|
86
|
+
* @param {any} value
|
|
87
|
+
*/
|
|
88
|
+
function set_(value) {
|
|
89
|
+
v.parse(v.instance(Set), value);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { set_ as set };
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Throws a validation error if value is not an Error instance
|
|
96
|
+
*
|
|
97
|
+
* @param {any} value
|
|
98
|
+
*/
|
|
99
|
+
export function error_(value) {
|
|
100
|
+
v.parse(v.instance(Map), value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { error_ as error };
|
|
104
|
+
|
|
105
|
+
// > Common values
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Expect a value not to be null
|
|
109
|
+
*
|
|
110
|
+
* @param {any} value
|
|
111
|
+
*/
|
|
112
|
+
export function notNull(value) {
|
|
113
|
+
v.notValue(null, value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Expect a value to be a boolean and true
|
|
118
|
+
*
|
|
119
|
+
* @param {any} value
|
|
120
|
+
*/
|
|
121
|
+
export function _true(value) {
|
|
122
|
+
v.value(true, value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { _true as true };
|
|
126
|
+
|
|
127
|
+
// > Compounds
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Expect a positive number
|
|
131
|
+
*
|
|
132
|
+
* @param {any} value
|
|
133
|
+
*/
|
|
134
|
+
export function positiveNumber(value) {
|
|
135
|
+
const schema = v.pipe(v.number(), v.minValue(0));
|
|
136
|
+
v.parse(schema, value);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// notNegativeNumber
|
|
140
|
+
// positiveInteger
|
|
141
|
+
// notNegativeInteger
|
|
142
|
+
|
|
143
|
+
// stringOrNull
|
|
144
|
+
// stringOrUndefined
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Throws a validation error if value is not a string
|
|
148
|
+
*
|
|
149
|
+
* @param {any} value
|
|
150
|
+
*/
|
|
151
|
+
export function notEmptyString(value) {
|
|
152
|
+
const schema = v.pipe(v.string(), v.minLength(1));
|
|
153
|
+
|
|
154
|
+
v.parse(schema, value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// notEmptyStringOrNull
|
|
158
|
+
|
|
159
|
+
// asyncIterator
|
|
160
|
+
// iterable
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Throws a validation error if value is not iterable
|
|
164
|
+
*
|
|
165
|
+
* @param {any} value
|
|
166
|
+
*/
|
|
167
|
+
export function iterable(value) {
|
|
168
|
+
const schema = v.pipe(v.looseObject({ [Symbol.iterator]: v.function() }));
|
|
169
|
+
|
|
170
|
+
v.parse(schema, value);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// iterator
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Throws a validation error if value is not a a store (has not subscribe
|
|
177
|
+
* method)
|
|
178
|
+
*
|
|
179
|
+
* @param {any} value
|
|
180
|
+
*/
|
|
181
|
+
export function store(value) {
|
|
182
|
+
v.parse(
|
|
183
|
+
v.custom((value) => {
|
|
184
|
+
if (!isObject(value) || typeof value.subscribe !== 'function') {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return true;
|
|
189
|
+
}),
|
|
190
|
+
value
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ArrayBuffer
|
|
195
|
+
// arrayOrUndefined
|
|
196
|
+
// arangoCollectionId
|
|
197
|
+
// uriComponent
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Throws a validation error if value is not an object or the value
|
|
201
|
+
* is an array
|
|
202
|
+
*
|
|
203
|
+
* @param {any} value
|
|
204
|
+
*/
|
|
205
|
+
export function objectNoArray(value) {
|
|
206
|
+
v.parse(
|
|
207
|
+
v.custom((value) => {
|
|
208
|
+
if (!isObject(value) || value instanceof Array) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return true;
|
|
213
|
+
}),
|
|
214
|
+
value
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Throws a validation error if value is not an object or the value
|
|
220
|
+
* is a function
|
|
221
|
+
*
|
|
222
|
+
* @param {any} value
|
|
223
|
+
*/
|
|
224
|
+
export function objectNoFunction(value) {
|
|
225
|
+
v.parse(
|
|
226
|
+
v.custom((value) => {
|
|
227
|
+
if (!isObject(value) || typeof value === 'function') {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return true;
|
|
232
|
+
}),
|
|
233
|
+
value
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Throws a validation error if value is not an object or null
|
|
239
|
+
*
|
|
240
|
+
* @param {any} value
|
|
241
|
+
*/
|
|
242
|
+
export function objectOrNull(value) {
|
|
243
|
+
v.parse(v.union([v.value(null), v.looseObject({})]), value);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// objectOrUndefined
|
|
247
|
+
// objectPath
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Throws a validation error if value is not an array or Set
|
|
251
|
+
*
|
|
252
|
+
* @param {any} value
|
|
253
|
+
*/
|
|
254
|
+
export function arrayOrSet(value) {
|
|
255
|
+
v.parse(v.union([v.instance(Array), v.instance(Set)]), value);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// setOfStrings
|
|
259
|
+
// emptyStringOrSymbol
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws a validation error if value is not a string
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value
|
|
5
|
+
*/
|
|
6
|
+
export function string(value: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Throws a validation error if value is not a boolean
|
|
9
|
+
*
|
|
10
|
+
* @param {any} value
|
|
11
|
+
*/
|
|
12
|
+
export function boolean(value: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* Throws a validation error if value is not a number
|
|
15
|
+
*
|
|
16
|
+
* @param {any} value
|
|
17
|
+
*/
|
|
18
|
+
export function number(value: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* Throws a validation error if value is not a Symbol
|
|
21
|
+
*
|
|
22
|
+
* @param {any} value
|
|
23
|
+
*/
|
|
24
|
+
export function symbol(value: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Throws a validation error if value is not defined
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value
|
|
29
|
+
*/
|
|
30
|
+
export function defined(value: any): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Throws a validation error if value is not a string
|
|
5
|
+
*
|
|
6
|
+
* @param {any} value
|
|
7
|
+
*/
|
|
8
|
+
export function string(value) {
|
|
9
|
+
v.parse(v.string(), value);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Throws a validation error if value is not a boolean
|
|
14
|
+
*
|
|
15
|
+
* @param {any} value
|
|
16
|
+
*/
|
|
17
|
+
export function boolean(value) {
|
|
18
|
+
v.parse(v.boolean(), value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Throws a validation error if value is not a number
|
|
23
|
+
*
|
|
24
|
+
* @param {any} value
|
|
25
|
+
*/
|
|
26
|
+
export function number(value) {
|
|
27
|
+
v.parse(v.number(), value);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Throws a validation error if value is not a Symbol
|
|
32
|
+
*
|
|
33
|
+
* @param {any} value
|
|
34
|
+
*/
|
|
35
|
+
export function symbol(value) {
|
|
36
|
+
v.parse(v.symbol(), value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Throws a validation error if value is not defined
|
|
41
|
+
*
|
|
42
|
+
* @param {any} value
|
|
43
|
+
*/
|
|
44
|
+
export function defined(value) {
|
|
45
|
+
v.parse(
|
|
46
|
+
v.custom((value) => {
|
|
47
|
+
if (value === undefined) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return true;
|
|
52
|
+
}, 'Invalid type: Expected any value, but received undefined'),
|
|
53
|
+
value
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws a validation error if value is not an url
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value
|
|
5
|
+
*/
|
|
6
|
+
export function url(value: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Throws a validation error if value is not an url or
|
|
9
|
+
* an empty string
|
|
10
|
+
*
|
|
11
|
+
* @param {any} value
|
|
12
|
+
*/
|
|
13
|
+
export function urlOrEmptyString(value: any): void;
|
|
14
|
+
/**
|
|
15
|
+
* Throws a validation error if value is not a relative url
|
|
16
|
+
*
|
|
17
|
+
* @param {any} value
|
|
18
|
+
*/
|
|
19
|
+
export function urlPath(value: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* Throws a validation error if value is not a relative url
|
|
22
|
+
*
|
|
23
|
+
* @param {any} value
|
|
24
|
+
*/
|
|
25
|
+
export function relativeUrl(value: any): void;
|
|
26
|
+
/**
|
|
27
|
+
* Throws a validation error if value is not an absolute
|
|
28
|
+
* or relative url
|
|
29
|
+
*
|
|
30
|
+
* @param {any} value
|
|
31
|
+
*/
|
|
32
|
+
export function absOrRelUrl(value: any): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// > Imports
|
|
2
|
+
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
ValidateUrl,
|
|
7
|
+
ValidateUrlOrEmptyString,
|
|
8
|
+
ValidateUrlPath,
|
|
9
|
+
ValidateRelativeUrl,
|
|
10
|
+
ValidateAbsOrRelUrl
|
|
11
|
+
} from '../../schemas/validate-url.js';
|
|
12
|
+
|
|
13
|
+
// > Exports
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Throws a validation error if value is not an url
|
|
17
|
+
*
|
|
18
|
+
* @param {any} value
|
|
19
|
+
*/
|
|
20
|
+
export function url(value) {
|
|
21
|
+
v.parse(ValidateUrl, value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Throws a validation error if value is not an url or
|
|
26
|
+
* an empty string
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value
|
|
29
|
+
*/
|
|
30
|
+
export function urlOrEmptyString(value) {
|
|
31
|
+
v.parse(ValidateUrlOrEmptyString, value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Throws a validation error if value is not a relative url
|
|
36
|
+
*
|
|
37
|
+
* @param {any} value
|
|
38
|
+
*/
|
|
39
|
+
export function urlPath(value) {
|
|
40
|
+
v.parse(ValidateUrlPath, value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Throws a validation error if value is not a relative url
|
|
45
|
+
*
|
|
46
|
+
* @param {any} value
|
|
47
|
+
*/
|
|
48
|
+
export function relativeUrl(value) {
|
|
49
|
+
v.parse(ValidateRelativeUrl, value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Throws a validation error if value is not an absolute
|
|
54
|
+
* or relative url
|
|
55
|
+
*
|
|
56
|
+
* @param {any} value
|
|
57
|
+
*/
|
|
58
|
+
export function absOrRelUrl(value) {
|
|
59
|
+
v.parse(ValidateAbsOrRelUrl, value);
|
|
60
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps a function so that the callback function will be called only once
|
|
3
|
+
*
|
|
4
|
+
* @param {function} callback
|
|
5
|
+
*
|
|
6
|
+
* @returns {function} callback wrapped in `once` function
|
|
7
|
+
*/
|
|
8
|
+
export function once(callback: Function): Function;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a debounced function
|
|
11
|
+
* - The original function is not called more than once during the
|
|
12
|
+
* specified interval
|
|
13
|
+
*
|
|
14
|
+
* @param {function} fn
|
|
15
|
+
* @param {number} [intervalMs=200]
|
|
16
|
+
*
|
|
17
|
+
* @returns {function} debounced function
|
|
18
|
+
*/
|
|
19
|
+
export function debounce(fn: Function, intervalMs?: number): Function;
|
|
20
|
+
export function noop(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Defer the execution of a function
|
|
23
|
+
* - Uses the best 'setImmediate' implementation supported by the current
|
|
24
|
+
* runtime environment
|
|
25
|
+
*
|
|
26
|
+
* @param {function} fn - Function to execute
|
|
27
|
+
*
|
|
28
|
+
* --
|
|
29
|
+
*
|
|
30
|
+
* @note setImmediate is preferred over nextTick
|
|
31
|
+
*
|
|
32
|
+
* @see https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/
|
|
33
|
+
*/
|
|
34
|
+
export const defer: any;
|