@nvidia-elements/forms 0.0.8 → 2.0.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 (77) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/NOTICE.md +1 -39
  3. package/dist/custom-elements.json +1293 -254
  4. package/dist/examples/csv.examples.js.map +1 -1
  5. package/dist/examples/light.examples.js.map +1 -1
  6. package/dist/examples/simple.examples.js.map +1 -1
  7. package/dist/examples/visualization.examples.js.map +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/internal/controllers/state-active.controller.d.ts +13 -0
  10. package/dist/internal/controllers/state-active.controller.js +26 -0
  11. package/dist/internal/controllers/state-active.controller.js.map +1 -0
  12. package/dist/internal/controllers/state-current.controller.d.ts +15 -0
  13. package/dist/internal/controllers/state-current.controller.js +34 -0
  14. package/dist/internal/controllers/state-current.controller.js.map +1 -0
  15. package/dist/internal/controllers/state-disabled.controller.d.ts +18 -0
  16. package/dist/internal/controllers/state-disabled.controller.js +17 -0
  17. package/dist/internal/controllers/state-disabled.controller.js.map +1 -0
  18. package/dist/internal/controllers/state-expanded.controller.d.ts +12 -0
  19. package/dist/internal/controllers/state-expanded.controller.js +17 -0
  20. package/dist/internal/controllers/state-expanded.controller.js.map +1 -0
  21. package/dist/internal/controllers/state-pressed.controller.d.ts +12 -0
  22. package/dist/internal/controllers/state-pressed.controller.js +17 -0
  23. package/dist/internal/controllers/state-pressed.controller.js.map +1 -0
  24. package/dist/internal/controllers/state-readonly.controller.d.ts +12 -0
  25. package/dist/internal/controllers/state-readonly.controller.js +17 -0
  26. package/dist/internal/controllers/state-readonly.controller.js.map +1 -0
  27. package/dist/internal/controllers/state-selected.controller.d.ts +15 -0
  28. package/dist/internal/controllers/state-selected.controller.js +34 -0
  29. package/dist/internal/controllers/state-selected.controller.js.map +1 -0
  30. package/dist/internal/controllers/type-anchor.controller.d.ts +15 -0
  31. package/dist/internal/controllers/type-anchor.controller.js +51 -0
  32. package/dist/internal/controllers/type-anchor.controller.js.map +1 -0
  33. package/dist/internal/controllers/type-button.controller.d.ts +14 -0
  34. package/dist/internal/controllers/type-button.controller.js +22 -0
  35. package/dist/internal/controllers/type-button.controller.js.map +1 -0
  36. package/dist/internal/controllers/type-command.controller.d.ts +16 -0
  37. package/dist/internal/controllers/type-command.controller.js +36 -0
  38. package/dist/internal/controllers/type-command.controller.js.map +1 -0
  39. package/dist/internal/controllers/type-interest-invoker.controller.d.ts +12 -0
  40. package/dist/internal/controllers/type-interest-invoker.controller.js +38 -0
  41. package/dist/internal/controllers/type-interest-invoker.controller.js.map +1 -0
  42. package/dist/internal/controllers/type-native-button.controller.d.ts +19 -0
  43. package/dist/internal/controllers/type-native-button.controller.js +54 -0
  44. package/dist/internal/controllers/type-native-button.controller.js.map +1 -0
  45. package/dist/internal/controllers/type-popover-trigger.controller.d.ts +16 -0
  46. package/dist/internal/controllers/type-popover-trigger.controller.js +21 -0
  47. package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -0
  48. package/dist/internal/controllers/types.d.ts +8 -0
  49. package/dist/internal/errors.js.map +1 -1
  50. package/dist/internal/schema.js.map +1 -1
  51. package/dist/internal/types.d.ts +18 -4
  52. package/dist/internal/utils.d.ts +17 -0
  53. package/dist/internal/utils.js +53 -1
  54. package/dist/internal/utils.js.map +1 -1
  55. package/dist/mixins/button.d.ts +22 -0
  56. package/dist/mixins/button.js +344 -0
  57. package/dist/mixins/button.js.map +1 -0
  58. package/dist/mixins/button.types.d.ts +116 -0
  59. package/dist/mixins/checkbox.d.ts +41 -0
  60. package/dist/mixins/checkbox.js +109 -0
  61. package/dist/mixins/checkbox.js.map +1 -0
  62. package/dist/mixins/control.d.ts +189 -0
  63. package/dist/mixins/control.js +358 -0
  64. package/dist/mixins/control.js.map +1 -0
  65. package/dist/mixins/index.d.ts +5 -0
  66. package/dist/mixins/index.js +6 -0
  67. package/dist/mixins/select.d.ts +49 -0
  68. package/dist/mixins/select.js +80 -0
  69. package/dist/mixins/select.js.map +1 -0
  70. package/dist/mixins/slider.d.ts +62 -0
  71. package/dist/mixins/slider.js +175 -0
  72. package/dist/mixins/slider.js.map +1 -0
  73. package/dist/validators/index.js.map +1 -1
  74. package/package.json +25 -19
  75. package/dist/mixin/index.d.ts +0 -460
  76. package/dist/mixin/index.js +0 -188
  77. package/dist/mixin/index.js.map +0 -1
