@hkdigital/lib-core 0.4.30 → 0.4.31
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/dist/auth/jwt/constants.d.ts +1 -1
- package/dist/auth/jwt/errors.d.ts +5 -5
- package/dist/auth/jwt/typedef.d.ts +30 -30
- package/dist/config/generators/imagetools.d.ts +3 -3
- package/dist/config/generators/vite.d.ts +11 -11
- package/dist/config/generators/vite.js +1 -1
- package/dist/design/generators/index.d.ts +9 -9
- package/dist/design/utils/clamp.d.ts +1 -1
- package/dist/design/utils/root-vars.d.ts +1 -1
- package/dist/design/utils/scaling.d.ts +2 -2
- package/dist/generic/data/classes/IterableTree.d.ts +2 -2
- package/dist/generic/data/classes/IterableTree.js +1 -0
- package/dist/generic/data/classes/Selector.d.ts +5 -5
- package/dist/generic/data/classes/Selector.js +53 -60
- package/dist/generic/data/classes/typedef.d.ts +5 -5
- package/dist/generic/errors/generic.d.ts +3 -1
- package/dist/generic/errors/promise.d.ts +2 -2
- package/dist/generic/events/classes/EventEmitter.js +1 -0
- package/dist/generic/promises/classes/HkPromise.js +9 -15
- package/dist/logging/internal/adapters/console.d.ts +5 -5
- package/dist/logging/internal/adapters/pino.d.ts +3 -3
- package/dist/logging/internal/adapters/typedef.d.ts +7 -7
- package/dist/logging/internal/factories/client.d.ts +1 -1
- package/dist/logging/internal/factories/server.d.ts +1 -1
- package/dist/logging/internal/logger/Logger.d.ts +3 -3
- package/dist/logging/internal/transports/pretty-transport.d.ts +3 -3
- package/dist/logging/internal/transports/test-transport.d.ts +5 -5
- package/dist/logging/typedef.d.ts +1 -1
- package/dist/network/cache/IndexedDbCache.d.ts +10 -10
- package/dist/network/cache/MemoryResponseCache.d.ts +3 -3
- package/dist/network/cache/typedef.d.ts +3 -3
- package/dist/network/errors/http.d.ts +2 -2
- package/dist/network/http/caching.d.ts +2 -2
- package/dist/network/http/http-request.d.ts +1 -1
- package/dist/network/http/typedef.d.ts +31 -31
- package/dist/network/loaders/audio/AudioScene.svelte.d.ts +2 -2
- package/dist/network/loaders/base/SceneBase.svelte.d.ts +4 -4
- package/dist/network/loaders/base/SceneBase.svelte.js +1 -1
- package/dist/network/loaders/image/ImageLoader.svelte.d.ts +1 -1
- package/dist/network/loaders/image/ImageVariantsLoader.svelte.d.ts +5 -5
- package/dist/network/loaders/image/utils/index.d.ts +3 -3
- package/dist/services/manager-plugins/ConfigPlugin.d.ts +1 -1
- package/dist/services/service-base/ServiceBase.d.ts +13 -3
- package/dist/services/service-base/ServiceBase.js +27 -9
- package/dist/services/service-base/typedef.d.ts +8 -8
- package/dist/services/service-manager/ServiceManager.d.ts +10 -2
- package/dist/services/service-manager/ServiceManager.js +55 -27
- package/dist/services/service-manager/typedef.d.ts +12 -11
- package/dist/services/service-manager/typedef.js +2 -1
- package/dist/state/machines/finite-state-machine/FiniteStateMachine.svelte.d.ts +1 -1
- package/dist/state/machines/loading-state-machine/LoadingStateMachine.svelte.d.ts +1 -1
- package/dist/state/stores/theme.d.ts +1 -1
- package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +7 -7
- package/dist/ui/components/button-group/typedef.d.ts +1 -1
- package/dist/ui/components/compare-left-right/CompareLeftRight.svelte.d.ts +5 -5
- package/dist/ui/components/drag-drop/DragController.d.ts +1 -1
- package/dist/ui/components/drag-drop/DragDropContext.svelte.d.ts +3 -3
- package/dist/ui/components/drag-drop/Draggable.svelte.d.ts +20 -20
- package/dist/ui/components/drag-drop/DropZone.svelte.d.ts +27 -27
- package/dist/ui/components/drag-drop/DropZoneArea.svelte.d.ts +26 -26
- package/dist/ui/components/drag-drop/DropZoneList.svelte.d.ts +27 -27
- package/dist/ui/components/drag-drop/drag-state.svelte.d.ts +4 -4
- package/dist/ui/components/drag-drop/typedef/drag.d.ts +1 -1
- package/dist/ui/components/game-box/GameBox.svelte.d.ts +19 -19
- package/dist/ui/components/game-box/gamebox.util.d.ts +2 -2
- package/dist/ui/components/grid-layers/GridLayers.svelte.d.ts +7 -7
- package/dist/ui/components/image-box/ImageBox.svelte.d.ts +14 -14
- package/dist/ui/components/presenter/ImageSlide.svelte.d.ts +8 -8
- package/dist/ui/components/presenter/Presenter.state.svelte.d.ts +1 -1
- package/dist/ui/components/presenter/Presenter.svelte.d.ts +5 -5
- package/dist/ui/components/presenter/typedef.d.ts +13 -13
- package/dist/ui/components/rows/panel-grid-row/PanelGridRow.svelte.d.ts +7 -7
- package/dist/ui/components/rows/panel-row-2/PanelRow2.svelte.d.ts +7 -7
- package/dist/ui/components/tab-bar/HkTabBar.svelte.d.ts +10 -10
- package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +1 -1
- package/dist/ui/components/tab-bar/HkTabBarSelector.svelte.d.ts +10 -10
- package/dist/ui/components/tab-bar/typedef.d.ts +3 -3
- package/dist/ui/components/virtual-viewport/VirtualViewport.svelte.d.ts +17 -17
- package/dist/ui/dev/blocks/TextBlock.svelte.d.ts +6 -6
- package/dist/ui/dev/buttons/CheckButton.svelte.d.ts +11 -11
- package/dist/ui/primitives/area/HkArea.svelte.d.ts +6 -6
- package/dist/ui/primitives/area/HkGridArea.svelte.d.ts +12 -12
- package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +16 -16
- package/dist/ui/primitives/buttons/button-icon-steeze/SteezeIconButton.svelte.d.ts +2 -2
- package/dist/ui/primitives/buttons/button-submit/SubmitButton.svelte +21 -0
- package/dist/ui/primitives/buttons/button-submit/SubmitButton.svelte.d.ts +12 -0
- package/dist/ui/primitives/buttons/index.d.ts +2 -1
- package/dist/ui/primitives/buttons/index.js +2 -1
- package/dist/ui/primitives/icons/HkIcon.svelte.d.ts +4 -4
- package/dist/ui/primitives/icons/HkTabIcon.svelte.d.ts +13 -13
- package/dist/ui/primitives/icons/SteezeIcon.svelte.d.ts +4 -4
- package/dist/ui/primitives/inputs/text-input/TextInput.svelte.d.ts +22 -22
- package/dist/ui/primitives/inputs/text-input/assets/IconInvalid.svelte.d.ts +1 -1
- package/dist/ui/primitives/inputs/text-input/assets/IconValid.svelte.d.ts +1 -1
- package/dist/ui/primitives/panels/panel/Panel.svelte.d.ts +6 -6
- package/dist/util/array/index.d.ts +17 -17
- package/dist/util/array/index.js +5 -5
- package/dist/util/compare/index.d.ts +2 -1
- package/dist/util/compare/index.js +1 -0
- package/dist/util/exceptions/index.d.ts +3 -2
- package/dist/util/exceptions/index.js +13 -9
- package/dist/util/expect/arrays.d.ts +1 -0
- package/dist/util/expect/arrays.js +1 -0
- package/dist/util/expect/primitives.d.ts +18 -0
- package/dist/util/expect/primitives.js +18 -0
- package/dist/util/function/index.d.ts +14 -1
- package/dist/util/geometry/index.d.ts +2 -2
- package/dist/util/geometry/index.js +1 -1
- package/dist/util/iterate/index.d.ts +7 -7
- package/dist/util/object/index.d.ts +13 -13
- package/dist/util/singleton/index.d.ts +3 -3
- package/dist/util/svelte/loading/loading-tracker.svelte.d.ts +1 -1
- package/dist/util/sveltekit/env/all.d.ts +5 -5
- package/dist/util/sveltekit/env/all.js +2 -2
- package/dist/util/sveltekit/env/parsers.d.ts +12 -12
- package/dist/util/sveltekit/env/private.d.ts +5 -5
- package/dist/util/sveltekit/env/public.d.ts +5 -5
- package/dist/util/sveltekit/route-folders/index.d.ts +2 -2
- package/dist/util/sveltekit/route-folders.d.ts +1 -0
- package/dist/util/{sveltekit.js → sveltekit/route-folders.js} +1 -1
- package/dist/util/time/index.d.ts +4 -4
- package/dist/valibot/parsers/url.d.ts +3 -3
- package/dist/valibot/parsers/url.js +6 -2
- package/package.json +1 -1
- package/dist/util/sveltekit.d.ts +0 -1
|
@@ -9,8 +9,8 @@ export class TokenExpiredError extends Error {
|
|
|
9
9
|
constructor(message: string, details?: Date | {
|
|
10
10
|
expiredAt?: Date;
|
|
11
11
|
}, cause?: Error);
|
|
12
|
-
expiredAt: Date;
|
|
13
|
-
cause: Error;
|
|
12
|
+
expiredAt: Date | null;
|
|
13
|
+
cause: Error | null;
|
|
14
14
|
}
|
|
15
15
|
export class JsonWebTokenError extends Error {
|
|
16
16
|
/**
|
|
@@ -21,8 +21,8 @@ export class JsonWebTokenError extends Error {
|
|
|
21
21
|
constructor(message: string, details?: Error | {
|
|
22
22
|
inner?: Error;
|
|
23
23
|
}, cause?: Error);
|
|
24
|
-
inner: Error;
|
|
25
|
-
cause: Error;
|
|
24
|
+
inner: Error | null;
|
|
25
|
+
cause: Error | null;
|
|
26
26
|
}
|
|
27
27
|
export class InvalidSignatureError extends JsonWebTokenError {
|
|
28
28
|
}
|
|
@@ -35,5 +35,5 @@ export class NotBeforeError extends JsonWebTokenError {
|
|
|
35
35
|
constructor(message: string, details?: Date | {
|
|
36
36
|
date?: Date;
|
|
37
37
|
}, cause?: Error);
|
|
38
|
-
date: Date;
|
|
38
|
+
date: Date | null;
|
|
39
39
|
}
|
|
@@ -5,31 +5,31 @@ export type JwtStandardClaims = {
|
|
|
5
5
|
/**
|
|
6
6
|
* - Issuer
|
|
7
7
|
*/
|
|
8
|
-
iss?: string;
|
|
8
|
+
iss?: string | undefined;
|
|
9
9
|
/**
|
|
10
10
|
* - Subject
|
|
11
11
|
*/
|
|
12
|
-
sub?: string;
|
|
12
|
+
sub?: string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* - Audience
|
|
15
15
|
*/
|
|
16
|
-
aud?: string | string[];
|
|
16
|
+
aud?: string | string[] | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* - Expiration time (seconds since epoch)
|
|
19
19
|
*/
|
|
20
|
-
exp?: number;
|
|
20
|
+
exp?: number | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* - Not before (seconds since epoch)
|
|
23
23
|
*/
|
|
24
|
-
nbf?: number;
|
|
24
|
+
nbf?: number | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* - Issued at (seconds since epoch)
|
|
27
27
|
*/
|
|
28
|
-
iat?: number;
|
|
28
|
+
iat?: number | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* - JWT ID
|
|
31
31
|
*/
|
|
32
|
-
jti?: string;
|
|
32
|
+
jti?: string | undefined;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* JWT payload - standard claims plus any custom data
|
|
@@ -42,47 +42,47 @@ export type SignOptions = {
|
|
|
42
42
|
/**
|
|
43
43
|
* - Signing algorithm (HS256, RS256, etc.)
|
|
44
44
|
*/
|
|
45
|
-
algorithm?: string;
|
|
45
|
+
algorithm?: string | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* - Expiration time ('1h', 3600, etc.)
|
|
48
48
|
*/
|
|
49
|
-
expiresIn?: string | number;
|
|
49
|
+
expiresIn?: string | number | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* - Not valid before time
|
|
52
52
|
*/
|
|
53
|
-
notBefore?: string | number;
|
|
53
|
+
notBefore?: string | number | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* - Audience claim
|
|
56
56
|
*/
|
|
57
|
-
audience?: string | string[];
|
|
57
|
+
audience?: string | string[] | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* - Issuer claim
|
|
60
60
|
*/
|
|
61
|
-
issuer?: string;
|
|
61
|
+
issuer?: string | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* - JWT ID claim
|
|
64
64
|
*/
|
|
65
|
-
jwtid?: string;
|
|
65
|
+
jwtid?: string | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* - Subject claim
|
|
68
68
|
*/
|
|
69
|
-
subject?: string;
|
|
69
|
+
subject?: string | undefined;
|
|
70
70
|
/**
|
|
71
71
|
* - Skip iat claim
|
|
72
72
|
*/
|
|
73
|
-
noTimestamp?: boolean;
|
|
73
|
+
noTimestamp?: boolean | undefined;
|
|
74
74
|
/**
|
|
75
75
|
* - Additional header claims
|
|
76
76
|
*/
|
|
77
|
-
header?:
|
|
77
|
+
header?: Object | undefined;
|
|
78
78
|
/**
|
|
79
79
|
* - Key ID header claim
|
|
80
80
|
*/
|
|
81
|
-
keyid?: string;
|
|
81
|
+
keyid?: string | undefined;
|
|
82
82
|
/**
|
|
83
83
|
* - Modify payload object directly
|
|
84
84
|
*/
|
|
85
|
-
mutatePayload?: boolean;
|
|
85
|
+
mutatePayload?: boolean | undefined;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
88
|
* JWT verification options
|
|
@@ -91,47 +91,47 @@ export type VerifyOptions = {
|
|
|
91
91
|
/**
|
|
92
92
|
* - Allowed algorithms
|
|
93
93
|
*/
|
|
94
|
-
algorithms?: string[];
|
|
94
|
+
algorithms?: string[] | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* - Expected audience
|
|
97
97
|
*/
|
|
98
|
-
audience?: string | string[];
|
|
98
|
+
audience?: string | string[] | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* - Return object with payload and header
|
|
101
101
|
*/
|
|
102
|
-
complete?: boolean;
|
|
102
|
+
complete?: boolean | undefined;
|
|
103
103
|
/**
|
|
104
104
|
* - Expected issuer
|
|
105
105
|
*/
|
|
106
|
-
issuer?: string;
|
|
106
|
+
issuer?: string | undefined;
|
|
107
107
|
/**
|
|
108
108
|
* - Skip expiration validation
|
|
109
109
|
*/
|
|
110
|
-
ignoreExpiration?: boolean;
|
|
110
|
+
ignoreExpiration?: boolean | undefined;
|
|
111
111
|
/**
|
|
112
112
|
* - Skip notBefore validation
|
|
113
113
|
*/
|
|
114
|
-
ignoreNotBefore?: boolean;
|
|
114
|
+
ignoreNotBefore?: boolean | undefined;
|
|
115
115
|
/**
|
|
116
116
|
* - Expected subject
|
|
117
117
|
*/
|
|
118
|
-
subject?: string;
|
|
118
|
+
subject?: string | undefined;
|
|
119
119
|
/**
|
|
120
120
|
* - Clock tolerance in seconds
|
|
121
121
|
*/
|
|
122
|
-
clockTolerance?: number;
|
|
122
|
+
clockTolerance?: number | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* - Maximum token age in seconds
|
|
125
125
|
*/
|
|
126
|
-
maxAge?: number;
|
|
126
|
+
maxAge?: number | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* - Current time override (seconds)
|
|
129
129
|
*/
|
|
130
|
-
clockTimestamp?: number;
|
|
130
|
+
clockTimestamp?: number | undefined;
|
|
131
131
|
/**
|
|
132
132
|
* - Expected nonce claim
|
|
133
133
|
*/
|
|
134
|
-
nonce?: string;
|
|
134
|
+
nonce?: string | undefined;
|
|
135
135
|
};
|
|
136
136
|
/**
|
|
137
137
|
* JWT secret types
|
|
@@ -151,7 +151,7 @@ export type JwtDecoded = {
|
|
|
151
151
|
/**
|
|
152
152
|
* - The decoded header
|
|
153
153
|
*/
|
|
154
|
-
header:
|
|
154
|
+
header: Object;
|
|
155
155
|
/**
|
|
156
156
|
* - The signature
|
|
157
157
|
*/
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* ) => (Record<string, string | string[]>[])}
|
|
12
12
|
*/
|
|
13
13
|
export function generateResponseConfigs(options?: {
|
|
14
|
-
widths?: number[];
|
|
15
|
-
thumbnailWidth?: number[];
|
|
14
|
+
widths?: number[] | undefined;
|
|
15
|
+
thumbnailWidth?: number[] | undefined;
|
|
16
16
|
}): (entries: [string, string[]][]) => (Record<string, string | string[]>[]);
|
|
17
17
|
/**
|
|
18
18
|
* Configures and returns a function that can be used as
|
|
@@ -24,5 +24,5 @@ export function generateResponseConfigs(options?: {
|
|
|
24
24
|
* @param {number[]} [options.presets=DEFAULT_PRESETS]
|
|
25
25
|
*/
|
|
26
26
|
export function generateDefaultDirectives(options?: {
|
|
27
|
-
presets?: number[];
|
|
27
|
+
presets?: number[] | undefined;
|
|
28
28
|
}): (url: URL) => URLSearchParams;
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
* @param {boolean} [options.enableVitest=true] Include Vitest configuration
|
|
7
7
|
* @param {boolean} [options.enableSvelteKit=true] Enable SvelteKit plugin
|
|
8
8
|
* @param {object} [options.customDefines={}] Additional define values
|
|
9
|
-
* @param {Array} [options.customPlugins=[]] Additional Vite plugins
|
|
9
|
+
* @param {Array<any>} [options.customPlugins=[]] Additional Vite plugins
|
|
10
10
|
* @param {object} [options.imagetoolsOptions={}] Options for imagetools config
|
|
11
11
|
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
12
12
|
*
|
|
13
13
|
* @returns {Promise<object>} Vite configuration object
|
|
14
14
|
*/
|
|
15
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;
|
|
16
|
+
enableImagetools?: boolean | undefined;
|
|
17
|
+
enableVitest?: boolean | undefined;
|
|
18
|
+
enableSvelteKit?: boolean | undefined;
|
|
19
|
+
customDefines?: object | undefined;
|
|
20
|
+
customPlugins?: any[] | undefined;
|
|
21
|
+
imagetoolsOptions?: object | undefined;
|
|
22
|
+
packageJsonPath?: string | undefined;
|
|
23
23
|
}): Promise<object>;
|
|
24
24
|
/**
|
|
25
25
|
* Generates build-time defines for Vite
|
|
@@ -31,8 +31,8 @@ export function generateViteConfig(options?: {
|
|
|
31
31
|
* @returns {object} Define configuration object
|
|
32
32
|
*/
|
|
33
33
|
export function generateViteDefines(options?: {
|
|
34
|
-
packageJsonPath?: string;
|
|
35
|
-
customDefines?: object;
|
|
34
|
+
packageJsonPath?: string | undefined;
|
|
35
|
+
customDefines?: object | undefined;
|
|
36
36
|
}): object;
|
|
37
37
|
/**
|
|
38
38
|
* Generates Vitest configuration
|
|
@@ -43,5 +43,5 @@ export function generateViteDefines(options?: {
|
|
|
43
43
|
* @returns {object} Vitest configuration object
|
|
44
44
|
*/
|
|
45
45
|
export function generateVitestConfig(options?: {
|
|
46
|
-
additionalPatterns?: string[];
|
|
46
|
+
additionalPatterns?: string[] | undefined;
|
|
47
47
|
}): object;
|
|
@@ -9,7 +9,7 @@ import { resolve } from 'path';
|
|
|
9
9
|
* @param {boolean} [options.enableVitest=true] Include Vitest configuration
|
|
10
10
|
* @param {boolean} [options.enableSvelteKit=true] Enable SvelteKit plugin
|
|
11
11
|
* @param {object} [options.customDefines={}] Additional define values
|
|
12
|
-
* @param {Array} [options.customPlugins=[]] Additional Vite plugins
|
|
12
|
+
* @param {Array<any>} [options.customPlugins=[]] Additional Vite plugins
|
|
13
13
|
* @param {object} [options.imagetoolsOptions={}] Options for imagetools config
|
|
14
14
|
* @param {string} [options.packageJsonPath='./package.json'] Path to package.json
|
|
15
15
|
*
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
export function generateTailwindThemeExtensions({ TEXT_POINT_SIZES, VIEWPORT_POINT_SIZES, TEXT_BASE_SIZES, TEXT_HEADING_SIZES, TEXT_UI_SIZES, RADIUS_SIZES, BORDER_WIDTH_SIZES, STROKE_WIDTH_SIZES }: {
|
|
43
|
-
TEXT_POINT_SIZES:
|
|
44
|
-
VIEWPORT_POINT_SIZES:
|
|
45
|
-
TEXT_BASE_SIZES:
|
|
46
|
-
TEXT_HEADING_SIZES:
|
|
47
|
-
TEXT_UI_SIZES:
|
|
48
|
-
RADIUS_SIZES:
|
|
49
|
-
BORDER_WIDTH_SIZES:
|
|
50
|
-
STROKE_WIDTH_SIZES:
|
|
51
|
-
}):
|
|
43
|
+
TEXT_POINT_SIZES: Object;
|
|
44
|
+
VIEWPORT_POINT_SIZES: Object;
|
|
45
|
+
TEXT_BASE_SIZES: Object;
|
|
46
|
+
TEXT_HEADING_SIZES: Object;
|
|
47
|
+
TEXT_UI_SIZES: Object;
|
|
48
|
+
RADIUS_SIZES: Object;
|
|
49
|
+
BORDER_WIDTH_SIZES: Object;
|
|
50
|
+
STROKE_WIDTH_SIZES: Object;
|
|
51
|
+
}): Object;
|
|
52
52
|
/**
|
|
53
53
|
* Generates text-based spacing units with with different scaling
|
|
54
54
|
* units (ut, bt, ht)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @returns {Object} Object with min and max values
|
|
6
6
|
* @throws {Error} If the CSS variable doesn't exist or doesn't contain a valid clamp function
|
|
7
7
|
*/
|
|
8
|
-
export function getClampParams(varName: string):
|
|
8
|
+
export function getClampParams(varName: string): Object;
|
|
9
9
|
/**
|
|
10
10
|
* CSS clamp function implementation
|
|
11
11
|
*
|
|
@@ -76,7 +76,7 @@ export function getRootCssDesignHeight(): number;
|
|
|
76
76
|
*
|
|
77
77
|
* @returns {Object} An object containing all scaling factors
|
|
78
78
|
*/
|
|
79
|
-
export function getAllRootScalingVars():
|
|
79
|
+
export function getAllRootScalingVars(): Object;
|
|
80
80
|
/**
|
|
81
81
|
* Extract a CSS variable value from document root
|
|
82
82
|
*
|
|
@@ -49,8 +49,8 @@ export function enableContainerScaling({ container, design, clamping, getDimensi
|
|
|
49
49
|
max: number;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
getDimensions?: Function;
|
|
53
|
-
useResizeObserver?: boolean;
|
|
52
|
+
getDimensions?: Function | undefined;
|
|
53
|
+
useResizeObserver?: boolean | undefined;
|
|
54
54
|
}): () => void;
|
|
55
55
|
/**
|
|
56
56
|
* Manages responsive design scaling by calculating and applying scale factors
|
|
@@ -10,8 +10,8 @@ export default class IterableTree {
|
|
|
10
10
|
* @param {string[]} [_parentArrPath]
|
|
11
11
|
*/
|
|
12
12
|
constructor(obj: object, options?: import("./typedef.js").IterableTreeOptions, _parentArrPath?: string[]);
|
|
13
|
-
obj:
|
|
14
|
-
_parentArrPath: string[];
|
|
13
|
+
obj: object;
|
|
14
|
+
_parentArrPath: string[] | null;
|
|
15
15
|
/**
|
|
16
16
|
* Get an iterator to iterate over all object [ path, value ] entries
|
|
17
17
|
*
|
|
@@ -5,9 +5,9 @@ export default class Selector {
|
|
|
5
5
|
/**
|
|
6
6
|
* Constructor
|
|
7
7
|
*
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {Record<string, any>|null} selector
|
|
9
9
|
*/
|
|
10
|
-
constructor(selector:
|
|
10
|
+
constructor(selector: Record<string, any> | null);
|
|
11
11
|
/**
|
|
12
12
|
* Returns the first item from the list of items that matches the selector
|
|
13
13
|
*
|
|
@@ -16,15 +16,15 @@ export default class Selector {
|
|
|
16
16
|
*
|
|
17
17
|
* @returns {T|null} item or null if not found
|
|
18
18
|
*/
|
|
19
|
-
findFirst<T extends
|
|
19
|
+
findFirst<T extends object>(items: T[] | null): T | null;
|
|
20
20
|
/**
|
|
21
21
|
* Returns all items from the list of items that match the selector
|
|
22
22
|
*
|
|
23
23
|
* @template {object} T
|
|
24
24
|
* @param {T[]|null} items
|
|
25
25
|
*
|
|
26
|
-
* @returns {T[]
|
|
26
|
+
* @returns {T[]} array of matching items
|
|
27
27
|
*/
|
|
28
|
-
findAll<T extends
|
|
28
|
+
findAll<T extends object>(items: T[] | null): T[];
|
|
29
29
|
#private;
|
|
30
30
|
}
|
|
@@ -36,19 +36,56 @@ import * as expect from '../../../util/expect.js';
|
|
|
36
36
|
* Construct a Selector class
|
|
37
37
|
*/
|
|
38
38
|
export default class Selector {
|
|
39
|
-
/** @type {function
|
|
40
|
-
#testFn
|
|
39
|
+
/** @type {function} test function */
|
|
40
|
+
#testFn;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Constructor
|
|
44
44
|
*
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {Record<string, any>|null} selector
|
|
46
46
|
*/
|
|
47
47
|
constructor(selector) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
// > Case A: selector=null
|
|
49
|
+
|
|
50
|
+
if (null === selector) {
|
|
51
|
+
this.#testFn = this.#returnTrue;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// > Validate selector
|
|
56
|
+
|
|
57
|
+
expect.objectOrNull(selector);
|
|
58
|
+
|
|
59
|
+
const keys = Object.keys(selector);
|
|
60
|
+
const n = keys.length;
|
|
61
|
+
|
|
62
|
+
// > Case B: selector has not properties
|
|
63
|
+
|
|
64
|
+
if (!n) {
|
|
65
|
+
this.#testFn = this.#returnTrue;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// > Case C: selector with single key-value pair
|
|
70
|
+
|
|
71
|
+
if (1 === n) {
|
|
72
|
+
const key = keys[0];
|
|
73
|
+
const value = selector[key];
|
|
74
|
+
|
|
75
|
+
this.#testFn = this.#testKeyValue.bind(this, key, value);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// > Case D: selector with multiple key-value pairs
|
|
50
80
|
|
|
51
|
-
|
|
81
|
+
const selectorValues = [];
|
|
82
|
+
|
|
83
|
+
for (const key of keys) {
|
|
84
|
+
selectorValues.push(selector[key]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
this.#testFn = this.#testMultipleKeyValues.bind(this, keys, selectorValues);
|
|
88
|
+
}
|
|
52
89
|
|
|
53
90
|
/**
|
|
54
91
|
* Returns the first item from the list of items that matches the selector
|
|
@@ -72,17 +109,16 @@ export default class Selector {
|
|
|
72
109
|
return null;
|
|
73
110
|
}
|
|
74
111
|
|
|
75
|
-
// -------------------------------------------------------------------- Method
|
|
76
|
-
|
|
77
112
|
/**
|
|
78
113
|
* Returns all items from the list of items that match the selector
|
|
79
114
|
*
|
|
80
115
|
* @template {object} T
|
|
81
116
|
* @param {T[]|null} items
|
|
82
117
|
*
|
|
83
|
-
* @returns {T[]
|
|
118
|
+
* @returns {T[]} array of matching items
|
|
84
119
|
*/
|
|
85
120
|
findAll(items) {
|
|
121
|
+
/** @type {T[]} */
|
|
86
122
|
const result = [];
|
|
87
123
|
|
|
88
124
|
if (!items) {
|
|
@@ -100,53 +136,6 @@ export default class Selector {
|
|
|
100
136
|
|
|
101
137
|
/* ------------------------------------------------------- Internal methods */
|
|
102
138
|
|
|
103
|
-
/**
|
|
104
|
-
* Update the internal selector function
|
|
105
|
-
*/
|
|
106
|
-
#updateTestFn(selector) {
|
|
107
|
-
// > Case A: selector=null
|
|
108
|
-
|
|
109
|
-
if (null === selector) {
|
|
110
|
-
this.#testFn = this.#returnTrue;
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// > Validate selector
|
|
115
|
-
|
|
116
|
-
expect.objectOrNull(selector);
|
|
117
|
-
|
|
118
|
-
const keys = Object.keys(selector);
|
|
119
|
-
const n = keys.length;
|
|
120
|
-
|
|
121
|
-
// > Case B: selector has not properties
|
|
122
|
-
|
|
123
|
-
if (!n) {
|
|
124
|
-
this.#testFn = this.#returnTrue;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// > Case C: selector with single key-value pair
|
|
129
|
-
|
|
130
|
-
if (1 === n) {
|
|
131
|
-
const key = keys[0];
|
|
132
|
-
const value = selector[key];
|
|
133
|
-
|
|
134
|
-
this.#testFn = this.#testKeyValue.bind(this, key, value);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// > Case D: selector with multiple key-value pairs
|
|
138
|
-
|
|
139
|
-
const selectorValues = [];
|
|
140
|
-
|
|
141
|
-
for (const key of keys) {
|
|
142
|
-
selectorValues.push(selector[key]);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
this.#testFn = this.#testMultipleKeyValues.bind(this, keys, selectorValues);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// -------------------------------------------------------------------- Method
|
|
149
|
-
|
|
150
139
|
/**
|
|
151
140
|
* Always return true
|
|
152
141
|
* - This function is used if the test function should always return true
|
|
@@ -157,23 +146,27 @@ export default class Selector {
|
|
|
157
146
|
return true;
|
|
158
147
|
}
|
|
159
148
|
|
|
160
|
-
// -------------------------------------------------------------------- Method
|
|
161
|
-
|
|
162
149
|
/**
|
|
163
150
|
* Return true if the item matches the key-value pair
|
|
164
151
|
* - This function is used if the test function should test a
|
|
165
152
|
* single key-value pair
|
|
153
|
+
* @param {string} key - Property key
|
|
154
|
+
* @param {any} value - Expected value
|
|
155
|
+
* @param {Record<string, any>} item - Item to test
|
|
156
|
+
* @returns {boolean} True if item matches
|
|
166
157
|
*/
|
|
167
158
|
#testKeyValue(key, value, item) {
|
|
168
159
|
return value === item[key];
|
|
169
160
|
}
|
|
170
161
|
|
|
171
|
-
// -------------------------------------------------------------------- Method
|
|
172
|
-
|
|
173
162
|
/**
|
|
174
163
|
* Return true if the item matches all key-value pairs
|
|
175
164
|
* - This function is used if the test function should test multiple
|
|
176
165
|
* key-value pairs
|
|
166
|
+
* @param {string[]} keys - Array of property keys
|
|
167
|
+
* @param {any[]} values - Array of expected values
|
|
168
|
+
* @param {Record<string, any>} item - Item to test
|
|
169
|
+
* @returns {boolean} True if item matches all key-value pairs
|
|
177
170
|
*/
|
|
178
171
|
#testMultipleKeyValues(keys, values, item) {
|
|
179
172
|
let isMatch = true;
|
|
@@ -4,21 +4,21 @@ export type IterableTreeOptions = {
|
|
|
4
4
|
/**
|
|
5
5
|
* - Whether to walk into array elements
|
|
6
6
|
*/
|
|
7
|
-
walkArrays?: boolean;
|
|
7
|
+
walkArrays?: boolean | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* - Whether to ignore empty object leaves
|
|
10
10
|
*/
|
|
11
|
-
ignoreEmptyObjectLeaves?: boolean;
|
|
11
|
+
ignoreEmptyObjectLeaves?: boolean | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* - Whether to expand path keys
|
|
14
14
|
*/
|
|
15
|
-
expandPathKeys?: boolean;
|
|
15
|
+
expandPathKeys?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* - Whether to output intermediate nodes
|
|
18
18
|
*/
|
|
19
|
-
outputIntermediateNodes?: boolean;
|
|
19
|
+
outputIntermediateNodes?: boolean | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* - Whether to use depth-first traversal
|
|
22
22
|
*/
|
|
23
|
-
depthFirst?: boolean;
|
|
23
|
+
depthFirst?: boolean | undefined;
|
|
24
24
|
};
|
|
@@ -11,6 +11,8 @@ export class DetailedError extends Error {
|
|
|
11
11
|
* @param {Error|null} [cause] - Original error
|
|
12
12
|
*/
|
|
13
13
|
constructor(message?: string, details?: import("./typedef.js").ErrorDetails, cause?: Error | null);
|
|
14
|
-
details:
|
|
14
|
+
details: string | {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
} | null;
|
|
15
17
|
cause: unknown;
|
|
16
18
|
}
|
|
@@ -15,8 +15,8 @@ export class PromiseError extends Error {
|
|
|
15
15
|
* @param {*} [options.details] - Additional details object
|
|
16
16
|
*/
|
|
17
17
|
constructor(message: string, options?: {
|
|
18
|
-
timeout?: boolean;
|
|
19
|
-
cancelled?: boolean;
|
|
18
|
+
timeout?: boolean | undefined;
|
|
19
|
+
cancelled?: boolean | undefined;
|
|
20
20
|
cause?: Error | any;
|
|
21
21
|
details?: any;
|
|
22
22
|
});
|
|
@@ -48,7 +48,7 @@ import { PromiseError } from '../../errors.js';
|
|
|
48
48
|
* HkPromise extends the default javascript Promise class
|
|
49
49
|
* - Exposes methods to interact with the state of the
|
|
50
50
|
* promise, such as 'resolve' and 'reject'
|
|
51
|
-
*
|
|
51
|
+
*
|
|
52
52
|
* @template T
|
|
53
53
|
* @extends {Promise<T>}
|
|
54
54
|
* @implements {PromiseLike<T>}
|
|
@@ -266,22 +266,16 @@ export default class HkPromise extends Promise {
|
|
|
266
266
|
|
|
267
267
|
if (errorOrDetails instanceof Error) {
|
|
268
268
|
// If it's an Error, create error chain
|
|
269
|
-
promiseError = new PromiseError(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
cause: errorOrDetails
|
|
274
|
-
}
|
|
275
|
-
);
|
|
269
|
+
promiseError = new PromiseError(errorOrDetails.message, {
|
|
270
|
+
cancelled: true,
|
|
271
|
+
cause: errorOrDetails
|
|
272
|
+
});
|
|
276
273
|
} else {
|
|
277
274
|
// If it's details or undefined, use as details
|
|
278
|
-
promiseError = new PromiseError(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
details: errorOrDetails
|
|
283
|
-
}
|
|
284
|
-
);
|
|
275
|
+
promiseError = new PromiseError('Cancelled', {
|
|
276
|
+
cancelled: true,
|
|
277
|
+
details: errorOrDetails
|
|
278
|
+
});
|
|
285
279
|
}
|
|
286
280
|
|
|
287
281
|
this.#cancelled = true;
|