@fluid-topics/ft-wc-utils 0.3.71 → 1.0.0-alpha.0
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 -2
- package/build/CacheRegistry.js +0 -1
- package/build/CancelablePromise.d.ts +0 -1
- package/build/CancelablePromise.js +0 -1
- package/build/Debouncer.d.ts +0 -1
- package/build/Debouncer.js +0 -1
- package/build/FtCssVariables.d.ts +3 -4
- package/build/FtCssVariables.js +0 -1
- package/build/FtLitElement.d.ts +9 -17
- package/build/FtLitElement.js +21 -42
- package/build/ParametrizedLabelResolver.d.ts +1 -2
- package/build/ParametrizedLabelResolver.js +1 -2
- package/build/ScopedRegistryLitElement.d.ts +22 -0
- package/build/ScopedRegistryLitElement.js +23 -0
- package/build/decorators.d.ts +0 -1
- package/build/decorators.js +0 -1
- package/build/deep-equal.d.ts +0 -1
- package/build/deep-equal.js +0 -1
- package/build/delay.d.ts +0 -1
- package/build/delay.js +0 -1
- package/build/designSystemVariables.d.ts +0 -1
- package/build/designSystemVariables.js +0 -1
- package/build/events.d.ts +1 -2
- package/build/events.js +0 -1
- package/build/generic-types.d.ts +2 -2
- package/build/generic-types.js +0 -1
- package/build/globals.d.ts +0 -1
- package/build/globals.js +0 -1
- package/build/globals.min.js +23 -33
- package/build/index.d.ts +1 -2
- package/build/index.js +1 -1
- package/build/mixins.d.ts +0 -1
- package/build/mixins.js +0 -1
- package/build/redux.d.ts +16 -22
- package/build/redux.js +55 -90
- package/build/revivers.d.ts +0 -1
- package/build/revivers.js +0 -1
- package/build/rollup-globals.d.ts +0 -1
- package/build/rollup-globals.js +0 -1
- package/build/silent-define.d.ts +0 -1
- package/build/silent-define.js +0 -1
- package/build/silent-define.min.js +1 -1
- package/package.json +4 -5
package/build/CacheRegistry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CancelablePromise } from "./CancelablePromise";
|
|
2
|
-
export
|
|
2
|
+
export type CachedContent<T = any> = undefined | CancelablePromise<T> | T | Error;
|
|
3
3
|
export declare class CacheRegistry<T = any> {
|
|
4
4
|
private loaders;
|
|
5
5
|
private content;
|
|
@@ -20,4 +20,3 @@ export declare class CacheRegistry<T = any> {
|
|
|
20
20
|
keys(): Array<string>;
|
|
21
21
|
values(): Array<CachedContent<T>>;
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=CacheRegistry.d.ts.map
|
package/build/CacheRegistry.js
CHANGED
package/build/Debouncer.d.ts
CHANGED
package/build/Debouncer.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CSSResult } from "lit";
|
|
2
|
-
export
|
|
2
|
+
export type FtCssVariableCategory = "COLOR" | "NUMBER" | "SIZE" | "UNKNOWN" | "POSITION" | "DISPLAY";
|
|
3
3
|
export declare class FtCssVariableFactory {
|
|
4
4
|
static create(name: string, category: FtCssVariableCategory, defaultValue: string): FtCssVariable;
|
|
5
5
|
static extend(name: string, fallbackVariable: FtCssVariable, defaultValue?: string): FtCssVariable;
|
|
6
6
|
static external(externalVariable: FtCssVariable, context: string): FtCssVariable;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type FtCssVariable = CSSResult & {
|
|
9
9
|
name: string;
|
|
10
10
|
category: FtCssVariableCategory;
|
|
11
11
|
fallbackVariable?: FtCssVariable;
|
|
@@ -16,6 +16,5 @@ export declare type FtCssVariable = CSSResult & {
|
|
|
16
16
|
get(defaultValue?: string): CSSResult;
|
|
17
17
|
lastResortDefaultValue(): string | undefined;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type FtCssVariables = Record<string, FtCssVariable>;
|
|
20
20
|
export declare function setVariable(variable: FtCssVariable, value: string | CSSResult | FtCssVariable): CSSResult;
|
|
21
|
-
//# sourceMappingURL=FtCssVariables.d.ts.map
|
package/build/FtCssVariables.js
CHANGED
package/build/FtLitElement.d.ts
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
2
|
+
import { ScopedRegistryLitElement } from "./ScopedRegistryLitElement";
|
|
3
|
+
declare const constructorPrototype: unique symbol;
|
|
4
|
+
declare const constructorName: unique symbol;
|
|
5
|
+
declare const exportpartsDebouncer: unique symbol;
|
|
6
|
+
export declare class FtLitElement extends ScopedRegistryLitElement {
|
|
7
|
+
private readonly [constructorPrototype];
|
|
8
|
+
private readonly [constructorName];
|
|
7
9
|
constructor();
|
|
8
10
|
adoptedCallback(): void;
|
|
9
11
|
exportpartsPrefix?: string;
|
|
10
12
|
exportpartsPrefixes?: string[];
|
|
11
13
|
customStylesheet?: string;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Unless inline styles are required for your use-case, prefer static styles member
|
|
14
|
-
*/
|
|
15
|
-
protected getStyles(): CSSResultGroup;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Unless inline styles are required for your use-case, prefer default render method
|
|
18
|
-
*/
|
|
19
|
-
protected getTemplate(): unknown;
|
|
20
|
-
protected render(): unknown;
|
|
21
14
|
protected updated(props: PropertyValues): void;
|
|
22
15
|
protected contentAvailableCallback(props: PropertyValues): void;
|
|
23
|
-
private exportpartsDebouncer;
|
|
16
|
+
private [exportpartsDebouncer];
|
|
24
17
|
private scheduleExportpartsUpdate;
|
|
25
18
|
private setExportpartsAttribute;
|
|
26
19
|
}
|
|
27
20
|
export {};
|
|
28
|
-
//# sourceMappingURL=FtLitElement.d.ts.map
|
package/build/FtLitElement.js
CHANGED
|
@@ -4,47 +4,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
import { ScopedRegistryHost } from "@lit-labs/scoped-registry-mixin";
|
|
7
|
+
var _a;
|
|
9
8
|
import { property } from "lit/decorators.js";
|
|
10
9
|
import { jsonProperty } from "./decorators";
|
|
11
10
|
import { Debouncer } from "./Debouncer";
|
|
12
|
-
|
|
11
|
+
import { ScopedRegistryLitElement } from "./ScopedRegistryLitElement";
|
|
12
|
+
const constructorPrototype = Symbol("constructorPrototype");
|
|
13
|
+
const constructorName = Symbol("constructorName");
|
|
14
|
+
const exportpartsDebouncer = Symbol("exportpartsDebouncer");
|
|
15
|
+
export class FtLitElement extends ScopedRegistryLitElement {
|
|
13
16
|
constructor() {
|
|
14
17
|
super();
|
|
15
|
-
this
|
|
16
|
-
this
|
|
17
|
-
this
|
|
18
|
+
this[_a] = new Debouncer(5);
|
|
19
|
+
this[constructorName] = this.constructor.name;
|
|
20
|
+
this[constructorPrototype] = this.constructor.prototype;
|
|
18
21
|
}
|
|
19
22
|
adoptedCallback() {
|
|
20
|
-
if (this.constructor.name !== this
|
|
21
|
-
Object.setPrototypeOf(this, this
|
|
23
|
+
if (this.constructor.name !== this[constructorName]) {
|
|
24
|
+
Object.setPrototypeOf(this, this[constructorPrototype]);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Unless inline styles are required for your use-case, prefer static styles member
|
|
26
|
-
*/
|
|
27
|
-
getStyles() {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Unless inline styles are required for your use-case, prefer default render method
|
|
32
|
-
*/
|
|
33
|
-
getTemplate() {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
render() {
|
|
37
|
-
let styles = this.getStyles();
|
|
38
|
-
if (!Array.isArray(styles)) {
|
|
39
|
-
styles = [styles];
|
|
40
|
-
}
|
|
41
|
-
return html `
|
|
42
|
-
${styles.map(s => html `
|
|
43
|
-
<style>${s}</style>
|
|
44
|
-
`)}
|
|
45
|
-
${this.getTemplate()}
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
27
|
updated(props) {
|
|
49
28
|
super.updated(props);
|
|
50
29
|
setTimeout(() => {
|
|
@@ -53,8 +32,8 @@ export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
|
53
32
|
}, 0);
|
|
54
33
|
}
|
|
55
34
|
contentAvailableCallback(props) {
|
|
56
|
-
var
|
|
57
|
-
((
|
|
35
|
+
var _b, _c;
|
|
36
|
+
((_c = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll(".ft-lit-element--custom-stylesheet")) !== null && _c !== void 0 ? _c : []).forEach(e => e.remove());
|
|
58
37
|
if (this.customStylesheet) {
|
|
59
38
|
const customStyles = document.createElement("style");
|
|
60
39
|
customStyles.classList.add("ft-lit-element--custom-stylesheet");
|
|
@@ -63,9 +42,9 @@ export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
scheduleExportpartsUpdate() {
|
|
66
|
-
this
|
|
67
|
-
var
|
|
68
|
-
if ((
|
|
45
|
+
this[exportpartsDebouncer].run(() => {
|
|
46
|
+
var _b;
|
|
47
|
+
if ((_b = this.exportpartsPrefix) === null || _b === void 0 ? void 0 : _b.trim()) {
|
|
69
48
|
this.setExportpartsAttribute([this.exportpartsPrefix]);
|
|
70
49
|
}
|
|
71
50
|
else if (this.exportpartsPrefixes != null && this.exportpartsPrefixes.length > 0) {
|
|
@@ -74,7 +53,7 @@ export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
|
74
53
|
});
|
|
75
54
|
}
|
|
76
55
|
setExportpartsAttribute(prefixes) {
|
|
77
|
-
var
|
|
56
|
+
var _b, _c, _d, _e, _f, _g;
|
|
78
57
|
const stringFilter = (p) => p != null && p.trim().length > 0;
|
|
79
58
|
const trimmedPrefixes = prefixes.filter(stringFilter).map(p => p.trim());
|
|
80
59
|
if (trimmedPrefixes.length === 0) {
|
|
@@ -82,9 +61,9 @@ export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
|
82
61
|
return;
|
|
83
62
|
}
|
|
84
63
|
const allSubParts = new Set();
|
|
85
|
-
for (let element of (
|
|
86
|
-
const foundParts = (
|
|
87
|
-
const foundExportParts = (
|
|
64
|
+
for (let element of (_c = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll("[part],[exportparts]")) !== null && _c !== void 0 ? _c : []) {
|
|
65
|
+
const foundParts = (_e = (_d = element.getAttribute("part")) === null || _d === void 0 ? void 0 : _d.split(" ")) !== null && _e !== void 0 ? _e : [];
|
|
66
|
+
const foundExportParts = (_g = (_f = element.getAttribute("exportparts")) === null || _f === void 0 ? void 0 : _f.split(",").map(exp => exp.split(":")[1])) !== null && _g !== void 0 ? _g : [];
|
|
88
67
|
new Array(...foundParts, ...foundExportParts).filter(stringFilter)
|
|
89
68
|
.map(part => part.trim())
|
|
90
69
|
.forEach(part => allSubParts.add(part));
|
|
@@ -97,6 +76,7 @@ export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
|
97
76
|
this.setAttribute("exportparts", [...this.part, ...prefixedSubParts].join(", "));
|
|
98
77
|
}
|
|
99
78
|
}
|
|
79
|
+
_a = exportpartsDebouncer;
|
|
100
80
|
__decorate([
|
|
101
81
|
property()
|
|
102
82
|
], FtLitElement.prototype, "exportpartsPrefix", void 0);
|
|
@@ -106,4 +86,3 @@ __decorate([
|
|
|
106
86
|
__decorate([
|
|
107
87
|
property()
|
|
108
88
|
], FtLitElement.prototype, "customStylesheet", void 0);
|
|
109
|
-
//# sourceMappingURL=FtLitElement.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ParametrizedLabels = Record<string, string | undefined>;
|
|
2
2
|
export declare class ParametrizedLabelResolver<T extends ParametrizedLabels = ParametrizedLabels> {
|
|
3
3
|
private defaultLabels;
|
|
4
4
|
private labels;
|
|
@@ -8,4 +8,3 @@ export declare class ParametrizedLabelResolver<T extends ParametrizedLabels = Pa
|
|
|
8
8
|
private formatValue;
|
|
9
9
|
private formatDate;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=ParametrizedLabelResolver.d.ts.map
|
|
@@ -13,7 +13,7 @@ export class ParametrizedLabelResolver {
|
|
|
13
13
|
resolvePluralKey(key, args) {
|
|
14
14
|
for (let arg of args) {
|
|
15
15
|
if (typeof arg === "number") {
|
|
16
|
-
const maybeNewKey = `${key}[\\=${arg}]`;
|
|
16
|
+
const maybeNewKey = `${String(key)}[\\=${arg}]`;
|
|
17
17
|
if (maybeNewKey in this.labels || maybeNewKey in this.defaultLabels) {
|
|
18
18
|
return maybeNewKey;
|
|
19
19
|
}
|
|
@@ -42,4 +42,3 @@ export class ParametrizedLabelResolver {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=ParametrizedLabelResolver.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from "lit-element/lit-element.js";
|
|
2
|
+
declare global {
|
|
3
|
+
interface ShadowRootInit {
|
|
4
|
+
customElements?: CustomElementRegistry;
|
|
5
|
+
}
|
|
6
|
+
interface ShadowRoot {
|
|
7
|
+
importNode(node: Node, deep?: boolean): Node;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type ElementDefinitionsMap = {
|
|
11
|
+
[key: string]: typeof HTMLElement;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Typescript would not let us use the mixin directly when upgrading Lit from 2.2.8 to 2.7.2
|
|
15
|
+
*
|
|
16
|
+
* From https://github.com/lit/lit/blob/main/packages/labs/scoped-registry-mixin/
|
|
17
|
+
*/
|
|
18
|
+
export declare class ScopedRegistryLitElement extends LitElement {
|
|
19
|
+
static elementDefinitions?: ElementDefinitionsMap;
|
|
20
|
+
static registry?: CustomElementRegistry;
|
|
21
|
+
createRenderRoot(): ShadowRoot;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement } from "lit-element/lit-element.js";
|
|
2
|
+
import { adoptStyles } from "@lit/reactive-element/css-tag.js";
|
|
3
|
+
/**
|
|
4
|
+
* Typescript would not let us use the mixin directly when upgrading Lit from 2.2.8 to 2.7.2
|
|
5
|
+
*
|
|
6
|
+
* From https://github.com/lit/lit/blob/main/packages/labs/scoped-registry-mixin/
|
|
7
|
+
*/
|
|
8
|
+
export class ScopedRegistryLitElement extends LitElement {
|
|
9
|
+
createRenderRoot() {
|
|
10
|
+
const constructor = this.constructor;
|
|
11
|
+
if (constructor.elementDefinitions && !constructor.registry) {
|
|
12
|
+
constructor.registry = new CustomElementRegistry();
|
|
13
|
+
Object.entries(constructor.elementDefinitions).forEach(([tagName, klass]) => constructor.registry.define(tagName, klass));
|
|
14
|
+
}
|
|
15
|
+
const init = {
|
|
16
|
+
...constructor.shadowRootOptions,
|
|
17
|
+
customElements: constructor.registry,
|
|
18
|
+
};
|
|
19
|
+
const renderRoot = this.renderOptions.creationScope = this.attachShadow(init);
|
|
20
|
+
adoptStyles(renderRoot, constructor.elementStyles);
|
|
21
|
+
return renderRoot;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/build/decorators.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import { PropertyDeclaration } from "@lit/reactive-element";
|
|
|
2
2
|
import { ClassElement } from "@lit/reactive-element/decorators/base";
|
|
3
3
|
export declare const customElement: (tagName: string) => (clazz: CustomElementConstructor) => void;
|
|
4
4
|
export declare function jsonProperty(defaultValue: any, options?: PropertyDeclaration): (attribute: Object | ClassElement, name?: PropertyKey | undefined) => any;
|
|
5
|
-
//# sourceMappingURL=decorators.d.ts.map
|
package/build/decorators.js
CHANGED
package/build/deep-equal.d.ts
CHANGED
package/build/deep-equal.js
CHANGED
package/build/delay.d.ts
CHANGED
package/build/delay.js
CHANGED
|
@@ -63,4 +63,3 @@ export const designSystemVariables = {
|
|
|
63
63
|
transitionDuration: FtCssVariableFactory.create("--ft-transition-duration", "UNKNOWN", "250ms"),
|
|
64
64
|
transitionTimingFunction: FtCssVariableFactory.create("--ft-transition-timing-function", "UNKNOWN", "ease-in-out"),
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=designSystemVariables.js.map
|
package/build/events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type FtNotificationType = "info" | "warning" | "error";
|
|
2
2
|
export interface FtNotificationEventDetail {
|
|
3
3
|
type: FtNotificationType;
|
|
4
4
|
message: string;
|
|
@@ -6,4 +6,3 @@ export interface FtNotificationEventDetail {
|
|
|
6
6
|
export declare class FtNotificationEvent extends CustomEvent<FtNotificationEventDetail> {
|
|
7
7
|
constructor(detail: FtNotificationEventDetail);
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=events.d.ts.map
|
package/build/events.js
CHANGED
package/build/generic-types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export type Optional<T> = T | null | undefined;
|
|
2
|
+
export type Constructor<T> = new (...args: any[]) => T;
|
package/build/generic-types.js
CHANGED
package/build/globals.d.ts
CHANGED
package/build/globals.js
CHANGED