@lmvz-ds/components 0.30.0 → 0.32.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/CHANGELOG.md +10 -0
- package/cjs/{ds.constants-D3srqM9m.js → ds.constants-CKeXfK-s.js} +10 -0
- package/cjs/{component-C7cavwmZ.js → element.util-Cq4y-_iX.js} +42 -31
- package/cjs/index.cjs.js +7 -1
- package/cjs/{list-keyboard-controller-CzZdPBeH.js → list-keyboard-controller-StN6Yn8W.js} +13 -8
- package/cjs/lmvz-action-list.cjs.entry.js +79 -0
- package/cjs/lmvz-button-group.cjs.entry.js +43 -47
- package/cjs/lmvz-button_2.cjs.entry.js +10 -8
- package/cjs/lmvz-card.cjs.entry.js +2 -2
- package/cjs/lmvz-checkbox.cjs.entry.js +1 -1
- package/cjs/lmvz-chip.cjs.entry.js +2 -2
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +3 -3
- package/cjs/lmvz-input.cjs.entry.js +5 -5
- package/cjs/lmvz-link.cjs.entry.js +2 -2
- package/cjs/lmvz-menuitem.cjs.entry.js +1 -1
- package/cjs/lmvz-message.cjs.entry.js +1 -1
- package/cjs/lmvz-modal.cjs.entry.js +5 -5
- package/cjs/lmvz-radio.cjs.entry.js +1 -1
- package/cjs/lmvz-select.cjs.entry.js +1 -1
- package/cjs/lmvz-snackbar.cjs.entry.js +1 -1
- package/cjs/lmvz-spinner.cjs.entry.js +1 -1
- package/cjs/lmvz-tab.cjs.entry.js +2 -2
- package/cjs/lmvz-tabs.cjs.entry.js +4 -4
- package/cjs/lmvz-toggle.cjs.entry.js +3 -3
- package/cjs/loader.cjs.js +1 -1
- package/cjs/stencil.util-DzvzXSwk.js +25 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-action-list/lmvz-action-list.css +93 -0
- package/collection/components/lmvz-action-list/lmvz-action-list.js +104 -0
- package/collection/components/lmvz-button/lmvz-button.css +65 -45
- package/collection/components/lmvz-button/lmvz-button.js +28 -7
- package/collection/components/lmvz-button-group/lmvz-button-group.css +33 -2
- package/collection/components/lmvz-button-group/lmvz-button-group.js +54 -38
- package/collection/components/lmvz-card/lmvz-card.css +58 -45
- package/collection/components/lmvz-card/lmvz-card.js +2 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +2 -2
- package/collection/components/lmvz-chip/lmvz-chip.js +7 -7
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.js +2 -2
- package/collection/components/lmvz-input/lmvz-input.js +5 -5
- package/collection/components/lmvz-link/lmvz-link.js +3 -3
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +2 -2
- package/collection/components/lmvz-message/lmvz-message.js +1 -1
- package/collection/components/lmvz-modal/lmvz-modal.css +7 -0
- package/collection/components/lmvz-modal/lmvz-modal.js +3 -3
- package/collection/components/lmvz-radio/lmvz-radio.js +2 -2
- package/collection/components/lmvz-select/lmvz-select.js +2 -2
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +1 -1
- package/collection/components/lmvz-spinner/lmvz-spinner.js +1 -1
- package/collection/components/lmvz-tab/lmvz-tab.css +7 -0
- package/collection/components/lmvz-tab/lmvz-tab.js +1 -1
- package/collection/components/lmvz-tabs/lmvz-tabs.css +7 -0
- package/collection/components/lmvz-tabs/lmvz-tabs.js +2 -2
- package/collection/components/lmvz-toggle/lmvz-toggle.js +3 -3
- package/collection/index.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/utils/aria/aria.constants.js +53 -0
- package/collection/utils/aria/list-keyboard-controller.js +12 -7
- package/collection/utils/async/async.util.js +62 -0
- package/collection/utils/data/event.utilt.js +19 -0
- package/collection/utils/data/number.util.js +6 -0
- package/collection/utils/data/object.util.js +20 -0
- package/collection/utils/data/time.util.js +3 -0
- package/collection/utils/element/element.util.js +117 -0
- package/collection/utils/{assets.js → stencil/assets.js} +1 -1
- package/collection/utils/stencil/stencil.util.js +12 -0
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-action-list.d.ts +11 -0
- package/components/lmvz-action-list.d.ts.bak +11 -0
- package/components/lmvz-action-list.js +1 -0
- package/components/lmvz-button-group.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-link.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-message.js +1 -1
- package/components/lmvz-modal.js +1 -1
- package/components/lmvz-radio.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.js +1 -1
- package/components/lmvz-spinner.js +1 -1
- package/components/lmvz-tab.js +1 -1
- package/components/lmvz-tabs.js +1 -1
- package/components/lmvz-toggle.js +1 -1
- package/components/p-B0H9qIwE.js +1 -0
- package/components/p-B4m1n4et.js +1 -0
- package/components/p-CJRqhXjK.js +1 -0
- package/components/p-CxfT9IA1.js +1 -0
- package/components/{p-CXakymyP.js → p-DJ90327O.js} +1 -1
- package/components/p-DeO5Vbxh.js +1 -0
- package/components/p-DuEtnKRj.js +1 -0
- package/esm/{ds.constants-BLS5MjIu.js → ds.constants-DuEtnKRj.js} +5 -1
- package/esm/{component-DOTK1OW3.js → element.util-CxfT9IA1.js} +37 -31
- package/esm/index.js +1 -1
- package/esm/{list-keyboard-controller-Coi8XfUH.js → list-keyboard-controller-BKa9Kd2t.js} +12 -7
- package/esm/lmvz-action-list.entry.js +77 -0
- package/esm/lmvz-button-group.entry.js +35 -39
- package/esm/lmvz-button_2.entry.js +9 -7
- package/esm/lmvz-card.entry.js +2 -2
- package/esm/lmvz-checkbox.entry.js +1 -1
- package/esm/lmvz-chip.entry.js +2 -2
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-input.entry.js +4 -4
- package/esm/lmvz-link.entry.js +2 -2
- package/esm/lmvz-menuitem.entry.js +1 -1
- package/esm/lmvz-message.entry.js +1 -1
- package/esm/lmvz-modal.entry.js +3 -3
- package/esm/lmvz-radio.entry.js +1 -1
- package/esm/lmvz-select.entry.js +1 -1
- package/esm/lmvz-snackbar.entry.js +1 -1
- package/esm/lmvz-spinner.entry.js +1 -1
- package/esm/lmvz-tab.entry.js +2 -2
- package/esm/lmvz-tabs.entry.js +4 -4
- package/esm/lmvz-toggle.entry.js +2 -2
- package/esm/loader.js +1 -1
- package/esm/stencil.util-CJRqhXjK.js +23 -0
- package/hydrate/index.js +501 -388
- package/hydrate/index.mjs +501 -388
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-f3c44dd4.entry.js → p-1ce90ea7.entry.js} +1 -1
- package/lmvz-components/{p-b08db5ad.entry.js → p-24125bcf.entry.js} +1 -1
- package/lmvz-components/p-25a78ead.entry.js +1 -0
- package/lmvz-components/p-4072b2fb.entry.js +1 -0
- package/lmvz-components/p-48109e1d.entry.js +1 -0
- package/lmvz-components/{p-3b3e532f.entry.js → p-582f44ff.entry.js} +1 -1
- package/lmvz-components/p-592d509b.entry.js +1 -0
- package/lmvz-components/{p-d7e99f03.entry.js → p-6f61c24d.entry.js} +1 -1
- package/lmvz-components/{p-58498d43.entry.js → p-703b10b5.entry.js} +1 -1
- package/lmvz-components/p-74c7521c.entry.js +1 -0
- package/lmvz-components/{p-b5254532.entry.js → p-80a26307.entry.js} +1 -1
- package/lmvz-components/{p-c60ab9c9.entry.js → p-8e1f66dd.entry.js} +1 -1
- package/lmvz-components/p-947e1fe6.entry.js +1 -0
- package/lmvz-components/p-B4m1n4et.js +1 -0
- package/lmvz-components/p-CJRqhXjK.js +1 -0
- package/lmvz-components/p-CxfT9IA1.js +1 -0
- package/lmvz-components/p-DuEtnKRj.js +1 -0
- package/lmvz-components/{p-230962c8.entry.js → p-b79af711.entry.js} +1 -1
- package/lmvz-components/p-c00f0d96.entry.js +1 -0
- package/lmvz-components/{p-5c951888.entry.js → p-c0d05a97.entry.js} +1 -1
- package/lmvz-components/{p-c0b1d0af.entry.js → p-c3e8092e.entry.js} +1 -1
- package/lmvz-components/{p-2ca85b7c.entry.js → p-ed3c2b13.entry.js} +1 -1
- package/lmvz-components/{p-35da6bfb.entry.js → p-fa2cd315.entry.js} +1 -1
- package/manifest.json +130 -18
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +0 -40
- package/types/api/ds.types.d.ts +68 -1
- package/types/components/lmvz-action-list/lmvz-action-list.d.ts +15 -0
- package/types/components/lmvz-button/lmvz-button.d.ts +6 -3
- package/types/components/lmvz-button-group/lmvz-button-group.d.ts +2 -0
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +1 -1
- package/types/components/lmvz-chip/lmvz-chip.d.ts +2 -2
- package/types/components/lmvz-header/lmvz-header.d.ts +1 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +1 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +1 -1
- package/types/components/lmvz-link/lmvz-link.d.ts +1 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +1 -1
- package/types/components/lmvz-modal/lmvz-modal.d.ts +1 -1
- package/types/components/lmvz-radio/lmvz-radio.d.ts +1 -1
- package/types/components/lmvz-select/lmvz-select.d.ts +1 -1
- package/types/components/lmvz-tabs/lmvz-tabs.d.ts +1 -1
- package/types/components/lmvz-toggle/lmvz-toggle.d.ts +1 -1
- package/types/components.d.ts +83 -2
- package/types/index.d.ts +1 -1
- package/types/utils/aria/aria-validation-controller.d.ts +3 -3
- package/types/utils/aria/aria.constants.d.ts +1 -0
- package/types/utils/aria/element-activation-controller.d.ts +1 -1
- package/types/utils/aria/list-keyboard-controller.d.ts +4 -1
- package/types/utils/async/async.util.d.ts +8 -0
- package/types/utils/data/event.utilt.d.ts +4 -0
- package/types/utils/data/number.util.d.ts +2 -0
- package/types/utils/data/object.util.d.ts +5 -0
- package/types/utils/data/time.util.d.ts +1 -0
- package/types/utils/element/element.util.d.ts +21 -0
- package/types/utils/radio/radio-group-controller.d.ts +1 -1
- package/types/utils/{reactive-controller-host.d.ts → stencil/reactive-controller-host.d.ts} +1 -1
- package/types/utils/stencil/stencil.util.d.ts +6 -0
- package/collection/utils/component.js +0 -270
- package/collection/utils/http.js +0 -21
- package/collection/utils/http.unit.js +0 -47
- package/components/p-BLS5MjIu.js +0 -1
- package/components/p-C0f2nNPZ.js +0 -1
- package/components/p-CtaMrBNE.js +0 -1
- package/components/p-DGlgVBPj.js +0 -1
- package/components/p-DOTK1OW3.js +0 -1
- package/lmvz-components/p-0d435e7b.entry.js +0 -1
- package/lmvz-components/p-44fea470.entry.js +0 -1
- package/lmvz-components/p-4dc44520.entry.js +0 -1
- package/lmvz-components/p-BLS5MjIu.js +0 -1
- package/lmvz-components/p-CtaMrBNE.js +0 -1
- package/lmvz-components/p-DOTK1OW3.js +0 -1
- package/lmvz-components/p-a4077c9f.entry.js +0 -1
- package/lmvz-components/p-dce6e41d.entry.js +0 -1
- package/lmvz-components/p-e3ce44a3.entry.js +0 -1
- package/types/utils/component.d.ts +0 -33
- package/types/utils/http.d.ts +0 -26
- package/types/utils/http.unit.d.ts +0 -1
- /package/collection/utils/{reactive-controller-host.js → stencil/reactive-controller-host.js} +0 -0
- /package/types/utils/{assets.d.ts → stencil/assets.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { type AriaValidationHost } from '../../utils/aria/aria-validation-controller';
|
|
3
3
|
import { type RadioHost } from '../../utils/radio/radio-group-controller';
|
|
4
|
-
import { ReactiveControllerHost } from '../../utils/reactive-controller-host';
|
|
4
|
+
import { ReactiveControllerHost } from '../../utils/stencil/reactive-controller-host';
|
|
5
5
|
export declare class LmvzRadio extends ReactiveControllerHost implements AriaValidationHost, RadioHost {
|
|
6
6
|
readonly el: HTMLElement;
|
|
7
7
|
get validationEl(): HTMLElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import type { Select } from '../../api';
|
|
3
3
|
import { type AriaValidationHost } from '../../utils/aria/aria-validation-controller';
|
|
4
|
-
import { ReactiveControllerHost } from '../../utils/reactive-controller-host';
|
|
4
|
+
import { ReactiveControllerHost } from '../../utils/stencil/reactive-controller-host';
|
|
5
5
|
export declare class LmvzSelect extends ReactiveControllerHost implements AriaValidationHost {
|
|
6
6
|
readonly el: HTMLElement;
|
|
7
7
|
get validationEl(): HTMLElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { type DirectionalFocusHost } from '../../utils/aria/list-keyboard-controller';
|
|
3
|
-
import { ReactiveControllerHost } from '../../utils/reactive-controller-host';
|
|
3
|
+
import { ReactiveControllerHost } from '../../utils/stencil/reactive-controller-host';
|
|
4
4
|
export declare class LmvzTabs extends ReactiveControllerHost implements DirectionalFocusHost {
|
|
5
5
|
readonly el: HTMLElement;
|
|
6
6
|
private readonly instanceId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { type AriaValidationHost } from '../../utils/aria/aria-validation-controller';
|
|
3
|
-
import { ReactiveControllerHost } from '../../utils/reactive-controller-host';
|
|
3
|
+
import { ReactiveControllerHost } from '../../utils/stencil/reactive-controller-host';
|
|
4
4
|
export declare class LmvzToggle extends ReactiveControllerHost implements AriaValidationHost {
|
|
5
5
|
readonly el: HTMLElement;
|
|
6
6
|
get validationEl(): HTMLElement;
|
package/types/components.d.ts
CHANGED
|
@@ -17,7 +17,38 @@ declare const chipTypes: readonly ["active", "warning", "success", "error", "neu
|
|
|
17
17
|
export declare namespace Components {
|
|
18
18
|
export interface LmvzAction {
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A keyboard-navigable action list component implementing the WAI-ARIA `menu` pattern.
|
|
22
|
+
* Renders a styled `<ul role="menu">` that accepts `<lmvz-button>`, native `<button>`,
|
|
23
|
+
* `<hr>` dividers, and `<div role="group">` groups via the default slot.
|
|
24
|
+
* Arrow keys move focus across interactive items; Home/End jump to first/last.
|
|
25
|
+
* **Disabled items:** Items with the native `disabled` attribute (or `disabled` prop on
|
|
26
|
+
* `<lmvz-button>`) are silently skipped during arrow-key navigation. This matches the
|
|
27
|
+
* behaviour of native `<select>` and keeps the interaction model simple.
|
|
28
|
+
* Trade-off: screen reader users navigating by arrow key cannot discover disabled items
|
|
29
|
+
* or read their labels. If surfacing disabled items to all users is required, use
|
|
30
|
+
* `aria-disabled="true"` on the item instead and handle activation prevention in the
|
|
31
|
+
* click/activation handler — the controller's `isFocusableElement` callback can then be
|
|
32
|
+
* used to override the skip logic.
|
|
33
|
+
* @example ```html
|
|
34
|
+
* <lmvz-action-list label="Actions">
|
|
35
|
+
* <lmvz-button>Edit</lmvz-button>
|
|
36
|
+
* <hr />
|
|
37
|
+
* <lmvz-button class="lmvz-action-list-item--danger">Delete</lmvz-button>
|
|
38
|
+
* </lmvz-action-list>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export interface LmvzActionList {
|
|
42
|
+
/**
|
|
43
|
+
* Accessible label for the menu, reflected as `aria-label` on the host Element. When absent, `aria-label` is not rendered on the host.
|
|
44
|
+
*/
|
|
45
|
+
"label"?: string;
|
|
46
|
+
}
|
|
20
47
|
export interface LmvzButton {
|
|
48
|
+
/**
|
|
49
|
+
* ARIA role applied to the inner `<button>` element. When set, the host element receives `role="presentation"` so that AT sees only one interactive element with the correct role. Use `"menuitem"` when the button is a child of a `role="menu"` container.
|
|
50
|
+
*/
|
|
51
|
+
"buttonRole"?: string;
|
|
21
52
|
/**
|
|
22
53
|
* Whether the button is disabled
|
|
23
54
|
* @default false
|
|
@@ -41,7 +72,6 @@ export declare namespace Components {
|
|
|
41
72
|
*/
|
|
42
73
|
"scale": Button.Scale;
|
|
43
74
|
/**
|
|
44
|
-
* @readonly
|
|
45
75
|
* @default 0
|
|
46
76
|
*/
|
|
47
77
|
"ti": number;
|
|
@@ -69,6 +99,10 @@ export declare namespace Components {
|
|
|
69
99
|
* @readonly
|
|
70
100
|
*/
|
|
71
101
|
"primaryEnabledAction": HTMLButtonElement | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
"stacked": boolean;
|
|
72
106
|
}
|
|
73
107
|
export interface LmvzCard {
|
|
74
108
|
/**
|
|
@@ -773,8 +807,15 @@ declare const iconWeights: readonly ["thin", "medium", "bold"];
|
|
|
773
807
|
export declare namespace Input {
|
|
774
808
|
export type Type = (typeof inputTypes)[number];
|
|
775
809
|
export type Size = (typeof inputSizes)[number];
|
|
810
|
+
|
|
776
811
|
export type Autocomplete = HTMLInputElement['autocomplete'];
|
|
812
|
+
/**
|
|
813
|
+
* Inputmode attribute for mobile keyboards
|
|
814
|
+
*/
|
|
777
815
|
export type Inputmode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
816
|
+
/**
|
|
817
|
+
* Autocapitalize attribute for mobile keyboards
|
|
818
|
+
*/
|
|
778
819
|
export type Autocapitalize = 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
779
820
|
}
|
|
780
821
|
|
|
@@ -788,7 +829,38 @@ export declare namespace JSX {
|
|
|
788
829
|
export interface LmvzAction {
|
|
789
830
|
"onActionClick"?: (event: LmvzActionCustomEvent<MouseEvent>) => void;
|
|
790
831
|
}
|
|
832
|
+
/**
|
|
833
|
+
* A keyboard-navigable action list component implementing the WAI-ARIA `menu` pattern.
|
|
834
|
+
* Renders a styled `<ul role="menu">` that accepts `<lmvz-button>`, native `<button>`,
|
|
835
|
+
* `<hr>` dividers, and `<div role="group">` groups via the default slot.
|
|
836
|
+
* Arrow keys move focus across interactive items; Home/End jump to first/last.
|
|
837
|
+
* **Disabled items:** Items with the native `disabled` attribute (or `disabled` prop on
|
|
838
|
+
* `<lmvz-button>`) are silently skipped during arrow-key navigation. This matches the
|
|
839
|
+
* behaviour of native `<select>` and keeps the interaction model simple.
|
|
840
|
+
* Trade-off: screen reader users navigating by arrow key cannot discover disabled items
|
|
841
|
+
* or read their labels. If surfacing disabled items to all users is required, use
|
|
842
|
+
* `aria-disabled="true"` on the item instead and handle activation prevention in the
|
|
843
|
+
* click/activation handler — the controller's `isFocusableElement` callback can then be
|
|
844
|
+
* used to override the skip logic.
|
|
845
|
+
* @example ```html
|
|
846
|
+
* <lmvz-action-list label="Actions">
|
|
847
|
+
* <lmvz-button>Edit</lmvz-button>
|
|
848
|
+
* <hr />
|
|
849
|
+
* <lmvz-button class="lmvz-action-list-item--danger">Delete</lmvz-button>
|
|
850
|
+
* </lmvz-action-list>
|
|
851
|
+
* ```
|
|
852
|
+
*/
|
|
853
|
+
export interface LmvzActionList {
|
|
854
|
+
/**
|
|
855
|
+
* Accessible label for the menu, reflected as `aria-label` on the host Element. When absent, `aria-label` is not rendered on the host.
|
|
856
|
+
*/
|
|
857
|
+
"label"?: string;
|
|
858
|
+
}
|
|
791
859
|
export interface LmvzButton {
|
|
860
|
+
/**
|
|
861
|
+
* ARIA role applied to the inner `<button>` element. When set, the host element receives `role="presentation"` so that AT sees only one interactive element with the correct role. Use `"menuitem"` when the button is a child of a `role="menu"` container.
|
|
862
|
+
*/
|
|
863
|
+
"buttonRole"?: string;
|
|
792
864
|
/**
|
|
793
865
|
* Whether the button is disabled
|
|
794
866
|
* @default false
|
|
@@ -816,7 +888,6 @@ export declare namespace JSX {
|
|
|
816
888
|
*/
|
|
817
889
|
"scale"?: Button.Scale;
|
|
818
890
|
/**
|
|
819
|
-
* @readonly
|
|
820
891
|
* @default 0
|
|
821
892
|
*/
|
|
822
893
|
"ti"?: number;
|
|
@@ -844,6 +915,10 @@ export declare namespace JSX {
|
|
|
844
915
|
* @readonly
|
|
845
916
|
*/
|
|
846
917
|
"primaryEnabledAction"?: HTMLButtonElement | undefined;
|
|
918
|
+
/**
|
|
919
|
+
* @default false
|
|
920
|
+
*/
|
|
921
|
+
"stacked"?: boolean;
|
|
847
922
|
}
|
|
848
923
|
export interface LmvzCard {
|
|
849
924
|
/**
|
|
@@ -1494,6 +1569,9 @@ export declare namespace JSX {
|
|
|
1494
1569
|
"value"?: string;
|
|
1495
1570
|
}
|
|
1496
1571
|
|
|
1572
|
+
export interface LmvzActionListAttributes {
|
|
1573
|
+
"label": string;
|
|
1574
|
+
}
|
|
1497
1575
|
export interface LmvzButtonAttributes {
|
|
1498
1576
|
"ti": number;
|
|
1499
1577
|
"scale": Button.Scale;
|
|
@@ -1504,8 +1582,10 @@ export declare namespace JSX {
|
|
|
1504
1582
|
"formMethod": 'dialog' | 'get' | 'post';
|
|
1505
1583
|
"name": string;
|
|
1506
1584
|
"value": string;
|
|
1585
|
+
"buttonRole": string;
|
|
1507
1586
|
}
|
|
1508
1587
|
export interface LmvzButtonGroupAttributes {
|
|
1588
|
+
"stacked": boolean;
|
|
1509
1589
|
"hasActions": boolean;
|
|
1510
1590
|
}
|
|
1511
1591
|
export interface LmvzCardAttributes {
|
|
@@ -1647,6 +1727,7 @@ export declare namespace JSX {
|
|
|
1647
1727
|
|
|
1648
1728
|
export interface IntrinsicElements {
|
|
1649
1729
|
"lmvz-action": LmvzAction;
|
|
1730
|
+
"lmvz-action-list": Omit<LmvzActionList, keyof LmvzActionListAttributes> & { [K in keyof LmvzActionList & keyof LmvzActionListAttributes]?: LmvzActionList[K] } & { [K in keyof LmvzActionList & keyof LmvzActionListAttributes as `attr:${K}`]?: LmvzActionListAttributes[K] } & { [K in keyof LmvzActionList & keyof LmvzActionListAttributes as `prop:${K}`]?: LmvzActionList[K] };
|
|
1650
1731
|
"lmvz-button": Omit<LmvzButton, keyof LmvzButtonAttributes> & { [K in keyof LmvzButton & keyof LmvzButtonAttributes]?: LmvzButton[K] } & { [K in keyof LmvzButton & keyof LmvzButtonAttributes as `attr:${K}`]?: LmvzButtonAttributes[K] } & { [K in keyof LmvzButton & keyof LmvzButtonAttributes as `prop:${K}`]?: LmvzButton[K] };
|
|
1651
1732
|
"lmvz-button-group": Omit<LmvzButtonGroup, keyof LmvzButtonGroupAttributes> & { [K in keyof LmvzButtonGroup & keyof LmvzButtonGroupAttributes]?: LmvzButtonGroup[K] } & { [K in keyof LmvzButtonGroup & keyof LmvzButtonGroupAttributes as `attr:${K}`]?: LmvzButtonGroupAttributes[K] } & { [K in keyof LmvzButtonGroup & keyof LmvzButtonGroupAttributes as `prop:${K}`]?: LmvzButtonGroup[K] };
|
|
1652
1733
|
"lmvz-card": Omit<LmvzCard, keyof LmvzCardAttributes> & { [K in keyof LmvzCard & keyof LmvzCardAttributes]?: LmvzCard[K] } & { [K in keyof LmvzCard & keyof LmvzCardAttributes as `attr:${K}`]?: LmvzCardAttributes[K] } & { [K in keyof LmvzCard & keyof LmvzCardAttributes as `prop:${K}`]?: LmvzCard[K] } & OneOf<"cardTitle", LmvzCard["cardTitle"], LmvzCardAttributes["cardTitle"]>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@lmvz-ds/aria-validation';
|
|
2
2
|
export type * from './components.d.ts';
|
|
3
|
-
export
|
|
3
|
+
export * from './api/ds.constants';
|
|
4
4
|
export type { LmvzDS, Typography } from './api';
|
|
5
5
|
export * from './components/lmvz-message/public';
|
|
6
6
|
export * from './components/lmvz-snackbar/public';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactiveController } from '../reactive-controller-host';
|
|
1
|
+
import type { ReactiveController } from '../stencil/reactive-controller-host';
|
|
2
2
|
export { isAriaValidationEnabled } from '@lmvz-ds/aria-validation';
|
|
3
3
|
export type AriaValidationHost<T extends HTMLElement = HTMLElement> = {
|
|
4
4
|
validationEl: T | undefined;
|
|
@@ -9,7 +9,7 @@ type Config = {
|
|
|
9
9
|
verboseLogging?: boolean;
|
|
10
10
|
validationTiming?: 'load' | 'slot';
|
|
11
11
|
};
|
|
12
|
-
export declare class AriaValidationController implements ReactiveController {
|
|
12
|
+
export declare class AriaValidationController<T extends HTMLElement = HTMLElement> implements ReactiveController {
|
|
13
13
|
private readonly host;
|
|
14
14
|
private readonly config?;
|
|
15
15
|
private visibilityObserver?;
|
|
@@ -19,7 +19,7 @@ export declare class AriaValidationController implements ReactiveController {
|
|
|
19
19
|
private static knownValidationErrors;
|
|
20
20
|
get disabled(): boolean;
|
|
21
21
|
private get useVerboseLogging();
|
|
22
|
-
constructor(host: AriaValidationHost
|
|
22
|
+
constructor(host: AriaValidationHost<T>, config?: Config | undefined);
|
|
23
23
|
private readonly onRuntimeConfigChange;
|
|
24
24
|
hostDidLoad(): void;
|
|
25
25
|
hostDidUpdate(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ariaAttributes: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import type { ReactiveController } from '../reactive-controller-host';
|
|
2
|
+
import type { ReactiveController } from '../stencil/reactive-controller-host';
|
|
3
3
|
export type ElementActivationHost = {
|
|
4
4
|
el: HTMLElement;
|
|
5
5
|
lmvzActivation: EventEmitter<void>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type { ReactiveController } from '../reactive-controller-host';
|
|
1
|
+
import type { ReactiveController } from '../stencil/reactive-controller-host';
|
|
2
2
|
export type DirectionalFocusHost = {
|
|
3
3
|
el: HTMLElement;
|
|
4
4
|
};
|
|
5
|
+
export type DirectionalFocusReceiver = {
|
|
6
|
+
resolveFocusableElement(): HTMLElement | undefined;
|
|
7
|
+
};
|
|
5
8
|
export type DirectionalFocusOrientation = 'horizontal' | 'vertical' | 'both';
|
|
6
9
|
export type DirectionalFocusControllerConfig = {
|
|
7
10
|
orientation?: DirectionalFocusOrientation;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
export declare const __zone_symbol__requestAnimationFrame: typeof window.requestAnimationFrame;
|
|
3
|
+
export declare const requestAnimationFrame: typeof window.requestAnimationFrame;
|
|
4
|
+
export declare const transitionEndAsync: (el: HTMLElement | null, expectedDuration?: number) => Promise<unknown>;
|
|
5
|
+
export declare const raf: (h: FrameRequestCallback) => number;
|
|
6
|
+
export declare const deferEvent: (event: EventEmitter) => EventEmitter;
|
|
7
|
+
export declare const debounceEvent: (event: EventEmitter, wait: number) => EventEmitter;
|
|
8
|
+
export declare const debounce: (func: (...args: unknown[]) => void, wait?: number) => (...args: unknown[]) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const now: (ev: UIEvent) => number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Attributes, Button, FormRef } from '../../api';
|
|
2
|
+
export declare function isActionButton(element: Element): element is HTMLButtonElement;
|
|
3
|
+
export declare function isLmvzButton(element?: Element): element is HTMLLmvzButtonElement;
|
|
4
|
+
export declare function isDisabledButton(element: HTMLButtonElement): boolean;
|
|
5
|
+
export declare function isVisible(element: Element): boolean;
|
|
6
|
+
export declare function getActionVariant(element: HTMLElement): Button.Variant;
|
|
7
|
+
export declare function isPrimaryAction(element: HTMLElement): boolean;
|
|
8
|
+
export declare function isSecondaryAction(element: HTMLElement): boolean;
|
|
9
|
+
export declare const inheritAttributes: (el: HTMLElement, attributes?: string[]) => Attributes;
|
|
10
|
+
export declare const inheritAriaAttributes: (el: HTMLElement, ignoreList?: string[]) => Attributes;
|
|
11
|
+
type EventCallback<K extends keyof HTMLElementEventMap> = (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown;
|
|
12
|
+
export declare const addEventListener: <T extends HTMLElement, K extends keyof HTMLElementEventMap>(el: T, eventName: K, callback: EventCallback<K>, options?: boolean | AddEventListenerOptions) => void;
|
|
13
|
+
export declare const removeEventListener: <K extends keyof HTMLElementEventMap>(el: HTMLElement, eventName: K, callback: EventCallback<K>, opts?: boolean | AddEventListenerOptions) => void;
|
|
14
|
+
export declare const getElementRoot: (el: HTMLElement, fallback?: HTMLElement) => HTMLElement | ShadowRoot;
|
|
15
|
+
export declare const hasShadowDom: (el: HTMLElement) => boolean;
|
|
16
|
+
export declare const focusVisibleElement: (el: HTMLElement) => void;
|
|
17
|
+
export declare const renderHiddenInput: (always: boolean, container: HTMLElement, name: string, value: string | undefined | null, disabled: boolean) => void;
|
|
18
|
+
export declare function getDeepActiveElement(root?: Document): Element | null;
|
|
19
|
+
export declare function canReceiveFocus(el: Element | undefined): boolean;
|
|
20
|
+
export declare function findFormByRef(form: FormRef, el: HTMLElement): HTMLFormElement | null;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type LazyLoadedComponent<T extends HTMLElement> = T & {
|
|
2
|
+
componentOnReady: () => Promise<T>;
|
|
3
|
+
};
|
|
4
|
+
export declare const componentOnReady: <T extends HTMLElement>(stencilEl: T, callback: (el: T) => unknown) => void;
|
|
5
|
+
export declare const hasLazyBuild: <T extends HTMLElement>(stencilEl: T) => stencilEl is LazyLoadedComponent<T>;
|
|
6
|
+
export {};
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
export const transitionEndAsync = (el, expectedDuration = 0) => {
|
|
2
|
-
return new Promise((resolve) => {
|
|
3
|
-
transitionEnd(el, expectedDuration, resolve);
|
|
4
|
-
});
|
|
5
|
-
};
|
|
6
|
-
const transitionEnd = (el, expectedDuration = 0, callback) => {
|
|
7
|
-
let unRegTrans;
|
|
8
|
-
let animationTimeout;
|
|
9
|
-
const opts = { passive: true };
|
|
10
|
-
const ANIMATION_FALLBACK_TIMEOUT = 500;
|
|
11
|
-
const unregister = () => {
|
|
12
|
-
if (unRegTrans) {
|
|
13
|
-
unRegTrans();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const onTransitionEnd = (ev) => {
|
|
17
|
-
if (ev === undefined || el === ev.target) {
|
|
18
|
-
unregister();
|
|
19
|
-
callback(ev);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
if (el) {
|
|
23
|
-
el.addEventListener('webkitTransitionEnd', onTransitionEnd, opts);
|
|
24
|
-
el.addEventListener('transitionend', onTransitionEnd, opts);
|
|
25
|
-
animationTimeout = setTimeout(onTransitionEnd, expectedDuration + ANIMATION_FALLBACK_TIMEOUT);
|
|
26
|
-
unRegTrans = () => {
|
|
27
|
-
if (animationTimeout !== undefined) {
|
|
28
|
-
clearTimeout(animationTimeout);
|
|
29
|
-
animationTimeout = undefined;
|
|
30
|
-
}
|
|
31
|
-
el.removeEventListener('webkitTransitionEnd', onTransitionEnd, opts);
|
|
32
|
-
el.removeEventListener('transitionend', onTransitionEnd, opts);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return unregister;
|
|
36
|
-
};
|
|
37
|
-
export const componentOnReady = (el, callback) => {
|
|
38
|
-
if (el.componentOnReady) {
|
|
39
|
-
el.componentOnReady().then((resolvedEl) => callback(resolvedEl));
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
raf(() => callback(el));
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
export const hasLazyBuild = (stencilEl) => {
|
|
46
|
-
return stencilEl.componentOnReady !== undefined;
|
|
47
|
-
};
|
|
48
|
-
export const inheritAttributes = (el, attributes = []) => {
|
|
49
|
-
const attributeObject = {};
|
|
50
|
-
attributes.forEach((attr) => {
|
|
51
|
-
if (el.hasAttribute(attr)) {
|
|
52
|
-
const value = el.getAttribute(attr);
|
|
53
|
-
if (value !== null) {
|
|
54
|
-
attributeObject[attr] = el.getAttribute(attr);
|
|
55
|
-
}
|
|
56
|
-
el.removeAttribute(attr);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return attributeObject;
|
|
60
|
-
};
|
|
61
|
-
const ariaAttributes = [
|
|
62
|
-
'role',
|
|
63
|
-
'aria-activedescendant',
|
|
64
|
-
'aria-atomic',
|
|
65
|
-
'aria-autocomplete',
|
|
66
|
-
'aria-braillelabel',
|
|
67
|
-
'aria-brailleroledescription',
|
|
68
|
-
'aria-busy',
|
|
69
|
-
'aria-checked',
|
|
70
|
-
'aria-colcount',
|
|
71
|
-
'aria-colindex',
|
|
72
|
-
'aria-colindextext',
|
|
73
|
-
'aria-colspan',
|
|
74
|
-
'aria-controls',
|
|
75
|
-
'aria-current',
|
|
76
|
-
'aria-describedby',
|
|
77
|
-
'aria-description',
|
|
78
|
-
'aria-details',
|
|
79
|
-
'aria-disabled',
|
|
80
|
-
'aria-errormessage',
|
|
81
|
-
'aria-expanded',
|
|
82
|
-
'aria-flowto',
|
|
83
|
-
'aria-haspopup',
|
|
84
|
-
'aria-hidden',
|
|
85
|
-
'aria-invalid',
|
|
86
|
-
'aria-keyshortcuts',
|
|
87
|
-
'aria-label',
|
|
88
|
-
'aria-labelledby',
|
|
89
|
-
'aria-level',
|
|
90
|
-
'aria-live',
|
|
91
|
-
'aria-multiline',
|
|
92
|
-
'aria-multiselectable',
|
|
93
|
-
'aria-orientation',
|
|
94
|
-
'aria-owns',
|
|
95
|
-
'aria-placeholder',
|
|
96
|
-
'aria-posinset',
|
|
97
|
-
'aria-pressed',
|
|
98
|
-
'aria-readonly',
|
|
99
|
-
'aria-relevant',
|
|
100
|
-
'aria-required',
|
|
101
|
-
'aria-roledescription',
|
|
102
|
-
'aria-rowcount',
|
|
103
|
-
'aria-rowindex',
|
|
104
|
-
'aria-rowindextext',
|
|
105
|
-
'aria-rowspan',
|
|
106
|
-
'aria-selected',
|
|
107
|
-
'aria-setsize',
|
|
108
|
-
'aria-sort',
|
|
109
|
-
'aria-valuemax',
|
|
110
|
-
'aria-valuemin',
|
|
111
|
-
'aria-valuenow',
|
|
112
|
-
'aria-valuetext',
|
|
113
|
-
];
|
|
114
|
-
export const inheritAriaAttributes = (el, ignoreList) => {
|
|
115
|
-
let attributesToInherit = ariaAttributes;
|
|
116
|
-
if (ignoreList && ignoreList.length > 0) {
|
|
117
|
-
attributesToInherit = attributesToInherit.filter((attr) => !ignoreList.includes(attr));
|
|
118
|
-
}
|
|
119
|
-
return inheritAttributes(el, attributesToInherit);
|
|
120
|
-
};
|
|
121
|
-
export const addEventListener = (el, eventName, callback, opts) => {
|
|
122
|
-
return el.addEventListener(eventName, callback, opts);
|
|
123
|
-
};
|
|
124
|
-
export const removeEventListener = (el, eventName, callback, opts) => {
|
|
125
|
-
return el.removeEventListener(eventName, callback, opts);
|
|
126
|
-
};
|
|
127
|
-
export const getElementRoot = (el, fallback = el) => {
|
|
128
|
-
return el.shadowRoot || fallback;
|
|
129
|
-
};
|
|
130
|
-
export const raf = (h) => {
|
|
131
|
-
if (typeof __zone_symbol__requestAnimationFrame === 'function') {
|
|
132
|
-
return __zone_symbol__requestAnimationFrame(h);
|
|
133
|
-
}
|
|
134
|
-
if (typeof requestAnimationFrame === 'function') {
|
|
135
|
-
return requestAnimationFrame(h);
|
|
136
|
-
}
|
|
137
|
-
return setTimeout(h);
|
|
138
|
-
};
|
|
139
|
-
export const hasShadowDom = (el) => {
|
|
140
|
-
return !!el.shadowRoot && !!el.attachShadow;
|
|
141
|
-
};
|
|
142
|
-
export const focusVisibleElement = (el) => {
|
|
143
|
-
el.focus();
|
|
144
|
-
};
|
|
145
|
-
export const renderHiddenInput = (always, container, name, value, disabled) => {
|
|
146
|
-
if (always || hasShadowDom(container)) {
|
|
147
|
-
let input = container.querySelector('input.aux-input');
|
|
148
|
-
if (!input) {
|
|
149
|
-
input = container.ownerDocument.createElement('input');
|
|
150
|
-
input.type = 'hidden';
|
|
151
|
-
input.classList.add('aux-input');
|
|
152
|
-
container.appendChild(input);
|
|
153
|
-
}
|
|
154
|
-
input.disabled = disabled;
|
|
155
|
-
input.name = name;
|
|
156
|
-
input.value = value || '';
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
export const clamp = (min, n, max) => {
|
|
160
|
-
return Math.max(min, Math.min(n, max));
|
|
161
|
-
};
|
|
162
|
-
export const assert = (actual, reason) => {
|
|
163
|
-
if (!actual) {
|
|
164
|
-
const message = 'ASSERT: ' + reason;
|
|
165
|
-
console.error(message);
|
|
166
|
-
debugger;
|
|
167
|
-
throw new Error(message);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
export const now = (ev) => {
|
|
171
|
-
return ev.timeStamp || Date.now();
|
|
172
|
-
};
|
|
173
|
-
export const pointerCoord = (ev) => {
|
|
174
|
-
if (ev) {
|
|
175
|
-
const changedTouches = ev.changedTouches;
|
|
176
|
-
if (changedTouches && changedTouches.length > 0) {
|
|
177
|
-
const touch = changedTouches[0];
|
|
178
|
-
return { x: touch.clientX, y: touch.clientY };
|
|
179
|
-
}
|
|
180
|
-
if (ev.pageX !== undefined) {
|
|
181
|
-
return { x: ev.pageX, y: ev.pageY };
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return { x: 0, y: 0 };
|
|
185
|
-
};
|
|
186
|
-
export const deferEvent = (event) => {
|
|
187
|
-
return debounceEvent(event, 0);
|
|
188
|
-
};
|
|
189
|
-
export const debounceEvent = (event, wait) => {
|
|
190
|
-
const original = event._original || event;
|
|
191
|
-
return {
|
|
192
|
-
_original: event,
|
|
193
|
-
emit: debounce(original.emit.bind(original), wait),
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
export const debounce = (func, wait = 0) => {
|
|
197
|
-
let timer;
|
|
198
|
-
return (...args) => {
|
|
199
|
-
clearTimeout(timer);
|
|
200
|
-
timer = setTimeout(func, wait, ...args);
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
export const shallowEqualStringMap = (map1, map2) => {
|
|
204
|
-
map1 ??= {};
|
|
205
|
-
map2 ??= {};
|
|
206
|
-
if (map1 === map2) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
const keys1 = Object.keys(map1);
|
|
210
|
-
if (keys1.length !== Object.keys(map2).length) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
for (const k1 of keys1) {
|
|
214
|
-
if (!(k1 in map2)) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
if (map1[k1] !== map2[k1]) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return true;
|
|
222
|
-
};
|
|
223
|
-
export const isSafeNumber = (input) => {
|
|
224
|
-
return typeof input === 'number' && !isNaN(input) && isFinite(input);
|
|
225
|
-
};
|
|
226
|
-
export function getDeepActiveElement(root = document) {
|
|
227
|
-
let activeElement = root.activeElement;
|
|
228
|
-
if (!activeElement) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
while (activeElement?.shadowRoot) {
|
|
232
|
-
const next = activeElement.shadowRoot.activeElement;
|
|
233
|
-
if (!next) {
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
activeElement = next;
|
|
237
|
-
}
|
|
238
|
-
return activeElement;
|
|
239
|
-
}
|
|
240
|
-
export function canReceiveFocus(el) {
|
|
241
|
-
if (!el)
|
|
242
|
-
return false;
|
|
243
|
-
return (el instanceof HTMLElement && el.tabIndex >= 0 && !el.hasAttribute('disabled') && el.getAttribute('aria-hidden') !== 'true' && el.checkVisibility() && el.offsetParent !== null);
|
|
244
|
-
}
|
|
245
|
-
export function findFormByRef(form, el) {
|
|
246
|
-
if (form instanceof HTMLFormElement) {
|
|
247
|
-
return form;
|
|
248
|
-
}
|
|
249
|
-
if (typeof form === 'string') {
|
|
250
|
-
const el = document.getElementById(form);
|
|
251
|
-
if (el) {
|
|
252
|
-
if (el instanceof HTMLFormElement) {
|
|
253
|
-
return el;
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
console.warn(`No Form found with selector: "#${form}". Verify that the element with id exists and is actually a <form> element.`, el);
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
console.warn(`No Form found with selector: "#${form}". Verify that the id is correct and the form is rendered in the DOM.`, el);
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (form !== undefined) {
|
|
266
|
-
console.warn(`The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`, el);
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
return el.closest('form');
|
|
270
|
-
}
|
package/collection/utils/http.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Micro } from "effect";
|
|
2
|
-
export class FetchError extends Micro.TaggedError('FetchError') {
|
|
3
|
-
}
|
|
4
|
-
export class NotFoundError extends Micro.TaggedError('NotFoundError') {
|
|
5
|
-
}
|
|
6
|
-
export const httpClient = (input, init) => Micro.gen(function* () {
|
|
7
|
-
const response = yield* Micro.tryPromise({
|
|
8
|
-
try: () => fetch(input, init),
|
|
9
|
-
catch: (error) => new FetchError({ cause: error }),
|
|
10
|
-
});
|
|
11
|
-
if (response.status === 404) {
|
|
12
|
-
return yield* Micro.fail(new NotFoundError({ url: response.url }));
|
|
13
|
-
}
|
|
14
|
-
return response;
|
|
15
|
-
});
|
|
16
|
-
export class ResponseTextError extends Micro.TaggedError('ResponseTextError') {
|
|
17
|
-
}
|
|
18
|
-
export const responseAsText = (res) => Micro.tryPromise({
|
|
19
|
-
try: () => res.text(),
|
|
20
|
-
catch: (error) => new ResponseTextError({ message: 'Failed to read response text', cause: error }),
|
|
21
|
-
});
|