@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,208 @@
|
|
|
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
|
+
const fontFamilyUtilities = {
|
|
41
|
+
'.font-heading': {
|
|
42
|
+
'font-family': 'var(--heading-font-family)'
|
|
43
|
+
},
|
|
44
|
+
'.font-base': {
|
|
45
|
+
'font-family': 'var(--base-font-family)'
|
|
46
|
+
},
|
|
47
|
+
'.font-ui': {
|
|
48
|
+
'font-family': 'var(--ui-font-family, var(--base-font-family))'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const textColorUtilities = {
|
|
53
|
+
'.text-base-color': {
|
|
54
|
+
color: 'var(--base-font-color)'
|
|
55
|
+
},
|
|
56
|
+
'.text-base-color-dark': {
|
|
57
|
+
color: 'var(--base-font-color-dark)'
|
|
58
|
+
},
|
|
59
|
+
'.text-heading-color': {
|
|
60
|
+
color: 'var(--heading-font-color)'
|
|
61
|
+
},
|
|
62
|
+
'.text-heading-color-dark': {
|
|
63
|
+
color: 'var(--heading-font-color-dark)'
|
|
64
|
+
},
|
|
65
|
+
'.text-ui-color': {
|
|
66
|
+
color: 'var(--ui-font-color, var(--base-font-color))'
|
|
67
|
+
},
|
|
68
|
+
'.text-ui-color-dark': {
|
|
69
|
+
color: 'var(--ui-font-color-dark, var(--base-font-color-dark))'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const typographyUtilities = generateTypographyUtilities(theme);
|
|
74
|
+
|
|
75
|
+
addUtilities({
|
|
76
|
+
...typographyUtilities,
|
|
77
|
+
...fontFamilyUtilities,
|
|
78
|
+
...textColorUtilities
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generates typography utility classes based on fontSize entries in the
|
|
84
|
+
* Tailwind theme
|
|
85
|
+
*
|
|
86
|
+
* This function creates typography utility classes for entries in the
|
|
87
|
+
* theme's fontSize configuration that start with 'heading-', 'base-', or
|
|
88
|
+
* 'ui-' prefixes. Each class includes font size, line height, font weight,
|
|
89
|
+
* font family, and color properties.
|
|
90
|
+
*
|
|
91
|
+
* @param {Function} theme - Tailwind's theme function to access configuration
|
|
92
|
+
* @returns {Object} An object containing the generated typography utility classes
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* // In your Tailwind plugin:
|
|
96
|
+
* const typographyUtils = generateTypographyUtilities(theme);
|
|
97
|
+
* addUtilities(typographyUtils);
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Example output format:
|
|
101
|
+
* // {
|
|
102
|
+
* // '.type-heading-h1': {
|
|
103
|
+
* // fontSize: 'calc(32px * var(--scale-text-heading))',
|
|
104
|
+
* // lineHeight: '1.25',
|
|
105
|
+
* // fontWeight: '700',
|
|
106
|
+
* // fontFamily: 'var(--heading-font-family)',
|
|
107
|
+
* // fontStyle: 'var(--heading-font-style)',
|
|
108
|
+
* // letterSpacing: 'var(--heading-letter-spacing)',
|
|
109
|
+
* // color: 'rgb(var(--heading-font-color))'
|
|
110
|
+
* // }
|
|
111
|
+
* // }
|
|
112
|
+
*/
|
|
113
|
+
function generateTypographyUtilities(theme) {
|
|
114
|
+
// Get font sizes from theme
|
|
115
|
+
const fontSizes = theme('fontSize');
|
|
116
|
+
|
|
117
|
+
// Create typography utilities
|
|
118
|
+
const typographyUtilities = {};
|
|
119
|
+
|
|
120
|
+
// Process all fontSize entries and create type- classes for them
|
|
121
|
+
Object.entries(fontSizes).forEach(([key, value]) => {
|
|
122
|
+
// Skip entries that don't match our prefixes
|
|
123
|
+
if (
|
|
124
|
+
!key.startsWith('heading-') &&
|
|
125
|
+
!key.startsWith('base-') &&
|
|
126
|
+
!key.startsWith('ui-')
|
|
127
|
+
) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const [size, options] = Array.isArray(value) ? value : [value, {}];
|
|
132
|
+
|
|
133
|
+
// Determine properties based on the prefix
|
|
134
|
+
let properties = {};
|
|
135
|
+
|
|
136
|
+
let propertiesDark;
|
|
137
|
+
|
|
138
|
+
if (key.startsWith('heading-')) {
|
|
139
|
+
properties = {
|
|
140
|
+
lineHeight: options.lineHeight || 'normal',
|
|
141
|
+
fontFamily: 'var(--heading-font-family)',
|
|
142
|
+
fontStyle: 'var(--heading-font-style)',
|
|
143
|
+
fontWeight: 'var(--heading-font-weight)',
|
|
144
|
+
letterSpacing: 'var(--heading-letter-spacing)',
|
|
145
|
+
color: 'var(--heading-font-color)'
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
propertiesDark = {
|
|
149
|
+
...properties,
|
|
150
|
+
color: 'var(--heading-font-color-dark)'
|
|
151
|
+
};
|
|
152
|
+
} else if (key.startsWith('base-')) {
|
|
153
|
+
properties = {
|
|
154
|
+
lineHeight: options.lineHeight || 'normal',
|
|
155
|
+
fontFamily: 'var(--base-font-family)',
|
|
156
|
+
fontWeight: 'var(--base-font-weight)',
|
|
157
|
+
letterSpacing: 'var(--base-letter-spacing)',
|
|
158
|
+
color: 'var(--base-font-color)'
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
propertiesDark = {
|
|
162
|
+
...properties,
|
|
163
|
+
color: 'var(--base-font-color-dark)'
|
|
164
|
+
};
|
|
165
|
+
} else if (key.startsWith('ui-')) {
|
|
166
|
+
properties = {
|
|
167
|
+
lineHeight: options.lineHeight || 'normal',
|
|
168
|
+
fontFamily: 'var(--ui-font-family, var(--base-font-family))',
|
|
169
|
+
fontWeight: 'var(--ui-font-weight)',
|
|
170
|
+
letterSpacing: 'var(--ui-letter-spacing, var(--base-letter-spacing))',
|
|
171
|
+
color: 'var(--ui-font-color, var(--base-font-color))'
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
propertiesDark = {
|
|
175
|
+
...properties,
|
|
176
|
+
color: 'var(--ui-font-color-dark, var(--base-font-color-dark))'
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Create the utility class using the original key
|
|
181
|
+
typographyUtilities[`.type-${key}`] = {
|
|
182
|
+
fontSize: size,
|
|
183
|
+
...properties,
|
|
184
|
+
// Include any other properties defined in the fontSize options
|
|
185
|
+
...Object.fromEntries(
|
|
186
|
+
Object.entries(options).filter(
|
|
187
|
+
([k]) => !['lineHeight'].includes(k)
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Create the utility class using the original key for dark
|
|
193
|
+
typographyUtilities[`.type-${key}-dark`] = {
|
|
194
|
+
fontSize: size,
|
|
195
|
+
...propertiesDark,
|
|
196
|
+
// Include any other properties defined in the fontSize options
|
|
197
|
+
...Object.fromEntries(
|
|
198
|
+
Object.entries(options).filter(
|
|
199
|
+
([k]) => !['lineHeight'].includes(k)
|
|
200
|
+
)
|
|
201
|
+
)
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// console.debug(typographyUtilities);
|
|
206
|
+
|
|
207
|
+
return typographyUtilities;
|
|
208
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates text-based spacing units with with different scaling
|
|
3
|
+
* units (ut, bt, ht)
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} values
|
|
6
|
+
* Array of pixel values to generate text-based spacing units for
|
|
7
|
+
*
|
|
8
|
+
* @returns {{[key: string]: string}}
|
|
9
|
+
* Generated text-based spacing units with ut, bt, and ht suffixes
|
|
10
|
+
*
|
|
11
|
+
* @throws {Error} If values is not an array or contains non-numeric values
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* generateTextBasedSpacing([1, 2, 4, 8])
|
|
15
|
+
* // Returns:
|
|
16
|
+
* // {
|
|
17
|
+
* // '1ut': 'calc(1px * var(--scale-text-ui))',
|
|
18
|
+
* // '2ut': 'calc(2px * var(--scale-text-ui))',
|
|
19
|
+
* // '1bt': 'calc(1px * var(--scale-text-base))',
|
|
20
|
+
* // '2bt': 'calc(2px * var(--scale-text-base))',
|
|
21
|
+
* // '1ht': 'calc(1px * var(--scale-text-heading))',
|
|
22
|
+
* // '2ht': 'calc(2px * var(--scale-text-heading))'
|
|
23
|
+
* // }
|
|
24
|
+
*/
|
|
25
|
+
export function generateTextBasedSpacing(values: number[]): {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Generates viewport-based spacing units with different scaling
|
|
30
|
+
* units (up, wp, hp)
|
|
31
|
+
*
|
|
32
|
+
* @param {number[]} values
|
|
33
|
+
* Array of pixel values to generate viewport-based spacing units for
|
|
34
|
+
*
|
|
35
|
+
* @returns {Object.<string, string>}
|
|
36
|
+
* Generated viewport-based spacing units:
|
|
37
|
+
* - up: UI points (clamped scaling)
|
|
38
|
+
* - p: UI points (deprecated, will be removed in future versions)
|
|
39
|
+
* - wp: Width points
|
|
40
|
+
* - hp: Height points
|
|
41
|
+
*
|
|
42
|
+
* @throws {Error} If values is not an array or contains non-numeric values
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* generateViewportBasedSpacing([1, 2, 4])
|
|
46
|
+
* // Returns:
|
|
47
|
+
* // {
|
|
48
|
+
* // '1up': 'calc(1px * var(--scale-ui))',
|
|
49
|
+
* // '1p': 'calc(1px * var(--scale-ui))', // deprecated
|
|
50
|
+
* // '1wp': 'calc(1px * var(--scale-w))',
|
|
51
|
+
* // '1hp': 'calc(1px * var(--scale-h))'
|
|
52
|
+
* // }
|
|
53
|
+
*/
|
|
54
|
+
export function generateViewportBasedSpacing(values: number[]): {
|
|
55
|
+
[x: string]: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {{
|
|
59
|
+
* size?: number,
|
|
60
|
+
* lineHeight?: number|string
|
|
61
|
+
* }} TextStyleSizes
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* Generates semantic text style definitions for a specific text category
|
|
65
|
+
* (base, UI, or heading). Each style includes a scaled font size and
|
|
66
|
+
* line height.
|
|
67
|
+
*
|
|
68
|
+
* @param {{[key: string]: TextStyleSizes}} sizes
|
|
69
|
+
* Set of text sizes to generate styles for
|
|
70
|
+
*
|
|
71
|
+
* @param {'base' | 'ui' | 'heading'} category
|
|
72
|
+
* Text category to generate styles for
|
|
73
|
+
*
|
|
74
|
+
* @returns {{[key: string]: [string, {lineHeight: number}]}}
|
|
75
|
+
* Generated text styles in Tailwind format
|
|
76
|
+
*
|
|
77
|
+
* @throws {Error} If a size has an invalid size or lineHeight
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* const TEXT_BASE_SIZES = {
|
|
81
|
+
* sm: { size: 16, lineHeight: 1.5 },
|
|
82
|
+
* md: { size: 20, lineHeight: 1.5 },
|
|
83
|
+
* lg: { size: 24, lineHeight: 1.4 }
|
|
84
|
+
* };
|
|
85
|
+
*
|
|
86
|
+
* generateTextStyles(TEXT_BASE_SIZES, 'base');
|
|
87
|
+
* // Returns:
|
|
88
|
+
* // {
|
|
89
|
+
* // 'base-sm':
|
|
90
|
+
* // ['calc(16px * var(--scale-text-base))', { lineHeight: 1.5 }],
|
|
91
|
+
* // 'base-md':
|
|
92
|
+
* // ['calc(20px * var(--scale-text-base))', { lineHeight: 1.5 }],
|
|
93
|
+
* // 'base-lg':
|
|
94
|
+
* // ['calc(24px * var(--scale-text-base))', { lineHeight: 1.4 }]
|
|
95
|
+
* // }
|
|
96
|
+
*/
|
|
97
|
+
export function generateTextStyles(sizes: {
|
|
98
|
+
[key: string]: TextStyleSizes;
|
|
99
|
+
}, category: "base" | "ui" | "heading"): {
|
|
100
|
+
[key: string]: [string, {
|
|
101
|
+
lineHeight: number;
|
|
102
|
+
}];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Generates border radius styles with UI scaling
|
|
106
|
+
*
|
|
107
|
+
* @param {{[key: string]: string | {size: number}}} sizes
|
|
108
|
+
* Set of radius sizes to generate, either as:
|
|
109
|
+
* - Object with size property (e.g., { size: 10 })
|
|
110
|
+
* - Direct string value (e.g., '0px', '9999px')
|
|
111
|
+
*
|
|
112
|
+
* @returns {Object.<string, string>}
|
|
113
|
+
* Generated border radius styles in Tailwind format
|
|
114
|
+
*
|
|
115
|
+
* @throws {Error} If a value has an invalid type
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* const RADIUS_SIZES = {
|
|
119
|
+
* none: '0px',
|
|
120
|
+
* sm: { size: 10 },
|
|
121
|
+
* md: { size: 15 },
|
|
122
|
+
* full: '9999px'
|
|
123
|
+
* };
|
|
124
|
+
*
|
|
125
|
+
* generateBorderRadiusStyles(RADIUS_SIZES)
|
|
126
|
+
* // Returns:
|
|
127
|
+
* // {
|
|
128
|
+
* // 'none': '0px',
|
|
129
|
+
* // 'sm': 'calc(10px * var(--scale-ui))',
|
|
130
|
+
* // 'md': 'calc(15px * var(--scale-ui))',
|
|
131
|
+
* // 'full': '9999px'
|
|
132
|
+
* // }
|
|
133
|
+
*/
|
|
134
|
+
export function generateBorderRadiusStyles(sizes: {
|
|
135
|
+
[key: string]: string | {
|
|
136
|
+
size: number;
|
|
137
|
+
};
|
|
138
|
+
}): {
|
|
139
|
+
[x: string]: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Generates width styles for various CSS properties with UI scaling and explicit naming
|
|
143
|
+
*
|
|
144
|
+
* @param {{[key: string]: {size: number}}} sizes
|
|
145
|
+
* Set of width sizes to generate
|
|
146
|
+
*
|
|
147
|
+
* @param {string} [prefix='width']
|
|
148
|
+
* Prefix to add before each variant name (default: 'width')
|
|
149
|
+
*
|
|
150
|
+
* @param {string} scaleVar
|
|
151
|
+
* CSS variable to use for scaling (default: '--scale-ui')
|
|
152
|
+
*
|
|
153
|
+
* @returns {{[key: string]: string}}
|
|
154
|
+
* Generated width styles in Tailwind format
|
|
155
|
+
*
|
|
156
|
+
* @throws {Error} If a size has an invalid type
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* const WIDTH_SIZES = {
|
|
160
|
+
* thin: { size: 1 },
|
|
161
|
+
* normal: { size: 2 },
|
|
162
|
+
* thick: { size: 4 }
|
|
163
|
+
* };
|
|
164
|
+
*
|
|
165
|
+
* generateWidthStyles(WIDTH_SIZES, 'width')
|
|
166
|
+
* // Returns:
|
|
167
|
+
* // {
|
|
168
|
+
* // 'width-thin': 'calc(1px * var(--scale-ui))',
|
|
169
|
+
* // 'width-normal': 'calc(2px * var(--scale-ui))',
|
|
170
|
+
* // 'width-thick': 'calc(4px * var(--scale-ui))'
|
|
171
|
+
* // }
|
|
172
|
+
*/
|
|
173
|
+
export function generateWidthStyles(sizes: {
|
|
174
|
+
[key: string]: {
|
|
175
|
+
size: number;
|
|
176
|
+
};
|
|
177
|
+
}, prefix?: string, scaleVar?: string): {
|
|
178
|
+
[key: string]: string;
|
|
179
|
+
};
|
|
180
|
+
export type TextStyleSizes = {
|
|
181
|
+
size?: number;
|
|
182
|
+
lineHeight?: number | string;
|
|
183
|
+
};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates text-based spacing units with with different scaling
|
|
3
|
+
* units (ut, bt, ht)
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} values
|
|
6
|
+
* Array of pixel values to generate text-based spacing units for
|
|
7
|
+
*
|
|
8
|
+
* @returns {{[key: string]: string}}
|
|
9
|
+
* Generated text-based spacing units with ut, bt, and ht suffixes
|
|
10
|
+
*
|
|
11
|
+
* @throws {Error} If values is not an array or contains non-numeric values
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* generateTextBasedSpacing([1, 2, 4, 8])
|
|
15
|
+
* // Returns:
|
|
16
|
+
* // {
|
|
17
|
+
* // '1ut': 'calc(1px * var(--scale-text-ui))',
|
|
18
|
+
* // '2ut': 'calc(2px * var(--scale-text-ui))',
|
|
19
|
+
* // '1bt': 'calc(1px * var(--scale-text-base))',
|
|
20
|
+
* // '2bt': 'calc(2px * var(--scale-text-base))',
|
|
21
|
+
* // '1ht': 'calc(1px * var(--scale-text-heading))',
|
|
22
|
+
* // '2ht': 'calc(2px * var(--scale-text-heading))'
|
|
23
|
+
* // }
|
|
24
|
+
*/
|
|
25
|
+
export function generateTextBasedSpacing(values) {
|
|
26
|
+
if (!Array.isArray(values)) {
|
|
27
|
+
throw new Error('values must be an array');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return values.reduce((units, value) => {
|
|
31
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
32
|
+
throw new Error(`Invalid spacing value: ${value}. Must be a number.`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Generate UI text spacing units
|
|
36
|
+
units[`${value}ut`] = `calc(${value}px * var(--scale-text-ui))`;
|
|
37
|
+
|
|
38
|
+
// Generate base text spacing units
|
|
39
|
+
units[`${value}bt`] = `calc(${value}px * var(--scale-text-base))`;
|
|
40
|
+
|
|
41
|
+
// Generate heading text spacing units
|
|
42
|
+
units[`${value}ht`] = `calc(${value}px * var(--scale-text-heading))`;
|
|
43
|
+
|
|
44
|
+
return units;
|
|
45
|
+
}, {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generates viewport-based spacing units with different scaling
|
|
50
|
+
* units (up, wp, hp)
|
|
51
|
+
*
|
|
52
|
+
* @param {number[]} values
|
|
53
|
+
* Array of pixel values to generate viewport-based spacing units for
|
|
54
|
+
*
|
|
55
|
+
* @returns {Object.<string, string>}
|
|
56
|
+
* Generated viewport-based spacing units:
|
|
57
|
+
* - up: UI points (clamped scaling)
|
|
58
|
+
* - p: UI points (deprecated, will be removed in future versions)
|
|
59
|
+
* - wp: Width points
|
|
60
|
+
* - hp: Height points
|
|
61
|
+
*
|
|
62
|
+
* @throws {Error} If values is not an array or contains non-numeric values
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* generateViewportBasedSpacing([1, 2, 4])
|
|
66
|
+
* // Returns:
|
|
67
|
+
* // {
|
|
68
|
+
* // '1up': 'calc(1px * var(--scale-ui))',
|
|
69
|
+
* // '1p': 'calc(1px * var(--scale-ui))', // deprecated
|
|
70
|
+
* // '1wp': 'calc(1px * var(--scale-w))',
|
|
71
|
+
* // '1hp': 'calc(1px * var(--scale-h))'
|
|
72
|
+
* // }
|
|
73
|
+
*/
|
|
74
|
+
export function generateViewportBasedSpacing(values) {
|
|
75
|
+
if (!Array.isArray(values)) {
|
|
76
|
+
throw new Error('values must be an array');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return values.reduce((units, value) => {
|
|
80
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
81
|
+
throw new Error(`Invalid spacing value: ${value}. Must be a number.`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Width points
|
|
85
|
+
units[`${value}wp`] = `calc(${value}px * var(--scale-w))`;
|
|
86
|
+
// Height points
|
|
87
|
+
units[`${value}hp`] = `calc(${value}px * var(--scale-h))`;
|
|
88
|
+
// UI points (standard)
|
|
89
|
+
units[`${value}up`] = `calc(${value}px * var(--scale-ui))`;
|
|
90
|
+
// UI points (deprecated)
|
|
91
|
+
units[`${value}p`] = `calc(${value}px * var(--scale-ui))`;
|
|
92
|
+
return units;
|
|
93
|
+
}, {});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {{
|
|
98
|
+
* size?: number,
|
|
99
|
+
* lineHeight?: number|string
|
|
100
|
+
* }} TextStyleSizes
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Generates semantic text style definitions for a specific text category
|
|
105
|
+
* (base, UI, or heading). Each style includes a scaled font size and
|
|
106
|
+
* line height.
|
|
107
|
+
*
|
|
108
|
+
* @param {{[key: string]: TextStyleSizes}} sizes
|
|
109
|
+
* Set of text sizes to generate styles for
|
|
110
|
+
*
|
|
111
|
+
* @param {'base' | 'ui' | 'heading'} category
|
|
112
|
+
* Text category to generate styles for
|
|
113
|
+
*
|
|
114
|
+
* @returns {{[key: string]: [string, {lineHeight: number}]}}
|
|
115
|
+
* Generated text styles in Tailwind format
|
|
116
|
+
*
|
|
117
|
+
* @throws {Error} If a size has an invalid size or lineHeight
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* const TEXT_BASE_SIZES = {
|
|
121
|
+
* sm: { size: 16, lineHeight: 1.5 },
|
|
122
|
+
* md: { size: 20, lineHeight: 1.5 },
|
|
123
|
+
* lg: { size: 24, lineHeight: 1.4 }
|
|
124
|
+
* };
|
|
125
|
+
*
|
|
126
|
+
* generateTextStyles(TEXT_BASE_SIZES, 'base');
|
|
127
|
+
* // Returns:
|
|
128
|
+
* // {
|
|
129
|
+
* // 'base-sm':
|
|
130
|
+
* // ['calc(16px * var(--scale-text-base))', { lineHeight: 1.5 }],
|
|
131
|
+
* // 'base-md':
|
|
132
|
+
* // ['calc(20px * var(--scale-text-base))', { lineHeight: 1.5 }],
|
|
133
|
+
* // 'base-lg':
|
|
134
|
+
* // ['calc(24px * var(--scale-text-base))', { lineHeight: 1.4 }]
|
|
135
|
+
* // }
|
|
136
|
+
*/
|
|
137
|
+
export function generateTextStyles(sizes, category) {
|
|
138
|
+
if (!sizes || typeof sizes !== 'object') {
|
|
139
|
+
throw new Error('configs must be an object');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!['base', 'ui', 'heading'].includes(category)) {
|
|
143
|
+
throw new Error('category must be one of: base, ui, heading');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return Object.entries(sizes).reduce((result, [variant, config]) => {
|
|
147
|
+
// Validate config
|
|
148
|
+
if (!config || typeof config !== 'object') {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Invalid size config for "${variant}": must be an object`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (typeof config.size !== 'number') {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Invalid size for "${category}-${variant}": must be a number`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const extraProps = { ...config };
|
|
161
|
+
delete extraProps.size;
|
|
162
|
+
|
|
163
|
+
result[`${category}-${variant}`] = [
|
|
164
|
+
`calc(${config.size}px * var(--scale-text-${category}))`,
|
|
165
|
+
extraProps
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
return result;
|
|
169
|
+
}, {});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Generates border radius styles with UI scaling
|
|
174
|
+
*
|
|
175
|
+
* @param {{[key: string]: string | {size: number}}} sizes
|
|
176
|
+
* Set of radius sizes to generate, either as:
|
|
177
|
+
* - Object with size property (e.g., { size: 10 })
|
|
178
|
+
* - Direct string value (e.g., '0px', '9999px')
|
|
179
|
+
*
|
|
180
|
+
* @returns {Object.<string, string>}
|
|
181
|
+
* Generated border radius styles in Tailwind format
|
|
182
|
+
*
|
|
183
|
+
* @throws {Error} If a value has an invalid type
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* const RADIUS_SIZES = {
|
|
187
|
+
* none: '0px',
|
|
188
|
+
* sm: { size: 10 },
|
|
189
|
+
* md: { size: 15 },
|
|
190
|
+
* full: '9999px'
|
|
191
|
+
* };
|
|
192
|
+
*
|
|
193
|
+
* generateBorderRadiusStyles(RADIUS_SIZES)
|
|
194
|
+
* // Returns:
|
|
195
|
+
* // {
|
|
196
|
+
* // 'none': '0px',
|
|
197
|
+
* // 'sm': 'calc(10px * var(--scale-ui))',
|
|
198
|
+
* // 'md': 'calc(15px * var(--scale-ui))',
|
|
199
|
+
* // 'full': '9999px'
|
|
200
|
+
* // }
|
|
201
|
+
*/
|
|
202
|
+
export function generateBorderRadiusStyles(sizes) {
|
|
203
|
+
if (!sizes || typeof sizes !== 'object') {
|
|
204
|
+
throw new Error('sizes must be an object');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return Object.entries(sizes).reduce((result, [variant, value]) => {
|
|
208
|
+
if (typeof value === 'object' && value !== null) {
|
|
209
|
+
// Handle {size: 10} format
|
|
210
|
+
if (typeof value.size !== 'number') {
|
|
211
|
+
throw new Error(
|
|
212
|
+
`Invalid radius size for "${variant}": size must be a number`
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
result[variant] = `calc(${value.size}px * var(--scale-ui))`;
|
|
216
|
+
} else if (typeof value === 'string') {
|
|
217
|
+
// Handle direct strings (like '0px' or '9999px')
|
|
218
|
+
result[variant] = value;
|
|
219
|
+
} else {
|
|
220
|
+
throw new Error(
|
|
221
|
+
`Invalid radius value for "${variant}": ` +
|
|
222
|
+
`must be an object with size property or a string`
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
}, {});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Generates width styles for various CSS properties with UI scaling and explicit naming
|
|
231
|
+
*
|
|
232
|
+
* @param {{[key: string]: {size: number}}} sizes
|
|
233
|
+
* Set of width sizes to generate
|
|
234
|
+
*
|
|
235
|
+
* @param {string} [prefix='width']
|
|
236
|
+
* Prefix to add before each variant name (default: 'width')
|
|
237
|
+
*
|
|
238
|
+
* @param {string} scaleVar
|
|
239
|
+
* CSS variable to use for scaling (default: '--scale-ui')
|
|
240
|
+
*
|
|
241
|
+
* @returns {{[key: string]: string}}
|
|
242
|
+
* Generated width styles in Tailwind format
|
|
243
|
+
*
|
|
244
|
+
* @throws {Error} If a size has an invalid type
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const WIDTH_SIZES = {
|
|
248
|
+
* thin: { size: 1 },
|
|
249
|
+
* normal: { size: 2 },
|
|
250
|
+
* thick: { size: 4 }
|
|
251
|
+
* };
|
|
252
|
+
*
|
|
253
|
+
* generateWidthStyles(WIDTH_SIZES, 'width')
|
|
254
|
+
* // Returns:
|
|
255
|
+
* // {
|
|
256
|
+
* // 'width-thin': 'calc(1px * var(--scale-ui))',
|
|
257
|
+
* // 'width-normal': 'calc(2px * var(--scale-ui))',
|
|
258
|
+
* // 'width-thick': 'calc(4px * var(--scale-ui))'
|
|
259
|
+
* // }
|
|
260
|
+
*/
|
|
261
|
+
export function generateWidthStyles(
|
|
262
|
+
sizes,
|
|
263
|
+
prefix = 'width',
|
|
264
|
+
scaleVar = '--scale-ui'
|
|
265
|
+
) {
|
|
266
|
+
if (!sizes || typeof sizes !== 'object') {
|
|
267
|
+
throw new Error('sizes must be an object');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return Object.entries(sizes).reduce((result, [variant, value]) => {
|
|
271
|
+
if (typeof value === 'object' && value !== null) {
|
|
272
|
+
if (typeof value.size !== 'number') {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`Invalid width size for "${variant}": size must be a number`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
result[`${prefix}${prefix.length ? '-' : ''}${variant}`] =
|
|
279
|
+
`calc(${value.size}px * var(${scaleVar}))`;
|
|
280
|
+
} else {
|
|
281
|
+
throw new Error(
|
|
282
|
+
`Invalid width value for "${variant}": ` +
|
|
283
|
+
`must be an object with size property`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
}, {});
|
|
288
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isTestEnv: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
export const isTestEnv = (
|
|
3
|
+
// For Vite environments
|
|
4
|
+
(typeof import.meta !== 'undefined' && import.meta.env?.MODE === 'test') ||
|
|
5
|
+
// For Node environments, safely check process
|
|
6
|
+
(typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test') ||
|
|
7
|
+
// For Vitest specific check
|
|
8
|
+
(typeof process !== 'undefined' && process?.env?.VITEST !== undefined)
|
|
9
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new Error from the error message and throws it with a reference
|
|
3
|
+
* to the originating Error
|
|
4
|
+
* - The originating Error is set as `cause` property
|
|
5
|
+
*
|
|
6
|
+
* @param {string} message - Additional message to prepend
|
|
7
|
+
* @param {Error|string} error - Original error
|
|
8
|
+
* @param {string|Object.<string, any>} details
|
|
9
|
+
*
|
|
10
|
+
* @throws {DetailedError}
|
|
11
|
+
* @returns {never} This function never returns
|
|
12
|
+
*/
|
|
13
|
+
export function rethrow(message: string, error: Error | string, details: string | {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}): never;
|