@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,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview In-memory implementation of response cache.
|
|
3
|
+
*
|
|
4
|
+
* This implementation provides a simple in-memory cache for HTTP responses
|
|
5
|
+
* with the same API as IndexedDbCache. It's useful for tests and environments
|
|
6
|
+
* where persistent storage isn't needed or available.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Create a memory cache
|
|
10
|
+
* const cache = new MemoryResponseCache();
|
|
11
|
+
*
|
|
12
|
+
* // Store a response
|
|
13
|
+
* const response = await fetch('https://example.com/api/data');
|
|
14
|
+
* await cache.set('api-data', response, { expiresIn: 3600000 });
|
|
15
|
+
*
|
|
16
|
+
* // Retrieve a cached response
|
|
17
|
+
* const cached = await cache.get('api-data');
|
|
18
|
+
* if (cached) {
|
|
19
|
+
* console.log(cached.response);
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {Object} CacheEntry
|
|
24
|
+
* @property {Response} response - Cached Response object
|
|
25
|
+
* @property {Object} metadata - Cache entry metadata
|
|
26
|
+
* @property {string} url - Original URL
|
|
27
|
+
* @property {number} timestamp - When the entry was cached
|
|
28
|
+
* @property {number|null} expires - Expiration timestamp (null if no expiration)
|
|
29
|
+
* @property {string|null} etag - ETag header if present
|
|
30
|
+
* @property {string|null} lastModified - Last-Modified header if present
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* In-memory response cache implementation
|
|
34
|
+
*/
|
|
35
|
+
export default class MemoryResponseCache {
|
|
36
|
+
/**
|
|
37
|
+
* Internal cache storage using Map
|
|
38
|
+
* @type {Map<string, Object>}
|
|
39
|
+
*/
|
|
40
|
+
cache: Map<string, any>;
|
|
41
|
+
/**
|
|
42
|
+
* Get a cached response
|
|
43
|
+
*
|
|
44
|
+
* @param {string} key - Cache key
|
|
45
|
+
* @returns {Promise<CacheEntry|null>} Cache entry or null if not found/expired
|
|
46
|
+
*/
|
|
47
|
+
get(key: string): Promise<CacheEntry | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Store a response in the cache
|
|
50
|
+
*
|
|
51
|
+
* @param {string} key - Cache key
|
|
52
|
+
* @param {Response} response - Response to cache
|
|
53
|
+
* @param {Object} [metadata={}] - Cache metadata
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
set(key: string, response: Response, metadata?: any): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a cached entry
|
|
59
|
+
*
|
|
60
|
+
* @param {string} key - Cache key
|
|
61
|
+
* @returns {Promise<boolean>} True if entry was deleted
|
|
62
|
+
*/
|
|
63
|
+
delete(key: string): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Clear all cached responses
|
|
66
|
+
*
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
clear(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Close the cache (no-op for memory cache, for API compatibility)
|
|
72
|
+
*
|
|
73
|
+
* @returns {Promise<void>}
|
|
74
|
+
*/
|
|
75
|
+
close(): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
export type CacheEntry = {
|
|
78
|
+
/**
|
|
79
|
+
* - Cached Response object
|
|
80
|
+
*/
|
|
81
|
+
response: Response;
|
|
82
|
+
/**
|
|
83
|
+
* - Cache entry metadata
|
|
84
|
+
*/
|
|
85
|
+
metadata: any;
|
|
86
|
+
/**
|
|
87
|
+
* - Original URL
|
|
88
|
+
*/
|
|
89
|
+
url: string;
|
|
90
|
+
/**
|
|
91
|
+
* - When the entry was cached
|
|
92
|
+
*/
|
|
93
|
+
timestamp: number;
|
|
94
|
+
/**
|
|
95
|
+
* - Expiration timestamp (null if no expiration)
|
|
96
|
+
*/
|
|
97
|
+
expires: number | null;
|
|
98
|
+
/**
|
|
99
|
+
* - ETag header if present
|
|
100
|
+
*/
|
|
101
|
+
etag: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* - Last-Modified header if present
|
|
104
|
+
*/
|
|
105
|
+
lastModified: string | null;
|
|
106
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview In-memory implementation of response cache.
|
|
3
|
+
*
|
|
4
|
+
* This implementation provides a simple in-memory cache for HTTP responses
|
|
5
|
+
* with the same API as IndexedDbCache. It's useful for tests and environments
|
|
6
|
+
* where persistent storage isn't needed or available.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Create a memory cache
|
|
10
|
+
* const cache = new MemoryResponseCache();
|
|
11
|
+
*
|
|
12
|
+
* // Store a response
|
|
13
|
+
* const response = await fetch('https://example.com/api/data');
|
|
14
|
+
* await cache.set('api-data', response, { expiresIn: 3600000 });
|
|
15
|
+
*
|
|
16
|
+
* // Retrieve a cached response
|
|
17
|
+
* const cached = await cache.get('api-data');
|
|
18
|
+
* if (cached) {
|
|
19
|
+
* console.log(cached.response);
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} CacheEntry
|
|
25
|
+
* @property {Response} response - Cached Response object
|
|
26
|
+
* @property {Object} metadata - Cache entry metadata
|
|
27
|
+
* @property {string} url - Original URL
|
|
28
|
+
* @property {number} timestamp - When the entry was cached
|
|
29
|
+
* @property {number|null} expires - Expiration timestamp (null if no expiration)
|
|
30
|
+
* @property {string|null} etag - ETag header if present
|
|
31
|
+
* @property {string|null} lastModified - Last-Modified header if present
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* In-memory response cache implementation
|
|
36
|
+
*/
|
|
37
|
+
export default class MemoryResponseCache {
|
|
38
|
+
/**
|
|
39
|
+
* Create a new in-memory cache
|
|
40
|
+
*/
|
|
41
|
+
constructor() {
|
|
42
|
+
/**
|
|
43
|
+
* Internal cache storage using Map
|
|
44
|
+
* @type {Map<string, Object>}
|
|
45
|
+
*/
|
|
46
|
+
this.cache = new Map();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get a cached response
|
|
51
|
+
*
|
|
52
|
+
* @param {string} key - Cache key
|
|
53
|
+
* @returns {Promise<CacheEntry|null>} Cache entry or null if not found/expired
|
|
54
|
+
*/
|
|
55
|
+
async get(key) {
|
|
56
|
+
const entry = this.cache.get(key);
|
|
57
|
+
|
|
58
|
+
if (!entry) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Check if expired
|
|
63
|
+
if (entry.expires && Date.now() > entry.expires) {
|
|
64
|
+
this.delete(key);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Update last accessed time
|
|
69
|
+
entry.lastAccessed = Date.now();
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
response: entry.response.clone(),
|
|
73
|
+
metadata: entry.metadata,
|
|
74
|
+
url: entry.url,
|
|
75
|
+
timestamp: entry.timestamp,
|
|
76
|
+
expires: entry.expires,
|
|
77
|
+
etag: entry.etag,
|
|
78
|
+
lastModified: entry.lastModified
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Store a response in the cache
|
|
84
|
+
*
|
|
85
|
+
* @param {string} key - Cache key
|
|
86
|
+
* @param {Response} response - Response to cache
|
|
87
|
+
* @param {Object} [metadata={}] - Cache metadata
|
|
88
|
+
* @returns {Promise<void>}
|
|
89
|
+
*/
|
|
90
|
+
async set(key, response, metadata = {}) {
|
|
91
|
+
const now = Date.now();
|
|
92
|
+
|
|
93
|
+
// Calculate expiration time if expiresIn is provided
|
|
94
|
+
let expires = metadata.expires || null;
|
|
95
|
+
if (!expires && metadata.expiresIn) {
|
|
96
|
+
expires = now + metadata.expiresIn;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.cache.set(key, {
|
|
100
|
+
response: response.clone(),
|
|
101
|
+
metadata,
|
|
102
|
+
url: response.url,
|
|
103
|
+
timestamp: now,
|
|
104
|
+
lastAccessed: now,
|
|
105
|
+
expires,
|
|
106
|
+
etag: response.headers.get('ETag'),
|
|
107
|
+
lastModified: response.headers.get('Last-Modified')
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Delete a cached entry
|
|
113
|
+
*
|
|
114
|
+
* @param {string} key - Cache key
|
|
115
|
+
* @returns {Promise<boolean>} True if entry was deleted
|
|
116
|
+
*/
|
|
117
|
+
async delete(key) {
|
|
118
|
+
return this.cache.delete(key);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Clear all cached responses
|
|
123
|
+
*
|
|
124
|
+
* @returns {Promise<void>}
|
|
125
|
+
*/
|
|
126
|
+
async clear() {
|
|
127
|
+
this.cache.clear();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Close the cache (no-op for memory cache, for API compatibility)
|
|
132
|
+
*
|
|
133
|
+
* @returns {Promise<void>}
|
|
134
|
+
*/
|
|
135
|
+
async close() {
|
|
136
|
+
// No-op for memory cache
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type CacheEntry = {
|
|
4
|
+
/**
|
|
5
|
+
* - Cached Response object
|
|
6
|
+
*/
|
|
7
|
+
response: Response;
|
|
8
|
+
/**
|
|
9
|
+
* - Cache entry metadata
|
|
10
|
+
*/
|
|
11
|
+
metadata: any;
|
|
12
|
+
/**
|
|
13
|
+
* - Original URL
|
|
14
|
+
*/
|
|
15
|
+
url: string;
|
|
16
|
+
/**
|
|
17
|
+
* - When the entry was cached
|
|
18
|
+
*/
|
|
19
|
+
timestamp: number;
|
|
20
|
+
/**
|
|
21
|
+
* - Expiration timestamp (null if no expiration)
|
|
22
|
+
*/
|
|
23
|
+
expires: number | null;
|
|
24
|
+
/**
|
|
25
|
+
* - ETag header if present
|
|
26
|
+
*/
|
|
27
|
+
etag: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* - Last-Modified header if present
|
|
30
|
+
*/
|
|
31
|
+
lastModified: string | null;
|
|
32
|
+
cacheVersion: string | null;
|
|
33
|
+
};
|
|
34
|
+
export type CacheStorage = {
|
|
35
|
+
/**
|
|
36
|
+
* Get a cached response for a key
|
|
37
|
+
*/
|
|
38
|
+
get: (arg0: string) => Promise<CacheEntry | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Store a response in the cache
|
|
41
|
+
*/
|
|
42
|
+
set: (arg0: string, arg1: Response, arg2: any) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Remove a cached response
|
|
45
|
+
*/
|
|
46
|
+
delete: (arg0: string) => Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Clear all cached responses
|
|
49
|
+
*/
|
|
50
|
+
clear: () => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
export type IDBRequestEvent = {
|
|
53
|
+
/**
|
|
54
|
+
* - The request that generated the event
|
|
55
|
+
*/
|
|
56
|
+
target: IDBRequest;
|
|
57
|
+
};
|
|
58
|
+
export type IDBVersionChangeEvent = {
|
|
59
|
+
/**
|
|
60
|
+
* - The request that generated the event
|
|
61
|
+
*/
|
|
62
|
+
target: IDBOpenDBRequest;
|
|
63
|
+
/**
|
|
64
|
+
* - The transaction for database upgrade
|
|
65
|
+
*/
|
|
66
|
+
transaction?: IDBTransaction;
|
|
67
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} CacheEntry
|
|
4
|
+
* @property {Response} response - Cached Response object
|
|
5
|
+
* @property {Object} metadata - Cache entry metadata
|
|
6
|
+
* @property {string} url - Original URL
|
|
7
|
+
* @property {number} timestamp - When the entry was cached
|
|
8
|
+
* @property {number|null} expires - Expiration timestamp (null if no expiration)
|
|
9
|
+
* @property {string|null} etag - ETag header if present
|
|
10
|
+
* @property {string|null} lastModified - Last-Modified header if present
|
|
11
|
+
* @property {string|null} cacheVersion
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} CacheStorage
|
|
16
|
+
* @property {function(string): Promise<CacheEntry|null>} get
|
|
17
|
+
* Get a cached response for a key
|
|
18
|
+
* @property {function(string, Response, Object): Promise<void>} set
|
|
19
|
+
* Store a response in the cache
|
|
20
|
+
* @property {function(string): Promise<boolean>} delete
|
|
21
|
+
* Remove a cached response
|
|
22
|
+
* @property {function(): Promise<void>} clear
|
|
23
|
+
* Clear all cached responses
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// > IndexedDB
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {Object} IDBRequestEvent
|
|
30
|
+
* @property {IDBRequest} target - The request that generated the event
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {Object} IDBVersionChangeEvent
|
|
35
|
+
* @property {IDBOpenDBRequest} target - The request that generated the event
|
|
36
|
+
* @property {IDBTransaction} [target.transaction] - The transaction for database upgrade
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// > Export default
|
|
40
|
+
|
|
41
|
+
export default {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} Options
|
|
3
|
+
* @property {boolean} walkArrays
|
|
4
|
+
* @property {boolean} ignoreEmptyObjectLeaves
|
|
5
|
+
* @property {boolean} expandPathKeys
|
|
6
|
+
* @property {boolean} outputIntermediateNodes
|
|
7
|
+
*/
|
|
8
|
+
export default class IterableTree {
|
|
9
|
+
/**
|
|
10
|
+
* Construct an object that can be used to iterate paths and values in
|
|
11
|
+
* an object.
|
|
12
|
+
* - Returns path-value pairs for all leaves of the object (tree)
|
|
13
|
+
* - Iterates "own properties" only (not inherited properties)
|
|
14
|
+
*
|
|
15
|
+
* @param {object} obj - Object to iterate
|
|
16
|
+
* @param {Options} [options]
|
|
17
|
+
* @param {string[]} [_parentArrPath]
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @return {Iterator} iterable object
|
|
21
|
+
*/
|
|
22
|
+
constructor(obj: object, options?: Options, _parentArrPath?: string[]);
|
|
23
|
+
obj: any;
|
|
24
|
+
_parentArrPath: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Get an iterator to iterate over all object [ path, value ] entries
|
|
27
|
+
*
|
|
28
|
+
* @returns {Iterator} object entries iterator
|
|
29
|
+
*/
|
|
30
|
+
entries(): Iterator<any, any, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Get an iterator to iterate over all object paths
|
|
33
|
+
*
|
|
34
|
+
* @returns {Iterator} object path iterator
|
|
35
|
+
*/
|
|
36
|
+
paths(): Iterator<any, any, any>;
|
|
37
|
+
/**
|
|
38
|
+
* Get an iterator to iterate over all values at the leaves of the paths in
|
|
39
|
+
* the object
|
|
40
|
+
*
|
|
41
|
+
* @returns {Iterator} object value iterator
|
|
42
|
+
*/
|
|
43
|
+
values(): Iterator<any, any, any>;
|
|
44
|
+
#private;
|
|
45
|
+
}
|
|
46
|
+
export type Options = {
|
|
47
|
+
walkArrays: boolean;
|
|
48
|
+
ignoreEmptyObjectLeaves: boolean;
|
|
49
|
+
expandPathKeys: boolean;
|
|
50
|
+
outputIntermediateNodes: boolean;
|
|
51
|
+
};
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/* ------------------------------------------------------------------ Imports */
|
|
2
|
+
|
|
3
|
+
import * as expect from '../../util/expect/index.js';
|
|
4
|
+
|
|
5
|
+
import { PATH_SEPARATOR } from '../../util/object/index.js';
|
|
6
|
+
|
|
7
|
+
/* ------------------------------------------------------------------ Typedef */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} Options
|
|
11
|
+
* @property {boolean} walkArrays
|
|
12
|
+
* @property {boolean} ignoreEmptyObjectLeaves
|
|
13
|
+
* @property {boolean} expandPathKeys
|
|
14
|
+
* @property {boolean} outputIntermediateNodes
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* ------------------------------------------------------------------ Exports */
|
|
18
|
+
|
|
19
|
+
export default class IterableTree {
|
|
20
|
+
/**
|
|
21
|
+
* @type {Options}
|
|
22
|
+
*/
|
|
23
|
+
#options;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Construct an object that can be used to iterate paths and values in
|
|
27
|
+
* an object.
|
|
28
|
+
* - Returns path-value pairs for all leaves of the object (tree)
|
|
29
|
+
* - Iterates "own properties" only (not inherited properties)
|
|
30
|
+
*
|
|
31
|
+
* @param {object} obj - Object to iterate
|
|
32
|
+
* @param {Options} [options]
|
|
33
|
+
* @param {string[]} [_parentArrPath]
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
* @return {Iterator} iterable object
|
|
37
|
+
*/
|
|
38
|
+
constructor(obj, options, _parentArrPath) {
|
|
39
|
+
//super( ...arguments );
|
|
40
|
+
|
|
41
|
+
expect.object(obj);
|
|
42
|
+
|
|
43
|
+
this.obj = obj;
|
|
44
|
+
|
|
45
|
+
this.#options = Object.assign(
|
|
46
|
+
{
|
|
47
|
+
walkArrays: false,
|
|
48
|
+
ignoreEmptyObjectLeaves: false,
|
|
49
|
+
expandPathKeys: false,
|
|
50
|
+
outputIntermediateNodes: false
|
|
51
|
+
},
|
|
52
|
+
options
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
this._parentArrPath = _parentArrPath || null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* --------------------------------------------------------- Public methods */
|
|
59
|
+
|
|
60
|
+
// -------------------------------------------------------------------- Method
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get an iterator to iterate over all object [ path, value ] entries
|
|
64
|
+
*
|
|
65
|
+
* @returns {Iterator} object entries iterator
|
|
66
|
+
*/
|
|
67
|
+
*entries() {
|
|
68
|
+
const obj = this.obj;
|
|
69
|
+
const parentArrPath = this._parentArrPath;
|
|
70
|
+
|
|
71
|
+
const options = this.options;
|
|
72
|
+
|
|
73
|
+
let { expandPathKeys, ignoreEmptyObjectLeaves, outputIntermediateNodes } = this.#options;
|
|
74
|
+
|
|
75
|
+
if (parentArrPath) {
|
|
76
|
+
// Never expand keys if not in root object
|
|
77
|
+
expandPathKeys = false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// @note keys are own properties only
|
|
81
|
+
const keys = Object.keys(obj);
|
|
82
|
+
|
|
83
|
+
let pathKeys;
|
|
84
|
+
|
|
85
|
+
if (expandPathKeys) {
|
|
86
|
+
pathKeys = [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// -- STEP 1: Normal object iteration (and gather path keys)
|
|
90
|
+
|
|
91
|
+
for (let j = 0, n = keys.length; j < n; j = j + 1) {
|
|
92
|
+
const key = keys[j];
|
|
93
|
+
|
|
94
|
+
if (expandPathKeys && key.includes(PATH_SEPARATOR)) {
|
|
95
|
+
// Gather pathKeys
|
|
96
|
+
pathKeys.push(key);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const valueAtPath = obj[key];
|
|
101
|
+
|
|
102
|
+
if (undefined === valueAtPath) {
|
|
103
|
+
// Ignore path-value pair if valueAtPath is undefined
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let path;
|
|
108
|
+
|
|
109
|
+
if (parentArrPath) {
|
|
110
|
+
path = parentArrPath.slice(0);
|
|
111
|
+
path.push(key);
|
|
112
|
+
} else {
|
|
113
|
+
path = [key];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// No recursion >>
|
|
117
|
+
|
|
118
|
+
if (!this.#shouldRecurse(valueAtPath)) {
|
|
119
|
+
if (
|
|
120
|
+
ignoreEmptyObjectLeaves &&
|
|
121
|
+
valueAtPath instanceof Object &&
|
|
122
|
+
0 === Object.keys(valueAtPath).length
|
|
123
|
+
) {
|
|
124
|
+
// Ignore empty object leave
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
yield [path, valueAtPath];
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Recursion >>
|
|
133
|
+
|
|
134
|
+
// console.log( { path, valueAtPath, outputIntermediateNodes } );
|
|
135
|
+
|
|
136
|
+
if (outputIntermediateNodes) {
|
|
137
|
+
// outputIntermediateNodes=true
|
|
138
|
+
// -> Output itermediate node
|
|
139
|
+
|
|
140
|
+
if (Array.isArray(valueAtPath)) {
|
|
141
|
+
// Intermediate node is an array
|
|
142
|
+
yield [path, []];
|
|
143
|
+
} else {
|
|
144
|
+
// Intermediate node is plain object
|
|
145
|
+
yield [path, {}];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const objectIterator = new IterableTree(valueAtPath, options, path);
|
|
150
|
+
|
|
151
|
+
for (const entry of objectIterator.entries()) {
|
|
152
|
+
yield entry;
|
|
153
|
+
}
|
|
154
|
+
} // end for
|
|
155
|
+
|
|
156
|
+
// -- STEP 2: Output entries from "path keys"
|
|
157
|
+
|
|
158
|
+
if (!pathKeys || !pathKeys.length) {
|
|
159
|
+
// No path keys -> done
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
for (let j = 0, n = pathKeys.length; j < n; j = j + 1) {
|
|
164
|
+
// @note path keys do not output intermediate nodes
|
|
165
|
+
|
|
166
|
+
const key = pathKeys[j];
|
|
167
|
+
|
|
168
|
+
const valueAtPath = obj[key];
|
|
169
|
+
const path = key.split(PATH_SEPARATOR);
|
|
170
|
+
|
|
171
|
+
yield [path, valueAtPath];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// -------------------------------------------------------------------- Method
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Get an iterator to iterate over all object paths
|
|
179
|
+
*
|
|
180
|
+
* @returns {Iterator} object path iterator
|
|
181
|
+
*/
|
|
182
|
+
*paths() {
|
|
183
|
+
for (const entry of this.entries()) {
|
|
184
|
+
yield entry[0];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// -------------------------------------------------------------------- Method
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get an iterator to iterate over all values at the leaves of the paths in
|
|
192
|
+
* the object
|
|
193
|
+
*
|
|
194
|
+
* @returns {Iterator} object value iterator
|
|
195
|
+
*/
|
|
196
|
+
*values() {
|
|
197
|
+
for (const entry of this.entries()) {
|
|
198
|
+
yield entry[1];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// -------------------------------------------------------------------- Method
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns true if the iterator should recurse into the specified value
|
|
206
|
+
*
|
|
207
|
+
* @param {string} value
|
|
208
|
+
*
|
|
209
|
+
* @return {boolean} true if the value should be iterated
|
|
210
|
+
*/
|
|
211
|
+
#shouldRecurse(value) {
|
|
212
|
+
if (!(value instanceof Object)) {
|
|
213
|
+
// not an object -> no recursion
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const walkArrays = this.#options.walkArrays;
|
|
218
|
+
|
|
219
|
+
if (walkArrays && Array.isArray(value)) {
|
|
220
|
+
// walkArrays=true AND isArray
|
|
221
|
+
|
|
222
|
+
if (!value.length) {
|
|
223
|
+
// Array is empty -> no recursion
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if ('[object Object]' !== value.toString()) {
|
|
231
|
+
// Not a plain object -> no recursion
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (Object.keys(value).length) {
|
|
236
|
+
// Object is not empty -> recursion
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Otherwise -> no recursion
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
} // end class
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Construct a Selector class
|
|
3
|
+
*/
|
|
4
|
+
export default class Selector {
|
|
5
|
+
/**
|
|
6
|
+
* Constructor
|
|
7
|
+
*
|
|
8
|
+
* @param {object|null} selector
|
|
9
|
+
*/
|
|
10
|
+
constructor(selector: object | null);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the first item from the list of items that matches the selector
|
|
13
|
+
*
|
|
14
|
+
* @template {object} T
|
|
15
|
+
* @param {T[]|null} items
|
|
16
|
+
*
|
|
17
|
+
* @returns {T|null} item or null if not found
|
|
18
|
+
*/
|
|
19
|
+
findFirst<T extends unknown>(items: T[] | null): T | null;
|
|
20
|
+
/**
|
|
21
|
+
* Returns all items from the list of items that match the selector
|
|
22
|
+
*
|
|
23
|
+
* @template {object} T
|
|
24
|
+
* @param {T[]|null} items
|
|
25
|
+
*
|
|
26
|
+
* @returns {T[]|null} item or null if not found
|
|
27
|
+
*/
|
|
28
|
+
findAll<T extends unknown>(items: T[] | null): T[] | null;
|
|
29
|
+
#private;
|
|
30
|
+
}
|