@hkdigital/lib-sveltekit 0.1.85 → 0.1.86
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/classes/data/Selector.d.ts +2 -2
- package/dist/classes/data/Selector.js +1 -1
- package/dist/components/drag-drop/drag-state.svelte.d.ts +3 -3
- package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +3 -3
- package/dist/features/hk-app-layout/HkAppLayout.state.svelte.d.ts +3 -3
- package/dist/themes/hkdev/components/buttons/button.css +6 -2
- package/dist/util/array/index.d.ts +7 -7
- package/dist/util/array/index.js +12 -31
- package/dist/util/svelte/state-context/index.d.ts +1 -1
- package/dist/util/svelte/state-context/index.js +4 -4
- package/package.json +1 -1
@@ -23,8 +23,8 @@ export default class Selector {
|
|
23
23
|
* @template {object} T
|
24
24
|
* @param {T[]|null} items
|
25
25
|
*
|
26
|
-
* @returns {T|null} item or null if not found
|
26
|
+
* @returns {T[]|null} item or null if not found
|
27
27
|
*/
|
28
|
-
findAll<T extends unknown>(items: T[] | null): T | null;
|
28
|
+
findAll<T extends unknown>(items: T[] | null): T[] | null;
|
29
29
|
#private;
|
30
30
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export const createOrGetDragState: (contextKey
|
2
|
-
export const createDragState: (contextKey
|
3
|
-
export const getDragState: (contextKey
|
1
|
+
export const createOrGetDragState: (contextKey?: import("../../typedef").ContextKey) => DragState;
|
2
|
+
export const createDragState: (contextKey?: import("../../typedef").ContextKey) => DragState;
|
3
|
+
export const getDragState: (contextKey?: import("../../typedef").ContextKey) => DragState;
|
4
4
|
declare class DragState {
|
5
5
|
draggables: Map<any, any>;
|
6
6
|
/**
|
@@ -48,7 +48,7 @@ export class HkTabBarState {
|
|
48
48
|
*/
|
49
49
|
linkTab(index: number, tabElement: HTMLElement): void;
|
50
50
|
}
|
51
|
-
export const createOrGetState: (contextKey
|
52
|
-
export const createState: (contextKey
|
53
|
-
export const getState: (contextKey
|
51
|
+
export const createOrGetState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarState;
|
52
|
+
export const createState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarState;
|
53
|
+
export const getState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarState;
|
54
54
|
export type Tab = import("./typedef.js").Tab;
|
@@ -14,6 +14,6 @@ export class HkTabBarSelectorState {
|
|
14
14
|
tabBarState: any;
|
15
15
|
#private;
|
16
16
|
}
|
17
|
-
export const createOrGetState: (contextKey
|
18
|
-
export const createState: (contextKey
|
19
|
-
export const getState: (contextKey
|
17
|
+
export const createOrGetState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarSelectorState;
|
18
|
+
export const createState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarSelectorState;
|
19
|
+
export const getState: (contextKey?: import("../../typedef/context.js").ContextKey) => HkTabBarSelectorState;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export class AppLayoutState {
|
2
2
|
landscapeOnSmallScreen: boolean;
|
3
3
|
}
|
4
|
-
export const createOrGetState: (contextKey
|
5
|
-
export const createState: (contextKey
|
6
|
-
export const getState: (contextKey
|
4
|
+
export const createOrGetState: (contextKey?: import("../../typedef").ContextKey) => AppLayoutState;
|
5
|
+
export const createState: (contextKey?: import("../../typedef").ContextKey) => AppLayoutState;
|
6
|
+
export const getState: (contextKey?: import("../../typedef").ContextKey) => AppLayoutState;
|
@@ -10,9 +10,11 @@
|
|
10
10
|
--btn-primary-bg: var(--color-primary-500);
|
11
11
|
--btn-primary-text: var(--color-primary-50);
|
12
12
|
--btn-primary-border: var(--color-primary-500);
|
13
|
+
|
13
14
|
--btn-primary-selected-bg: var(--color-primary-700);
|
14
|
-
--btn-primary-selected-border: var(--color-primary-800);
|
15
15
|
--btn-primary-selected-text: var(--color-primary-50);
|
16
|
+
--btn-primary-selected-border: var(--color-primary-800);
|
17
|
+
|
16
18
|
--btn-primary-hover-bg: var(--color-primary-600);
|
17
19
|
--btn-primary-hover-border: var(--color-primary-600);
|
18
20
|
--btn-primary-focus-outline: var(--color-primary-800);
|
@@ -21,9 +23,11 @@
|
|
21
23
|
--btn-secondary-bg: transparent;
|
22
24
|
--btn-secondary-text: var(--color-secondary-500);
|
23
25
|
--btn-secondary-border: var(--color-secondary-500);
|
26
|
+
|
24
27
|
--btn-secondary-selected-bg: var(--color-secondary-100);
|
25
|
-
--btn-secondary-selected-border: var(--color-secondary-600);
|
26
28
|
--btn-secondary-selected-text: var(--color-secondary-800);
|
29
|
+
--btn-secondary-selected-border: var(--color-secondary-600);
|
30
|
+
|
27
31
|
--btn-secondary-hover-bg: var(--color-secondary-50);
|
28
32
|
--btn-secondary-hover-border: var(--color-secondary-500);
|
29
33
|
--btn-secondary-focus-outline: var(--color-secondary-800);
|
@@ -27,12 +27,12 @@ export function toArray(value: any, start?: number, end?: number): any[];
|
|
27
27
|
* Convert an async iterator to an array
|
28
28
|
* - If no async iterator is passed, the value will be processed by `from()`
|
29
29
|
*
|
30
|
-
* @param {AsyncIterator|
|
30
|
+
* @param {AsyncIterator|any} value
|
31
31
|
* Async iterator or value to convert to array
|
32
32
|
*
|
33
|
-
* @returns {Array} list of items returned by the iterator
|
33
|
+
* @returns {Promise<Array>} list of items returned by the iterator
|
34
34
|
*/
|
35
|
-
export function toArrayAsync(value: AsyncIterator<any, any, any> |
|
35
|
+
export function toArrayAsync(value: AsyncIterator<any, any, any> | any): Promise<any[]>;
|
36
36
|
/**
|
37
37
|
* Convert a path string to an array path
|
38
38
|
* - The path string will be spit at the `pathSeparator` token
|
@@ -51,13 +51,13 @@ export function toArrayPath(path: string | string[], pathSeparator?: string): st
|
|
51
51
|
/**
|
52
52
|
* Push a value to an array if it is not null, undefined or an empty string
|
53
53
|
*
|
54
|
-
* @template {
|
54
|
+
* @template {array} T
|
55
55
|
* @param {T} arr
|
56
56
|
* @param {any} value
|
57
57
|
*
|
58
58
|
* @returns {T} arr
|
59
59
|
*/
|
60
|
-
export function pushNotEmpty<T extends
|
60
|
+
export function pushNotEmpty<T extends any[]>(arr: T, value: any): T;
|
61
61
|
/**
|
62
62
|
* Loop over the supplied array and call the callback for every element
|
63
63
|
* - The callback will receive the current element of the array as
|
@@ -86,12 +86,12 @@ export function loop(arr: any[], callback: Function, additionalArguments: any[])
|
|
86
86
|
*
|
87
87
|
*
|
88
88
|
*
|
89
|
-
* @returns {
|
89
|
+
* @returns {any[]|Set<any>} values
|
90
90
|
*/
|
91
91
|
export function pathValues(items: object[], path: any, options?: {
|
92
92
|
outputAsSet?: boolean;
|
93
93
|
pathSeparator?: string;
|
94
|
-
}):
|
94
|
+
}): any[] | Set<any>;
|
95
95
|
/**
|
96
96
|
* Sort function that sorts a list of objects by values encountered at the
|
97
97
|
* specified key values of the object.
|
package/dist/util/array/index.js
CHANGED
@@ -21,8 +21,6 @@ export { smallestFirst, largestFirst };
|
|
21
21
|
|
22
22
|
export { arraySlice, arrayConcat };
|
23
23
|
|
24
|
-
// -----------------------------------------------------------------------------
|
25
|
-
|
26
24
|
/**
|
27
25
|
* Convert a value to an array
|
28
26
|
* - Converts an Arguments object to plain JS array
|
@@ -83,23 +81,24 @@ export function toArray(value, start, end) {
|
|
83
81
|
//
|
84
82
|
return Array.from(value);
|
85
83
|
} else {
|
86
|
-
return arraySlice(value, start, end);
|
84
|
+
return arraySlice.call(value, start, end);
|
87
85
|
}
|
88
86
|
}
|
89
87
|
|
90
|
-
// -----------------------------------------------------------------------------
|
91
|
-
|
92
88
|
/**
|
93
89
|
* Convert an async iterator to an array
|
94
90
|
* - If no async iterator is passed, the value will be processed by `from()`
|
95
91
|
*
|
96
|
-
* @param {AsyncIterator|
|
92
|
+
* @param {AsyncIterator|any} value
|
97
93
|
* Async iterator or value to convert to array
|
98
94
|
*
|
99
|
-
* @returns {Array} list of items returned by the iterator
|
95
|
+
* @returns {Promise<Array>} list of items returned by the iterator
|
100
96
|
*/
|
101
97
|
export async function toArrayAsync(value) {
|
102
|
-
if (
|
98
|
+
if (
|
99
|
+
value instanceof Object &&
|
100
|
+
typeof value[Symbol.asyncIterator] === 'function'
|
101
|
+
) {
|
103
102
|
// value is an async iterator
|
104
103
|
|
105
104
|
const arr = [];
|
@@ -116,8 +115,6 @@ export async function toArrayAsync(value) {
|
|
116
115
|
}
|
117
116
|
}
|
118
117
|
|
119
|
-
// -----------------------------------------------------------------------------
|
120
|
-
|
121
118
|
/**
|
122
119
|
* Convert a path string to an array path
|
123
120
|
* - The path string will be spit at the `pathSeparator` token
|
@@ -139,16 +136,16 @@ export function toArrayPath(path, pathSeparator = PATH_SEPARATOR) {
|
|
139
136
|
// path is already an array
|
140
137
|
return path;
|
141
138
|
} else {
|
142
|
-
throw new Error(
|
139
|
+
throw new Error(
|
140
|
+
'Missing or invalid parameter [path] (expected string or array)'
|
141
|
+
);
|
143
142
|
}
|
144
143
|
}
|
145
144
|
|
146
|
-
// -----------------------------------------------------------------------------
|
147
|
-
|
148
145
|
/**
|
149
146
|
* Push a value to an array if it is not null, undefined or an empty string
|
150
147
|
*
|
151
|
-
* @template {
|
148
|
+
* @template {array} T
|
152
149
|
* @param {T} arr
|
153
150
|
* @param {any} value
|
154
151
|
*
|
@@ -164,8 +161,6 @@ export function pushNotEmpty(arr, value) {
|
|
164
161
|
return arr;
|
165
162
|
}
|
166
163
|
|
167
|
-
// -----------------------------------------------------------------------------
|
168
|
-
|
169
164
|
/**
|
170
165
|
* Loop over the supplied array and call the callback for every element
|
171
166
|
* - The callback will receive the current element of the array as
|
@@ -213,8 +208,6 @@ export function loop(arr, callback, additionalArguments) {
|
|
213
208
|
}
|
214
209
|
}
|
215
210
|
|
216
|
-
// -----------------------------------------------------------------------------
|
217
|
-
|
218
211
|
/**
|
219
212
|
* Get a list of all values from the items in the array at the
|
220
213
|
* specified path
|
@@ -231,7 +224,7 @@ export function loop(arr, callback, additionalArguments) {
|
|
231
224
|
*
|
232
225
|
*
|
233
226
|
*
|
234
|
-
* @returns {
|
227
|
+
* @returns {any[]|Set<any>} values
|
235
228
|
*/
|
236
229
|
export function pathValues(items, path, options = {}) {
|
237
230
|
// == Process parameters
|
@@ -277,8 +270,6 @@ export function pathValues(items, path, options = {}) {
|
|
277
270
|
return values;
|
278
271
|
}
|
279
272
|
|
280
|
-
// -----------------------------------------------------------------------------
|
281
|
-
|
282
273
|
/**
|
283
274
|
* Sort function that sorts a list of objects by values encountered at the
|
284
275
|
* specified key values of the object.
|
@@ -306,8 +297,6 @@ export function sortByKeyValue(items, key, compareFn = smallestFirst) {
|
|
306
297
|
});
|
307
298
|
}
|
308
299
|
|
309
|
-
// -----------------------------------------------------------------------------
|
310
|
-
|
311
300
|
/**
|
312
301
|
* Sort function that sorts a list of objects by values encountered at the
|
313
302
|
* specified key values of the object.
|
@@ -335,8 +324,6 @@ export function sortByKeyValueReversed(items, key, compareFn = largestFirst) {
|
|
335
324
|
});
|
336
325
|
}
|
337
326
|
|
338
|
-
// -----------------------------------------------------------------------------
|
339
|
-
|
340
327
|
/**
|
341
328
|
* Sort function that sorts a list of objects by values encountered at the
|
342
329
|
* specified object path.
|
@@ -393,8 +380,6 @@ export function sortByPathValue(items, path, compareFn = smallestFirst) {
|
|
393
380
|
cache.clear();
|
394
381
|
}
|
395
382
|
|
396
|
-
// -----------------------------------------------------------------------------
|
397
|
-
|
398
383
|
/**
|
399
384
|
* Find the first item in the list of objects that matches the selector
|
400
385
|
* - All items in the supplied array must be objects
|
@@ -411,8 +396,6 @@ export function findFirst(arr, selector) {
|
|
411
396
|
return selectorObj.findFirst(arr);
|
412
397
|
}
|
413
398
|
|
414
|
-
// -----------------------------------------------------------------------------
|
415
|
-
|
416
399
|
/**
|
417
400
|
* Returns all items from the list of items that match the selector
|
418
401
|
* - All items in the supplied array must be objects
|
@@ -429,8 +412,6 @@ export function findAll(arr, selector) {
|
|
429
412
|
return selectorObj.findAll(arr);
|
430
413
|
}
|
431
414
|
|
432
|
-
// -----------------------------------------------------------------------------
|
433
|
-
|
434
415
|
/**
|
435
416
|
* Convert array to an object using a list of keys for each index
|
436
417
|
*
|
@@ -14,5 +14,5 @@
|
|
14
14
|
* getState
|
15
15
|
* ]}
|
16
16
|
*/
|
17
|
-
export function defineStateContext<T>(State: new () => T): [(contextKey
|
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('../../../typedef').ContextKey} contextKey
|
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('../../../typedef').ContextKey} contextKey
|
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('../../../typedef').ContextKey} contextKey
|
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('../../../typedef').ContextKey} contextKey
|
102
|
+
* @param {import('../../../typedef').ContextKey} [contextKey]
|
103
103
|
*
|
104
104
|
* @returns {T} state
|
105
105
|
*/
|