@hkdigital/lib-core 0.3.14 → 0.4.3
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 +18 -9
- package/dist/auth/errors.d.ts +1 -0
- package/dist/auth/errors.js +1 -0
- package/dist/{states → browser/navigation}/navigation.svelte.js +1 -1
- package/dist/browser/navigation.d.ts +1 -0
- package/dist/browser/navigation.js +1 -0
- package/dist/config/README.md +5 -5
- package/dist/config/generators/imagetools.d.ts +2 -0
- package/dist/config/generators/imagetools.js +23 -10
- package/dist/config/generators/vite.js +1 -1
- package/dist/config/imagetools.d.ts +5 -5
- package/dist/config/typedef.d.ts +11 -0
- package/dist/config/typedef.js +17 -0
- package/dist/design/README.md +211 -66
- package/dist/design/config/{design-config.d.ts → design-tokens.d.ts} +23 -10
- package/dist/design/config/design-tokens.js +107 -0
- package/dist/design/generators/index.d.ts +51 -0
- package/dist/design/generators/index.js +124 -0
- package/dist/design/index.d.ts +3 -4
- package/dist/design/index.js +24 -41
- package/dist/design/plugins/skeleton.d.ts +4 -2
- package/dist/design/plugins/skeleton.js +3 -2
- package/dist/design/themes/hkdev/components/buttons/button-text.css +38 -25
- package/dist/design/themes/hkdev/theme-ext.js +1 -1
- package/dist/design/utils/clamp.js +1 -1
- package/dist/design/utils/root-vars.d.ts +50 -39
- package/dist/design/utils/root-vars.js +127 -29
- package/dist/{classes/data → generic/data/classes}/IterableTree.js +2 -2
- package/dist/{classes/data → generic/data/classes}/Selector.js +1 -1
- package/dist/generic/data/classes/typedef.d.ts +24 -0
- package/dist/generic/data/classes/typedef.js +14 -0
- package/dist/generic/data.d.ts +2 -0
- package/dist/generic/data.js +2 -0
- package/dist/generic/errors.d.ts +2 -0
- package/dist/generic/errors.js +2 -0
- package/dist/generic/events.d.ts +1 -0
- package/dist/generic/events.js +1 -0
- package/dist/{classes/promise → generic/promises/classes}/HkPromise.d.ts +17 -7
- package/dist/{classes/promise → generic/promises/classes}/HkPromise.js +20 -10
- package/dist/generic/promises.d.ts +1 -0
- package/dist/generic/promises.js +1 -0
- package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.d.ts +1 -1
- package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.js +2 -2
- package/dist/generic/streaming.d.ts +3 -0
- package/dist/generic/streaming.js +3 -0
- package/dist/generic/typedef.d.ts +1 -0
- package/dist/generic/typedef.js +1 -0
- package/dist/index.js +1 -0
- package/dist/logging/errors.d.ts +7 -0
- package/dist/logging/errors.js +11 -0
- package/dist/logging/index.d.ts +2 -3
- package/dist/logging/index.js +3 -4
- package/dist/logging/internal/adapters/console.d.ts +1 -16
- package/dist/logging/internal/adapters/console.js +322 -14
- package/dist/logging/internal/adapters/formatting.d.ts +69 -0
- package/dist/logging/internal/adapters/formatting.js +395 -0
- package/dist/logging/internal/adapters/pino.js +128 -27
- package/dist/logging/internal/adapters/typedef.d.ts +30 -0
- package/dist/logging/internal/adapters/typedef.js +11 -0
- package/dist/logging/internal/factories/client.js +1 -1
- package/dist/logging/internal/factories/server.js +12 -2
- package/dist/logging/internal/logger/Logger.d.ts +9 -7
- package/dist/logging/internal/logger/Logger.js +44 -9
- package/dist/logging/internal/test-errors.d.ts +35 -0
- package/dist/logging/internal/test-errors.js +137 -0
- package/dist/network/cache/IndexedDbCache.d.ts +1 -1
- package/dist/network/cache/MemoryResponseCache.d.ts +5 -0
- package/dist/network/cache/MemoryResponseCache.js +5 -2
- package/dist/network/errors.d.ts +2 -0
- package/dist/network/errors.js +2 -0
- package/dist/network/http/caching.js +1 -1
- package/dist/network/http/errors.d.ts +2 -2
- package/dist/network/http/errors.js +5 -13
- package/dist/network/http/http-request.js +1 -1
- package/dist/network/http/json-request.js +1 -1
- package/dist/network/http/response.js +1 -1
- package/dist/network/http/url.js +1 -1
- package/dist/network/loaders/README.md +14 -7
- package/dist/network/loaders/audio/AudioScene.svelte.js +3 -2
- package/dist/network/loaders/image/ImageLoader.svelte.d.ts +2 -2
- package/dist/network/loaders/image/ImageLoader.svelte.js +1 -1
- package/dist/network/loaders/image/ImageScene.svelte.d.ts +2 -2
- package/dist/network/loaders/image/ImageScene.svelte.js +9 -8
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.d.ts +5 -5
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.js +14 -13
- package/dist/network/loaders/image/utils/index.d.ts +2 -2
- package/dist/network/loaders/image/utils/index.js +9 -12
- package/dist/network/loaders/typedef.d.ts +0 -9
- package/dist/network/loaders/typedef.js +0 -12
- package/dist/network/states/NetworkLoader.svelte.d.ts +1 -1
- package/dist/network/states/NetworkLoader.svelte.js +3 -2
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.js +0 -3
- package/dist/services/service-base/ServiceBase.d.ts +2 -2
- package/dist/services/service-base/ServiceBase.js +15 -11
- package/dist/services/service-base/typedef.d.ts +2 -31
- package/dist/services/service-base/typedef.js +3 -2
- package/dist/services/service-manager/ServiceManager.d.ts +3 -3
- package/dist/services/service-manager/ServiceManager.js +2 -2
- package/dist/services/service-manager/typedef.d.ts +3 -3
- package/dist/services/service-manager/typedef.js +3 -3
- package/dist/services/typedef.d.ts +2 -0
- package/dist/services/typedef.js +2 -0
- package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.d.ts +1 -1
- package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.js +1 -1
- package/dist/state/classes/subscribers-count/index.d.ts +1 -0
- package/dist/state/classes/subscribers-count/index.js +1 -0
- package/dist/state/classes.d.ts +3 -0
- package/dist/state/classes.js +3 -0
- package/dist/{util/svelte/state-context/index.d.ts → state/context/state-context.d.ts} +1 -1
- package/dist/{util/svelte/state-context/index.js → state/context/state-context.js} +4 -4
- package/dist/state/context.d.ts +1 -0
- package/dist/state/context.js +1 -0
- package/dist/state/stores.d.ts +1 -0
- package/dist/state/stores.js +1 -0
- package/dist/ui/README.md +49 -0
- package/dist/ui/components/button-group/index.d.ts +1 -0
- package/dist/ui/components/button-group/index.js +1 -0
- package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte +1 -1
- package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte +2 -2
- package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte +4 -4
- package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte.d.ts +4 -4
- package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte +3 -3
- package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.d.ts +11 -11
- package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.js +5 -5
- package/dist/ui/components/drag-drop/typedef.d.ts +2 -0
- package/dist/ui/components/drag-drop/typedef.js +2 -0
- package/dist/ui/components/game-box/GameBox.svelte +1 -1
- package/dist/ui/components/game-box/index.d.ts +1 -0
- package/dist/ui/components/game-box/index.js +1 -0
- package/dist/ui/components/grid-layers/index.d.ts +1 -0
- package/dist/ui/components/grid-layers/index.js +1 -0
- package/dist/ui/{primitives/layout → components}/grid-layers/util.js +1 -1
- package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +3 -3
- package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.js +3 -4
- package/dist/ui/components/hk-app-layout/index.d.ts +1 -0
- package/dist/ui/components/hk-app-layout/index.js +1 -0
- package/dist/ui/components/image-box/ImageBox.svelte +2 -2
- package/dist/ui/components/image-box/ImageBox.svelte.d.ts +3 -3
- package/dist/ui/components/image-box/index.d.ts +1 -1
- package/dist/ui/components/presenter/ImageSlide.svelte +1 -1
- package/dist/ui/components/presenter/ImageSlide.svelte.d.ts +2 -2
- package/dist/ui/components/presenter/Presenter.state.svelte.d.ts +3 -3
- package/dist/ui/components/presenter/Presenter.state.svelte.js +1 -1
- package/dist/ui/components/presenter/Presenter.svelte +1 -1
- package/dist/ui/components/presenter/Presenter.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte.d.ts +1 -1
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.js +4 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte +2 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte.d.ts +2 -2
- package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +19 -0
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.state.svelte.js +2 -2
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte +1 -1
- package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte.d.ts +2 -2
- package/dist/ui/{primitives → components}/tab-bar/typedef.d.ts +1 -1
- package/dist/ui/{primitives → components}/tab-bar/typedef.js +1 -1
- package/dist/ui/components/typedef.d.ts +5 -0
- package/dist/ui/components/typedef.js +5 -0
- package/dist/ui/components/virtual-viewport/index.d.ts +1 -0
- package/dist/ui/components/virtual-viewport/index.js +1 -0
- package/dist/ui/components.d.ts +11 -0
- package/dist/ui/components.js +11 -0
- package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte +1 -1
- package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +8 -8
- package/dist/ui/dev.d.ts +3 -0
- package/dist/ui/dev.js +3 -0
- package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +1 -1
- package/dist/ui/primitives/buttons/button-text/TextButton.svelte +1 -1
- package/dist/ui/primitives/typedef.d.ts +1 -0
- package/dist/ui/primitives/typedef.js +1 -0
- package/dist/ui/primitives.d.ts +5 -0
- package/dist/ui/primitives.js +5 -0
- package/dist/ui/typedef.d.ts +2 -0
- package/dist/ui/typedef.js +2 -0
- package/dist/util/array/index.js +1 -1
- package/dist/util/bases/base58.d.ts +3 -3
- package/dist/util/bases/base58.js +3 -3
- package/dist/util/compare/index.d.ts +4 -5
- package/dist/util/compare/index.js +3 -4
- package/dist/util/exceptions/index.js +1 -1
- package/dist/util/expect/arrays.d.ts +11 -11
- package/dist/util/expect/arrays.js +14 -6
- package/dist/util/expect/index.js +2 -2
- package/dist/util/expect/primitives.d.ts +6 -5
- package/dist/util/expect/primitives.js +15 -5
- package/dist/util/expect/url.d.ts +6 -5
- package/dist/util/expect/url.js +15 -5
- package/dist/util/function/index.d.ts +1 -14
- package/dist/util/index.d.ts +5 -0
- package/dist/util/index.js +13 -0
- package/dist/util/is/index.d.ts +3 -2
- package/dist/util/is/index.js +2 -1
- package/dist/util/iterate/index.d.ts +6 -8
- package/dist/util/iterate/index.js +5 -5
- package/dist/util/object/index.d.ts +1 -2
- package/dist/util/object/index.js +2 -3
- package/dist/util/ssr/index.d.ts +16 -0
- package/dist/util/ssr/index.js +44 -0
- package/dist/util/svelte/index.d.ts +1 -1
- package/dist/util/svelte/index.js +1 -1
- package/dist/util/time/index.d.ts +2 -2
- package/dist/util/time/index.js +1 -1
- package/dist/valibot/index.d.ts +1 -1
- package/dist/valibot/index.js +27 -1
- package/package.json +4 -4
- 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 +0 -17
- package/dist/assets/autospuiten/car-paint-picker.js +0 -41
- package/dist/assets/autospuiten/labels.d.ts +0 -7
- package/dist/assets/autospuiten/labels.js +0 -7
- package/dist/classes/data/index.d.ts +0 -2
- package/dist/classes/data/index.js +0 -2
- package/dist/classes/event-emitter/index.d.ts +0 -1
- package/dist/classes/event-emitter/index.js +0 -2
- package/dist/classes/index.d.ts +0 -4
- package/dist/classes/index.js +0 -4
- package/dist/classes/promise/index.d.ts +0 -1
- package/dist/classes/promise/index.js +0 -1
- package/dist/classes/stores/index.d.ts +0 -1
- package/dist/classes/stores/index.js +0 -1
- package/dist/classes/streams/index.d.ts +0 -3
- package/dist/classes/streams/index.js +0 -3
- package/dist/classes/svelte/index.d.ts +0 -1
- package/dist/classes/svelte/index.js +0 -1
- package/dist/design/config/design-config.js +0 -73
- package/dist/design/tailwind-theme-extend.d.ts +0 -23
- package/dist/design/tailwind-theme-extend.js +0 -158
- package/dist/errors/index.d.ts +0 -5
- package/dist/errors/index.js +0 -5
- package/dist/logging/internal/factories/universal.d.ts +0 -9
- package/dist/logging/internal/factories/universal.js +0 -22
- package/dist/services/service-base/index.d.ts +0 -3
- package/dist/services/service-base/index.js +0 -3
- package/dist/states/index.d.ts +0 -1
- package/dist/states/index.js +0 -1
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/typedef/index.d.ts +0 -4
- package/dist/typedef/index.js +0 -4
- package/dist/ui/primitives/debug/index.d.ts +0 -1
- package/dist/ui/primitives/debug/index.js +0 -1
- package/dist/ui/primitives/index.d.ts +0 -0
- package/dist/ui/primitives/index.js +0 -2
- package/dist/ui/primitives/layout/grid-layers/GridLayers.svelte__heightFrom__ +0 -372
- package/dist/ui/primitives/layout/index.d.ts +0 -1
- package/dist/ui/primitives/layout/index.js +0 -1
- package/dist/ui/primitives/tab-bar/HkTabBarSelector.state.svelte.d.ts +0 -19
- /package/dist/{errors → auth/errors}/jwt.d.ts +0 -0
- /package/dist/{errors → auth/errors}/jwt.js +0 -0
- /package/dist/{states → browser/navigation}/navigation.svelte.d.ts +0 -0
- /package/dist/{classes/data → generic/data/classes}/IterableTree.d.ts +0 -0
- /package/dist/{classes/data → generic/data/classes}/Selector.d.ts +0 -0
- /package/dist/{classes → generic}/data/typedef.d.ts +0 -0
- /package/dist/{classes → generic}/data/typedef.js +0 -0
- /package/dist/{errors → generic/errors}/generic.d.ts +0 -0
- /package/dist/{errors → generic/errors}/generic.js +0 -0
- /package/dist/{errors → generic/errors}/promise.d.ts +0 -0
- /package/dist/{errors → generic/errors}/promise.js +0 -0
- /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.d.ts +0 -0
- /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.js +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.d.ts +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.js +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.d.ts +0 -0
- /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.js +0 -0
- /package/dist/logging/{internal/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/logging/{internal/constants.js → constants.js} +0 -0
- /package/dist/logging/{internal/typedef.d.ts → typedef.d.ts} +0 -0
- /package/dist/logging/{internal/typedef.js → typedef.js} +0 -0
- /package/dist/{errors → network/errors}/api.d.ts +0 -0
- /package/dist/{errors → network/errors}/api.js +0 -0
- /package/dist/{errors → network/errors}/http.d.ts +0 -0
- /package/dist/{errors → network/errors}/http.js +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.js +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.js +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.js +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.d.ts +0 -0
- /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.js +0 -0
- /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.d.ts +0 -0
- /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.js +0 -0
- /package/dist/{typedef/context.d.ts → state/context/typedef.d.ts} +0 -0
- /package/dist/{typedef/context.js → state/context/typedef.js} +0 -0
- /package/dist/{stores → state/stores}/theme.d.ts +0 -0
- /package/dist/{stores → state/stores}/theme.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/DragController.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/DragController.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/actions.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/actions.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/index.js +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.d.ts +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.js +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.d.ts +0 -0
- /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.js +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/util.d.ts +0 -0
- /package/dist/ui/{primitives → components}/drag-drop/util.js +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/layout → components}/grid-layers/util.d.ts +0 -0
- /package/dist/ui/{primitives → components}/rows/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/rows/index.js +0 -0
- /package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte +0 -0
- /package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte +0 -0
- /package/dist/ui/{primitives → components}/tab-bar/index.d.ts +0 -0
- /package/dist/ui/{primitives → components}/tab-bar/index.js +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte +0 -0
- /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte.d.ts +0 -0
- /package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +0 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import * as expect from '../../../util/expect/index.js';
|
|
4
4
|
|
|
5
|
+
import { LoadingStateMachine } from '../../../state/classes.js';
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
|
-
LoadingStateMachine,
|
|
7
8
|
STATE_INITIAL,
|
|
8
9
|
STATE_LOADING,
|
|
9
10
|
STATE_UNLOADING,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
STATE_ERROR,
|
|
13
14
|
LOAD,
|
|
14
15
|
LOADED
|
|
15
|
-
} from '../../../classes/
|
|
16
|
+
} from '../../../state/classes/loading-state-machine/constants.js';
|
|
16
17
|
|
|
17
18
|
import ImageLoader from './ImageLoader.svelte.js';
|
|
18
19
|
|
|
@@ -148,7 +149,7 @@ export default class ImageScene {
|
|
|
148
149
|
*
|
|
149
150
|
* @param {object} _
|
|
150
151
|
* @param {string} _.label
|
|
151
|
-
* @param {import('
|
|
152
|
+
* @param {import('../../../config/typedef.js').ImageSource} _.imageSource
|
|
152
153
|
*/
|
|
153
154
|
defineImage({ label, imageSource }) {
|
|
154
155
|
expect.notEmptyString(label);
|
|
@@ -188,7 +189,7 @@ export default class ImageScene {
|
|
|
188
189
|
*
|
|
189
190
|
* @returns {ImageSceneSource}
|
|
190
191
|
*/
|
|
191
|
-
#
|
|
192
|
+
#getImageSceneSource(label) {
|
|
192
193
|
for (const source of this.#imageSources) {
|
|
193
194
|
if (label === source.label) {
|
|
194
195
|
return source;
|
|
@@ -213,7 +214,7 @@ export default class ImageScene {
|
|
|
213
214
|
* @returns {ImageLoader}
|
|
214
215
|
*/
|
|
215
216
|
getImageLoader(label) {
|
|
216
|
-
const source = this.#
|
|
217
|
+
const source = this.#getImageSceneSource(label);
|
|
217
218
|
|
|
218
219
|
return source.imageLoader;
|
|
219
220
|
}
|
|
@@ -226,9 +227,9 @@ export default class ImageScene {
|
|
|
226
227
|
* @returns {ImageMeta}
|
|
227
228
|
*/
|
|
228
229
|
getImageMeta(label) {
|
|
229
|
-
const source = this.#
|
|
230
|
+
const source = this.#getImageSceneSource(label);
|
|
230
231
|
|
|
231
|
-
return source.imageMeta;
|
|
232
|
+
return source.imageLoader.imageMeta;
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
/**
|
|
@@ -241,7 +242,7 @@ export default class ImageScene {
|
|
|
241
242
|
* @returns {string}
|
|
242
243
|
*/
|
|
243
244
|
getObjectURL(label) {
|
|
244
|
-
const source = this.#
|
|
245
|
+
const source = this.#getImageSceneSource(label);
|
|
245
246
|
|
|
246
247
|
return source.imageLoader.getObjectURL();
|
|
247
248
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** @typedef {import('
|
|
1
|
+
/** @typedef {import('../../../config/typedef.js').ImageMeta} ImageMeta */
|
|
2
2
|
export default class ImageVariantsLoader {
|
|
3
3
|
/**
|
|
4
|
-
* @param {ImageMeta[]}
|
|
4
|
+
* @param {ImageMeta[]} imageSource
|
|
5
5
|
*/
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(imageSource: ImageMeta[], { devicePixelRatio }?: {
|
|
7
7
|
devicePixelRatio?: number;
|
|
8
8
|
});
|
|
9
9
|
/**
|
|
@@ -20,7 +20,7 @@ export default class ImageVariantsLoader {
|
|
|
20
20
|
fit?: "cover" | "contain" | "fill";
|
|
21
21
|
}): void;
|
|
22
22
|
get loaded(): boolean;
|
|
23
|
-
get variant(): import("
|
|
23
|
+
get variant(): import("../../../config/typedef.js").ImageMeta;
|
|
24
24
|
/**
|
|
25
25
|
* Get object URL that can be used as src parameter of an HTML image
|
|
26
26
|
*
|
|
@@ -40,4 +40,4 @@ export default class ImageVariantsLoader {
|
|
|
40
40
|
getOptimalImageMeta(containerWidth: number): ImageMeta | null;
|
|
41
41
|
#private;
|
|
42
42
|
}
|
|
43
|
-
export type ImageMeta = import("
|
|
43
|
+
export type ImageMeta = import("../../../config/typedef.js").ImageMeta;
|
|
@@ -2,14 +2,14 @@ import { calculateEffectiveWidth } from './utils/index.js';
|
|
|
2
2
|
|
|
3
3
|
import ImageLoader from './ImageLoader.svelte.js';
|
|
4
4
|
|
|
5
|
-
/** @typedef {import('
|
|
5
|
+
/** @typedef {import('../../../config/typedef.js').ImageMeta} ImageMeta */
|
|
6
6
|
|
|
7
7
|
export default class ImageVariantsLoader {
|
|
8
8
|
/** @type {number} */
|
|
9
9
|
#devicePixelRatio;
|
|
10
10
|
|
|
11
11
|
/** @type {ImageMeta[]} */
|
|
12
|
-
#
|
|
12
|
+
#imageSource;
|
|
13
13
|
|
|
14
14
|
/** @type {ImageMeta|null} */
|
|
15
15
|
#imageVariant = $state(null);
|
|
@@ -28,12 +28,13 @@ export default class ImageVariantsLoader {
|
|
|
28
28
|
#loaded = $derived.by(() => this.#progress?.loaded || false);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* @param {ImageMeta[]}
|
|
31
|
+
* @param {ImageMeta[]} imageSource
|
|
32
32
|
*/
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(imageSource, { devicePixelRatio = 1 } = {}) {
|
|
34
34
|
this.#devicePixelRatio = devicePixelRatio ?? 1;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
// Keep images in large-to-small order (as provided)
|
|
36
|
+
this.#imageSource = [...imageSource];
|
|
37
|
+
// console.debug("imageSource",imageSource);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -45,7 +46,7 @@ export default class ImageVariantsLoader {
|
|
|
45
46
|
* @param {'cover'|'contain'|'fill'} [params.fit='contain'] Fit mode
|
|
46
47
|
*/
|
|
47
48
|
updateOptimalImageMeta({ containerWidth, containerHeight, fit = 'contain' }) {
|
|
48
|
-
const baseImage = this.#
|
|
49
|
+
const baseImage = this.#imageSource[0];
|
|
49
50
|
const imageAspectRatio = baseImage.width / baseImage.height;
|
|
50
51
|
|
|
51
52
|
const effectiveWidth = calculateEffectiveWidth({
|
|
@@ -71,7 +72,7 @@ export default class ImageVariantsLoader {
|
|
|
71
72
|
this.#imageLoader.unload();
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
this.#imageLoader = new ImageLoader(newVariant);
|
|
75
|
+
this.#imageLoader = new ImageLoader([newVariant]);
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
this.#imageLoader.load();
|
|
@@ -136,15 +137,15 @@ export default class ImageVariantsLoader {
|
|
|
136
137
|
// Calculate the required width (container * DPR)
|
|
137
138
|
const requiredWidth = containerWidth * this.#devicePixelRatio;
|
|
138
139
|
|
|
139
|
-
const imagesMeta = this.#
|
|
140
|
+
const imagesMeta = this.#imageSource;
|
|
140
141
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
const optimal = imagesMeta.
|
|
142
|
+
// Array is large-to-small, so find the last (smallest) image that's still >= required width
|
|
143
|
+
// This gives us the smallest image that's larger than our required width
|
|
144
|
+
const optimal = imagesMeta.findLast(
|
|
144
145
|
(current) => current.width >= requiredWidth
|
|
145
146
|
);
|
|
146
147
|
|
|
147
148
|
// Fall back to the largest image if nothing is big enough
|
|
148
|
-
return optimal || imagesMeta[
|
|
149
|
+
return optimal || imagesMeta[0];
|
|
149
150
|
}
|
|
150
151
|
} // end class
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* of sorted responsive image formats, so it should be the
|
|
5
5
|
* largest image.
|
|
6
6
|
*
|
|
7
|
-
* @param {import('
|
|
7
|
+
* @param {import('../../../../config/typedef.js').ImageSource} imageSource
|
|
8
8
|
*/
|
|
9
|
-
export function toSingleImageMeta(imageSource: import("
|
|
9
|
+
export function toSingleImageMeta(imageSource: import("../../../../config/typedef.js").ImageSource): import("../../../../config/typedef.js").ImageMeta;
|
|
10
10
|
/**
|
|
11
11
|
* Calculate effective width based on container dimensions and fit mode
|
|
12
12
|
*
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
+
import { expect } from '../../../../util/index.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Returns the unchanged image meta object or the last item of
|
|
3
5
|
* an array of ImageMeta objects. This is assumed to be a list
|
|
4
6
|
* of sorted responsive image formats, so it should be the
|
|
5
7
|
* largest image.
|
|
6
8
|
*
|
|
7
|
-
* @param {import('
|
|
9
|
+
* @param {import('../../../../config/typedef.js').ImageSource} imageSource
|
|
8
10
|
*/
|
|
9
11
|
export function toSingleImageMeta(imageSource) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
imageSource = imageSource[imageSource.length - 1];
|
|
15
|
-
}
|
|
12
|
+
expect.array(imageSource);
|
|
13
|
+
|
|
14
|
+
const imageMeta = imageSource[0];
|
|
16
15
|
|
|
17
|
-
if (typeof
|
|
18
|
-
|
|
19
|
-
} else if (!imageSource) {
|
|
20
|
-
throw new Error('Missing [imageSource]');
|
|
16
|
+
if (typeof imageMeta !== 'object') {
|
|
17
|
+
throw new Error('Invalid value for parameter [imageSource]');
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
return imageMeta;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
/**
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
declare const _default: {};
|
|
2
2
|
export default _default;
|
|
3
|
-
export type ImageMeta = {
|
|
4
|
-
src: string;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Single ImageMeta object or array of ImageMeta objects
|
|
10
|
-
*/
|
|
11
|
-
export type ImageSource = ImageMeta | ImageMeta[];
|
|
12
3
|
export type ObjectPosition = "center" | "top" | "bottom" | "left" | "right" | "left top" | "left center" | "left bottom" | "center top" | "center center" | "center bottom" | "right top" | "right center" | "right bottom" | string;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {object} ImageMeta
|
|
3
|
-
* @property {string} src
|
|
4
|
-
* @property {number} width
|
|
5
|
-
* @property {number} height
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {ImageMeta | ImageMeta[]} ImageSource
|
|
10
|
-
* Single ImageMeta object or array of ImageMeta objects
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
1
|
/**
|
|
14
2
|
* @typedef {"center" | "top" | "bottom" | "left" | "right" |
|
|
15
3
|
* "left top" | "left center" | "left bottom" |
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CONTENT_TYPE } from '../../constants/http/index.js';
|
|
2
2
|
|
|
3
|
+
import { LoadingStateMachine } from '../../state/classes.js';
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
|
-
LoadingStateMachine,
|
|
5
6
|
STATE_INITIAL,
|
|
6
7
|
STATE_LOADING,
|
|
7
8
|
STATE_UNLOADING,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
LOADED,
|
|
14
15
|
UNLOAD,
|
|
15
16
|
INITIAL
|
|
16
|
-
} from '../../classes/
|
|
17
|
+
} from '../../state/classes/loading-state-machine/constants.js';
|
|
17
18
|
|
|
18
19
|
import * as expect from '../../util/expect/index.js';
|
|
19
20
|
|
package/dist/services/index.d.ts
CHANGED
|
@@ -2,5 +2,3 @@ export { default as ServiceBase } from "./service-base/ServiceBase.js";
|
|
|
2
2
|
export { default as ServiceManager } from "./service-manager/ServiceManager.js";
|
|
3
3
|
export * from "./service-base/constants.js";
|
|
4
4
|
export * from "./service-manager/constants.js";
|
|
5
|
-
export * from "./service-base/typedef.js";
|
|
6
|
-
export * from "./service-manager/typedef.js";
|
package/dist/services/index.js
CHANGED
|
@@ -3,6 +3,3 @@ export { default as ServiceManager } from './service-manager/ServiceManager.js';
|
|
|
3
3
|
|
|
4
4
|
export * from './service-base/constants.js';
|
|
5
5
|
export * from './service-manager/constants.js';
|
|
6
|
-
|
|
7
|
-
export * from './service-base/typedef.js';
|
|
8
|
-
export * from './service-manager/typedef.js';
|
|
@@ -157,5 +157,5 @@ export type HealthStatus = import("./typedef.js").HealthStatus;
|
|
|
157
157
|
export type StateChangeEvent = import("./typedef.js").StateChangeEvent;
|
|
158
158
|
export type HealthChangeEvent = import("./typedef.js").HealthChangeEvent;
|
|
159
159
|
export type ServiceErrorEvent = import("./typedef.js").ServiceErrorEvent;
|
|
160
|
-
import { EventEmitter } from '../../
|
|
161
|
-
import { Logger } from '../../logging/
|
|
160
|
+
import { EventEmitter } from '../../generic/events.js';
|
|
161
|
+
import { Logger } from '../../logging/index.js';
|
|
@@ -50,8 +50,9 @@
|
|
|
50
50
|
* }
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
|
-
import { EventEmitter } from '../../
|
|
54
|
-
import { Logger, INFO } from '../../logging/
|
|
53
|
+
import { EventEmitter } from '../../generic/events.js';
|
|
54
|
+
import { Logger, INFO } from '../../logging/index.js';
|
|
55
|
+
import { DetailedError } from '../../generic/errors.js';
|
|
55
56
|
|
|
56
57
|
import {
|
|
57
58
|
CREATED,
|
|
@@ -117,9 +118,11 @@ export class ServiceBase extends EventEmitter {
|
|
|
117
118
|
* @returns {Promise<boolean>} True if initialization succeeded
|
|
118
119
|
*/
|
|
119
120
|
async initialize(config = {}) {
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (
|
|
122
|
+
this.state !== CREATED &&
|
|
123
|
+
this.state !== STOPPED &&
|
|
124
|
+
this.state !== DESTROYED
|
|
125
|
+
) {
|
|
123
126
|
this.logger.warn(`Cannot initialize from state: ${this.state}`);
|
|
124
127
|
return false;
|
|
125
128
|
}
|
|
@@ -443,18 +446,19 @@ export class ServiceBase extends EventEmitter {
|
|
|
443
446
|
* @param {Error} error - Error that occurred
|
|
444
447
|
*/
|
|
445
448
|
_setError(operation, error) {
|
|
446
|
-
|
|
449
|
+
const detailedError = new DetailedError(`${operation} failed`, {
|
|
450
|
+
cause: error
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
this.error = detailedError;
|
|
447
454
|
this._setState(ERROR_STATE);
|
|
448
455
|
this._setHealthy(false);
|
|
449
456
|
|
|
450
|
-
this.logger.error(
|
|
451
|
-
error: error.message,
|
|
452
|
-
stack: error.stack
|
|
453
|
-
});
|
|
457
|
+
this.logger.error(detailedError);
|
|
454
458
|
|
|
455
459
|
this.emit('error', {
|
|
456
460
|
operation,
|
|
457
|
-
error
|
|
461
|
+
error: detailedError
|
|
458
462
|
});
|
|
459
463
|
}
|
|
460
464
|
}
|
|
@@ -55,38 +55,9 @@ export type HealthStatus = {
|
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Base class interface that services must implement
|
|
58
|
+
* Allows additional custom properties and methods via Record<string, any>
|
|
58
59
|
*/
|
|
59
|
-
export type ServiceInstance =
|
|
60
|
-
/**
|
|
61
|
-
* - Service name
|
|
62
|
-
*/
|
|
63
|
-
name: string;
|
|
64
|
-
/**
|
|
65
|
-
* - Current state
|
|
66
|
-
*/
|
|
67
|
-
state: string;
|
|
68
|
-
/**
|
|
69
|
-
* - Health status
|
|
70
|
-
*/
|
|
71
|
-
healthy: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* - Last error
|
|
74
|
-
*/
|
|
75
|
-
error: Error | null;
|
|
76
|
-
/**
|
|
77
|
-
* - Service logger
|
|
78
|
-
*/
|
|
79
|
-
logger: import("../../logging/internal/logger").Logger;
|
|
80
|
-
initialize: (config?: any) => Promise<boolean>;
|
|
81
|
-
start: () => Promise<boolean>;
|
|
82
|
-
stop: (options?: StopOptions) => Promise<boolean>;
|
|
83
|
-
recover: () => Promise<boolean>;
|
|
84
|
-
destroy: () => Promise<boolean>;
|
|
85
|
-
getHealth: () => Promise<HealthStatus>;
|
|
86
|
-
setLogLevel: (level: string) => boolean;
|
|
87
|
-
on: (event: string, handler: Function) => Function;
|
|
88
|
-
emit: (event: string, data: any) => boolean;
|
|
89
|
-
};
|
|
60
|
+
export type ServiceInstance = any & Record<string, any>;
|
|
90
61
|
export type StateChangeEvent = {
|
|
91
62
|
/**
|
|
92
63
|
* - Service name (added by ServiceManager)
|
|
@@ -53,13 +53,14 @@
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Base class interface that services must implement
|
|
56
|
+
* Allows additional custom properties and methods via Record<string, any>
|
|
56
57
|
*
|
|
57
|
-
* @typedef {Object} ServiceInstance
|
|
58
|
+
* @typedef {Object & Record<string, any>} ServiceInstance
|
|
58
59
|
* @property {string} name - Service name
|
|
59
60
|
* @property {string} state - Current state
|
|
60
61
|
* @property {boolean} healthy - Health status
|
|
61
62
|
* @property {Error|null} error - Last error
|
|
62
|
-
* @property {import('../../logging/
|
|
63
|
+
* @property {import('../../logging/index.js').Logger} logger - Service logger
|
|
63
64
|
* @property {(config?: *) => Promise<boolean>} initialize
|
|
64
65
|
* @property {() => Promise<boolean>} start
|
|
65
66
|
* @property {(options?: StopOptions) => Promise<boolean>} stop
|
|
@@ -40,10 +40,10 @@ export class ServiceManager extends EventEmitter {
|
|
|
40
40
|
*
|
|
41
41
|
* @param {string} name - Service name
|
|
42
42
|
*
|
|
43
|
-
* @returns {import('
|
|
43
|
+
* @returns {import('../service-base/typedef.js').ServiceInstance|null}
|
|
44
44
|
* Service instance or null if not found
|
|
45
45
|
*/
|
|
46
|
-
get(name: string): import("
|
|
46
|
+
get(name: string): import("../service-base/typedef.js").ServiceInstance | null;
|
|
47
47
|
/**
|
|
48
48
|
* Initialize a service
|
|
49
49
|
*
|
|
@@ -141,5 +141,5 @@ export type ServiceManagerConfig = import("./typedef.js").ServiceManagerConfig;
|
|
|
141
141
|
export type ServiceEntry = import("./typedef.js").ServiceEntry;
|
|
142
142
|
export type HealthCheckResult = import("./typedef.js").HealthCheckResult;
|
|
143
143
|
export type StopOptions = import("../service-base/typedef.js").StopOptions;
|
|
144
|
-
import { EventEmitter } from '../../
|
|
144
|
+
import { EventEmitter } from '../../generic/events.js';
|
|
145
145
|
import { Logger } from '../../logging/index.js';
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
* });
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
-
import { EventEmitter } from '../../
|
|
66
|
+
import { EventEmitter } from '../../generic/events.js';
|
|
67
67
|
import { Logger, DEBUG, INFO, WARN } from '../../logging/index.js';
|
|
68
68
|
|
|
69
69
|
import {
|
|
@@ -160,7 +160,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
160
160
|
*
|
|
161
161
|
* @param {string} name - Service name
|
|
162
162
|
*
|
|
163
|
-
* @returns {import('
|
|
163
|
+
* @returns {import('../service-base/typedef.js').ServiceInstance|null}
|
|
164
164
|
* Service instance or null if not found
|
|
165
165
|
*/
|
|
166
166
|
get(name) {
|
|
@@ -63,12 +63,12 @@ export type LogConfig = {
|
|
|
63
63
|
* Result of health check for all services
|
|
64
64
|
*/
|
|
65
65
|
export type HealthCheckResult = {
|
|
66
|
-
[x: string]: HealthStatus;
|
|
66
|
+
[x: string]: import("../service-base/typedef.js").HealthStatus;
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Service class constructor type
|
|
70
70
|
*/
|
|
71
|
-
export type ServiceConstructor = new (name: string, options?: ServiceOptions) => ServiceInstance;
|
|
71
|
+
export type ServiceConstructor = new (name: string, options?: import("../service-base/typedef.js").ServiceOptions) => import("../service-base/typedef.js").ServiceInstance;
|
|
72
72
|
/**
|
|
73
73
|
* Internal service registry entry
|
|
74
74
|
*/
|
|
@@ -80,7 +80,7 @@ export type ServiceEntry = {
|
|
|
80
80
|
/**
|
|
81
81
|
* - Service instance (lazy-created)
|
|
82
82
|
*/
|
|
83
|
-
instance: ServiceInstance | null;
|
|
83
|
+
instance: import("../service-base/typedef.js").ServiceInstance | null;
|
|
84
84
|
/**
|
|
85
85
|
* - Service configuration
|
|
86
86
|
*/
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Result of health check for all services
|
|
64
|
-
* @typedef {Object<string, HealthStatus>} HealthCheckResult
|
|
64
|
+
* @typedef {Object<string, import('../service-base/typedef.js').HealthStatus>} HealthCheckResult
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Service class constructor type
|
|
69
69
|
*
|
|
70
|
-
* @typedef {new (name: string, options?: ServiceOptions) => ServiceInstance} ServiceConstructor
|
|
70
|
+
* @typedef {new (name: string, options?: import('../service-base/typedef.js').ServiceOptions) => import('../service-base/typedef.js').ServiceInstance} ServiceConstructor
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
73
|
// ============================================================================
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
*
|
|
80
80
|
* @typedef {Object} ServiceEntry
|
|
81
81
|
* @property {ServiceConstructor} ServiceClass - Service class constructor
|
|
82
|
-
* @property {ServiceInstance|null} instance - Service instance (lazy-created)
|
|
82
|
+
* @property {import('../service-base/typedef.js').ServiceInstance|null} instance - Service instance (lazy-created)
|
|
83
83
|
* @property {*} config - Service configuration
|
|
84
84
|
* @property {string[]} dependencies - Service dependencies
|
|
85
85
|
* @property {Set<string>} dependents - Services that depend on this one
|
package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.d.ts
RENAMED
|
@@ -9,4 +9,4 @@ export default class LoadingStateMachine extends FiniteStateMachine {
|
|
|
9
9
|
get error(): Error;
|
|
10
10
|
#private;
|
|
11
11
|
}
|
|
12
|
-
import
|
|
12
|
+
import FiniteStateMachine from '../finite-state-machine/FiniteStateMachine.svelte.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SubScribersCount } from "./SubscribersCount.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SubScribersCount } from './SubscribersCount.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as FiniteStateMachine } from "./classes/finite-state-machine/FiniteStateMachine.svelte.js";
|
|
2
|
+
export { default as LoadingStateMachine } from "./classes/loading-state-machine/LoadingStateMachine.svelte.js";
|
|
3
|
+
export { default as SubscribersCount } from "./classes/subscribers-count/SubscribersCount.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as FiniteStateMachine } from './classes/finite-state-machine/FiniteStateMachine.svelte.js';
|
|
2
|
+
export { default as LoadingStateMachine } from './classes/loading-state-machine/LoadingStateMachine.svelte.js';
|
|
3
|
+
export { default as SubscribersCount } from './classes/subscribers-count/SubscribersCount.js';
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* getState
|
|
15
15
|
* ]}
|
|
16
16
|
*/
|
|
17
|
-
export function defineStateContext<T>(State: new () => T): [(contextKey?: import("
|
|
17
|
+
export function defineStateContext<T>(State: new () => T): [(contextKey?: import("./typedef").ContextKey) => T, (contextKey?: import("./typedef").ContextKey) => T, (contextKey?: import("./typedef").ContextKey) => T];
|
|
18
18
|
export const DEFAULT_CONTEXT_KEY: "default";
|
|
@@ -30,7 +30,7 @@ export function defineStateContext(State) {
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal function to get the supplied key or the shared key
|
|
32
32
|
*
|
|
33
|
-
* @param {import('
|
|
33
|
+
* @param {import('./typedef').ContextKey} [contextKey]
|
|
34
34
|
*
|
|
35
35
|
* @returns {Symbol} key
|
|
36
36
|
*/
|
|
@@ -55,7 +55,7 @@ export function defineStateContext(State) {
|
|
|
55
55
|
/**
|
|
56
56
|
* Create component state
|
|
57
57
|
*
|
|
58
|
-
* @param {import('
|
|
58
|
+
* @param {import('./typedef').ContextKey} [contextKey]
|
|
59
59
|
*
|
|
60
60
|
* @returns {T} state
|
|
61
61
|
*/
|
|
@@ -80,7 +80,7 @@ export function defineStateContext(State) {
|
|
|
80
80
|
/**
|
|
81
81
|
* Get component state or create a new state if it does not yet exist
|
|
82
82
|
*
|
|
83
|
-
* @param {import('
|
|
83
|
+
* @param {import('./typedef').ContextKey} [contextKey]
|
|
84
84
|
*
|
|
85
85
|
* @returns {T} state
|
|
86
86
|
*/
|
|
@@ -99,7 +99,7 @@ export function defineStateContext(State) {
|
|
|
99
99
|
*
|
|
100
100
|
* @throws Will throw an error if the state-context does not exist
|
|
101
101
|
*
|
|
102
|
-
* @param {import('
|
|
102
|
+
* @param {import('./typedef').ContextKey} [contextKey]
|
|
103
103
|
*
|
|
104
104
|
* @returns {T} state
|
|
105
105
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineStateContext, DEFAULT_CONTEXT_KEY } from "./context/state-context.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineStateContext, DEFAULT_CONTEXT_KEY } from './context/state-context.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as theme from "./stores/theme.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as theme from './stores/theme.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# UI Library Organization
|
|
2
|
+
|
|
3
|
+
## Primitives vs Components
|
|
4
|
+
|
|
5
|
+
### **Primitives** (`$lib/ui/primitives/`)
|
|
6
|
+
Basic building blocks that are:
|
|
7
|
+
- Single-purpose
|
|
8
|
+
- Stateless or minimal state
|
|
9
|
+
- Used as building blocks for more complex components
|
|
10
|
+
- Simple, focused functionality
|
|
11
|
+
|
|
12
|
+
**Examples:**
|
|
13
|
+
- **buttons/** - Basic interactive elements
|
|
14
|
+
- **icons/** - Simple icon wrappers
|
|
15
|
+
- **inputs/** - Form controls
|
|
16
|
+
- **area/** - Basic layout containers (HkArea, HkGridArea)
|
|
17
|
+
- **panels/** - Simple panel wrapper
|
|
18
|
+
|
|
19
|
+
### **Components** (`$lib/ui/components/`)
|
|
20
|
+
Compound or complex components that are:
|
|
21
|
+
- Feature-complete solutions
|
|
22
|
+
- Often stateful with complex behavior
|
|
23
|
+
- Solve specific use cases
|
|
24
|
+
- Combine multiple primitives or have complex internal logic
|
|
25
|
+
|
|
26
|
+
**Examples:**
|
|
27
|
+
- **presenter/** - Complex slideshow with state management
|
|
28
|
+
- **image-box/** - Feature-rich image display
|
|
29
|
+
- **game-box/** - Specialized game container
|
|
30
|
+
- **hk-app-layout/** - Complex app layout with state
|
|
31
|
+
- **compare-left-right/** - Specialized comparison view
|
|
32
|
+
- **virtual-viewport/** - Complex viewport management
|
|
33
|
+
- **button-group/** - Compound button collection
|
|
34
|
+
- **drag-drop/** - Complex system with multiple interdependent parts
|
|
35
|
+
- **tab-bar/** - Complex component with state management
|
|
36
|
+
- **grid-layers/** - Complex layout system with utilities
|
|
37
|
+
- **rows/** - Layout components that combine multiple elements
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
// Import primitives for building blocks
|
|
43
|
+
import { Button, TextInput, HkIcon } from '$lib/ui/primitives.js';
|
|
44
|
+
|
|
45
|
+
// Import components for complete solutions
|
|
46
|
+
import { Presenter, ImageBox, HkAppLayout } from '$lib/ui/components.js';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The distinction helps library users understand the intended use and complexity of each component.
|