@hkdigital/lib-core 0.3.10 → 0.3.12
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 +36 -12
- package/dist/assets/autospuiten/car-paint-picker.d.ts +7 -7
- package/dist/classes/data/IterableTree.d.ts +13 -6
- package/dist/classes/data/IterableTree.js +18 -5
- package/dist/classes/promise/HkPromise.d.ts +18 -17
- package/dist/classes/promise/HkPromise.js +135 -128
- package/dist/classes/streams/ServerEventsStore.d.ts +2 -3
- package/dist/classes/streams/ServerEventsStore.js +5 -4
- package/dist/classes/svelte/index.d.ts +0 -8
- package/dist/classes/svelte/index.js +0 -13
- package/dist/config/README.md +197 -0
- package/dist/config/generators/vite.d.ts +47 -0
- package/dist/config/generators/vite.js +148 -0
- package/dist/config/imagetools.d.ts +2 -2
- package/dist/config/vite.d.ts +1 -0
- package/dist/config/vite.js +5 -0
- package/dist/constants/regexp/README.md +96 -0
- package/dist/constants/regexp/index.d.ts +1 -1
- package/dist/constants/regexp/index.js +2 -2
- package/dist/constants/regexp/text.d.ts +6 -6
- package/dist/constants/regexp/text.js +6 -6
- package/dist/constants/regexp/url.d.ts +1 -0
- package/dist/constants/regexp/url.js +3 -0
- package/dist/constants/regexp/user.d.ts +0 -1
- package/dist/constants/regexp/user.js +6 -10
- package/dist/design/README.md +405 -0
- package/dist/design/index.d.ts +8 -0
- package/dist/design/index.js +97 -0
- package/dist/design/tailwind-theme-extend.js +4 -4
- package/dist/design/themes/README.md +103 -0
- package/dist/{themes → design/themes}/hkdev/theme-ext.js +1 -1
- package/dist/{util/design-system/css → design/utils}/clamp.js +1 -1
- package/dist/{util/design-system/css/root-design-vars.d.ts → design/utils/root-vars.d.ts} +2 -2
- package/dist/{util/design-system/css/root-design-vars.js → design/utils/root-vars.js} +3 -3
- package/dist/{util/design-system/layout → design/utils}/scaling.js +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/promise.d.ts +27 -0
- package/dist/errors/promise.js +26 -0
- package/dist/logging/README.md +158 -0
- package/dist/logging/index.d.ts +3 -1
- package/dist/logging/index.js +6 -2
- package/dist/logging/internal/adapters/console.js +1 -1
- package/dist/logging/internal/adapters/pino.js +29 -11
- package/dist/logging/internal/factories/client.d.ts +1 -1
- package/dist/logging/internal/factories/client.js +2 -2
- package/dist/logging/internal/factories/server.d.ts +1 -1
- package/dist/logging/internal/factories/server.js +2 -2
- package/dist/logging/internal/factories/universal.d.ts +2 -2
- package/dist/logging/internal/factories/universal.js +1 -1
- package/dist/logging/internal/{unified-logger → logger}/Logger.d.ts +2 -2
- package/dist/logging/internal/{unified-logger → logger}/Logger.js +3 -3
- package/dist/logging/internal/logger/index.d.ts +1 -0
- package/dist/logging/internal/logger/index.js +1 -0
- package/dist/logging/internal/{unified-logger/typedef.d.ts → typedef.d.ts} +2 -1
- package/dist/logging/internal/{unified-logger/typedef.js → typedef.js} +5 -1
- package/dist/network/README.md +173 -0
- package/dist/network/cache.d.ts +3 -0
- package/dist/network/cache.js +4 -0
- package/dist/{util → network}/http/caching.js +3 -5
- package/dist/{util → network}/http/errors.js +1 -1
- package/dist/{util → network}/http/headers.js +1 -1
- package/dist/{util → network}/http/http-request.js +2 -2
- package/dist/{util → network}/http/json-request.js +1 -1
- package/dist/{util → network}/http/response.js +1 -1
- package/dist/network/http.d.ts +6 -0
- package/dist/network/http.js +6 -0
- package/dist/network/loaders/README.md +255 -0
- package/dist/{classes/svelte → network/loaders}/audio/AudioLoader.svelte.d.ts +1 -1
- package/dist/{classes/svelte → network/loaders}/audio/AudioLoader.svelte.js +1 -1
- package/dist/{classes/svelte → network/loaders}/audio/AudioScene.svelte.js +1 -1
- package/dist/network/loaders/audio.d.ts +2 -0
- package/dist/network/loaders/audio.js +2 -0
- package/dist/{classes/svelte → network/loaders}/image/ImageLoader.svelte.d.ts +3 -6
- package/dist/{classes/svelte → network/loaders}/image/ImageLoader.svelte.js +5 -6
- package/dist/{classes/svelte → network/loaders}/image/ImageScene.svelte.d.ts +5 -7
- package/dist/{classes/svelte → network/loaders}/image/ImageScene.svelte.js +8 -9
- package/dist/{classes/svelte → network/loaders}/image/ImageVariantsLoader.svelte.d.ts +4 -4
- package/dist/{classes/svelte → network/loaders}/image/ImageVariantsLoader.svelte.js +3 -5
- package/dist/{util/image → network/loaders/image/utils}/index.d.ts +2 -2
- package/dist/{util/image → network/loaders/image/utils}/index.js +10 -10
- package/dist/network/loaders/image.d.ts +5 -0
- package/dist/network/loaders/image.js +8 -0
- package/dist/network/loaders.d.ts +2 -0
- package/dist/network/loaders.js +2 -0
- package/dist/{classes/svelte/network-loader → network/states}/NetworkLoader.svelte.d.ts +1 -1
- package/dist/{classes/svelte/network-loader → network/states}/NetworkLoader.svelte.js +4 -4
- package/dist/{classes/svelte/network-loader → network/states}/mocks.js +2 -2
- package/dist/network/typedef.d.ts +4 -0
- package/dist/network/typedef.js +10 -0
- package/dist/services/README.md +200 -0
- package/dist/services/index.d.ts +6 -1
- package/dist/services/index.js +8 -1
- package/dist/services/{internal/service-base → service-base}/ServiceBase.d.ts +2 -2
- package/dist/services/{internal/service-base → service-base}/ServiceBase.js +2 -2
- package/dist/services/{internal/service-base → service-base}/constants.d.ts +0 -12
- package/dist/services/{internal/service-base → service-base}/constants.js +0 -12
- package/dist/services/{internal/service-base → service-base}/typedef.d.ts +1 -1
- package/dist/services/{internal/service-base → service-base}/typedef.js +1 -1
- package/dist/services/{internal/service-manager → service-manager}/ServiceManager.d.ts +2 -2
- package/dist/services/{internal/service-manager → service-manager}/ServiceManager.js +2 -2
- package/dist/typedef/index.d.ts +0 -1
- package/dist/typedef/index.js +1 -1
- package/dist/{components → ui/components}/button-group/ButtonGroup.svelte +1 -1
- package/dist/{components → ui/components}/game-box/GameBox.svelte +1 -1
- package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +6 -0
- package/dist/{components → ui/components}/hk-app-layout/HkAppLayout.state.svelte.js +1 -1
- package/dist/{components → ui/components}/hk-app-layout/HkAppLayout.svelte +1 -1
- package/dist/{components → ui/components}/image-box/ImageBox.svelte +14 -14
- package/dist/{components → ui/components}/image-box/ImageBox.svelte.d.ts +6 -6
- package/dist/{components → ui/components}/image-box/index.js +1 -1
- package/dist/{components → ui/components}/presenter/ImageSlide.svelte +2 -2
- package/dist/{components → ui/components}/presenter/ImageSlide.svelte.d.ts +2 -2
- package/dist/{components → ui/components}/presenter/Presenter.state.svelte.d.ts +1 -1
- package/dist/{components → ui/components}/presenter/Presenter.state.svelte.js +2 -2
- package/dist/{components → ui/components}/presenter/util.js +2 -2
- package/dist/{components → ui/components}/virtual-viewport/VirtualViewport.svelte +1 -1
- package/dist/{primitives → ui/primitives}/buttons/button/Button.svelte +1 -1
- package/dist/{primitives → ui/primitives}/buttons/button/Button.svelte.d.ts +1 -1
- package/dist/{primitives → ui/primitives}/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +2 -2
- package/dist/{primitives → ui/primitives}/drag-drop/DragDropContext.svelte +1 -1
- package/dist/{primitives → ui/primitives}/drag-drop/DragDropContext.svelte.d.ts +1 -1
- package/dist/{primitives → ui/primitives}/drag-drop/Draggable.svelte +4 -4
- package/dist/{primitives → ui/primitives}/drag-drop/Draggable.svelte.d.ts +1 -1
- package/dist/{primitives → ui/primitives}/drag-drop/DropZone.svelte +6 -6
- package/dist/{primitives → ui/primitives}/drag-drop/DropZone.svelte.d.ts +3 -3
- package/dist/{primitives → ui/primitives}/drag-drop/DropZoneArea.svelte +3 -3
- package/dist/{primitives → ui/primitives}/drag-drop/DropZoneArea.svelte.d.ts +3 -3
- package/dist/{primitives → ui/primitives}/drag-drop/DropZoneList.svelte +3 -3
- package/dist/{primitives → ui/primitives}/drag-drop/DropZoneList.svelte.d.ts +3 -3
- package/dist/{primitives → ui/primitives}/drag-drop/drag-state.svelte.d.ts +11 -11
- package/dist/{primitives → ui/primitives}/drag-drop/drag-state.svelte.js +5 -5
- package/dist/{primitives → ui/primitives}/inputs/text-input/TextInput.svelte +1 -1
- package/dist/{primitives → ui/primitives}/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
- package/dist/{primitives → ui/primitives}/tab-bar/HkTabBar.state.svelte.js +2 -2
- package/dist/{primitives → ui/primitives}/tab-bar/HkTabBarSelector.state.svelte.d.ts +3 -3
- package/dist/{primitives → ui/primitives}/tab-bar/HkTabBarSelector.state.svelte.js +2 -2
- package/dist/util/exceptions/index.d.ts +4 -3
- package/dist/util/exceptions/index.js +9 -6
- package/dist/util/expect/url.d.ts +6 -6
- package/dist/util/expect/url.js +17 -17
- package/dist/util/iterate/index.d.ts +4 -4
- package/dist/util/iterate/index.js +2 -2
- package/dist/valibot/README.md +61 -0
- package/dist/valibot/index.d.ts +4 -4
- package/dist/valibot/index.js +4 -5
- package/dist/valibot/parsers/email.d.ts +12 -0
- package/dist/valibot/parsers/email.js +34 -0
- package/dist/valibot/{url.d.ts → parsers/url.d.ts} +13 -5
- package/dist/valibot/{url.js → parsers/url.js} +22 -6
- package/dist/valibot/{user.js → parsers/user.js} +2 -2
- package/dist/valibot/parsers.d.ts +2 -0
- package/dist/valibot/parsers.js +4 -0
- package/package.json +3 -5
- package/dist/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +0 -6
- package/dist/constants/regexp/web.d.ts +0 -1
- package/dist/constants/regexp/web.js +0 -3
- package/dist/logging/internal/unified-logger/index.d.ts +0 -3
- package/dist/logging/internal/unified-logger/index.js +0 -6
- package/dist/schemas/index.d.ts +0 -1
- package/dist/schemas/index.js +0 -1
- package/dist/schemas/validate-url.d.ts +0 -30
- package/dist/schemas/validate-url.js +0 -180
- package/dist/services/internal/index.d.ts +0 -6
- package/dist/services/internal/index.js +0 -8
- package/dist/themes/index.d.ts +0 -1
- package/dist/themes/index.js +0 -1
- package/dist/util/design-system/index.d.ts +0 -5
- package/dist/util/design-system/index.js +0 -5
- package/dist/zod/all.d.ts +0 -6
- package/dist/zod/all.js +0 -33
- package/dist/zod/generic.d.ts +0 -6
- package/dist/zod/generic.js +0 -11
- package/dist/zod/javascript.d.ts +0 -8
- package/dist/zod/javascript.js +0 -32
- package/dist/zod/user.d.ts +0 -9
- package/dist/zod/user.js +0 -16
- package/dist/zod/web.d.ts +0 -21
- package/dist/zod/web.js +0 -52
- /package/dist/config/{imagetools-config.d.ts → generators/imagetools.d.ts} +0 -0
- /package/dist/config/{imagetools-config.js → generators/imagetools.js} +0 -0
- /package/dist/design/{design-config.d.ts → config/design-config.d.ts} +0 -0
- /package/dist/design/{design-config.js → config/design-config.js} +0 -0
- /package/dist/{util/design-system/tailwind.d.ts → design/generators/index.d.ts} +0 -0
- /package/dist/{util/design-system/tailwind.js → design/generators/index.js} +0 -0
- /package/dist/{util/design-system → design/plugins}/skeleton.d.ts +0 -0
- /package/dist/{util/design-system → design/plugins}/skeleton.js +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/blocks/text-block.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/boxes/game-box.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/buttons/button-icon-steeze.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/buttons/button-text.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/buttons/button.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/buttons/skip-button.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/drag-drop/draggable.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/drag-drop/drop-zone.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/icons/icon-steeze.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/inputs/text-input.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/panels/panel.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/rows/panel-grid-row.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components/rows/panel-row-2.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/components.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/debug.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/global/layout.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/global/on-colors.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/globals.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/responsive.css +0 -0
- /package/dist/{themes → design/themes}/hkdev/theme-ext.d.ts +0 -0
- /package/dist/{themes → design/themes}/hkdev/theme.css +0 -0
- /package/dist/{util/design-system/css → design/utils}/clamp.d.ts +0 -0
- /package/dist/{util/design-system/layout → design/utils}/scaling.d.ts +0 -0
- /package/dist/{util/design-system/components → design/utils}/states.d.ts +0 -0
- /package/dist/{util/design-system/components → design/utils}/states.js +0 -0
- /package/dist/logging/internal/{unified-logger/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/logging/internal/{unified-logger/constants.js → constants.js} +0 -0
- /package/dist/{classes → network}/cache/IndexedDbCache.d.ts +0 -0
- /package/dist/{classes → network}/cache/IndexedDbCache.js +0 -0
- /package/dist/{classes → network}/cache/MemoryResponseCache.d.ts +0 -0
- /package/dist/{classes → network}/cache/MemoryResponseCache.js +0 -0
- /package/dist/{classes → network}/cache/index.d.ts +0 -0
- /package/dist/{classes → network}/cache/index.js +0 -0
- /package/dist/{classes → network}/cache/typedef.d.ts +0 -0
- /package/dist/{classes → network}/cache/typedef.js +0 -0
- /package/dist/{util → network}/http/caching.d.ts +0 -0
- /package/dist/{util → network}/http/errors.d.ts +0 -0
- /package/dist/{util → network}/http/headers.d.ts +0 -0
- /package/dist/{util → network}/http/http-request.d.ts +0 -0
- /package/dist/{util → network}/http/index.d.ts +0 -0
- /package/dist/{util → network}/http/index.js +0 -0
- /package/dist/{util → network}/http/json-request.d.ts +0 -0
- /package/dist/{util → network}/http/mocks.d.ts +0 -0
- /package/dist/{util → network}/http/mocks.js +0 -0
- /package/dist/{util → network}/http/response.d.ts +0 -0
- /package/dist/{util → network}/http/test-data__/content-length-test-hkdigital-small.V4HfZyBQ.avif +0 -0
- /package/dist/{util → network}/http/typedef.d.ts +0 -0
- /package/dist/{util → network}/http/typedef.js +0 -0
- /package/dist/{util → network}/http/url.d.ts +0 -0
- /package/dist/{util → network}/http/url.js +0 -0
- /package/dist/{classes/svelte → network/loaders}/audio/AudioScene.svelte.d.ts +0 -0
- /package/dist/{classes/svelte → network/loaders}/audio/mocks.d.ts +0 -0
- /package/dist/{classes/svelte → network/loaders}/audio/mocks.js +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/index.d.ts +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/index.js +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/mocks.d.ts +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/mocks.js +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/typedef.d.ts +0 -0
- /package/dist/{classes/svelte → network/loaders}/image/typedef.js +0 -0
- /package/dist/{typedef/image.d.ts → network/loaders/typedef.d.ts} +0 -0
- /package/dist/{typedef/image.js → network/loaders/typedef.js} +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/constants.d.ts +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/constants.js +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/index.d.ts +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/index.js +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/mocks.d.ts +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/typedef.d.ts +0 -0
- /package/dist/{classes/svelte/network-loader → network/states}/typedef.js +0 -0
- /package/dist/services/{internal/service-base → service-base}/index.d.ts +0 -0
- /package/dist/services/{internal/service-base → service-base}/index.js +0 -0
- /package/dist/services/{internal/service-manager → service-manager}/constants.d.ts +0 -0
- /package/dist/services/{internal/service-manager → service-manager}/constants.js +0 -0
- /package/dist/services/{internal/service-manager → service-manager}/typedef.d.ts +0 -0
- /package/dist/services/{internal/service-manager → service-manager}/typedef.js +0 -0
- /package/dist/{components → ui/components}/button-group/ButtonGroup.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/button-group/typedef.d.ts +0 -0
- /package/dist/{components → ui/components}/button-group/typedef.js +0 -0
- /package/dist/{components → ui/components}/compare-left-right/CompareLeftRight.svelte +0 -0
- /package/dist/{components → ui/components}/compare-left-right/CompareLeftRight.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/compare-left-right/index.d.ts +0 -0
- /package/dist/{components → ui/components}/compare-left-right/index.js +0 -0
- /package/dist/{components → ui/components}/game-box/GameBox.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/game-box/gamebox.util.d.ts +0 -0
- /package/dist/{components → ui/components}/game-box/gamebox.util.js +0 -0
- /package/dist/{components → ui/components}/hk-app-layout/HkAppLayout.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/image-box/index.d.ts +0 -0
- /package/dist/{components → ui/components}/image-box/typedef.d.ts +0 -0
- /package/dist/{components → ui/components}/image-box/typedef.js +0 -0
- /package/dist/{components → ui/components}/index.d.ts +0 -0
- /package/dist/{components → ui/components}/index.js +0 -0
- /package/dist/{components → ui/components}/presenter/Presenter.svelte +0 -0
- /package/dist/{components → ui/components}/presenter/Presenter.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/presenter/constants.d.ts +0 -0
- /package/dist/{components → ui/components}/presenter/constants.js +0 -0
- /package/dist/{components → ui/components}/presenter/index.d.ts +0 -0
- /package/dist/{components → ui/components}/presenter/index.js +0 -0
- /package/dist/{components → ui/components}/presenter/typedef.d.ts +0 -0
- /package/dist/{components → ui/components}/presenter/typedef.js +0 -0
- /package/dist/{components → ui/components}/presenter/util.d.ts +0 -0
- /package/dist/{components → ui/components}/virtual-viewport/VirtualViewport.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/area/HkArea.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/area/HkArea.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/area/HkGridArea.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/area/HkGridArea.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/area/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/area/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/button-icon-steeze/SteezeIconButton.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/button-icon-steeze/SteezeIconButton.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/button-text/TextButton.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/button-text/TextButton.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/buttons/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/debug/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/debug/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/DragController.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/DragController.js +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/actions.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/actions.js +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/util.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/drag-drop/util.js +0 -0
- /package/dist/{primitives → ui/primitives}/hkdev/blocks/TextBlock.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/hkdev/blocks/TextBlock.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/hkdev/buttons/CheckButton.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/hkdev/buttons/CheckButton.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/HkIcon.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/icons/HkIcon.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/HkTabIcon.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/icons/HkTabIcon.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/SteezeIcon.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/icons/SteezeIcon.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/icons/typedef.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/icons/typedef.js +0 -0
- /package/dist/{primitives → ui/primitives}/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/TestTextInput.svelte__ +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/TextInput.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/TextInput.svelte___ +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/assets/IconInvalid.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/assets/IconInvalid.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/assets/IconValid.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/inputs/text-input/assets/IconValid.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/layout/grid-layers/GridLayers.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/layout/grid-layers/GridLayers.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/layout/grid-layers/GridLayers.svelte__heightFrom__ +0 -0
- /package/dist/{primitives → ui/primitives}/layout/grid-layers/util.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/layout/grid-layers/util.js +0 -0
- /package/dist/{primitives → ui/primitives}/layout/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/layout/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/panels/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/panels/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/panels/panel/Panel.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/panels/panel/Panel.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/rows/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/rows/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/rows/panel-grid-row/PanelGridRow.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/rows/panel-grid-row/PanelGridRow.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/rows/panel-row-2/PanelRow2.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/rows/panel-row-2/PanelRow2.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/HkTabBar.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/HkTabBar.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/HkTabBarSelector.svelte +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/HkTabBarSelector.svelte.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/index.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/index.js +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/typedef.d.ts +0 -0
- /package/dist/{primitives → ui/primitives}/tab-bar/typedef.js +0 -0
- /package/dist/valibot/{date.js__ → parsers/date.js__} +0 -0
- /package/dist/valibot/{user.d.ts → parsers/user.d.ts} +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Config
|
|
2
|
+
|
|
3
|
+
Reusable configuration generators for HKdigital projects.
|
|
4
|
+
|
|
5
|
+
## Vite Configuration
|
|
6
|
+
|
|
7
|
+
The `vite.js` provides generators for common Vite setups used across HKdigital projects.
|
|
8
|
+
|
|
9
|
+
### Quick Start
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
// vite.config.js
|
|
13
|
+
import { defineConfig } from 'vitest/config';
|
|
14
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
15
|
+
import { generateViteConfig } from '@hkdigital/lib-sveltekit/config/vite.js';
|
|
16
|
+
|
|
17
|
+
export default defineConfig(
|
|
18
|
+
await generateViteConfig({
|
|
19
|
+
enableImagetools: true
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Functions
|
|
25
|
+
|
|
26
|
+
#### `generateViteConfig(options)`
|
|
27
|
+
|
|
28
|
+
Generates a complete Vite configuration with HKdigital defaults.
|
|
29
|
+
|
|
30
|
+
**Options:**
|
|
31
|
+
- `enableImagetools` (boolean, default: `true`) - Include vite-imagetools plugin
|
|
32
|
+
- `enableVitest` (boolean, default: `true`) - Include Vitest test configuration
|
|
33
|
+
- `enableSvelteKit` (boolean, default: `true`) - Include SvelteKit plugin
|
|
34
|
+
- `customDefines` (object, default: `{}`) - Additional define values
|
|
35
|
+
- `customPlugins` (array, default: `[]`) - Additional Vite plugins
|
|
36
|
+
- `imagetoolsOptions` (object, default: `{}`) - Options passed to imagetools config
|
|
37
|
+
- `packageJsonPath` (string, default: `'./package.json'`) - Path to package.json
|
|
38
|
+
|
|
39
|
+
**Built-in defines:**
|
|
40
|
+
- `import.meta.env.VITE_APP_VERSION` - Version from package.json
|
|
41
|
+
- `import.meta.env.VITE_BUILD_TIMESTAMP` - Build timestamp
|
|
42
|
+
|
|
43
|
+
**Example:**
|
|
44
|
+
```javascript
|
|
45
|
+
export default defineConfig(
|
|
46
|
+
await generateViteConfig({
|
|
47
|
+
enableImagetools: true,
|
|
48
|
+
enableVitest: true,
|
|
49
|
+
customDefines: {
|
|
50
|
+
'import.meta.env.VITE_API_URL': JSON.stringify('https://api.example.com')
|
|
51
|
+
},
|
|
52
|
+
imagetoolsOptions: {
|
|
53
|
+
widths: [640, 1024, 1536, 1920]
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### `generateViteDefines(options)`
|
|
60
|
+
|
|
61
|
+
Generates only the define configuration (no plugins).
|
|
62
|
+
|
|
63
|
+
**Options:**
|
|
64
|
+
- `packageJsonPath` (string, default: `'./package.json'`) - Path to package.json
|
|
65
|
+
- `customDefines` (object, default: `{}`) - Additional define values
|
|
66
|
+
|
|
67
|
+
**Example:**
|
|
68
|
+
```javascript
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
plugins: [sveltekit()],
|
|
71
|
+
define: generateViteDefines({
|
|
72
|
+
customDefines: {
|
|
73
|
+
'import.meta.env.VITE_API_URL': JSON.stringify(process.env.API_URL)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### `generateVitestConfig(options)`
|
|
80
|
+
|
|
81
|
+
Generates only the Vitest test configuration.
|
|
82
|
+
|
|
83
|
+
**Options:**
|
|
84
|
+
- `additionalPatterns` (array, default: `[]`) - Additional test file patterns
|
|
85
|
+
|
|
86
|
+
**Example:**
|
|
87
|
+
```javascript
|
|
88
|
+
export default defineConfig({
|
|
89
|
+
plugins: [sveltekit()],
|
|
90
|
+
test: generateVitestConfig({
|
|
91
|
+
additionalPatterns: ['tests/**/*.integration.js']
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Imagetools Configuration
|
|
97
|
+
|
|
98
|
+
When `enableImagetools: true`, the following dependencies are required in your project:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm add -D vite-imagetools
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### TypeScript Support
|
|
105
|
+
|
|
106
|
+
For TypeScript and JavaScript projects using VS Code or other TypeScript-aware editors, add to your `app.d.ts`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import '@hkdigital/lib-sveltekit/config/imagetools.d.ts';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Why this is needed:**
|
|
113
|
+
- Provides type definitions for image imports with query parameters (e.g., `hero.jpg?preset=photo`)
|
|
114
|
+
- Enables IntelliSense and autocompletion for imagetools directives in your editor
|
|
115
|
+
- Prevents TypeScript errors when importing processed images
|
|
116
|
+
- Works for both TypeScript and JavaScript projects (VS Code uses TypeScript for JS intellisense)
|
|
117
|
+
|
|
118
|
+
**What it enables:**
|
|
119
|
+
```javascript
|
|
120
|
+
// These imports will have proper typing and editor support
|
|
121
|
+
import heroImage from '$lib/assets/hero.jpg?preset=photo';
|
|
122
|
+
import heroResponsive from '$lib/assets/hero.jpg?preset=photo&responsive';
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Image Usage
|
|
126
|
+
|
|
127
|
+
With imagetools enabled, you can use images with processing directives:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Basic usage
|
|
131
|
+
import heroImage from '$lib/assets/hero.jpg?preset=photo';
|
|
132
|
+
|
|
133
|
+
// Responsive images
|
|
134
|
+
import heroResponsive from '$lib/assets/hero.jpg?preset=photo&responsive';
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Available presets:**
|
|
138
|
+
- `default` - AVIF format, 90% quality
|
|
139
|
+
- `photo` - JPG format, 95% quality, returns metadata
|
|
140
|
+
- `render` - JPG format, 95% quality, returns metadata
|
|
141
|
+
- `gradient` - JPG format, 95% quality, returns metadata
|
|
142
|
+
- `drawing` - AVIF format, 90% quality, returns metadata
|
|
143
|
+
- `savedata` - AVIF format, 85% quality, returns metadata
|
|
144
|
+
- `blur` - AVIF format, 50% quality with blur effect, returns metadata
|
|
145
|
+
|
|
146
|
+
## Migration from Direct Config
|
|
147
|
+
|
|
148
|
+
### Before
|
|
149
|
+
```javascript
|
|
150
|
+
// vite.config.js
|
|
151
|
+
import { defineConfig } from 'vitest/config';
|
|
152
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
153
|
+
import { imagetools } from 'vite-imagetools';
|
|
154
|
+
import { readFileSync } from 'fs';
|
|
155
|
+
import { resolve } from 'path';
|
|
156
|
+
|
|
157
|
+
import {
|
|
158
|
+
generateDefaultDirectives,
|
|
159
|
+
generateResponseConfigs
|
|
160
|
+
} from '@hkdigital/lib-sveltekit/config/imagetools-config.js';
|
|
161
|
+
|
|
162
|
+
const packageJson = JSON.parse(
|
|
163
|
+
readFileSync(resolve('./package.json'), 'utf-8')
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
export default defineConfig({
|
|
167
|
+
plugins: [
|
|
168
|
+
sveltekit(),
|
|
169
|
+
imagetools({
|
|
170
|
+
defaultDirectives: generateDefaultDirectives(),
|
|
171
|
+
resolveConfigs: generateResponseConfigs()
|
|
172
|
+
})
|
|
173
|
+
],
|
|
174
|
+
define: {
|
|
175
|
+
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version),
|
|
176
|
+
'import.meta.env.VITE_BUILD_TIMESTAMP': JSON.stringify(new Date().toISOString())
|
|
177
|
+
},
|
|
178
|
+
test: {
|
|
179
|
+
include: [
|
|
180
|
+
'src/**/*.{test,spec}.{js,ts}',
|
|
181
|
+
'src/**/*.svelte.{test,spec}.{js,ts}'
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### After
|
|
188
|
+
```javascript
|
|
189
|
+
// vite.config.js
|
|
190
|
+
import { defineConfig } from 'vitest/config';
|
|
191
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
192
|
+
import { generateViteConfig } from '@hkdigital/lib-sveltekit/config/vite.js';
|
|
193
|
+
|
|
194
|
+
export default defineConfig(
|
|
195
|
+
await generateViteConfig()
|
|
196
|
+
);
|
|
197
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a Vite configuration object with common HKdigital settings
|
|
3
|
+
*
|
|
4
|
+
* @param {object} [options] Configuration options
|
|
5
|
+
* @param {boolean} [options.enableImagetools=true] Enable vite-imagetools plugin
|
|
6
|
+
* @param {boolean} [options.enableVitest=true] Include Vitest configuration
|
|
7
|
+
* @param {boolean} [options.enableSvelteKit=true] Enable SvelteKit plugin
|
|
8
|
+
* @param {object} [options.customDefines={}] Additional define values
|
|
9
|
+
* @param {Array} [options.customPlugins=[]] Additional Vite plugins
|
|
10
|
+
* @param {object} [options.imagetoolsOptions={}] Options for imagetools config
|
|
11
|
+
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
12
|
+
*
|
|
13
|
+
* @returns {Promise<object>} Vite configuration object
|
|
14
|
+
*/
|
|
15
|
+
export function generateViteConfig(options?: {
|
|
16
|
+
enableImagetools?: boolean;
|
|
17
|
+
enableVitest?: boolean;
|
|
18
|
+
enableSvelteKit?: boolean;
|
|
19
|
+
customDefines?: object;
|
|
20
|
+
customPlugins?: any[];
|
|
21
|
+
imagetoolsOptions?: object;
|
|
22
|
+
packageJsonPath?: string;
|
|
23
|
+
}): Promise<object>;
|
|
24
|
+
/**
|
|
25
|
+
* Generates build-time defines for Vite
|
|
26
|
+
*
|
|
27
|
+
* @param {object} [options] Configuration options
|
|
28
|
+
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
29
|
+
* @param {object} [options.customDefines={}] Additional define values
|
|
30
|
+
*
|
|
31
|
+
* @returns {object} Define configuration object
|
|
32
|
+
*/
|
|
33
|
+
export function generateViteDefines(options?: {
|
|
34
|
+
packageJsonPath?: string;
|
|
35
|
+
customDefines?: object;
|
|
36
|
+
}): object;
|
|
37
|
+
/**
|
|
38
|
+
* Generates Vitest configuration
|
|
39
|
+
*
|
|
40
|
+
* @param {object} [options] Configuration options
|
|
41
|
+
* @param {string[]} [options.additionalPatterns=[]] Additional test patterns
|
|
42
|
+
*
|
|
43
|
+
* @returns {object} Vitest configuration object
|
|
44
|
+
*/
|
|
45
|
+
export function generateVitestConfig(options?: {
|
|
46
|
+
additionalPatterns?: string[];
|
|
47
|
+
}): object;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates a Vite configuration object with common HKdigital settings
|
|
6
|
+
*
|
|
7
|
+
* @param {object} [options] Configuration options
|
|
8
|
+
* @param {boolean} [options.enableImagetools=true] Enable vite-imagetools plugin
|
|
9
|
+
* @param {boolean} [options.enableVitest=true] Include Vitest configuration
|
|
10
|
+
* @param {boolean} [options.enableSvelteKit=true] Enable SvelteKit plugin
|
|
11
|
+
* @param {object} [options.customDefines={}] Additional define values
|
|
12
|
+
* @param {Array} [options.customPlugins=[]] Additional Vite plugins
|
|
13
|
+
* @param {object} [options.imagetoolsOptions={}] Options for imagetools config
|
|
14
|
+
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<object>} Vite configuration object
|
|
17
|
+
*/
|
|
18
|
+
export async function generateViteConfig(options = {}) {
|
|
19
|
+
const {
|
|
20
|
+
enableImagetools = true,
|
|
21
|
+
enableVitest = true,
|
|
22
|
+
enableSvelteKit = true,
|
|
23
|
+
customDefines = {},
|
|
24
|
+
customPlugins = [],
|
|
25
|
+
imagetoolsOptions = {},
|
|
26
|
+
packageJsonPath = './package.json'
|
|
27
|
+
} = options;
|
|
28
|
+
|
|
29
|
+
// Read package.json for version
|
|
30
|
+
const packageJson = JSON.parse(
|
|
31
|
+
readFileSync(resolve(packageJsonPath), 'utf-8')
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const plugins = [...customPlugins];
|
|
35
|
+
|
|
36
|
+
// Add SvelteKit plugin (provides $lib alias and other SvelteKit features)
|
|
37
|
+
if (enableSvelteKit) {
|
|
38
|
+
try {
|
|
39
|
+
const { sveltekit } = await import('@sveltejs/kit/vite');
|
|
40
|
+
plugins.push(sveltekit());
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(error);
|
|
43
|
+
console.warn(
|
|
44
|
+
'@sveltejs/kit/vite not found. Install it to enable SvelteKit support.'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Conditionally add imagetools
|
|
50
|
+
if (enableImagetools) {
|
|
51
|
+
try {
|
|
52
|
+
const { imagetools } = await import('vite-imagetools');
|
|
53
|
+
const {
|
|
54
|
+
generateDefaultDirectives,
|
|
55
|
+
generateResponseConfigs
|
|
56
|
+
} = await import('./imagetools.js');
|
|
57
|
+
|
|
58
|
+
plugins.push(
|
|
59
|
+
imagetools({
|
|
60
|
+
defaultDirectives: generateDefaultDirectives(imagetoolsOptions),
|
|
61
|
+
resolveConfigs: generateResponseConfigs(imagetoolsOptions)
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
const errorMessage = `
|
|
66
|
+
╭─────────────────────────────────────────────────────────────╮
|
|
67
|
+
│ Missing Dependency │
|
|
68
|
+
├─────────────────────────────────────────────────────────────┤
|
|
69
|
+
│ 'vite-imagetools' is required when enableImagetools: true │
|
|
70
|
+
│ Install it with: pnpm add -D vite-imagetools │
|
|
71
|
+
│ Or set enableImagetools: false │
|
|
72
|
+
╰─────────────────────────────────────────────────────────────╯`;
|
|
73
|
+
console.error(errorMessage);
|
|
74
|
+
throw new Error('vite-imagetools is required when enableImagetools: true');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const config = {
|
|
79
|
+
plugins,
|
|
80
|
+
define: {
|
|
81
|
+
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version),
|
|
82
|
+
'import.meta.env.VITE_BUILD_TIMESTAMP': JSON.stringify(
|
|
83
|
+
new Date().toISOString()
|
|
84
|
+
),
|
|
85
|
+
...customDefines
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (enableVitest) {
|
|
90
|
+
config.test = {
|
|
91
|
+
include: [
|
|
92
|
+
'src/**/*.{test,spec}.{js,ts}',
|
|
93
|
+
'src/**/*.svelte.{test,spec}.{js,ts}'
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return config;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Generates build-time defines for Vite
|
|
103
|
+
*
|
|
104
|
+
* @param {object} [options] Configuration options
|
|
105
|
+
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
106
|
+
* @param {object} [options.customDefines={}] Additional define values
|
|
107
|
+
*
|
|
108
|
+
* @returns {object} Define configuration object
|
|
109
|
+
*/
|
|
110
|
+
export function generateViteDefines(options = {}) {
|
|
111
|
+
const {
|
|
112
|
+
packageJsonPath = './package.json',
|
|
113
|
+
customDefines = {}
|
|
114
|
+
} = options;
|
|
115
|
+
|
|
116
|
+
const packageJson = JSON.parse(
|
|
117
|
+
readFileSync(resolve(packageJsonPath), 'utf-8')
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version),
|
|
122
|
+
'import.meta.env.VITE_BUILD_TIMESTAMP': JSON.stringify(
|
|
123
|
+
new Date().toISOString()
|
|
124
|
+
),
|
|
125
|
+
...customDefines
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Generates Vitest configuration
|
|
131
|
+
*
|
|
132
|
+
* @param {object} [options] Configuration options
|
|
133
|
+
* @param {string[]} [options.additionalPatterns=[]] Additional test patterns
|
|
134
|
+
*
|
|
135
|
+
* @returns {object} Vitest configuration object
|
|
136
|
+
*/
|
|
137
|
+
export function generateVitestConfig(options = {}) {
|
|
138
|
+
const { additionalPatterns = [] } = options;
|
|
139
|
+
|
|
140
|
+
const defaultPatterns = [
|
|
141
|
+
'src/**/*.{test,spec}.{js,ts}',
|
|
142
|
+
'src/**/*.svelte.{test,spec}.{js,ts}'
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
include: [...defaultPatterns, ...additionalPatterns]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type ImageMeta = import('../typedef').ImageMeta;
|
|
2
|
-
type ImageSource = import('../typedef').ImageSource;
|
|
1
|
+
type ImageMeta = import('../network/typedef.js').ImageMeta;
|
|
2
|
+
type ImageSource = import('../network/typedef.js').ImageSource;
|
|
3
3
|
|
|
4
4
|
declare module '*?responsive' {
|
|
5
5
|
const out: ImageMeta[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { generateViteConfig, generateViteDefines, generateVitestConfig } from "./generators/vite.js";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Regular Expression Constants
|
|
2
|
+
|
|
3
|
+
This directory contains regular expression patterns and components for validating text, user data, and URL formats.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
All regular expressions use the `v` flag (Unicode Sets mode) for consistent Unicode support and advanced character class operations.
|
|
8
|
+
|
|
9
|
+
## Unicode Property Escapes
|
|
10
|
+
|
|
11
|
+
### Character Types
|
|
12
|
+
|
|
13
|
+
- **Letter (any language)**: `\p{L}`
|
|
14
|
+
- **Letter (Latin only)**: `\p{Script=Latin}`
|
|
15
|
+
- **Number (any language)**: `\p{N}`
|
|
16
|
+
- **Number (decimal digits only)**: `\p{Nd}` - excludes roman numerals
|
|
17
|
+
|
|
18
|
+
### Available Constants
|
|
19
|
+
|
|
20
|
+
From `text.js`:
|
|
21
|
+
- `LCHAR` - Latin script characters: `\p{Script=Latin}`
|
|
22
|
+
- `LNUMBER` - Latin decimal digits: `[0-9]`
|
|
23
|
+
- `LCHAR_LNUMBER` - Combination of Latin characters and Latin decimal numbers
|
|
24
|
+
- `EMOJI` - RGI Emoji: `\p{RGI_Emoji}`
|
|
25
|
+
- `PUNCT` - Basic punctuation marks: `\p{Punctuation}`
|
|
26
|
+
- `PUNCT_RICH` - All Unicode punctuation: `\p{P}`
|
|
27
|
+
|
|
28
|
+
## Usage Examples
|
|
29
|
+
|
|
30
|
+
### Basic Usage
|
|
31
|
+
```js
|
|
32
|
+
import { LCHAR, LNUMBER } from '$lib/constants/regexp/text.js';
|
|
33
|
+
|
|
34
|
+
// Use with 'v' flag for Unicode Sets mode
|
|
35
|
+
const re = new RegExp(`^(?:${LCHAR}|${LNUMBER})+$`, 'v');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Character Classes vs Groups
|
|
39
|
+
```js
|
|
40
|
+
// ❌ Don't use Unicode properties in character classes with 'v' flag
|
|
41
|
+
const invalid = new RegExp(`^[${LCHAR}]$`, 'v'); // Error
|
|
42
|
+
|
|
43
|
+
// ✅ Use non-capturing groups instead
|
|
44
|
+
const valid = new RegExp(`^(?:${LCHAR})$`, 'v'); // Works
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Flag Usage
|
|
48
|
+
|
|
49
|
+
### The `v` Flag (Unicode Sets Mode)
|
|
50
|
+
- Enables advanced Unicode support
|
|
51
|
+
- Supports set operations: `[A--B]`, `[A&&B]`, `[A||B]`
|
|
52
|
+
- Better emoji and complex Unicode sequence handling
|
|
53
|
+
- Stricter syntax requirements than `u` flag
|
|
54
|
+
|
|
55
|
+
### RGI Emoji Support
|
|
56
|
+
The `v` flag enables support for "Recommended for General Interchange" emoji, allowing matching of emoji regardless of their internal code point complexity.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
const emojiPattern = new RegExp(`^(?:${EMOJI})$`, 'v');
|
|
60
|
+
emojiPattern.test('😄'); // true
|
|
61
|
+
emojiPattern.test('👨🏾⚕️'); // true (complex multi-codepoint emoji)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## File Structure
|
|
65
|
+
|
|
66
|
+
- `text.js` - Basic Unicode character type constants
|
|
67
|
+
- `user.js` - User data validation patterns (names, usernames, etc.)
|
|
68
|
+
- `url.js` - URL and slug validation patterns
|
|
69
|
+
- `index.js` - Exports all regexp constants
|
|
70
|
+
- `*.test.js` - Test files for each module
|
|
71
|
+
|
|
72
|
+
## Validation Patterns
|
|
73
|
+
|
|
74
|
+
### User Data (user.js)
|
|
75
|
+
- `RE_NAME` - Personal names with Latin characters
|
|
76
|
+
- `RE_FULLNAME` - Full names with space separators
|
|
77
|
+
- `RE_SURNAME` - Surnames with optional prefixes
|
|
78
|
+
- `RE_USERNAME` - Usernames with alphanumeric and limited special characters
|
|
79
|
+
- `RE_PHONENUMBER` - Phone number formats
|
|
80
|
+
|
|
81
|
+
### URL Data (url.js)
|
|
82
|
+
- `URL_SLUG` - URL-safe slugs for paths (e.g., "my-blog-post")
|
|
83
|
+
|
|
84
|
+
## Browser Support
|
|
85
|
+
|
|
86
|
+
The `v` flag requires modern browser support:
|
|
87
|
+
- Chrome 112+ (March 2023)
|
|
88
|
+
- Firefox 116+ (August 2023)
|
|
89
|
+
- Safari 17+ (September 2023)
|
|
90
|
+
- Node.js 20+ (April 2023)
|
|
91
|
+
|
|
92
|
+
## References
|
|
93
|
+
|
|
94
|
+
- [Unicode Character Properties](https://en.wikipedia.org/wiki/Unicode_character_property#General_Category)
|
|
95
|
+
- [RegExp v flag specification](https://v8.dev/features/regexp-v-flag)
|
|
96
|
+
- [MDN Unicode character class escape](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* such a some emoji, you must use the flag 'v'.
|
|
13
13
|
*
|
|
14
14
|
* @eg
|
|
15
|
-
* const re = new RegExp('^
|
|
15
|
+
* const re = new RegExp('^(?:${Latin_Number})', 'v');
|
|
16
16
|
*
|
|
17
17
|
* @eg
|
|
18
18
|
* const re = new RegExp('^[${Symbols_Emoji}]', 'v');
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export * from './text.js';
|
|
30
30
|
export * from './user.js';
|
|
31
|
-
export * from './
|
|
31
|
+
export * from './url.js';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* import { Latin_Char_Number as lcn } from './latin.js';
|
|
12
12
|
* export const User_Username = `^[${lcn}]+${lcn}_-]{1,38}[${lcn}]$`;
|
|
13
13
|
*
|
|
14
|
-
* const re = new RegExp('^
|
|
14
|
+
* const re = new RegExp('^(?:${Latin_Number})', 'v');
|
|
15
15
|
*
|
|
16
16
|
* Emoji:
|
|
17
17
|
*
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
* @see https://en.wikipedia.org/
|
|
40
40
|
* wiki/Unicode_character_property#General_Category
|
|
41
41
|
*/
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
42
|
+
export const LCHAR: "\\p{Script=Latin}";
|
|
43
|
+
export const LNUMBER: "[0-9]";
|
|
44
|
+
export const LCHAR_LNUMBER: "\\p{Script=Latin}|[0-9]";
|
|
45
45
|
export const EMOJI: "\\p{RGI_Emoji}";
|
|
46
|
-
export const
|
|
47
|
-
export const
|
|
46
|
+
export const PUNCT: "\\p{Punctuation}";
|
|
47
|
+
export const PUNCT_RICH: "\\p{P}";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* import { Latin_Char_Number as lcn } from './latin.js';
|
|
12
12
|
* export const User_Username = `^[${lcn}]+${lcn}_-]{1,38}[${lcn}]$`;
|
|
13
13
|
*
|
|
14
|
-
* const re = new RegExp('^
|
|
14
|
+
* const re = new RegExp('^(?:${Latin_Number})', 'v');
|
|
15
15
|
*
|
|
16
16
|
* Emoji:
|
|
17
17
|
*
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
* wiki/Unicode_character_property#General_Category
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
43
|
+
export const LCHAR = '\\p{Script=Latin}';
|
|
44
|
+
export const LNUMBER = '[0-9]';
|
|
45
|
+
export const LCHAR_LNUMBER = `${LCHAR}|${LNUMBER}`;
|
|
46
46
|
|
|
47
47
|
export const EMOJI = '\\p{RGI_Emoji}';
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
48
|
+
export const PUNCT = '\\p{Punctuation}';
|
|
49
|
+
export const PUNCT_RICH = '\\p{P}';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const URL_SLUG: "^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$";
|
|
@@ -6,28 +6,24 @@
|
|
|
6
6
|
* @see https://ihateregex.io/expr/discord-username/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { LNUMBER as N, LCHAR, LCHAR_LNUMBER as CN } from './text.js';
|
|
10
10
|
|
|
11
11
|
export const RE_NAME = new RegExp(
|
|
12
|
-
`^[${
|
|
12
|
+
`^[${LCHAR}]+(([\\s'\\-\\.]{1}|[\\s]{1}[']{0,1})[${LCHAR}]+){0,8}$`, 'v'
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
export const RE_FULLNAME = new RegExp(
|
|
16
|
-
`^[${
|
|
16
|
+
`^[${LCHAR}]{2,}[\\s][']?[${LCHAR}]{1,}([\\s]?['\\-]?[${LCHAR}]{1,})*$`, 'v'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
export const RE_SURNAME = new RegExp(
|
|
20
|
-
`^[']?[${
|
|
20
|
+
`^[']?[${LCHAR}]{1,}([\\s]?['\\-]?[${LCHAR}]{1,})*$`, 'v'
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
export const RE_USERNAME = new RegExp(
|
|
24
|
-
`^
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export const RE_EMAIL = new RegExp(
|
|
28
|
-
`[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+`, 'v'
|
|
24
|
+
`^(?:${CN}){2,40}([\\-_\\.](?:${CN}){1,40}){0,3}([#](?:${N}){1,10}){0,1}$`, 'v'
|
|
29
25
|
);
|
|
30
26
|
|
|
31
27
|
export const RE_PHONENUMBER = new RegExp(
|
|
32
28
|
`^[\\+]?[\\(]?[0-9]{3}[\\)]?[\\-\\s\\.]?[0-9]{3}[\\-\\s\\.]?[0-9]{4,6}$`, 'v'
|
|
33
|
-
)
|
|
29
|
+
)
|