@fluid-topics/ft-wc-utils 1.3.26 → 1.3.27

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.
@@ -5,4 +5,4 @@ export type FtFormComponentInterface = {
5
5
  get form(): HTMLFormElement | null;
6
6
  };
7
7
  export type FtFormComponentType<T extends Constructor<FtLitElement>> = T & Constructor<FtFormComponentInterface>;
8
- export declare function toFtFormComponent<T extends Constructor<FtLitElement>>(ElementClass: T): FtFormComponentType<T>;
8
+ export declare const toFtFormComponent: <T extends Constructor<FtLitElement>>(c: T) => FtFormComponentType<T>;
@@ -1,5 +1,6 @@
1
+ import { applyMixinOnce } from "./helpers";
1
2
  const elementInternals = Symbol("elementInternals");
2
- export function toFtFormComponent(ElementClass) {
3
+ export const toFtFormComponent = applyMixinOnce(Symbol("toFtFormComponent"), function (ElementClass) {
3
4
  class FtFormComponentClass extends ElementClass {
4
5
  static get formAssociated() {
5
6
  return true;
@@ -16,4 +17,4 @@ export function toFtFormComponent(ElementClass) {
16
17
  }
17
18
  }
18
19
  return FtFormComponentClass;
19
- }
20
+ });
@@ -8,5 +8,5 @@ export type FtLitElementWithAriaNotificationInterface = {
8
8
  sendAriaNotification(message?: AriaNotificationMessageType): void;
9
9
  };
10
10
  type FtLitElementWithAriaNotificationType<T extends Constructor<FtLitElement>> = T & Constructor<FtLitElementWithAriaNotificationInterface>;
11
- export declare function withAriaNotification<T extends Constructor<FtLitElement>>(Class: T): FtLitElementWithAriaNotificationType<T>;
11
+ export declare const withAriaNotification: <T extends Constructor<FtLitElement>>(c: T) => FtLitElementWithAriaNotificationType<T>;
12
12
  export {};
@@ -1,5 +1,6 @@
1
1
  import { FtNotificationEvent } from "./events";
2
- export function withAriaNotification(Class) {
2
+ import { applyMixinOnce } from "./helpers";
3
+ export const withAriaNotification = applyMixinOnce(Symbol("withAriaNotification"), function (Class) {
3
4
  class FtLitElementWithAriaNotificationClass extends Class {
4
5
  sendAriaNotificationIfVisible(message) {
5
6
  setTimeout(() => {
@@ -19,4 +20,4 @@ export function withAriaNotification(Class) {
19
20
  }
20
21
  }
21
22
  return FtLitElementWithAriaNotificationClass;
22
- }
23
+ });
@@ -7,7 +7,7 @@ export type FtdsBaseInterface = {
7
7
  getDesignSystemBaseClasses(): Record<string, boolean>;
8
8
  };
9
9
  export type FtdsBaseType<T extends Constructor<FtLitElement>> = T & Constructor<FtdsBaseInterface>;
10
- export declare function toFtdsBase<T extends Constructor<FtLitElement>>(ElementClass: T): FtdsBaseType<T>;
10
+ export declare const toFtdsBase: <T extends Constructor<FtLitElement>>(c: T) => FtdsBaseType<T>;
11
11
  declare const FtdsBase_base: FtdsBaseType<typeof FtLitElement>;
12
12
  export declare class FtdsBase extends FtdsBase_base {
13
13
  }
package/build/FtdsBase.js CHANGED
@@ -7,7 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { FtLitElement } from "./FtLitElement";
8
8
  import { property } from "lit/decorators.js";
9
9
  import { DesignSystemFamily, DesignSystemSize, resolveFamilyClass, resolveSizeClass } from "@fluid-topics/design-system-variables";
10
- export function toFtdsBase(ElementClass) {
10
+ import { applyMixinOnce } from "./helpers";
11
+ export const toFtdsBase = applyMixinOnce(Symbol("toFtdsBase"), function (ElementClass) {
11
12
  class FtdsBase extends ElementClass {
12
13
  constructor() {
13
14
  super(...arguments);
@@ -17,7 +18,7 @@ export function toFtdsBase(ElementClass) {
17
18
  getDesignSystemBaseClasses() {
18
19
  return {
19
20
  [resolveFamilyClass(this.family)]: true,
20
- [resolveSizeClass(this.size)]: true
21
+ [resolveSizeClass(this.size)]: true,
21
22
  };
22
23
  }
23
24
  }
@@ -28,6 +29,6 @@ export function toFtdsBase(ElementClass) {
28
29
  property()
29
30
  ], FtdsBase.prototype, "family", void 0);
30
31
  return FtdsBase;
31
- }
32
+ });
32
33
  export class FtdsBase extends toFtdsBase(FtLitElement) {
33
34
  }
package/build/events.d.ts CHANGED
@@ -18,7 +18,7 @@ export interface WithEventBusInterface extends EventTarget {
18
18
  addEventListener<T extends Event = Event>(type: string, callback: (e: T) => void, options?: AddEventListenerOptions | boolean): void;
19
19
  removeEventListener<T extends Event = Event>(type: string, callback: (e: T) => void, options?: EventListenerOptions | boolean): void;
20
20
  }
21
- export declare function withEventBus<T extends Constructor>(Base: T, eventBus?: EventTarget): T & Constructor<WithEventBusInterface>;
21
+ export declare const withEventBus: <T extends Constructor>(c: T) => T & Constructor<WithEventBusInterface>;
22
22
  declare const WithEventBus_base: ObjectConstructor & Constructor<WithEventBusInterface>;
23
23
  export declare class WithEventBus extends WithEventBus_base {
24
24
  }
package/build/events.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { applyMixinOnce } from "./helpers";
1
2
  export class FtNotificationEvent extends CustomEvent {
2
3
  constructor(detail) {
3
4
  super("ft-notification", { bubbles: true, composed: true, detail });
@@ -13,7 +14,7 @@ export class PostResizeEvent extends Event {
13
14
  super("ft-post-resize", { composed: true, bubbles: true });
14
15
  }
15
16
  }
16
- export function withEventBus(Base, eventBus) {
17
+ export const withEventBus = applyMixinOnce(Symbol("withEventBus"), function (Base, eventBus) {
17
18
  return class extends Base {
18
19
  constructor() {
19
20
  super(...arguments);
@@ -29,6 +30,6 @@ export function withEventBus(Base, eventBus) {
29
30
  this.eventBus.removeEventListener(type, callback, options);
30
31
  }
31
32
  };
32
- }
33
+ });
33
34
  export class WithEventBus extends withEventBus(Object) {
34
35
  }
@@ -43,4 +43,4 @@ export declare class InputValidationEvent extends CustomEvent<{
43
43
  }> {
44
44
  constructor(level: string);
45
45
  }
46
- export declare function toFtInput<T extends Constructor<FtLitElement>, V>(ElementClass: T): FtInputType<T, V>;
46
+ export declare const toFtInput: <T extends Constructor<FtLitElement>, V>(c: T) => FtInputType<T, V>;
@@ -8,6 +8,7 @@ import { property, state } from "lit/decorators.js";
8
8
  import { repeat } from "lit/directives/repeat.js";
9
9
  import { when } from "lit/directives/when.js";
10
10
  import { html } from "lit";
11
+ import { applyMixinOnce } from "../helpers";
11
12
  export var ValidateOn;
12
13
  (function (ValidateOn) {
13
14
  ValidateOn["blur"] = "blur";
@@ -25,7 +26,7 @@ export class InputValidationEvent extends CustomEvent {
25
26
  super("input-validated", { detail: { level: level } });
26
27
  }
27
28
  }
28
- export function toFtInput(ElementClass) {
29
+ export const toFtInput = applyMixinOnce(Symbol("toFtInput"), function (ElementClass) {
29
30
  class FtInput extends ElementClass {
30
31
  constructor() {
31
32
  super(...arguments);
@@ -90,15 +91,15 @@ export function toFtInput(ElementClass) {
90
91
  `;
91
92
  }
92
93
  resolveStatus() {
93
- return this.forceStatus ? this.forceStatus :
94
- this.errorMessages.length ? Status.error :
95
- this.warningMessages.length ? Status.warning :
96
- Status.default;
94
+ return this.forceStatus ? this.forceStatus
95
+ : this.errorMessages.length ? Status.error
96
+ : this.warningMessages.length ? Status.warning
97
+ : Status.default;
97
98
  }
98
99
  processRules(rules) {
99
- return rules.map(r => r(this.value))
100
- .filter(s => s !== true)
101
- .map(e => e);
100
+ return rules.map((r) => r(this.value))
101
+ .filter((s) => s !== true)
102
+ .map((e) => e);
102
103
  }
103
104
  }
104
105
  __decorate([
@@ -153,4 +154,4 @@ export function toFtInput(ElementClass) {
153
154
  state()
154
155
  ], FtInput.prototype, "additionalErrorRules", void 0);
155
156
  return FtInput;
156
- }
157
+ });