@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,142 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
|
|
4
|
+
import { GridLayers } from '../../components/layout/index.js';
|
|
5
|
+
|
|
6
|
+
import { PresenterState } from './Presenter.state.svelte.js';
|
|
7
|
+
import { cssBefore, cssDuring, waitForRender } from './util.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("./typedef.js").Slide} Slide
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import("./typedef.js").Layer} Layer
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {{
|
|
19
|
+
* classes?: string,
|
|
20
|
+
* slides?: import("./typedef.js").Slide[],
|
|
21
|
+
* presenterRef?: import('./Presenter.state.svelte.js').PresenterRef,
|
|
22
|
+
* layoutSnippet: import('svelte').Snippet<[Slide|null, Layer]>,
|
|
23
|
+
* loadingSnippet?: import('svelte').Snippet,
|
|
24
|
+
* }}
|
|
25
|
+
*/
|
|
26
|
+
let {
|
|
27
|
+
// > Style
|
|
28
|
+
classes,
|
|
29
|
+
|
|
30
|
+
// > Functional
|
|
31
|
+
slides,
|
|
32
|
+
presenterRef = $bindable(),
|
|
33
|
+
|
|
34
|
+
// Snippets
|
|
35
|
+
layoutSnippet,
|
|
36
|
+
loadingSnippet
|
|
37
|
+
} = $props();
|
|
38
|
+
|
|
39
|
+
const presenter = new PresenterState();
|
|
40
|
+
|
|
41
|
+
onMount(() => {
|
|
42
|
+
// Configure presenter with slides if provided
|
|
43
|
+
presenter.configure({ slides });
|
|
44
|
+
presenterRef = presenter.getPresenterRef();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// > State
|
|
48
|
+
|
|
49
|
+
let classesA = $state('');
|
|
50
|
+
let classesB = $state('');
|
|
51
|
+
|
|
52
|
+
let stylesA = $state('');
|
|
53
|
+
let stylesB = $state('');
|
|
54
|
+
|
|
55
|
+
//> Apply stage classes and styles
|
|
56
|
+
|
|
57
|
+
$effect(() => {
|
|
58
|
+
// > layerA
|
|
59
|
+
|
|
60
|
+
const { stageBeforeIn, stageIn, stageBeforeOut, stageOut, transitions } =
|
|
61
|
+
presenter.layerA;
|
|
62
|
+
|
|
63
|
+
if (transitions?.length) {
|
|
64
|
+
// console.debug('layerA:transitions', transitions, {
|
|
65
|
+
// stageBeforeIn,
|
|
66
|
+
// stageIn,
|
|
67
|
+
// stageBeforeOut,
|
|
68
|
+
// stageOut
|
|
69
|
+
// });
|
|
70
|
+
|
|
71
|
+
if (stageBeforeIn || stageBeforeOut) {
|
|
72
|
+
({ style: stylesA, classes: classesA } = cssBefore(transitions));
|
|
73
|
+
} else if (stageIn || stageOut) {
|
|
74
|
+
waitForRender(() => {
|
|
75
|
+
({ style: stylesA, classes: classesA } = cssDuring(transitions));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
stylesA = '';
|
|
80
|
+
classesA = '';
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
$effect(() => {
|
|
85
|
+
// > layerB
|
|
86
|
+
|
|
87
|
+
const { stageBeforeIn, stageIn, stageBeforeOut, stageOut, transitions } =
|
|
88
|
+
presenter.layerB;
|
|
89
|
+
|
|
90
|
+
if (transitions?.length) {
|
|
91
|
+
// console.debug('layerB:transitions', transitions, {
|
|
92
|
+
// stageBeforeIn,
|
|
93
|
+
// stageIn,
|
|
94
|
+
// stageBeforeOut,
|
|
95
|
+
// stageOut
|
|
96
|
+
// });
|
|
97
|
+
|
|
98
|
+
if (stageBeforeIn || stageBeforeOut) {
|
|
99
|
+
({ style: stylesB, classes: classesB } = cssBefore(transitions));
|
|
100
|
+
} else if (stageIn || stageOut) {
|
|
101
|
+
waitForRender(() => {
|
|
102
|
+
({ style: stylesB, classes: classesB } = cssDuring(transitions));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
stylesB = '';
|
|
107
|
+
classesB = '';
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<GridLayers data-feature="presenter" {classes}>
|
|
113
|
+
<div
|
|
114
|
+
data-layer="layer1"
|
|
115
|
+
style:z-index={presenter.layerA.z}
|
|
116
|
+
style:visibility={presenter.layerA.visible ? 'visible' : 'hidden'}
|
|
117
|
+
inert={presenter.busy}
|
|
118
|
+
class="justify-self-stretch self-stretch overflow-hidden"
|
|
119
|
+
>
|
|
120
|
+
<div class="{classesA} h-full w-full grid" style={stylesA}>
|
|
121
|
+
{@render layoutSnippet(presenter.slideA, presenter.layerA)}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div
|
|
126
|
+
data-layer="layer2"
|
|
127
|
+
style:z-index={presenter.layerB.z}
|
|
128
|
+
style:visibility={presenter.layerB.visible ? 'visible' : 'hidden'}
|
|
129
|
+
inert={presenter.busy}
|
|
130
|
+
class="justify-self-stretch self-stretch overflow-hidden"
|
|
131
|
+
>
|
|
132
|
+
<div class="{classesB} h-full w-full grid" style={stylesB}>
|
|
133
|
+
{@render layoutSnippet(presenter.slideB, presenter.layerB)}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
{#if loadingSnippet && presenter.loadingSpinner}
|
|
138
|
+
<div class="justify-self-stretch self-stretch overflow-hidden grid z-[20]">
|
|
139
|
+
{@render loadingSnippet()}
|
|
140
|
+
</div>
|
|
141
|
+
{/if}
|
|
142
|
+
</GridLayers>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default Presenter;
|
|
2
|
+
type Presenter = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<{
|
|
5
|
+
classes?: string;
|
|
6
|
+
slides?: Slide[];
|
|
7
|
+
presenterRef?: PresenterRef;
|
|
8
|
+
layoutSnippet: Snippet<[Slide, Layer]>;
|
|
9
|
+
loadingSnippet?: Snippet<[]>;
|
|
10
|
+
}>): void;
|
|
11
|
+
};
|
|
12
|
+
declare const Presenter: import("svelte").Component<{
|
|
13
|
+
classes?: string;
|
|
14
|
+
slides?: import("./typedef.js").Slide[];
|
|
15
|
+
presenterRef?: import("./Presenter.state.svelte.js").PresenterRef;
|
|
16
|
+
layoutSnippet: import("svelte").Snippet<[import("./typedef.js").Slide | null, import("./typedef.js").Layer]>;
|
|
17
|
+
loadingSnippet?: import("svelte").Snippet;
|
|
18
|
+
}, {}, "presenterRef">;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Presenter } from "./Presenter.svelte";
|
|
2
|
+
export { default as ImageSlide } from "./ImageSlide.svelte";
|
|
3
|
+
export { PresenterState } from "./Presenter.state.svelte.js";
|
|
4
|
+
export * from "./typedef.js";
|
|
5
|
+
export * from "./constants.js";
|
|
6
|
+
export * from "./util.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Presenter } from './Presenter.svelte';
|
|
2
|
+
export { default as ImageSlide } from './ImageSlide.svelte';
|
|
3
|
+
|
|
4
|
+
export { PresenterState } from './Presenter.state.svelte.js';
|
|
5
|
+
|
|
6
|
+
export * from './typedef.js';
|
|
7
|
+
export * from './constants.js';
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
export * from './util.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type CssTransition = {
|
|
4
|
+
type: ("css");
|
|
5
|
+
property: string;
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
delay?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
timing?: string;
|
|
11
|
+
};
|
|
12
|
+
export type FadeInTransition = {
|
|
13
|
+
type: ("fade-in");
|
|
14
|
+
from?: string;
|
|
15
|
+
to?: string;
|
|
16
|
+
delay?: number;
|
|
17
|
+
duration?: number;
|
|
18
|
+
timing?: string;
|
|
19
|
+
};
|
|
20
|
+
export type FadeOutTransition = {
|
|
21
|
+
type: ("fade-out");
|
|
22
|
+
from?: string;
|
|
23
|
+
to?: string;
|
|
24
|
+
delay?: number;
|
|
25
|
+
duration?: number;
|
|
26
|
+
timing?: string;
|
|
27
|
+
};
|
|
28
|
+
export type LoadController = {
|
|
29
|
+
/**
|
|
30
|
+
* - Function to call when loading is complete
|
|
31
|
+
*/
|
|
32
|
+
loaded: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* - Function to return to the previous slide
|
|
35
|
+
*/
|
|
36
|
+
cancel: () => void;
|
|
37
|
+
};
|
|
38
|
+
export type ListenerParams = {
|
|
39
|
+
stage: string;
|
|
40
|
+
slideName: string;
|
|
41
|
+
};
|
|
42
|
+
export type ListenerCallback = (params: ListenerParams) => () => void;
|
|
43
|
+
export type UnregisterFn = () => void;
|
|
44
|
+
export type PresenterRef = {
|
|
45
|
+
/**
|
|
46
|
+
* - Navigate to a slide by name
|
|
47
|
+
*/
|
|
48
|
+
gotoSlide: (name: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* - Get the current slide name
|
|
51
|
+
*/
|
|
52
|
+
getCurrentSlideName: () => string;
|
|
53
|
+
/**
|
|
54
|
+
* Register listener that is called when a slide enters state 'before'
|
|
55
|
+
*/
|
|
56
|
+
onBefore: (callback: ListenerCallback) => UnregisterFn;
|
|
57
|
+
/**
|
|
58
|
+
* Register listener that is called when a slide enters state 'show'
|
|
59
|
+
*/
|
|
60
|
+
onShow: (callback: ListenerCallback) => UnregisterFn;
|
|
61
|
+
};
|
|
62
|
+
export type Transition = CssTransition | FadeInTransition | FadeOutTransition;
|
|
63
|
+
export type SlideData = {
|
|
64
|
+
[attrs: string]: any;
|
|
65
|
+
};
|
|
66
|
+
export type SlideLayerLayout = {
|
|
67
|
+
[attrs: string]: any;
|
|
68
|
+
};
|
|
69
|
+
export type SlideLayer = {
|
|
70
|
+
data?: SlideData;
|
|
71
|
+
layout?: SlideLayerLayout;
|
|
72
|
+
};
|
|
73
|
+
export type Slide = {
|
|
74
|
+
name: string;
|
|
75
|
+
data?: SlideData;
|
|
76
|
+
layers?: SlideLayer[];
|
|
77
|
+
intro?: Transition[];
|
|
78
|
+
outro?: Transition[];
|
|
79
|
+
duration?: number;
|
|
80
|
+
};
|
|
81
|
+
export type Layer = {
|
|
82
|
+
z: number;
|
|
83
|
+
visible: boolean;
|
|
84
|
+
stageIdle?: boolean;
|
|
85
|
+
stageBeforeIn?: boolean;
|
|
86
|
+
stageIn?: boolean;
|
|
87
|
+
stageShow?: boolean;
|
|
88
|
+
stageBeforeOut?: boolean;
|
|
89
|
+
stageOut?: boolean;
|
|
90
|
+
stageAfter?: boolean;
|
|
91
|
+
transitions?: Transition[];
|
|
92
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* type: (import('./constants').TRANSITION_CSS),
|
|
4
|
+
* property: string,
|
|
5
|
+
* from: string,
|
|
6
|
+
* to: string,
|
|
7
|
+
* delay?: number
|
|
8
|
+
* duration?: number
|
|
9
|
+
* timing?: string
|
|
10
|
+
* }} CssTransition
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {{
|
|
15
|
+
* type: (import('./constants').FADE_IN),
|
|
16
|
+
* from?: string,
|
|
17
|
+
* to?: string,
|
|
18
|
+
* delay?: number
|
|
19
|
+
* duration?: number
|
|
20
|
+
* timing?: string
|
|
21
|
+
* }} FadeInTransition
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {{
|
|
26
|
+
* type: (import('./constants').FADE_OUT),
|
|
27
|
+
* from?: string,
|
|
28
|
+
* to?: string,
|
|
29
|
+
* delay?: number
|
|
30
|
+
* duration?: number
|
|
31
|
+
* timing?: string
|
|
32
|
+
* }} FadeOutTransition
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} LoadController
|
|
37
|
+
* @property {() => void} loaded - Function to call when loading is complete
|
|
38
|
+
* @property {() => void} cancel - Function to return to the previous slide
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {{
|
|
43
|
+
* stage: string,
|
|
44
|
+
* slideName: string
|
|
45
|
+
* }} ListenerParams
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {( params: ListenerParams) => () => void } ListenerCallback
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {() => void } UnregisterFn
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {Object} PresenterRef
|
|
58
|
+
* @property {(name: string) => void} gotoSlide - Navigate to a slide by name
|
|
59
|
+
* @property {() => string} getCurrentSlideName - Get the current slide name
|
|
60
|
+
* @property {( callback: ListenerCallback ) => UnregisterFn} onBefore
|
|
61
|
+
* Register listener that is called when a slide enters state 'before'
|
|
62
|
+
* @property {( callback: ListenerCallback ) => UnregisterFn} onShow
|
|
63
|
+
* Register listener that is called when a slide enters state 'show'
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {CssTransition|FadeInTransition|FadeOutTransition} Transition
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @typedef {{[attrs: string]: *}} SlideData
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {{[attrs: string]: *}} SlideLayerLayout
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @typedef {{data?:SlideData, layout?:SlideLayerLayout}} SlideLayer
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @typedef {object} Slide
|
|
84
|
+
* @property {string} name
|
|
85
|
+
* @property {SlideData} [data]
|
|
86
|
+
* @property {SlideLayer[]} [layers]
|
|
87
|
+
* @property {Transition[]} [intro]
|
|
88
|
+
* @property {Transition[]} [outro]
|
|
89
|
+
* @property {number} [duration]
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @typedef {object} Layer
|
|
94
|
+
* @property {number} z
|
|
95
|
+
* @property {boolean} visible
|
|
96
|
+
* @property {boolean} [stageIdle]
|
|
97
|
+
* @property {boolean} [stageBeforeIn]
|
|
98
|
+
* @property {boolean} [stageIn]
|
|
99
|
+
* @property {boolean} [stageShow]
|
|
100
|
+
* @property {boolean} [stageBeforeOut]
|
|
101
|
+
* @property {boolean} [stageOut]
|
|
102
|
+
* @property {boolean} [stageAfter]
|
|
103
|
+
* @property {Transition[]} [transitions]
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
export default {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("./typedef").Transition} Transition
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Ensures DOM is updated by Svelte and then painted by the browser
|
|
6
|
+
* before executing the callback function.
|
|
7
|
+
*
|
|
8
|
+
* @param {Function} callback - Function to execute after DOM update and paint
|
|
9
|
+
* @returns {Promise<void>} - Promise that resolves after the callback is executed
|
|
10
|
+
*/
|
|
11
|
+
export function waitForRender(callback: Function): Promise<void>;
|
|
12
|
+
/** === Generate CSS for lists of transitions */
|
|
13
|
+
/**
|
|
14
|
+
* Generates style and class names to be used before the transitions
|
|
15
|
+
* become active
|
|
16
|
+
*
|
|
17
|
+
* @param {Transition[]} transitions
|
|
18
|
+
*
|
|
19
|
+
* @returns {{style: string, classes: string}}
|
|
20
|
+
*/
|
|
21
|
+
export function cssBefore(transitions: Transition[]): {
|
|
22
|
+
style: string;
|
|
23
|
+
classes: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Generates style and class names to be used when the transitions are active
|
|
27
|
+
*
|
|
28
|
+
* @param {Transition[]} transitions
|
|
29
|
+
*
|
|
30
|
+
* @returns {{style: string, classes: string}}
|
|
31
|
+
*/
|
|
32
|
+
export function cssDuring(transitions: Transition[]): {
|
|
33
|
+
style: string;
|
|
34
|
+
classes: string;
|
|
35
|
+
};
|
|
36
|
+
/** === Generate CSS for single transitions */
|
|
37
|
+
/**
|
|
38
|
+
* Generates style and class names for specified transition for
|
|
39
|
+
* the stage 'stageBeforeIn'
|
|
40
|
+
*
|
|
41
|
+
* @param {Transition} transition
|
|
42
|
+
*
|
|
43
|
+
* @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
|
|
44
|
+
*/
|
|
45
|
+
export function transitionCssBefore(transition: Transition): {
|
|
46
|
+
propertyStyle: string;
|
|
47
|
+
transitionStyle: string;
|
|
48
|
+
classes: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Generates style and class names for specified transition for
|
|
52
|
+
* the stage 'stageIn'
|
|
53
|
+
*
|
|
54
|
+
* @param {Transition} transition
|
|
55
|
+
*
|
|
56
|
+
* @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
|
|
57
|
+
*/
|
|
58
|
+
export function transitionCssDuring(transition: Transition): {
|
|
59
|
+
propertyStyle: string;
|
|
60
|
+
transitionStyle: string;
|
|
61
|
+
classes: string;
|
|
62
|
+
};
|
|
63
|
+
export type Transition = import("./typedef").Transition;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { tick } from 'svelte';
|
|
2
|
+
|
|
3
|
+
import * as expect from '../../util/expect/index.js';
|
|
4
|
+
|
|
5
|
+
import { pushNotEmpty } from '../../util/array/index.js';
|
|
6
|
+
|
|
7
|
+
import { TRANSITION_CSS, FADE_IN, FADE_OUT } from './constants.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("./typedef").Transition} Transition
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Ensures DOM is updated by Svelte and then painted by the browser
|
|
15
|
+
* before executing the callback function.
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} callback - Function to execute after DOM update and paint
|
|
18
|
+
* @returns {Promise<void>} - Promise that resolves after the callback is executed
|
|
19
|
+
*/
|
|
20
|
+
export function waitForRender(callback) {
|
|
21
|
+
return tick().then(() => {
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
requestAnimationFrame(() => {
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
callback();
|
|
27
|
+
resolve();
|
|
28
|
+
}, 20);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** === Generate CSS for lists of transitions */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generates style and class names to be used before the transitions
|
|
39
|
+
* become active
|
|
40
|
+
*
|
|
41
|
+
* @param {Transition[]} transitions
|
|
42
|
+
*
|
|
43
|
+
* @returns {{style: string, classes: string}}
|
|
44
|
+
*/
|
|
45
|
+
export function cssBefore(transitions) {
|
|
46
|
+
expect.objectArray(transitions);
|
|
47
|
+
|
|
48
|
+
/** @type {string[]} */ let propertyStyleArr = [];
|
|
49
|
+
/** @type {string[]} */ let transitionStyleArr = [];
|
|
50
|
+
/** @type {string[]} */ let classesArr = [];
|
|
51
|
+
|
|
52
|
+
for (const transition of transitions) {
|
|
53
|
+
const { propertyStyle, transitionStyle, classes } =
|
|
54
|
+
transitionCssBefore(transition);
|
|
55
|
+
|
|
56
|
+
pushNotEmpty(propertyStyleArr, propertyStyle);
|
|
57
|
+
pushNotEmpty(transitionStyleArr, transitionStyle);
|
|
58
|
+
pushNotEmpty(classesArr, classes);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let style = propertyStyleArr.join(';');
|
|
62
|
+
|
|
63
|
+
if (transitionStyleArr.length) {
|
|
64
|
+
style += `;transition: ${transitionStyleArr.join(',')}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// console.log('cssBefore', transitions, style);
|
|
68
|
+
|
|
69
|
+
return { style, classes: classesArr.join() };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generates style and class names to be used when the transitions are active
|
|
74
|
+
*
|
|
75
|
+
* @param {Transition[]} transitions
|
|
76
|
+
*
|
|
77
|
+
* @returns {{style: string, classes: string}}
|
|
78
|
+
*/
|
|
79
|
+
export function cssDuring(transitions) {
|
|
80
|
+
expect.objectArray(transitions);
|
|
81
|
+
|
|
82
|
+
/** @type {string[]} */ let propertyStyleArr = [];
|
|
83
|
+
/** @type {string[]} */ let transitionStyleArr = [];
|
|
84
|
+
/** @type {string[]} */ let classesArr = [];
|
|
85
|
+
|
|
86
|
+
for (const transition of transitions) {
|
|
87
|
+
const { propertyStyle, transitionStyle, classes } =
|
|
88
|
+
transitionCssDuring(transition);
|
|
89
|
+
|
|
90
|
+
pushNotEmpty(propertyStyleArr, propertyStyle);
|
|
91
|
+
pushNotEmpty(transitionStyleArr, transitionStyle);
|
|
92
|
+
pushNotEmpty(classesArr, classes);
|
|
93
|
+
} // end for
|
|
94
|
+
|
|
95
|
+
let style = propertyStyleArr.join(';');
|
|
96
|
+
|
|
97
|
+
if (transitionStyleArr.length) {
|
|
98
|
+
style += `;transition: ${transitionStyleArr.join(',')}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return { style, classes: classesArr.join() };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** === Generate CSS for single transitions */
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Generates style and class names for specified transition for
|
|
108
|
+
* the stage 'stageBeforeIn'
|
|
109
|
+
*
|
|
110
|
+
* @param {Transition} transition
|
|
111
|
+
*
|
|
112
|
+
* @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
|
|
113
|
+
*/
|
|
114
|
+
export function transitionCssBefore(transition) {
|
|
115
|
+
expect.objectNoArray(transition);
|
|
116
|
+
|
|
117
|
+
let {
|
|
118
|
+
type,
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
property,
|
|
121
|
+
from
|
|
122
|
+
} = transition;
|
|
123
|
+
|
|
124
|
+
let propertyStyle = '';
|
|
125
|
+
let transitionStyle = '';
|
|
126
|
+
let classes = '';
|
|
127
|
+
|
|
128
|
+
switch (type) {
|
|
129
|
+
case FADE_IN:
|
|
130
|
+
type = TRANSITION_CSS;
|
|
131
|
+
property = 'opacity';
|
|
132
|
+
from = from ?? '0';
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case FADE_OUT:
|
|
136
|
+
type = TRANSITION_CSS;
|
|
137
|
+
property = 'opacity';
|
|
138
|
+
from = from ?? '1';
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!type || TRANSITION_CSS === type) {
|
|
143
|
+
expect.notEmptyString(property);
|
|
144
|
+
expect.string(from);
|
|
145
|
+
|
|
146
|
+
propertyStyle = `${property}: ${from}`;
|
|
147
|
+
} else {
|
|
148
|
+
throw new Error(`Unknown transition type [${type}]`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// console.log('transitionCssBefore', { propertyStyle, transitionStyle });
|
|
152
|
+
|
|
153
|
+
return { propertyStyle, transitionStyle, classes };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Generates style and class names for specified transition for
|
|
158
|
+
* the stage 'stageIn'
|
|
159
|
+
*
|
|
160
|
+
* @param {Transition} transition
|
|
161
|
+
*
|
|
162
|
+
* @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
|
|
163
|
+
*/
|
|
164
|
+
export function transitionCssDuring(transition) {
|
|
165
|
+
expect.objectNoArray(transition);
|
|
166
|
+
|
|
167
|
+
let {
|
|
168
|
+
type,
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
property,
|
|
171
|
+
to,
|
|
172
|
+
delay = 0,
|
|
173
|
+
duration = 1000,
|
|
174
|
+
timing = 'ease'
|
|
175
|
+
} = transition;
|
|
176
|
+
|
|
177
|
+
let propertyStyle;
|
|
178
|
+
let transitionStyle;
|
|
179
|
+
let classes = '';
|
|
180
|
+
|
|
181
|
+
switch (type) {
|
|
182
|
+
case FADE_IN:
|
|
183
|
+
type = TRANSITION_CSS;
|
|
184
|
+
property = 'opacity';
|
|
185
|
+
to = to ?? '1';
|
|
186
|
+
break;
|
|
187
|
+
|
|
188
|
+
case FADE_OUT:
|
|
189
|
+
type = TRANSITION_CSS;
|
|
190
|
+
property = 'opacity';
|
|
191
|
+
to = to ?? '0';
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!type || TRANSITION_CSS === type) {
|
|
196
|
+
expect.notEmptyString(property);
|
|
197
|
+
expect.string(to);
|
|
198
|
+
|
|
199
|
+
propertyStyle = `${property}: ${to}`;
|
|
200
|
+
|
|
201
|
+
/* property name | duration | easing function | delay */
|
|
202
|
+
transitionStyle = `${property} ${duration}ms ${timing} ${delay}ms`;
|
|
203
|
+
} else {
|
|
204
|
+
throw new Error(`Unknown transition type [${type}]`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// console.log('transitionCssDuring', { propertyStyle, transitionStyle });
|
|
208
|
+
|
|
209
|
+
return { propertyStyle, transitionStyle, classes };
|
|
210
|
+
}
|