@@ -1,460 +0,0 @@
1
- import { FormControlMetadata, FormControlValue } from '../internal/types.js';
2
- type Constructor = (new (...args: any[]) => HTMLElement & {
3
- connectedCallback?(): void;
4
- disconnectedCallback?(): void;
5
- attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;
6
- requestUpdate?(name?: string, oldValue?: unknown): void;
7
- }) & {
8
- observedAttributes?: string[];
9
- };
10
- /**
11
- * @description A mixin that adds form control functionality to a component.
12
- * @event input - Dispatched when the value of the component changes as a result of a user action.
13
- * @event change - Dispatched when the user modifies and commits the element's value.
14
- * @event reset - Dispatched when the control state was reset to its initial value.
15
- * @event invalid - Dispatched when the control is invalid.
16
- */
17
- export declare function FormControlMixin<TBase extends Constructor, T extends FormControlValue>(SuperClass: TBase): {
18
- new (...args: any[]): {
19
- /** determine if component is in readonly/non-editable state */
20
- get readOnly(): boolean;
21
- set readOnly(value: boolean | unknown);
22
- /** determine if component is in disabled state */
23
- get disabled(): boolean;
24
- set disabled(value: boolean | unknown);
25
- /** determine if the component value requires input */
26
- get required(): boolean;
27
- set required(value: T | unknown);
28
- /** name associated to parent form */
29
- get name(): string;
30
- set name(value: string);
31
- /** get determine if component is in no validation state */
32
- get noValidate(): boolean;
33
- /** set determine if component is in no validation state */
34
- set noValidate(value: boolean | unknown);
35
- /** @internal */
36
- _value: T | undefined;
37
- get value(): T | undefined;
38
- /** value state of the component */
39
- set value(value: T | unknown);
40
- /** @protected */
41
- updateValue(value: T): void;
42
- /** associated parent form */
43
- get form(): HTMLFormElement | null;
44
- /** determine if the component is a candidate for constraint checking */
45
- get willValidate(): boolean;
46
- /** validity state of the component */
47
- get validity(): ValidityState;
48
- /** validation message of the component */
49
- get validationMessage(): string;
50
- /** stringified value of the component */
51
- get valueAsString(): string;
52
- /** parsed number value of the component */
53
- get valueAsNumber(): number;
54
- set valueAsNumber(value: number);
55
- get type(): string;
56
- /** @internal */
57
- get _metadata(): FormControlMetadata;
58
- /** @internal */
59
- _formInternals: ElementInternals;
60
- /** @internal */
61
- _initialValue: T | undefined;
62
- /** @internal */
63
- get _validators(): import('../index.js').Validator[];
64
- /** @protected */
65
- get _internals(): ElementInternals;
66
- connectedCallback(): void;
67
- disconnectedCallback(): void;
68
- /**
69
- * @internal
70
- * Stop events that originated inside this component's own shadow tree so the
71
- * mixin can re-dispatch them semantically. Slotted light-DOM events traverse the
72
- * host's shadow root via slots and must continue bubbling.
73
- */
74
- _stopInternalPropagation: (event: Event) => void;
75
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
76
- /** @internal */
77
- _handleAttributeChange(name: string, newValue: string): void;
78
- /** @protected */
79
- formResetCallback(): void;
80
- /** @protected https://webkit.org/blog/13711/elementinternals-and-form-associated-custom-elements/*/
81
- formStateRestoreCallback(state: T, _reason: string): void;
82
- /** report validity of the component */
83
- reportValidity(): boolean;
84
- /** check validity of the component */
85
- checkValidity(): boolean;
86
- /** @protected */
87
- setValidity(validity: Partial<ValidityState>, message?: string): void;
88
- /** @protected */
89
- dispatchInputEvent(): void;
90
- /** @protected */
91
- dispatchChangeEvent(): void;
92
- /** @protected */
93
- dispatchUpdateEvent(type: "input" | "change"): void;
94
- /** @internal */
95
- _updateFormState(): void;
96
- /** @internal */
97
- _requestUpdate(): void;
98
- accessKey: string;
99
- readonly accessKeyLabel: string;
100
- autocapitalize: string;
101
- autocorrect: boolean;
102
- dir: string;
103
- draggable: boolean;
104
- hidden: boolean | "until-found";
105
- inert: boolean;
106
- innerText: string;
107
- lang: string;
108
- readonly offsetHeight: number;
109
- readonly offsetLeft: number;
110
- readonly offsetParent: Element | null;
111
- readonly offsetTop: number;
112
- readonly offsetWidth: number;
113
- outerText: string;
114
- popover: string | null;
115
- spellcheck: boolean;
116
- title: string;
117
- translate: boolean;
118
- writingSuggestions: string;
119
- attachInternals(): ElementInternals;
120
- click(): void;
121
- hidePopover(): void;
122
- showPopover(options?: ShowPopoverOptions): void;
123
- togglePopover(options?: TogglePopoverOptions | boolean): boolean;
124
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
125
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
126
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
127
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
128
- readonly attributes: NamedNodeMap;
129
- get classList(): DOMTokenList;
130
- set classList(value: string);
131
- className: string;
132
- readonly clientHeight: number;
133
- readonly clientLeft: number;
134
- readonly clientTop: number;
135
- readonly clientWidth: number;
136
- readonly currentCSSZoom: number;
137
- readonly customElementRegistry: CustomElementRegistry | null;
138
- id: string;
139
- innerHTML: string;
140
- readonly localName: string;
141
- readonly namespaceURI: string | null;
142
- onfullscreenchange: ((this: Element, ev: Event) => any) | null;
143
- onfullscreenerror: ((this: Element, ev: Event) => any) | null;
144
- outerHTML: string;
145
- readonly ownerDocument: Document;
146
- get part(): DOMTokenList;
147
- set part(value: string);
148
- readonly prefix: string | null;
149
- readonly scrollHeight: number;
150
- scrollLeft: number;
151
- scrollTop: number;
152
- readonly scrollWidth: number;
153
- readonly shadowRoot: ShadowRoot | null;
154
- slot: string;
155
- readonly tagName: string;
156
- attachShadow(init: ShadowRootInit): ShadowRoot;
157
- checkVisibility(options?: CheckVisibilityOptions): boolean;
158
- closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
159
- closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
160
- closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
161
- closest<E extends Element = Element>(selectors: string): E | null;
162
- computedStyleMap(): StylePropertyMapReadOnly;
163
- getAttribute(qualifiedName: string): string | null;
164
- getAttributeNS(namespace: string | null, localName: string): string | null;
165
- getAttributeNames(): string[];
166
- getAttributeNode(qualifiedName: string): Attr | null;
167
- getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
168
- getBoundingClientRect(): DOMRect;
169
- getClientRects(): DOMRectList;
170
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
171
- getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
172
- getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
173
- getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
174
- getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
175
- getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
176
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
177
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
178
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
179
- getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
180
- getHTML(options?: GetHTMLOptions): string;
181
- hasAttribute(qualifiedName: string): boolean;
182
- hasAttributeNS(namespace: string | null, localName: string): boolean;
183
- hasAttributes(): boolean;
184
- hasPointerCapture(pointerId: number): boolean;
185
- insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
186
- insertAdjacentHTML(position: InsertPosition, string: string): void;
187
- insertAdjacentText(where: InsertPosition, data: string): void;
188
- matches<K extends keyof HTMLElementTagNameMap>(selectors: K): this is HTMLElementTagNameMap[K];
189
- matches<K extends keyof SVGElementTagNameMap>(selectors: K): this is SVGElementTagNameMap[K];
190
- matches<K extends keyof MathMLElementTagNameMap>(selectors: K): this is MathMLElementTagNameMap[K];
191
- matches(selectors: string): boolean;
192
- releasePointerCapture(pointerId: number): void;
193
- removeAttribute(qualifiedName: string): void;
194
- removeAttributeNS(namespace: string | null, localName: string): void;
195
- removeAttributeNode(attr: Attr): Attr;
196
- requestFullscreen(options?: FullscreenOptions): Promise<void>;
197
- requestPointerLock(options?: PointerLockOptions): Promise<void>;
198
- scroll(options?: ScrollToOptions): void;
199
- scroll(x: number, y: number): void;
200
- scrollBy(options?: ScrollToOptions): void;
201
- scrollBy(x: number, y: number): void;
202
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
203
- scrollTo(options?: ScrollToOptions): void;
204
- scrollTo(x: number, y: number): void;
205
- setAttribute(qualifiedName: string, value: string): void;
206
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
207
- setAttributeNode(attr: Attr): Attr | null;
208
- setAttributeNodeNS(attr: Attr): Attr | null;
209
- setHTMLUnsafe(html: string): void;
210
- setPointerCapture(pointerId: number): void;
211
- toggleAttribute(qualifiedName: string, force?: boolean): boolean;
212
- webkitMatchesSelector(selectors: string): boolean;
213
- get textContent(): string;
214
- set textContent(value: string | null);
215
- readonly baseURI: string;
216
- readonly childNodes: NodeListOf<ChildNode>;
217
- readonly firstChild: ChildNode | null;
218
- readonly isConnected: boolean;
219
- readonly lastChild: ChildNode | null;
220
- readonly nextSibling: ChildNode | null;
221
- readonly nodeName: string;
222
- readonly nodeType: number;
223
- nodeValue: string | null;
224
- readonly parentElement: HTMLElement | null;
225
- readonly parentNode: ParentNode | null;
226
- readonly previousSibling: ChildNode | null;
227
- appendChild<T_1 extends Node>(node: T_1): T_1;
228
- cloneNode(subtree?: boolean): Node;
229
- compareDocumentPosition(other: Node): number;
230
- contains(other: Node | null): boolean;
231
- getRootNode(options?: GetRootNodeOptions): Node;
232
- hasChildNodes(): boolean;
233
- insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
234
- isDefaultNamespace(namespace: string | null): boolean;
235
- isEqualNode(otherNode: Node | null): boolean;
236
- isSameNode(otherNode: Node | null): boolean;
237
- lookupNamespaceURI(prefix: string | null): string | null;
238
- lookupPrefix(namespace: string | null): string | null;
239
- normalize(): void;
240
- removeChild<T_1 extends Node>(child: T_1): T_1;
241
- replaceChild<T_1 extends Node>(node: Node, child: T_1): T_1;
242
- readonly ELEMENT_NODE: 1;
243
- readonly ATTRIBUTE_NODE: 2;
244
- readonly TEXT_NODE: 3;
245
- readonly CDATA_SECTION_NODE: 4;
246
- readonly ENTITY_REFERENCE_NODE: 5;
247
- readonly ENTITY_NODE: 6;
248
- readonly PROCESSING_INSTRUCTION_NODE: 7;
249
- readonly COMMENT_NODE: 8;
250
- readonly DOCUMENT_NODE: 9;
251
- readonly DOCUMENT_TYPE_NODE: 10;
252
- readonly DOCUMENT_FRAGMENT_NODE: 11;
253
- readonly NOTATION_NODE: 12;
254
- readonly DOCUMENT_POSITION_DISCONNECTED: 1;
255
- readonly DOCUMENT_POSITION_PRECEDING: 2;
256
- readonly DOCUMENT_POSITION_FOLLOWING: 4;
257
- readonly DOCUMENT_POSITION_CONTAINS: 8;
258
- readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
259
- readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
260
- dispatchEvent(event: Event): boolean;
261
- ariaActiveDescendantElement: Element | null;
262
- ariaAtomic: string | null;
263
- ariaAutoComplete: string | null;
264
- ariaBrailleLabel: string | null;
265
- ariaBrailleRoleDescription: string | null;
266
- ariaBusy: string | null;
267
- ariaChecked: string | null;
268
- ariaColCount: string | null;
269
- ariaColIndex: string | null;
270
- ariaColIndexText: string | null;
271
- ariaColSpan: string | null;
272
- ariaControlsElements: ReadonlyArray<Element> | null;
273
- ariaCurrent: string | null;
274
- ariaDescribedByElements: ReadonlyArray<Element> | null;
275
- ariaDescription: string | null;
276
- ariaDetailsElements: ReadonlyArray<Element> | null;
277
- ariaDisabled: string | null;
278
- ariaErrorMessageElements: ReadonlyArray<Element> | null;
279
- ariaExpanded: string | null;
280
- ariaFlowToElements: ReadonlyArray<Element> | null;
281
- ariaHasPopup: string | null;
282
- ariaHidden: string | null;
283
- ariaInvalid: string | null;
284
- ariaKeyShortcuts: string | null;
285
- ariaLabel: string | null;
286
- ariaLabelledByElements: ReadonlyArray<Element> | null;
287
- ariaLevel: string | null;
288
- ariaLive: string | null;
289
- ariaModal: string | null;
290
- ariaMultiLine: string | null;
291
- ariaMultiSelectable: string | null;
292
- ariaOrientation: string | null;
293
- ariaOwnsElements: ReadonlyArray<Element> | null;
294
- ariaPlaceholder: string | null;
295
- ariaPosInSet: string | null;
296
- ariaPressed: string | null;
297
- ariaReadOnly: string | null;
298
- ariaRelevant: string | null;
299
- ariaRequired: string | null;
300
- ariaRoleDescription: string | null;
301
- ariaRowCount: string | null;
302
- ariaRowIndex: string | null;
303
- ariaRowIndexText: string | null;
304
- ariaRowSpan: string | null;
305
- ariaSelected: string | null;
306
- ariaSetSize: string | null;
307
- ariaSort: string | null;
308
- ariaValueMax: string | null;
309
- ariaValueMin: string | null;
310
- ariaValueNow: string | null;
311
- ariaValueText: string | null;
312
- role: string | null;
313
- animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
314
- getAnimations(options?: GetAnimationsOptions): Animation[];
315
- after(...nodes: (Node | string)[]): void;
316
- before(...nodes: (Node | string)[]): void;
317
- remove(): void;
318
- replaceWith(...nodes: (Node | string)[]): void;
319
- readonly nextElementSibling: Element | null;
320
- readonly previousElementSibling: Element | null;
321
- readonly childElementCount: number;
322
- readonly children: HTMLCollection;
323
- readonly firstElementChild: Element | null;
324
- readonly lastElementChild: Element | null;
325
- append(...nodes: (Node | string)[]): void;
326
- moveBefore(node: Node, child: Node | null): void;
327
- prepend(...nodes: (Node | string)[]): void;
328
- querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
329
- querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
330
- querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
331
- querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
332
- querySelector<E extends Element = Element>(selectors: string): E | null;
333
- querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
334
- querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
335
- querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
336
- querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
337
- querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
338
- replaceChildren(...nodes: (Node | string)[]): void;
339
- readonly assignedSlot: HTMLSlotElement | null;
340
- readonly attributeStyleMap: StylePropertyMap;
341
- get style(): CSSStyleDeclaration;
342
- set style(cssText: string);
343
- contentEditable: string;
344
- enterKeyHint: string;
345
- inputMode: string;
346
- readonly isContentEditable: boolean;
347
- onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
348
- onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
349
- onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
350
- onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
351
- onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
352
- onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
353
- onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
354
- onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
355
- onbeforetoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
356
- onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
357
- oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
358
- oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
359
- oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
360
- onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
361
- onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
362
- onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
363
- oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null;
364
- oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
365
- oncontextmenu: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
366
- oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
367
- oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
368
- oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
369
- oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
370
- ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
371
- ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
372
- ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
373
- ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
374
- ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
375
- ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
376
- ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
377
- ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
378
- ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
379
- onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
380
- onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
381
- onerror: OnErrorEventHandler;
382
- onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
383
- onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
384
- ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
385
- oninput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
386
- oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
387
- onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
388
- onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
389
- onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
390
- onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
391
- onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
392
- onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
393
- onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
394
- onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
395
- onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
396
- onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
397
- onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
398
- onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
399
- onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
400
- onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
401
- onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
402
- onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
403
- onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
404
- onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
405
- onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
406
- onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
407
- onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
408
- onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
409
- onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
410
- onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
411
- onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
412
- onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
413
- onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
414
- onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
415
- onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
416
- onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
417
- onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
418
- onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
419
- onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
420
- onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
421
- onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
422
- onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
423
- onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
424
- onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
425
- onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
426
- onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
427
- onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
428
- onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
429
- onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
430
- onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
431
- ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
432
- ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
433
- ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
434
- ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
435
- ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
436
- ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
437
- ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
438
- ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
439
- ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
440
- ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
441
- onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
442
- onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
443
- onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
444
- onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
445
- onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
446
- onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
447
- onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
448
- autofocus: boolean;
449
- readonly dataset: DOMStringMap;
450
- nonce: string;
451
- tabIndex: number;
452
- blur(): void;
453
- focus(options?: FocusOptions): void;
454
- requestUpdate?(name?: string, oldValue?: unknown): void;
455
- };
456
- formAssociated: boolean;
457
- metadata: FormControlMetadata;
458
- get observedAttributes(): string[];
459
- } & TBase;
460
- export {};
@@ -1,188 +0,0 @@
1
- import { FormControlError as e } from "../internal/errors.js";
2
- import { parseValueSchema as t } from "../internal/schema.js";
3
- import { isObjectLiteral as n } from "../internal/utils.js";
4
- //#region src/mixin/index.ts
5
- function r(r) {
6
- return class extends r {
7
- static {
8
- this.formAssociated = !0;
9
- }
10
- get readOnly() {
11
- return this.getAttribute("readonly") !== null;
12
- }
13
- set readOnly(e) {
14
- this.toggleAttribute("readonly", e), this._requestUpdate();
15
- }
16
- get disabled() {
17
- return this.getAttribute("disabled") !== null;
18
- }
19
- set disabled(e) {
20
- this.toggleAttribute("disabled", e), this._requestUpdate();
21
- }
22
- get required() {
23
- return this.getAttribute("required") !== null;
24
- }
25
- set required(e) {
26
- this.toggleAttribute("required", e), this._requestUpdate();
27
- }
28
- get name() {
29
- return this.getAttribute("name") ?? "";
30
- }
31
- set name(e) {
32
- this.setAttribute("name", e), this._requestUpdate();
33
- }
34
- get noValidate() {
35
- return this.getAttribute("novalidate") !== null || this._formInternals.form?.noValidate === !0;
36
- }
37
- set noValidate(e) {
38
- this.toggleAttribute("novalidate", e), this._requestUpdate();
39
- }
40
- set value(e) {
41
- this.updateValue(e), this._requestUpdate();
42
- }
43
- get value() {
44
- return this._value;
45
- }
46
- updateValue(e) {
47
- let t = this._value;
48
- this._value = structuredClone(e), !this.checkValidity() && this._metadata.strict && (this._value = t, console.error("FormControlError: (strict mode)", this.validationMessage)), this._updateFormState();
49
- }
50
- get form() {
51
- return this._formInternals.form;
52
- }
53
- get willValidate() {
54
- return this._formInternals.willValidate;
55
- }
56
- get validity() {
57
- return this._formInternals.validity;
58
- }
59
- get validationMessage() {
60
- return this._formInternals.validationMessage;
61
- }
62
- get valueAsString() {
63
- return JSON.stringify(this.value);
64
- }
65
- get valueAsNumber() {
66
- return Number(this.valueAsString);
67
- }
68
- set valueAsNumber(t) {
69
- if (typeof this._value == "number" && typeof t == "number") this.value = t;
70
- else throw new e(this.localName, "cannot set number value on non-number type");
71
- }
72
- get type() {
73
- return this.localName;
74
- }
75
- get _metadata() {
76
- return this.constructor.metadata;
77
- }
78
- get _validators() {
79
- return this._metadata.validators ?? [];
80
- }
81
- get _internals() {
82
- return this._formInternals;
83
- }
84
- constructor(...e) {
85
- super(...e), this._formInternals = this.attachInternals(), this._stopInternalPropagation = (e) => {
86
- let t = e.composedPath()[0];
87
- t instanceof Node && this.shadowRoot?.contains(t) && e.stopPropagation();
88
- }, this._initialValue = this.value;
89
- }
90
- connectedCallback() {
91
- super.connectedCallback && super.connectedCallback(), this.tabIndex = 0, this._updateFormState(), this.shadowRoot?.addEventListener("input", this._stopInternalPropagation), this.shadowRoot?.addEventListener("change", this._stopInternalPropagation);
92
- }
93
- disconnectedCallback() {
94
- super.disconnectedCallback && super.disconnectedCallback(), this.shadowRoot?.removeEventListener("input", this._stopInternalPropagation), this.shadowRoot?.removeEventListener("change", this._stopInternalPropagation);
95
- }
96
- static get observedAttributes() {
97
- return (super.observedAttributes ?? []).concat([
98
- "value",
99
- "readonly",
100
- "required",
101
- "name",
102
- "novalidate",
103
- "disabled"
104
- ]);
105
- }
106
- attributeChangedCallback(e, t, n) {
107
- super.attributeChangedCallback && super.attributeChangedCallback(e, t, n), n !== t && this._handleAttributeChange(e, n);
108
- }
109
- _handleAttributeChange(e, n) {
110
- switch (e) {
111
- case "value":
112
- this.value = t(this.localName, n, this._metadata.valueSchema), this._initialValue === void 0 && (this._initialValue = this.value);
113
- break;
114
- case "readonly":
115
- this.readOnly = n !== null;
116
- break;
117
- case "disabled":
118
- this.disabled = n !== null;
119
- break;
120
- case "required":
121
- this.required = n !== null;
122
- break;
123
- case "name":
124
- this.name = n;
125
- break;
126
- }
127
- }
128
- formResetCallback() {
129
- this.value = this._initialValue, this.checkValidity();
130
- }
131
- formStateRestoreCallback(e, t) {
132
- this.value = e, this.checkValidity();
133
- }
134
- reportValidity() {
135
- return this._formInternals.reportValidity();
136
- }
137
- checkValidity() {
138
- if (this.noValidate) this._formInternals.setValidity({});
139
- else for (let e of this._validators) {
140
- let t = e(this.value, this);
141
- if (t.validity.valid) this._formInternals.setValidity({});
142
- else {
143
- this._formInternals.setValidity(t.validity, t.message, this.shadowRoot?.activeElement ?? void 0);
144
- break;
145
- }
146
- }
147
- return this._formInternals.checkValidity();
148
- }
149
- setValidity(e, t) {
150
- this._formInternals.setValidity(e, t);
151
- }
152
- dispatchInputEvent() {
153
- this.dispatchEvent(new InputEvent("input", {
154
- bubbles: !0,
155
- cancelable: !0,
156
- data: this.valueAsString
157
- }));
158
- }
159
- dispatchChangeEvent() {
160
- this.dispatchEvent(new Event("change", {
161
- bubbles: !0,
162
- cancelable: !0
163
- }));
164
- }
165
- dispatchUpdateEvent(e) {
166
- e === "input" ? this.dispatchInputEvent() : e === "change" && this.dispatchChangeEvent();
167
- }
168
- _updateFormState() {
169
- if (this.name) if (typeof this.value == "number") this._formInternals?.setFormValue(`${this.value}`);
170
- else if (n(this.value)) {
171
- let e = new FormData();
172
- Object.entries(this.value).filter(([e]) => e !== "value").forEach(([t, n]) => {
173
- e.set(`${this.name}-${t}`, `${n}`);
174
- }), this._formInternals?.setFormValue(e);
175
- } else if (Array.isArray(this.value)) {
176
- let e = new FormData();
177
- this.value.forEach((t) => e.append(`${this.name}`, t)), this._formInternals?.setFormValue(e);
178
- } else this._formInternals?.setFormValue(this.value);
179
- }
180
- _requestUpdate() {
181
- this.requestUpdate && this.requestUpdate();
182
- }
183
- };
184
- }
185
- //#endregion
186
- export { r as FormControlMixin };
187
-
188
- //# sourceMappingURL=index.js.map