@hkdigital/lib-sveltekit 0.1.84 → 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.
Files changed (54) hide show
  1. package/dist/classes/data/Selector.d.ts +2 -2
  2. package/dist/classes/data/Selector.js +1 -1
  3. package/dist/components/drag-drop/drag-state.svelte.d.ts +3 -3
  4. package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
  5. package/dist/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +3 -3
  6. package/dist/features/hk-app-layout/HkAppLayout.state.svelte.d.ts +6 -0
  7. package/dist/themes/hkdev/components/buttons/button.css +6 -2
  8. package/dist/util/array/index.d.ts +7 -7
  9. package/dist/util/array/index.js +12 -31
  10. package/dist/util/svelte/state-context/index.d.ts +1 -1
  11. package/dist/util/svelte/state-context/index.js +4 -4
  12. package/package.json +1 -1
  13. package/dist/widgets/hk-app-layout/HkAppLayout.state.svelte.d.ts +0 -6
  14. /package/dist/{widgets → features}/button-group/ButtonGroup.svelte +0 -0
  15. /package/dist/{widgets → features}/button-group/ButtonGroup.svelte.d.ts +0 -0
  16. /package/dist/{widgets → features}/button-group/typedef.d.ts +0 -0
  17. /package/dist/{widgets → features}/button-group/typedef.js +0 -0
  18. /package/dist/{widgets → features}/compare-left-right/CompareLeftRight.svelte +0 -0
  19. /package/dist/{widgets → features}/compare-left-right/CompareLeftRight.svelte.d.ts +0 -0
  20. /package/dist/{widgets → features}/compare-left-right/index.d.ts +0 -0
  21. /package/dist/{widgets → features}/compare-left-right/index.js +0 -0
  22. /package/dist/{widgets → features}/game-box/GameBox.svelte +0 -0
  23. /package/dist/{widgets → features}/game-box/GameBox.svelte.d.ts +0 -0
  24. /package/dist/{widgets → features}/game-box/gamebox.util.d.ts +0 -0
  25. /package/dist/{widgets → features}/game-box/gamebox.util.js +0 -0
  26. /package/dist/{widgets → features}/hk-app-layout/HkAppLayout.state.svelte.js +0 -0
  27. /package/dist/{widgets → features}/hk-app-layout/HkAppLayout.svelte +0 -0
  28. /package/dist/{widgets → features}/hk-app-layout/HkAppLayout.svelte.d.ts +0 -0
  29. /package/dist/{widgets → features}/image-box/ImageBox.svelte +0 -0
  30. /package/dist/{widgets → features}/image-box/ImageBox.svelte.d.ts +0 -0
  31. /package/dist/{widgets → features}/image-box/index.d.ts +0 -0
  32. /package/dist/{widgets → features}/image-box/index.js +0 -0
  33. /package/dist/{widgets → features}/image-box/typedef.d.ts +0 -0
  34. /package/dist/{widgets → features}/image-box/typedef.js +0 -0
  35. /package/dist/{widgets → features}/index.d.ts +0 -0
  36. /package/dist/{widgets → features}/index.js +0 -0
  37. /package/dist/{widgets → features}/presenter/(broken) Presenter.state.svelte.js__ +0 -0
  38. /package/dist/{widgets → features}/presenter/ImageSlide.svelte +0 -0
  39. /package/dist/{widgets → features}/presenter/ImageSlide.svelte.d.ts +0 -0
  40. /package/dist/{widgets → features}/presenter/Presenter.state.svelte.d.ts +0 -0
  41. /package/dist/{widgets → features}/presenter/Presenter.state.svelte.js +0 -0
  42. /package/dist/{widgets → features}/presenter/Presenter.svelte +0 -0
  43. /package/dist/{widgets → features}/presenter/Presenter.svelte.d.ts +0 -0
  44. /package/dist/{widgets → features}/presenter/Presenter.svelte__ +0 -0
  45. /package/dist/{widgets → features}/presenter/constants.d.ts +0 -0
  46. /package/dist/{widgets → features}/presenter/constants.js +0 -0
  47. /package/dist/{widgets → features}/presenter/index.d.ts +0 -0
  48. /package/dist/{widgets → features}/presenter/index.js +0 -0
  49. /package/dist/{widgets → features}/presenter/typedef.d.ts +0 -0
  50. /package/dist/{widgets → features}/presenter/typedef.js +0 -0
  51. /package/dist/{widgets → features}/presenter/util.d.ts +0 -0
  52. /package/dist/{widgets → features}/presenter/util.js +0 -0
  53. /package/dist/{widgets → features}/virtual-viewport/VirtualViewport.svelte +0 -0
  54. /package/dist/{widgets → features}/virtual-viewport/VirtualViewport.svelte.d.ts +0 -0
@@ -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
  }
@@ -80,7 +80,7 @@ export default class Selector {
80
80
  * @template {object} T
81
81
  * @param {T[]|null} items
82
82
  *
83
- * @returns {T|null} item or null if not found
83
+ * @returns {T[]|null} item or null if not found
84
84
  */
85
85
  findAll(items) {
86
86
  const result = [];
@@ -1,6 +1,6 @@
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;
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: 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;
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: 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;
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;
@@ -0,0 +1,6 @@
1
+ export class AppLayoutState {
2
+ landscapeOnSmallScreen: boolean;
3
+ }
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|mixed} value
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> | mixed): 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 {arrray} T
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 arrray>(arr: T, value: any): T;
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 {mixed[]} values
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
- }): mixed[];
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.
@@ -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|mixed} value
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 (value instanceof Object && typeof value[Symbol.asyncIterator] === 'function') {
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('Missing or invalid parameter [path] (expected string or array)');
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 {arrray} T
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 {mixed[]} values
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: import("../../../typedef").ContextKey) => T, (contextKey: import("../../../typedef").ContextKey) => T, (contextKey: import("../../../typedef").ContextKey) => T];
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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -1,6 +0,0 @@
1
- export class AppLayoutState {
2
- landscapeOnSmallScreen: boolean;
3
- }
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;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes