@fluid-topics/ft-wc-utils 0.3.70 → 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.
Files changed (43) hide show
  1. package/build/CacheRegistry.d.ts +1 -2
  2. package/build/CacheRegistry.js +0 -1
  3. package/build/CancelablePromise.d.ts +0 -1
  4. package/build/CancelablePromise.js +0 -1
  5. package/build/Debouncer.d.ts +0 -1
  6. package/build/Debouncer.js +0 -1
  7. package/build/FtCssVariables.d.ts +3 -4
  8. package/build/FtCssVariables.js +0 -1
  9. package/build/FtLitElement.d.ts +9 -17
  10. package/build/FtLitElement.js +21 -42
  11. package/build/ParametrizedLabelResolver.d.ts +1 -2
  12. package/build/ParametrizedLabelResolver.js +1 -2
  13. package/build/ScopedRegistryLitElement.d.ts +22 -0
  14. package/build/ScopedRegistryLitElement.js +23 -0
  15. package/build/decorators.d.ts +0 -1
  16. package/build/decorators.js +0 -1
  17. package/build/deep-equal.d.ts +0 -1
  18. package/build/deep-equal.js +0 -1
  19. package/build/delay.d.ts +0 -1
  20. package/build/delay.js +0 -1
  21. package/build/designSystemVariables.d.ts +0 -1
  22. package/build/designSystemVariables.js +0 -1
  23. package/build/events.d.ts +1 -2
  24. package/build/events.js +0 -1
  25. package/build/generic-types.d.ts +2 -2
  26. package/build/generic-types.js +0 -1
  27. package/build/globals.d.ts +0 -1
  28. package/build/globals.js +0 -1
  29. package/build/globals.min.js +23 -33
  30. package/build/index.d.ts +1 -2
  31. package/build/index.js +1 -1
  32. package/build/mixins.d.ts +0 -1
  33. package/build/mixins.js +0 -1
  34. package/build/redux.d.ts +16 -22
  35. package/build/redux.js +55 -90
  36. package/build/revivers.d.ts +0 -1
  37. package/build/revivers.js +0 -1
  38. package/build/rollup-globals.d.ts +0 -1
  39. package/build/rollup-globals.js +0 -1
  40. package/build/silent-define.d.ts +0 -1
  41. package/build/silent-define.js +0 -1
  42. package/build/silent-define.min.js +1 -1
  43. package/package.json +4 -5
@@ -1,5 +1,5 @@
1
1
  import { CancelablePromise } from "./CancelablePromise";
2
- export declare type CachedContent<T = any> = undefined | CancelablePromise<T> | T | Error;
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
@@ -83,4 +83,3 @@ export class CacheRegistry {
83
83
  return Object.values(this.content);
84
84
  }
85
85
  }
86
- //# sourceMappingURL=CacheRegistry.js.map
@@ -4,4 +4,3 @@ export declare class CancelablePromise<T> extends Promise<T> {
4
4
  cancel(): void;
5
5
  }
6
6
  export declare const cancelable: <T>(promise: Promise<T>) => CancelablePromise<T>;
7
- //# sourceMappingURL=CancelablePromise.d.ts.map
@@ -22,4 +22,3 @@ export class CancelablePromise extends Promise {
22
22
  }
23
23
  }
24
24
  export const cancelable = (promise) => new CancelablePromise((accept, reject) => promise.then(accept).catch(reject));
25
- //# sourceMappingURL=CancelablePromise.js.map
@@ -14,4 +14,3 @@ export declare class Debouncer {
14
14
  private clearTimeout;
15
15
  private clearPromise;
16
16
  }
17
- //# sourceMappingURL=Debouncer.d.ts.map
@@ -58,4 +58,3 @@ export class Debouncer {
58
58
  this.rejectPromise = undefined;
59
59
  }
60
60
  }
61
- //# sourceMappingURL=Debouncer.js.map
@@ -1,11 +1,11 @@
1
1
  import { CSSResult } from "lit";
