@fluid-topics/ft-wc-utils 1.3.31 → 1.3.32
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/build/DateFormatter.d.ts +1 -0
- package/build/DateFormatter.js +5 -0
- package/build/DynamicImporter.d.ts +1 -1
- package/build/DynamicImporter.js +3 -1
- package/build/FtLitElementWithAriaNotification.d.ts +4 -2
- package/build/FtLitElementWithAriaNotification.js +14 -13
- package/build/a11y/FluidTopicsA11yHints.d.ts +1 -0
- package/build/a11y/FluidTopicsA11yHints.js +2 -0
- package/build/designSystemVariables.js +10 -10
- package/build/globals.min.js +13 -13
- package/build/helpers.d.ts +3 -0
- package/build/helpers.js +25 -0
- package/package.json +2 -2
package/build/helpers.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export declare const delay: (ms: number) => Promise<unknown>;
|
|
|
3
3
|
export declare function waitUntil(condition: Provider<boolean | Promise<boolean>>, interval?: number, timeout?: Optional<number>): Promise<void>;
|
|
4
4
|
export declare function waitFor<T>(provider: Provider<Optional<T> | Promise<Optional<T>>>, interval?: number, timeout?: Optional<number>): Promise<T>;
|
|
5
5
|
export declare function flatDeep<T>(arr: Array<T>, getChildren: (o: T) => Array<T>): Array<T>;
|
|
6
|
+
export declare function forEachDeep<T>(arr: Array<T>, getChildren: (o: T) => Array<T>, callback: (o: T, index: number, currentArray: Array<T>, breadcrumb: Array<T>) => boolean | void): void;
|
|
7
|
+
export declare function someDeep<T>(arr: Array<T>, getChildren: (o: T) => Array<T>, predicate: (o: T, index: number, currentArray: Array<T>, breadcrumb: Array<T>) => unknown): boolean;
|
|
8
|
+
export declare function everyDeep<T>(arr: Array<T>, getChildren: (o: T) => Array<T>, predicate: (o: T, index: number, currentArray: Array<T>, breadcrumb: Array<T>) => unknown): boolean;
|
|
6
9
|
export declare function dateReviver(...dateKeys: string[]): (key: string, value: any) => any;
|
|
7
10
|
export declare function parseDate(value: string): Date;
|
|
8
11
|
export declare function deepEqual(a: any, b: any): boolean;
|
package/build/helpers.js
CHANGED
|
@@ -19,6 +19,31 @@ export async function waitFor(provider, interval = 10, timeout = 20000) {
|
|
|
19
19
|
export function flatDeep(arr, getChildren) {
|
|
20
20
|
return arr.flatMap((o) => [o, ...flatDeep(getChildren(o), getChildren)]);
|
|
21
21
|
}
|
|
22
|
+
export function forEachDeep(arr, getChildren, callback) {
|
|
23
|
+
const recursiveForEach = (currentArray, breadcrumb) => {
|
|
24
|
+
var _a;
|
|
25
|
+
for (let index = 0; index < currentArray.length; index++) {
|
|
26
|
+
const current = currentArray[index];
|
|
27
|
+
const shouldContinue = ((_a = callback(current, index, currentArray, breadcrumb)) !== null && _a !== void 0 ? _a : true) && recursiveForEach(getChildren(current), [...breadcrumb, current]);
|
|
28
|
+
if (!shouldContinue) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
recursiveForEach(arr, []);
|
|
35
|
+
}
|
|
36
|
+
export function someDeep(arr, getChildren, predicate) {
|
|
37
|
+
let predicateValid = false;
|
|
38
|
+
forEachDeep(arr, getChildren, (o, i, a, b) => {
|
|
39
|
+
predicateValid = !!predicate(o, i, a, b);
|
|
40
|
+
return !predicateValid;
|
|
41
|
+
});
|
|
42
|
+
return predicateValid;
|
|
43
|
+
}
|
|
44
|
+
export function everyDeep(arr, getChildren, predicate) {
|
|
45
|
+
return !someDeep(arr, getChildren, (o, i, a, b) => !predicate(o, i, a, b));
|
|
46
|
+
}
|
|
22
47
|
export function dateReviver(...dateKeys) {
|
|
23
48
|
return (key, value) => dateKeys.includes(key) ? parseDate(value) : value;
|
|
24
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-wc-utils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.32",
|
|
4
4
|
"description": "Internal web components tools",
|
|
5
5
|
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"mark.js": "8.11.1",
|
|
25
25
|
"moment": "2.29.4"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "60fe73e7ae4d0815116abe89d2c4315cf454f626"
|
|
28
28
|
}
|