@fluid-topics/ft-wc-utils 1.3.13 → 1.3.15
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/CacheRegistry.d.ts +1 -0
- package/build/CacheRegistry.js +10 -11
- package/build/decorators.d.ts +4 -0
- package/build/decorators.js +12 -4
- package/build/floating.d.ts +2 -1
- package/build/floating.js +4 -1
- package/build/globals.min.js +13 -13
- package/package.json +2 -2
package/build/CacheRegistry.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class CacheRegistry extends WithEventBus {
|
|
|
20
20
|
register(key: string, loader: () => Promise<any>, final?: boolean): void;
|
|
21
21
|
registerFinal(key: string, loader: () => Promise<any>): void;
|
|
22
22
|
clearAll(dispatchEvent?: boolean): string[];
|
|
23
|
+
clearMatching(matcher: (key: string) => boolean, dispatchEvent?: boolean): string[];
|
|
23
24
|
clear(key: string, dispatchEvent?: boolean): string | undefined;
|
|
24
25
|
private forceClear;
|
|
25
26
|
private clearClearTimeout;
|
package/build/CacheRegistry.js
CHANGED
|
@@ -18,16 +18,15 @@ export class CacheRegistry extends WithEventBus {
|
|
|
18
18
|
this.content[key] = { ...content, loader, final, status };
|
|
19
19
|
}
|
|
20
20
|
registerFinal(key, loader) {
|
|
21
|
-
this.forceClear(key); // Force the final content to be reloaded when the loader changes
|
|
22
21
|
this.register(key, loader, true);
|
|
23
22
|
}
|
|
24
23
|
clearAll(dispatchEvent = true) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
return this.clearMatching(() => true, dispatchEvent);
|
|
25
|
+
}
|
|
26
|
+
clearMatching(matcher, dispatchEvent = true) {
|
|
27
|
+
const clearedKeys = Object.keys(this.content)
|
|
28
|
+
.filter(matcher)
|
|
29
|
+
.filter((key) => this.clear(key, false) != undefined);
|
|
31
30
|
if (dispatchEvent && clearedKeys.length > 0) {
|
|
32
31
|
this.dispatchEvent(new ClearCacheEvent(clearedKeys));
|
|
33
32
|
}
|
|
@@ -92,7 +91,7 @@ export class CacheRegistry extends WithEventBus {
|
|
|
92
91
|
content.status = "LOADING";
|
|
93
92
|
content.promise = cancelable(loader());
|
|
94
93
|
return content.promise
|
|
95
|
-
.then(value => {
|
|
94
|
+
.then((value) => {
|
|
96
95
|
content.status = "RESOLVED";
|
|
97
96
|
content.value = value;
|
|
98
97
|
if (ttl != null) {
|
|
@@ -101,7 +100,7 @@ export class CacheRegistry extends WithEventBus {
|
|
|
101
100
|
}
|
|
102
101
|
return value;
|
|
103
102
|
})
|
|
104
|
-
.catch(error => {
|
|
103
|
+
.catch((error) => {
|
|
105
104
|
var _a;
|
|
106
105
|
if (!((_a = content.promise) === null || _a === void 0 ? void 0 : _a.isCanceled)) {
|
|
107
106
|
content.status = "ERROR";
|
|
@@ -123,10 +122,10 @@ export class CacheRegistry extends WithEventBus {
|
|
|
123
122
|
return ((_a = this.content[key]) === null || _a === void 0 ? void 0 : _a.status) !== undefined && ((_b = this.content[key]) === null || _b === void 0 ? void 0 : _b.status) !== "REGISTERED";
|
|
124
123
|
}
|
|
125
124
|
resolvedKeys() {
|
|
126
|
-
return Object.keys(this.content).filter(key => { var _a; return ((_a = this.content[key]) === null || _a === void 0 ? void 0 : _a.status) === "RESOLVED"; });
|
|
125
|
+
return Object.keys(this.content).filter((key) => { var _a; return ((_a = this.content[key]) === null || _a === void 0 ? void 0 : _a.status) === "RESOLVED"; });
|
|
127
126
|
}
|
|
128
127
|
resolvedValues() {
|
|
129
|
-
return this.resolvedKeys().map(key => this.content[key].value);
|
|
128
|
+
return this.resolvedKeys().map((key) => this.content[key].value);
|
|
130
129
|
}
|
|
131
130
|
keys() {
|
|
132
131
|
return Object.keys(this.content);
|
package/build/decorators.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { PropertyDeclaration } from "@lit/reactive-element";
|
|
2
2
|
export declare const customElement: (tagName: string) => (clazz: CustomElementConstructor) => void;
|
|
3
3
|
export declare function jsonProperty(defaultValue: any, options?: PropertyDeclaration): PropertyDecorator;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use numberProperty instead
|
|
6
|
+
*/
|
|
4
7
|
export declare function optionalNumberProperty(options?: PropertyDeclaration): PropertyDecorator;
|
|
8
|
+
export declare function numberProperty(options?: PropertyDeclaration): PropertyDecorator;
|
|
5
9
|
export declare function isNumber(value: any): boolean;
|
package/build/decorators.js
CHANGED
|
@@ -23,17 +23,24 @@ export function jsonProperty(defaultValue, options) {
|
|
|
23
23
|
},
|
|
24
24
|
toAttribute: (value) => {
|
|
25
25
|
return JSON.stringify(value);
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
27
|
},
|
|
28
28
|
hasChanged,
|
|
29
|
-
...(options !== null && options !== void 0 ? options : {})
|
|
29
|
+
...(options !== null && options !== void 0 ? options : {}),
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use numberProperty instead
|
|
34
|
+
*/
|
|
32
35
|
export function optionalNumberProperty(options) {
|
|
36
|
+
return numberProperty(options);
|
|
37
|
+
}
|
|
38
|
+
export function numberProperty(options) {
|
|
33
39
|
return property({
|
|
34
40
|
type: Object,
|
|
35
41
|
converter: {
|
|
36
42
|
fromAttribute: (value) => {
|
|
43
|
+
console.log("from attribute", value, options);
|
|
37
44
|
if (value == null) {
|
|
38
45
|
return undefined;
|
|
39
46
|
}
|
|
@@ -41,9 +48,10 @@ export function optionalNumberProperty(options) {
|
|
|
41
48
|
},
|
|
42
49
|
toAttribute: (value) => {
|
|
43
50
|
return value == null ? undefined : "" + value;
|
|
44
|
-
}
|
|
51
|
+
},
|
|
45
52
|
},
|
|
46
|
-
|
|
53
|
+
useDefault: true,
|
|
54
|
+
...(options !== null && options !== void 0 ? options : {}),
|
|
47
55
|
});
|
|
48
56
|
}
|
|
49
57
|
export function isNumber(value) {
|
package/build/floating.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ComputePositionReturn, Placement, Strategy } from "@floating-ui/dom";
|
|
2
|
+
import { FtCssVariable } from "@fluid-topics/design-system-variables";
|
|
2
3
|
export declare function computeOffsetPosition(reference: HTMLElement, element: HTMLElement, placement: Placement): Promise<ComputePositionReturn>;
|
|
3
|
-
export declare function computeOffsetAutoPosition(reference: HTMLElement, element: HTMLElement, placement?: Placement, allowedPlacements?: Placement[], strategy?: Strategy, maxHeightCssVariable?: string, offsetValue?: number): Promise<ComputePositionReturn>;
|
|
4
|
+
export declare function computeOffsetAutoPosition(reference: HTMLElement, element: HTMLElement, placement?: Placement, allowedPlacements?: Placement[], strategy?: Strategy, maxHeightCssVariable?: string | FtCssVariable, offsetValue?: number): Promise<ComputePositionReturn>;
|
package/build/floating.js
CHANGED
|
@@ -29,8 +29,11 @@ export async function computeOffsetAutoPosition(reference, element, placement, a
|
|
|
29
29
|
autoPlacement({ allowedPlacements: allowedPlacements }),
|
|
30
30
|
size({
|
|
31
31
|
apply({ availableHeight, elements }) {
|
|
32
|
+
if (typeof maxHeightCssVariable === "string") {
|
|
33
|
+
maxHeightCssVariable = `var(${maxHeightCssVariable})`;
|
|
34
|
+
}
|
|
32
35
|
if (maxHeightCssVariable) {
|
|
33
|
-
elements.floating.style.maxHeight = `min(${Math.max(0, availableHeight)}px,
|
|
36
|
+
elements.floating.style.maxHeight = `min(${Math.max(0, availableHeight)}px, ${maxHeightCssVariable})`;
|
|
34
37
|
}
|
|
35
38
|
else {
|
|
36
39
|
elements.floating.style.maxHeight = `${Math.max(0, availableHeight)}px`;
|