2
- export declare type FtCssVariableCategory = "COLOR" | "NUMBER" | "SIZE" | "UNKNOWN" | "POSITION" | "DISPLAY";
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 declare type FtCssVariable = CSSResult & {
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 declare type FtCssVariables = Record<string, FtCssVariable>;
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
@@ -43,4 +43,3 @@ export class FtCssVariableFactory {
43
43
  export function setVariable(variable, value) {
44
44
  return unsafeCSS(`${variable.name}: ${value}`);
45
45
  }
46
- //# sourceMappingURL=FtCssVariables.js.map
@@ -1,28 +1,20 @@
1
- import { LitElement, PropertyValues } from "lit";
2
- import { CSSResultGroup } from "@lit/reactive-element/css-tag";
3
- declare const FtLitElement_base: typeof LitElement;
4
- export declare class FtLitElement extends FtLitElement_base {
5
- private readonly constructorPrototype;
6
- private readonly constructorName;
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
@@ -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
- import { html, LitElement } from "lit";
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
- export class FtLitElement extends ScopedRegistryHost(LitElement) {
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.exportpartsDebouncer = new Debouncer(5);
16
- this.constructorName = this.constructor.name;
17
- this.constructorPrototype = this.constructor.prototype;
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.constructorName) {
21
- Object.setPrototypeOf(this, this.constructorPrototype);
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 _a, _b;
57
- ((_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ft-lit-element--custom-stylesheet")) !== null && _b !== void 0 ? _b : []).forEach(e => e.remove());
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.exportpartsDebouncer.run(() => {
67
- var _a;
68
- if ((_a = this.exportpartsPrefix) === null || _a === void 0 ? void 0 : _a.trim()) {
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 _a, _b, _c, _d, _e, _f;
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 (_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[part],[exportparts]")) !== null && _b !== void 0 ? _b : []) {
86
- const foundParts = (_d = (_c = element.getAttribute("part")) === null || _c === void 0 ? void 0 : _c.split(" ")) !== null && _d !== void 0 ? _d : [];
87
- const foundExportParts = (_f = (_e = element.getAttribute("exportparts")) === null || _e === void 0 ? void 0 : _e.split(",").map(exp => exp.split(":")[1])) !== null && _f !== void 0 ? _f : [];
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 declare type ParametrizedLabels = Record<string, string | undefined>;
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
+ }
@@ -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
@@ -29,4 +29,3 @@ export function jsonProperty(defaultValue, options) {
29
29
  ...(options !== null && options !== void 0 ? options : {})
30
30
  });
31
31
  }
32
- //# sourceMappingURL=decorators.js.map
@@ -1,2 +1 @@
1
1
  export declare function deepEqual(a: any, b: any): boolean;
2
- //# sourceMappingURL=deep-equal.d.ts.map
@@ -62,4 +62,3 @@ export function deepEqual(a, b) {
62
62
  return false;
63
63
  }
64
64
  }
65
- //# sourceMappingURL=deep-equal.js.map
package/build/delay.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export declare const delay: (ms: number) => Promise<unknown>;
2
- //# sourceMappingURL=delay.d.ts.map
package/build/delay.js CHANGED
@@ -1,2 +1 @@
1
1
  export const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
2
- //# sourceMappingURL=delay.js.map
@@ -62,4 +62,3 @@ export declare const designSystemVariables: {
62
62
  transitionDuration: import("./FtCssVariables").FtCssVariable;
63
63
  transitionTimingFunction: import("./FtCssVariables").FtCssVariable;
64
64
  };
65
- //# sourceMappingURL=designSystemVariables.d.ts.map
@@ -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 declare type FtNotificationType = "info" | "warning" | "error";
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
@@ -3,4 +3,3 @@ export class FtNotificationEvent extends CustomEvent {
3
3
  super("ft-notification", { bubbles: true, composed: true, detail });
4
4
  }
5
5
  }
6
- //# sourceMappingURL=events.js.map
@@ -1,2 +1,2 @@
1
- export declare type Optional<T> = T | null | undefined;
2
- //# sourceMappingURL=generic-types.d.ts.map
1
+ export type Optional<T> = T | null | undefined;
2
+ export type Constructor<T> = new (...args: any[]) => T;
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=generic-types.js.map
@@ -5,4 +5,3 @@ export * as litClassMap from "lit/directives/class-map.js";
5
5
  export * as litStyleMap from "lit/directives/style-map.js";
6
6
  export * as litUnsafeHTML from "lit-html/directives/unsafe-html.js";
7
7
  export * as wcUtils from "./index";
8
- //# sourceMappingURL=globals.d.ts.map
package/build/globals.js CHANGED
@@ -5,4 +5,3 @@ export * as litClassMap from "lit/directives/class-map.js";
5
5
  export * as litStyleMap from "lit/directives/style-map.js";
6
6
  export * as litUnsafeHTML from "lit-html/directives/unsafe-html.js";
7
7
  export * as wcUtils from "./index";
8
- //# sourceMappingURL=globals.js.map