@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,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates state classes from an object of state variables
|
|
3
|
+
*
|
|
4
|
+
* @param {Object.<string, boolean>} stateObject
|
|
5
|
+
* Object with state names as keys and boolean values
|
|
6
|
+
*
|
|
7
|
+
* @returns {string} Space-separated string of state classes
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Returns "state-selected state-error"
|
|
11
|
+
* toStateClasses({ selected: true, loading: false, error: true });
|
|
12
|
+
*/
|
|
13
|
+
export function toStateClasses(stateObject) {
|
|
14
|
+
if (!stateObject || typeof stateObject !== 'object') {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return Object.entries(stateObject)
|
|
19
|
+
.filter((entry) => entry[1] === true)
|
|
20
|
+
.map(([state]) => `state-${state}`)
|
|
21
|
+
.join(' ');
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract clamp parameters from a CSS variable
|
|
3
|
+
*
|
|
4
|
+
* @param {string} varName - CSS variable name without '--'
|
|
5
|
+
* @returns {Object} Object with min and max values
|
|
6
|
+
* @throws {Error} If the CSS variable doesn't exist or doesn't contain a valid clamp function
|
|
7
|
+
*/
|
|
8
|
+
export function getClampParams(varName: string): any;
|
|
9
|
+
/**
|
|
10
|
+
* CSS clamp function implementation
|
|
11
|
+
*
|
|
12
|
+
* @param {number} min - Minimum value
|
|
13
|
+
* @param {number} value - Value to clamp
|
|
14
|
+
* @param {number} max - Maximum value
|
|
15
|
+
* @returns {number} Clamped value
|
|
16
|
+
*/
|
|
17
|
+
export function clamp(min: number, value: number, max: number): number;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getRootCssVar } from '../../css/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cache to that ensures we parse CSS clamp parameters only once
|
|
5
|
+
* @type {Object.<string, {min: number, max: number}>}
|
|
6
|
+
*/
|
|
7
|
+
let clampParamCache = {};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extract clamp parameters from a CSS variable
|
|
11
|
+
*
|
|
12
|
+
* @param {string} varName - CSS variable name without '--'
|
|
13
|
+
* @returns {Object} Object with min and max values
|
|
14
|
+
* @throws {Error} If the CSS variable doesn't exist or doesn't contain a valid clamp function
|
|
15
|
+
*/
|
|
16
|
+
export function getClampParams(varName) {
|
|
17
|
+
// Check cache first
|
|
18
|
+
if (clampParamCache[varName]) {
|
|
19
|
+
return clampParamCache[varName];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Get the CSS variable value using the existing utility
|
|
23
|
+
const declaration = getRootCssVar(varName);
|
|
24
|
+
|
|
25
|
+
if (declaration === null) {
|
|
26
|
+
throw new Error(`CSS variable --${varName} not found`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Parse clamp() function values
|
|
30
|
+
const clampMatch =
|
|
31
|
+
typeof declaration === 'string'
|
|
32
|
+
? declaration.match(
|
|
33
|
+
/clamp\s*\(\s*([\d.]+)\s*,\s*[^,]+\s*,\s*([\d.]+)\s*\)/
|
|
34
|
+
)
|
|
35
|
+
: null;
|
|
36
|
+
|
|
37
|
+
if (!clampMatch || clampMatch.length < 3) {
|
|
38
|
+
// console.log(declaration);
|
|
39
|
+
throw new Error(
|
|
40
|
+
`CSS variable --${varName} does not contain a valid clamp function`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const min = parseFloat(clampMatch[1]);
|
|
45
|
+
const max = parseFloat(clampMatch[2]);
|
|
46
|
+
|
|
47
|
+
if (isNaN(min) || isNaN(max)) {
|
|
48
|
+
throw new Error(`Invalid min/max values in CSS variable --${varName}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Cache the result
|
|
52
|
+
clampParamCache[varName] = { min, max };
|
|
53
|
+
return { min, max };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* CSS clamp function implementation
|
|
58
|
+
*
|
|
59
|
+
* @param {number} min - Minimum value
|
|
60
|
+
* @param {number} value - Value to clamp
|
|
61
|
+
* @param {number} max - Maximum value
|
|
62
|
+
* @returns {number} Clamped value
|
|
63
|
+
*/
|
|
64
|
+
export function clamp(min, value, max) {
|
|
65
|
+
return Math.max(min, Math.min(value, max));
|
|
66
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a complete HTML style tag with CSS custom properties for
|
|
3
|
+
* the design system based on provided configuration.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} design - Design dimensions configuration
|
|
6
|
+
* @param {number} design.width - The design width in pixels
|
|
7
|
+
* @param {number} design.height - The design height in pixels
|
|
8
|
+
* @param {Object} clamping - Scaling configuration parameters
|
|
9
|
+
* @param {Object} clamping.ui - UI clamping configuration
|
|
10
|
+
* @param {number} clamping.ui.min - Minimum UI scaling factor
|
|
11
|
+
* @param {number} clamping.ui.max - Maximum UI scaling factor
|
|
12
|
+
* @param {Object} clamping.textBase - Base text scaling configuration
|
|
13
|
+
* @param {number} clamping.textBase.min - Minimum base text scaling
|
|
14
|
+
* @param {number} clamping.textBase.max - Maximum base text scaling
|
|
15
|
+
* @param {Object} clamping.textHeading - Heading text clamping configuration
|
|
16
|
+
* @param {number} clamping.textHeading.min - Minimum heading text scaling
|
|
17
|
+
* @param {number} clamping.textHeading.max - Maximum heading text scaling
|
|
18
|
+
* @param {Object} clamping.textUi - UI text clamping configuration
|
|
19
|
+
* @param {number} clamping.textUi.min - Minimum UI text scaling
|
|
20
|
+
* @param {number} clamping.textUi.max - Maximum UI text scaling
|
|
21
|
+
*
|
|
22
|
+
* @returns {string} Complete HTML style tag with design system CSS variables
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // +layout.svelte
|
|
26
|
+
* <script>
|
|
27
|
+
* import { DESIGN, CLAMPING } from '../../../tailwind/extend/clamping/config.js';
|
|
28
|
+
*
|
|
29
|
+
* import { rootDesignVarsHTML } from '../index.js';
|
|
30
|
+
* </script>
|
|
31
|
+
*
|
|
32
|
+
* <svelte:head>
|
|
33
|
+
* {@html rootDesignVarsHTML(DESIGN, CLAMPING)}
|
|
34
|
+
* </svelte:head>
|
|
35
|
+
*
|
|
36
|
+
* // Generates style tag for use in svelte:head
|
|
37
|
+
* // <style>:root { --design-width: 1920; ... }</style>
|
|
38
|
+
*/
|
|
39
|
+
export function rootDesignVarsHTML(design: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}, clamping: {
|
|
43
|
+
ui: {
|
|
44
|
+
min: number;
|
|
45
|
+
max: number;
|
|
46
|
+
};
|
|
47
|
+
textBase: {
|
|
48
|
+
min: number;
|
|
49
|
+
max: number;
|
|
50
|
+
};
|
|
51
|
+
textHeading: {
|
|
52
|
+
min: number;
|
|
53
|
+
max: number;
|
|
54
|
+
};
|
|
55
|
+
textUi: {
|
|
56
|
+
min: number;
|
|
57
|
+
max: number;
|
|
58
|
+
};
|
|
59
|
+
}): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get design width from CSS variables
|
|
62
|
+
*
|
|
63
|
+
* @returns {number} Design width
|
|
64
|
+
*/
|
|
65
|
+
export function getRootCssDesignWidth(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Get design height from CSS variables
|
|
68
|
+
*
|
|
69
|
+
* @returns {number} Design height
|
|
70
|
+
*/
|
|
71
|
+
export function getRootCssDesignHeight(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves all current scaling factors from CSS variables
|
|
74
|
+
*
|
|
75
|
+
* @returns {Object} An object containing all scaling factors
|
|
76
|
+
*/
|
|
77
|
+
export function getAllRootScalingVars(): any;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { getRootCssVar } from '../../css/css-vars.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates a complete HTML style tag with CSS custom properties for
|
|
5
|
+
* the design system based on provided configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} design - Design dimensions configuration
|
|
8
|
+
* @param {number} design.width - The design width in pixels
|
|
9
|
+
* @param {number} design.height - The design height in pixels
|
|
10
|
+
* @param {Object} clamping - Scaling configuration parameters
|
|
11
|
+
* @param {Object} clamping.ui - UI clamping configuration
|
|
12
|
+
* @param {number} clamping.ui.min - Minimum UI scaling factor
|
|
13
|
+
* @param {number} clamping.ui.max - Maximum UI scaling factor
|
|
14
|
+
* @param {Object} clamping.textBase - Base text scaling configuration
|
|
15
|
+
* @param {number} clamping.textBase.min - Minimum base text scaling
|
|
16
|
+
* @param {number} clamping.textBase.max - Maximum base text scaling
|
|
17
|
+
* @param {Object} clamping.textHeading - Heading text clamping configuration
|
|
18
|
+
* @param {number} clamping.textHeading.min - Minimum heading text scaling
|
|
19
|
+
* @param {number} clamping.textHeading.max - Maximum heading text scaling
|
|
20
|
+
* @param {Object} clamping.textUi - UI text clamping configuration
|
|
21
|
+
* @param {number} clamping.textUi.min - Minimum UI text scaling
|
|
22
|
+
* @param {number} clamping.textUi.max - Maximum UI text scaling
|
|
23
|
+
*
|
|
24
|
+
* @returns {string} Complete HTML style tag with design system CSS variables
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // +layout.svelte
|
|
28
|
+
* <script>
|
|
29
|
+
* import { DESIGN, CLAMPING } from '../../../tailwind/extend/clamping/config.js';
|
|
30
|
+
*
|
|
31
|
+
* import { rootDesignVarsHTML } from '../index.js';
|
|
32
|
+
* </script>
|
|
33
|
+
*
|
|
34
|
+
* <svelte:head>
|
|
35
|
+
* {@html rootDesignVarsHTML(DESIGN, CLAMPING)}
|
|
36
|
+
* </svelte:head>
|
|
37
|
+
*
|
|
38
|
+
* // Generates style tag for use in svelte:head
|
|
39
|
+
* // <style>:root { --design-width: 1920; ... }</style>
|
|
40
|
+
*/
|
|
41
|
+
export function rootDesignVarsHTML(design, clamping) {
|
|
42
|
+
return `<style>:root {
|
|
43
|
+
/* Design dimensions */
|
|
44
|
+
--design-width: ${design.width};
|
|
45
|
+
--design-height: ${design.height};
|
|
46
|
+
|
|
47
|
+
/* Scaling factors */
|
|
48
|
+
--scale-w: 1;
|
|
49
|
+
--scale-h: 1;
|
|
50
|
+
|
|
51
|
+
/* --scale-viewport: min(var(--scale-w), var(--scale-h)); */
|
|
52
|
+
--scale-viewport: 1;
|
|
53
|
+
|
|
54
|
+
/* Base clamping units */
|
|
55
|
+
--scale-ui: clamp(${clamping.ui.min}, var(--scale-viewport), ${clamping.ui.max});
|
|
56
|
+
--scale-text-base: clamp(${clamping.textBase.min}, var(--scale-viewport), ${clamping.textBase.max});
|
|
57
|
+
--scale-text-heading: clamp(${clamping.textHeading.min}, var(--scale-viewport), ${clamping.textHeading.max});
|
|
58
|
+
--scale-text-ui: clamp(${clamping.textUi.min}, var(--scale-viewport), ${clamping.textUi.max});
|
|
59
|
+
}</style>`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get design width from CSS variables
|
|
64
|
+
*
|
|
65
|
+
* @returns {number} Design width
|
|
66
|
+
*/
|
|
67
|
+
export function getRootCssDesignWidth() {
|
|
68
|
+
return getRootCssVar('design-width');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get design height from CSS variables
|
|
73
|
+
*
|
|
74
|
+
* @returns {number} Design height
|
|
75
|
+
*/
|
|
76
|
+
export function getRootCssDesignHeight() {
|
|
77
|
+
return getRootCssVar('design-height');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves all current scaling factors from CSS variables
|
|
82
|
+
*
|
|
83
|
+
* @returns {Object} An object containing all scaling factors
|
|
84
|
+
*/
|
|
85
|
+
export function getAllRootScalingVars() {
|
|
86
|
+
const styles = getComputedStyle(document.documentElement);
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
scaleW: parseFloat(styles.getPropertyValue('--scale-w').trim()) || 0,
|
|
90
|
+
scaleH: parseFloat(styles.getPropertyValue('--scale-h').trim()) || 0,
|
|
91
|
+
scaleViewport:
|
|
92
|
+
parseFloat(styles.getPropertyValue('--scale-viewport').trim()) || 0,
|
|
93
|
+
|
|
94
|
+
scaleUI: parseFloat(styles.getPropertyValue('--scale-ui').trim()) || 0,
|
|
95
|
+
scaleTextBase:
|
|
96
|
+
parseFloat(styles.getPropertyValue('--scale-text-base').trim()) || 0,
|
|
97
|
+
scaleTextHeading:
|
|
98
|
+
parseFloat(styles.getPropertyValue('--scale-text-heading').trim()) || 0,
|
|
99
|
+
scaleTextUI:
|
|
100
|
+
parseFloat(styles.getPropertyValue('--scale-text-ui').trim()) || 0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages responsive design scaling by calculating and applying scale factors
|
|
3
|
+
* based on container dimensions and design system requirements.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} options - Configuration options
|
|
6
|
+
* @param {HTMLElement} options.container - The container element to apply scaling to
|
|
7
|
+
* @param {Object} options.design - The base design dimensions
|
|
8
|
+
* @param {number} options.design.width - The reference design width
|
|
9
|
+
* @param {number} options.design.height - The reference design height
|
|
10
|
+
* @param {Object} options.clamping - The min/max values for various scale factors
|
|
11
|
+
* @param {Object} options.clamping.ui - UI element scaling constraints
|
|
12
|
+
* @param {number} options.clamping.ui.min - Minimum UI scale factor
|
|
13
|
+
* @param {number} options.clamping.ui.max - Maximum UI scale factor
|
|
14
|
+
* @param {Object} options.clamping.textBase - Base text scaling constraints
|
|
15
|
+
* @param {number} options.clamping.textBase.min - Minimum base text scale factor
|
|
16
|
+
* @param {number} options.clamping.textBase.max - Maximum base text scale factor
|
|
17
|
+
* @param {Object} options.clamping.textHeading - Heading text scaling constraints
|
|
18
|
+
* @param {number} options.clamping.textHeading.min - Minimum heading text scale factor
|
|
19
|
+
* @param {number} options.clamping.textHeading.max - Maximum heading text scale factor
|
|
20
|
+
* @param {Object} options.clamping.textUi - UI text scaling constraints
|
|
21
|
+
* @param {number} options.clamping.textUi.min - Minimum UI text scale factor
|
|
22
|
+
* @param {number} options.clamping.textUi.max - Maximum UI text scale factor
|
|
23
|
+
* @param {Function} [options.getDimensions] - Optional function to get width and height
|
|
24
|
+
* @param {boolean} [options.useResizeObserver=true] - Whether to use ResizeObserver
|
|
25
|
+
*
|
|
26
|
+
* @returns {()=>void} A cleanup function that removes event listeners and observers
|
|
27
|
+
*/
|
|
28
|
+
export function enableContainerScaling({ container, design, clamping, getDimensions, useResizeObserver }: {
|
|
29
|
+
container: HTMLElement;
|
|
30
|
+
design: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
clamping: {
|
|
35
|
+
ui: {
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
};
|
|
39
|
+
textBase: {
|
|
40
|
+
min: number;
|
|
41
|
+
max: number;
|
|
42
|
+
};
|
|
43
|
+
textHeading: {
|
|
44
|
+
min: number;
|
|
45
|
+
max: number;
|
|
46
|
+
};
|
|
47
|
+
textUi: {
|
|
48
|
+
min: number;
|
|
49
|
+
max: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
getDimensions?: Function;
|
|
53
|
+
useResizeObserver?: boolean;
|
|
54
|
+
}): () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Manages responsive design scaling by calculating and applying scale factors
|
|
57
|
+
* based on viewport dimensions and design system requirements.
|
|
58
|
+
*
|
|
59
|
+
* @param {Object} design - The base design dimensions
|
|
60
|
+
* @param {number} design.width - The reference design width
|
|
61
|
+
* @param {number} design.height - The reference design height
|
|
62
|
+
* @param {Object} clamping - The min/max values for various scale factors
|
|
63
|
+
* @param {Object} clamping.ui - UI element scaling constraints
|
|
64
|
+
* @param {number} clamping.ui.min - Minimum UI scale factor
|
|
65
|
+
* @param {number} clamping.ui.max - Maximum UI scale factor
|
|
66
|
+
* @param {Object} clamping.textBase - Base text scaling constraints
|
|
67
|
+
* @param {number} clamping.textBase.min - Minimum base text scale factor
|
|
68
|
+
* @param {number} clamping.textBase.max - Maximum base text scale factor
|
|
69
|
+
* @param {Object} clamping.textHeading - Heading text scaling constraints
|
|
70
|
+
* @param {number} clamping.textHeading.min - Minimum heading text scale factor
|
|
71
|
+
* @param {number} clamping.textHeading.max - Maximum heading text scale factor
|
|
72
|
+
* @param {Object} clamping.textUi - UI text scaling constraints
|
|
73
|
+
* @param {number} clamping.textUi.min - Minimum UI text scale factor
|
|
74
|
+
* @param {number} clamping.textUi.max - Maximum UI text scale factor
|
|
75
|
+
*
|
|
76
|
+
* @returns {()=>void} A cleanup function that removes the event listener
|
|
77
|
+
*/
|
|
78
|
+
export function enableScalingUI(design: {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
}, clamping: {
|
|
82
|
+
ui: {
|
|
83
|
+
min: number;
|
|
84
|
+
max: number;
|
|
85
|
+
};
|
|
86
|
+
textBase: {
|
|
87
|
+
min: number;
|
|
88
|
+
max: number;
|
|
89
|
+
};
|
|
90
|
+
textHeading: {
|
|
91
|
+
min: number;
|
|
92
|
+
max: number;
|
|
93
|
+
};
|
|
94
|
+
textUi: {
|
|
95
|
+
min: number;
|
|
96
|
+
max: number;
|
|
97
|
+
};
|
|
98
|
+
}): () => void;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { clamp } from '../css/clamp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Manages responsive design scaling by calculating and applying scale factors
|
|
5
|
+
* based on container dimensions and design system requirements.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} options - Configuration options
|
|
8
|
+
* @param {HTMLElement} options.container - The container element to apply scaling to
|
|
9
|
+
* @param {Object} options.design - The base design dimensions
|
|
10
|
+
* @param {number} options.design.width - The reference design width
|
|
11
|
+
* @param {number} options.design.height - The reference design height
|
|
12
|
+
* @param {Object} options.clamping - The min/max values for various scale factors
|
|
13
|
+
* @param {Object} options.clamping.ui - UI element scaling constraints
|
|
14
|
+
* @param {number} options.clamping.ui.min - Minimum UI scale factor
|
|
15
|
+
* @param {number} options.clamping.ui.max - Maximum UI scale factor
|
|
16
|
+
* @param {Object} options.clamping.textBase - Base text scaling constraints
|
|
17
|
+
* @param {number} options.clamping.textBase.min - Minimum base text scale factor
|
|
18
|
+
* @param {number} options.clamping.textBase.max - Maximum base text scale factor
|
|
19
|
+
* @param {Object} options.clamping.textHeading - Heading text scaling constraints
|
|
20
|
+
* @param {number} options.clamping.textHeading.min - Minimum heading text scale factor
|
|
21
|
+
* @param {number} options.clamping.textHeading.max - Maximum heading text scale factor
|
|
22
|
+
* @param {Object} options.clamping.textUi - UI text scaling constraints
|
|
23
|
+
* @param {number} options.clamping.textUi.min - Minimum UI text scale factor
|
|
24
|
+
* @param {number} options.clamping.textUi.max - Maximum UI text scale factor
|
|
25
|
+
* @param {Function} [options.getDimensions] - Optional function to get width and height
|
|
26
|
+
* @param {boolean} [options.useResizeObserver=true] - Whether to use ResizeObserver
|
|
27
|
+
*
|
|
28
|
+
* @returns {()=>void} A cleanup function that removes event listeners and observers
|
|
29
|
+
*/
|
|
30
|
+
export function enableContainerScaling({
|
|
31
|
+
container,
|
|
32
|
+
design,
|
|
33
|
+
clamping,
|
|
34
|
+
getDimensions,
|
|
35
|
+
useResizeObserver = true
|
|
36
|
+
}) {
|
|
37
|
+
if (!container) {
|
|
38
|
+
throw new Error('Container element is required for enableContainerScaling');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let resizeObserver;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Updates CSS scale variables based on container dimensions
|
|
45
|
+
* and design system constraints
|
|
46
|
+
*/
|
|
47
|
+
function updateScaleValues() {
|
|
48
|
+
try {
|
|
49
|
+
let containerWidth, containerHeight;
|
|
50
|
+
|
|
51
|
+
// Use custom dimension getter if provided
|
|
52
|
+
if (typeof getDimensions === 'function') {
|
|
53
|
+
const dimensions = getDimensions();
|
|
54
|
+
containerWidth = dimensions.width;
|
|
55
|
+
containerHeight = dimensions.height;
|
|
56
|
+
} else {
|
|
57
|
+
// Otherwise use container's client dimensions
|
|
58
|
+
const rect = container.getBoundingClientRect();
|
|
59
|
+
containerWidth = rect.width;
|
|
60
|
+
containerHeight = rect.height;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Skip update if dimensions are zero (container not visible)
|
|
64
|
+
if (containerWidth <= 0 || containerHeight <= 0) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Calculate scale factors based on container size relative to design dimensions
|
|
69
|
+
const scaleW = containerWidth / design.width;
|
|
70
|
+
const scaleH = containerHeight / design.height;
|
|
71
|
+
|
|
72
|
+
// Use the smaller scale factor to ensure content fits within container
|
|
73
|
+
const scaleViewport = Math.min(scaleW, scaleH);
|
|
74
|
+
|
|
75
|
+
// Apply clamping to different element types
|
|
76
|
+
const scaleUI = clamp(clamping.ui.min, scaleViewport, clamping.ui.max);
|
|
77
|
+
|
|
78
|
+
const scaleTextBase = clamp(
|
|
79
|
+
clamping.textBase.min,
|
|
80
|
+
scaleViewport,
|
|
81
|
+
clamping.textBase.max
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const scaleTextHeading = clamp(
|
|
85
|
+
clamping.textHeading.min,
|
|
86
|
+
scaleViewport,
|
|
87
|
+
clamping.textHeading.max
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const scaleTextUi = clamp(
|
|
91
|
+
clamping.textUi.min,
|
|
92
|
+
scaleViewport,
|
|
93
|
+
clamping.textUi.max
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Set CSS custom properties on the container
|
|
97
|
+
container.style.setProperty('--scale-w', String(scaleW));
|
|
98
|
+
container.style.setProperty('--scale-h', String(scaleH));
|
|
99
|
+
container.style.setProperty('--scale-viewport', String(scaleViewport));
|
|
100
|
+
container.style.setProperty('--scale-ui', String(scaleUI));
|
|
101
|
+
container.style.setProperty('--scale-text-base', String(scaleTextBase));
|
|
102
|
+
container.style.setProperty(
|
|
103
|
+
'--scale-text-heading',
|
|
104
|
+
String(scaleTextHeading)
|
|
105
|
+
);
|
|
106
|
+
container.style.setProperty('--scale-text-ui', String(scaleTextUi));
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Error updating container scale values:', error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Initialize scales
|
|
113
|
+
updateScaleValues();
|
|
114
|
+
|
|
115
|
+
// Set up ResizeObserver for container resize detection
|
|
116
|
+
if (useResizeObserver && typeof ResizeObserver !== 'undefined') {
|
|
117
|
+
resizeObserver = new ResizeObserver(updateScaleValues);
|
|
118
|
+
resizeObserver.observe(container);
|
|
119
|
+
} else {
|
|
120
|
+
// Fallback to window resize event
|
|
121
|
+
window.addEventListener('resize', updateScaleValues);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Return cleanup function
|
|
125
|
+
return function cleanup() {
|
|
126
|
+
if (resizeObserver) {
|
|
127
|
+
resizeObserver.disconnect();
|
|
128
|
+
} else {
|
|
129
|
+
window.removeEventListener('resize', updateScaleValues);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Manages responsive design scaling by calculating and applying scale factors
|
|
136
|
+
* based on viewport dimensions and design system requirements.
|
|
137
|
+
*
|
|
138
|
+
* @param {Object} design - The base design dimensions
|
|
139
|
+
* @param {number} design.width - The reference design width
|
|
140
|
+
* @param {number} design.height - The reference design height
|
|
141
|
+
* @param {Object} clamping - The min/max values for various scale factors
|
|
142
|
+
* @param {Object} clamping.ui - UI element scaling constraints
|
|
143
|
+
* @param {number} clamping.ui.min - Minimum UI scale factor
|
|
144
|
+
* @param {number} clamping.ui.max - Maximum UI scale factor
|
|
145
|
+
* @param {Object} clamping.textBase - Base text scaling constraints
|
|
146
|
+
* @param {number} clamping.textBase.min - Minimum base text scale factor
|
|
147
|
+
* @param {number} clamping.textBase.max - Maximum base text scale factor
|
|
148
|
+
* @param {Object} clamping.textHeading - Heading text scaling constraints
|
|
149
|
+
* @param {number} clamping.textHeading.min - Minimum heading text scale factor
|
|
150
|
+
* @param {number} clamping.textHeading.max - Maximum heading text scale factor
|
|
151
|
+
* @param {Object} clamping.textUi - UI text scaling constraints
|
|
152
|
+
* @param {number} clamping.textUi.min - Minimum UI text scale factor
|
|
153
|
+
* @param {number} clamping.textUi.max - Maximum UI text scale factor
|
|
154
|
+
*
|
|
155
|
+
* @returns {()=>void} A cleanup function that removes the event listener
|
|
156
|
+
*/
|
|
157
|
+
export function enableScalingUI(design, clamping) {
|
|
158
|
+
/**
|
|
159
|
+
* Updates CSS scale variables based on current viewport dimensions
|
|
160
|
+
* and design system constraints
|
|
161
|
+
*/
|
|
162
|
+
function updateScaleValues() {
|
|
163
|
+
try {
|
|
164
|
+
const vw = window.innerWidth;
|
|
165
|
+
const vh = window.innerHeight;
|
|
166
|
+
|
|
167
|
+
// Calculate scale factors based on viewport size relative to design dimensions
|
|
168
|
+
const scaleW = vw / design.width;
|
|
169
|
+
const scaleH = vh / design.height;
|
|
170
|
+
|
|
171
|
+
// Use the smaller scale factor to ensure content fits within viewport
|
|
172
|
+
const scaleViewport = Math.min(scaleW, scaleH);
|
|
173
|
+
|
|
174
|
+
// Apply clamping to different element types
|
|
175
|
+
const scaleUI = clamp(clamping.ui.min, scaleViewport, clamping.ui.max);
|
|
176
|
+
|
|
177
|
+
const scaleTextBase = clamp(
|
|
178
|
+
clamping.textBase.min,
|
|
179
|
+
scaleViewport,
|
|
180
|
+
clamping.textBase.max
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const scaleTextHeading = clamp(
|
|
184
|
+
clamping.textHeading.min,
|
|
185
|
+
scaleViewport,
|
|
186
|
+
clamping.textHeading.max
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const scaleTextUi = clamp(
|
|
190
|
+
clamping.textUi.min,
|
|
191
|
+
scaleViewport,
|
|
192
|
+
clamping.textUi.max
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
// Set CSS custom properties for use in the design system
|
|
196
|
+
document.documentElement.style.setProperty('--scale-w', String(scaleW));
|
|
197
|
+
document.documentElement.style.setProperty('--scale-h', String(scaleH));
|
|
198
|
+
document.documentElement.style.setProperty(
|
|
199
|
+
'--scale-viewport',
|
|
200
|
+
String(scaleViewport)
|
|
201
|
+
);
|
|
202
|
+
document.documentElement.style.setProperty('--scale-ui', String(scaleUI));
|
|
203
|
+
document.documentElement.style.setProperty(
|
|
204
|
+
'--scale-text-base',
|
|
205
|
+
String(scaleTextBase)
|
|
206
|
+
);
|
|
207
|
+
document.documentElement.style.setProperty(
|
|
208
|
+
'--scale-text-heading',
|
|
209
|
+
String(scaleTextHeading)
|
|
210
|
+
);
|
|
211
|
+
document.documentElement.style.setProperty(
|
|
212
|
+
'--scale-text-ui',
|
|
213
|
+
String(scaleTextUi)
|
|
214
|
+
);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
console.error('Error updating design scale values:', error);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Initialize scales and attach resize listener
|
|
221
|
+
updateScaleValues();
|
|
222
|
+
window.addEventListener('resize', updateScaleValues);
|
|
223
|
+
|
|
224
|
+
// Return cleanup function
|
|
225
|
+
return function cleanup() {
|
|
226
|
+
window.removeEventListener('resize', updateScaleValues);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates utility classes for UI font styling that work with Skeleton themes
|
|
3
|
+
*
|
|
4
|
+
* This plugin adds utility classes for UI typography that reference CSS
|
|
5
|
+
* variables defined in your Skeleton theme, allowing consistent styling of UI
|
|
6
|
+
* elements across your application.
|
|
7
|
+
*
|
|
8
|
+
* @note Important Configuration Requirements:
|
|
9
|
+
* 1. Add UI font variables to your theme file:
|
|
10
|
+
* - `--ui-font-family`: Font family for UI elements
|
|
11
|
+
* (falls back to `--base-font-family`)
|
|
12
|
+
* - `--ui-font-color`: Text color for UI elements
|
|
13
|
+
* (falls back to `--base-font-color`)
|
|
14
|
+
* - `--ui-font-color-dark`: Dark mode text color
|
|
15
|
+
* (falls back to `--base-font-color-dark`)
|
|
16
|
+
*
|
|
17
|
+
* 2. This plugin generates the following utility classes:
|
|
18
|
+
* - `font-ui`: Applies UI font family
|
|
19
|
+
* - `text-ui`: Applies UI text color
|
|
20
|
+
* - `text-ui-dark`: Applies UI dark mode text color (with .dark selector)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // tailwind.config.js
|
|
24
|
+
* import { customUtilitiesPlugin }
|
|
25
|
+
* from './src/lib/util/design-system/skeleton.js';
|
|
26
|
+
*
|
|
27
|
+
* export default {
|
|
28
|
+
* plugins: [
|
|
29
|
+
* customUtilitiesPlugin,
|
|
30
|
+
* skeleton({
|
|
31
|
+
* themes: [defaultThemes.cerberus, customThemes.yourTheme]
|
|
32
|
+
* })
|
|
33
|
+
* ]
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} api - Tailwind plugin API
|
|
37
|
+
* @param {Function} api.addUtilities - Function to add utilities
|
|
38
|
+
*/
|
|
39
|
+
export function customUtilitiesPlugin({ addUtilities, theme }: {
|
|
40
|
+
addUtilities: Function;
|
|
41
|
+
}): void;
|