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