@nvidia-elements/forms 0.0.7 → 0.1.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 (83) hide show
  1. package/CHANGELOG.md +155 -14
  2. package/NOTICE.md +1 -39
  3. package/README.md +1 -7
  4. package/dist/custom-elements.json +1293 -254
  5. package/dist/examples/csv.examples.js.map +1 -1
  6. package/dist/examples/csv.examples.json +1 -1
  7. package/dist/examples/light.examples.js.map +1 -1
  8. package/dist/examples/light.examples.json +2 -2
  9. package/dist/examples/simple.examples.js.map +1 -1
  10. package/dist/examples/simple.examples.json +2 -2
  11. package/dist/examples/visualization.examples.js.map +1 -1
  12. package/dist/examples/visualization.examples.json +2 -2
  13. package/dist/index.js +1 -1
  14. package/dist/internal/controllers/state-active.controller.d.ts +13 -0
  15. package/dist/internal/controllers/state-active.controller.js +26 -0
  16. package/dist/internal/controllers/state-active.controller.js.map +1 -0
  17. package/dist/internal/controllers/state-current.controller.d.ts +15 -0
  18. package/dist/internal/controllers/state-current.controller.js +34 -0
  19. package/dist/internal/controllers/state-current.controller.js.map +1 -0
  20. package/dist/internal/controllers/state-disabled.controller.d.ts +18 -0
  21. package/dist/internal/controllers/state-disabled.controller.js +17 -0
  22. package/dist/internal/controllers/state-disabled.controller.js.map +1 -0
  23. package/dist/internal/controllers/state-expanded.controller.d.ts +12 -0
  24. package/dist/internal/controllers/state-expanded.controller.js +17 -0
  25. package/dist/internal/controllers/state-expanded.controller.js.map +1 -0
  26. package/dist/internal/controllers/state-pressed.controller.d.ts +12 -0
  27. package/dist/internal/controllers/state-pressed.controller.js +17 -0
  28. package/dist/internal/controllers/state-pressed.controller.js.map +1 -0
  29. package/dist/internal/controllers/state-readonly.controller.d.ts +12 -0
  30. package/dist/internal/controllers/state-readonly.controller.js +17 -0
  31. package/dist/internal/controllers/state-readonly.controller.js.map +1 -0
  32. package/dist/internal/controllers/state-selected.controller.d.ts +15 -0
  33. package/dist/internal/controllers/state-selected.controller.js +34 -0
  34. package/dist/internal/controllers/state-selected.controller.js.map +1 -0
  35. package/dist/internal/controllers/type-anchor.controller.d.ts +15 -0
  36. package/dist/internal/controllers/type-anchor.controller.js +51 -0
  37. package/dist/internal/controllers/type-anchor.controller.js.map +1 -0
  38. package/dist/internal/controllers/type-button.controller.d.ts +14 -0
  39. package/dist/internal/controllers/type-button.controller.js +22 -0
  40. package/dist/internal/controllers/type-button.controller.js.map +1 -0
  41. package/dist/internal/controllers/type-command.controller.d.ts +16 -0
  42. package/dist/internal/controllers/type-command.controller.js +36 -0
  43. package/dist/internal/controllers/type-command.controller.js.map +1 -0
  44. package/dist/internal/controllers/type-interest-invoker.controller.d.ts +12 -0
  45. package/dist/internal/controllers/type-interest-invoker.controller.js +38 -0
  46. package/dist/internal/controllers/type-interest-invoker.controller.js.map +1 -0
  47. package/dist/internal/controllers/type-native-button.controller.d.ts +19 -0
  48. package/dist/internal/controllers/type-native-button.controller.js +54 -0
  49. package/dist/internal/controllers/type-native-button.controller.js.map +1 -0
  50. package/dist/internal/controllers/type-popover-trigger.controller.d.ts +16 -0
  51. package/dist/internal/controllers/type-popover-trigger.controller.js +21 -0
  52. package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -0
  53. package/dist/internal/controllers/types.d.ts +8 -0
  54. package/dist/internal/errors.js.map +1 -1
  55. package/dist/internal/schema.js +13 -24
  56. package/dist/internal/schema.js.map +1 -1
  57. package/dist/internal/types.d.ts +18 -4
  58. package/dist/internal/utils.d.ts +17 -0
  59. package/dist/internal/utils.js +53 -1
  60. package/dist/internal/utils.js.map +1 -1
  61. package/dist/mixins/button.d.ts +22 -0
  62. package/dist/mixins/button.js +344 -0
  63. package/dist/mixins/button.js.map +1 -0
  64. package/dist/mixins/button.types.d.ts +121 -0
  65. package/dist/mixins/checkbox.d.ts +41 -0
  66. package/dist/mixins/checkbox.js +109 -0
  67. package/dist/mixins/checkbox.js.map +1 -0
  68. package/dist/mixins/control.d.ts +189 -0
  69. package/dist/mixins/control.js +358 -0
  70. package/dist/mixins/control.js.map +1 -0
  71. package/dist/mixins/index.d.ts +5 -0
  72. package/dist/mixins/index.js +6 -0
  73. package/dist/mixins/select.d.ts +49 -0
  74. package/dist/mixins/select.js +80 -0
  75. package/dist/mixins/select.js.map +1 -0
  76. package/dist/mixins/slider.d.ts +62 -0
  77. package/dist/mixins/slider.js +175 -0
  78. package/dist/mixins/slider.js.map +1 -0
  79. package/dist/validators/index.js.map +1 -1
  80. package/package.json +31 -19
  81. package/dist/mixin/index.d.ts +0 -460
  82. package/dist/mixin/index.js +0 -188
  83. package/dist/mixin/index.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ import { removeEmptyTextNode as e } from "../utils.js";
2
+ //#region src/internal/controllers/type-anchor.controller.ts
3
+ var t = class {
4
+ #e = null;
5
+ #t = !1;
6
+ constructor(e) {
7
+ this.host = e, this.host.addController(this);
8
+ }
9
+ get readOnly() {
10
+ return this.#t;
11
+ }
12
+ hostUpdated() {
13
+ this.#s();
14
+ let e = this.#n;
15
+ this.#t = !!e, e ? this.host._internals.states.add("anchor") : this.host._internals.states.delete("anchor"), this.#i && (this.#i.style.textDecoration = "none", this.host.style.cursor = "pointer"), this.#c(e);
16
+ }
17
+ hostDisconnected() {
18
+ this.#l();
19
+ }
20
+ get #n() {
21
+ return this.#r ?? this.#i;
22
+ }
23
+ get #r() {
24
+ return this.host.shadowRoot?.querySelector("slot, slot[name=anchor]")?.assignedElements()?.find((e) => e?.tagName === "A");
25
+ }
26
+ get #i() {
27
+ return this.host.parentElement?.tagName === "A" ? this.host.parentElement : null;
28
+ }
29
+ get #a() {
30
+ return this.host.shadowRoot?.querySelector("slot:not([name])");
31
+ }
32
+ get #o() {
33
+ return this.host.shadowRoot?.querySelector("slot[name=anchor]");
34
+ }
35
+ #s() {
36
+ this.#n && this.#o && (this.#n.slot = "anchor", this.#a?.assignedNodes().forEach((t) => e(t)));
37
+ }
38
+ #c(e) {
39
+ this.#l(), this.#e = e ?? null, this.#e?.addEventListener("click", this.#u);
40
+ }
41
+ #l() {
42
+ this.#e?.removeEventListener("click", this.#u), this.#e = null;
43
+ }
44
+ #u = (e) => {
45
+ this.host.disabled && (e.preventDefault(), e.stopImmediatePropagation());
46
+ };
47
+ };
48
+ //#endregion
49
+ export { t as TypeAnchorController };
50
+
51
+ //# sourceMappingURL=type-anchor.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-anchor.controller.js","names":["#readOnly","#updateAnchorSlotAssignment","#anchor","#parentAnchor","#setupAnchorClickBehavior","#removeAnchorClickBehavior","#slottedAnchor","#defaultSlot","#anchorSlot","#anchorClickTarget","#onAnchorClick"],"sources":["../../../src/internal/controllers/type-anchor.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { removeEmptyTextNode } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype AnchorBehaviorHost = ReactiveElement & {\n disabled: boolean;\n readOnly: boolean;\n _internals?: ElementInternals;\n};\n\nexport class TypeAnchorController<T extends AnchorBehaviorHost> implements ReactiveController {\n #anchorClickTarget: HTMLAnchorElement | null = null;\n #readOnly = false;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n get readOnly() {\n return this.#readOnly;\n }\n\n hostUpdated() {\n this.#updateAnchorSlotAssignment();\n const anchor = this.#anchor;\n this.#readOnly = Boolean(anchor);\n\n if (anchor) {\n this.host._internals!.states.add('anchor');\n } else {\n this.host._internals!.states.delete('anchor');\n }\n\n if (this.#parentAnchor) {\n this.#parentAnchor.style.textDecoration = 'none';\n this.host.style.cursor = 'pointer';\n }\n\n this.#setupAnchorClickBehavior(anchor);\n }\n\n hostDisconnected() {\n this.#removeAnchorClickBehavior();\n }\n\n get #anchor() {\n return this.#slottedAnchor ?? this.#parentAnchor;\n }\n\n get #slottedAnchor() {\n return this.host.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot, slot[name=anchor]')\n ?.assignedElements()\n ?.find(element => element?.tagName === 'A') as HTMLAnchorElement | undefined;\n }\n\n get #parentAnchor() {\n return this.host.parentElement?.tagName === 'A' ? (this.host.parentElement as HTMLAnchorElement) : null;\n }\n\n get #defaultSlot() {\n return this.host.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n }\n\n get #anchorSlot() {\n return this.host.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=anchor]');\n }\n\n #updateAnchorSlotAssignment() {\n if (this.#anchor && this.#anchorSlot) {\n this.#anchor.slot = 'anchor';\n this.#defaultSlot?.assignedNodes().forEach(node => removeEmptyTextNode(node));\n }\n }\n\n #setupAnchorClickBehavior(anchor: HTMLAnchorElement | null | undefined) {\n this.#removeAnchorClickBehavior();\n this.#anchorClickTarget = anchor ?? null;\n this.#anchorClickTarget?.addEventListener('click', this.#onAnchorClick);\n }\n\n #removeAnchorClickBehavior() {\n this.#anchorClickTarget?.removeEventListener('click', this.#onAnchorClick);\n this.#anchorClickTarget = null;\n }\n\n #onAnchorClick = (event: Event) => {\n if (this.host.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n}\n"],"mappings":";;AAYA,IAAa,IAAb,MAA8F;CAC5F,KAA+C;CAC/C,KAAY;CAEZ,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,IAAI,WAAW;EACb,OAAO,KAAKA;CACd;CAEA,cAAc;EACZ,KAAKC,GAA4B;EACjC,IAAM,IAAS,KAAKC;EAcpB,AAbA,KAAKF,KAAY,EAAQ,GAErB,IACF,KAAK,KAAK,WAAY,OAAO,IAAI,QAAQ,IAEzC,KAAK,KAAK,WAAY,OAAO,OAAO,QAAQ,GAG1C,KAAKG,OACP,KAAKA,GAAc,MAAM,iBAAiB,QAC1C,KAAK,KAAK,MAAM,SAAS,YAG3B,KAAKC,GAA0B,CAAM;CACvC;CAEA,mBAAmB;EACjB,KAAKC,GAA2B;CAClC;CAEA,IAAIH,KAAU;EACZ,OAAO,KAAKI,MAAkB,KAAKH;CACrC;CAEA,IAAIG,KAAiB;EACnB,OAAO,KAAK,KAAK,YACb,cAA+B,yBAAyB,GACxD,iBAAiB,GACjB,MAAK,MAAW,GAAS,YAAY,GAAG;CAC9C;CAEA,IAAIH,KAAgB;EAClB,OAAO,KAAK,KAAK,eAAe,YAAY,MAAO,KAAK,KAAK,gBAAsC;CACrG;CAEA,IAAII,KAAe;EACjB,OAAO,KAAK,KAAK,YAAY,cAA+B,kBAAkB;CAChF;CAEA,IAAIC,KAAc;EAChB,OAAO,KAAK,KAAK,YAAY,cAA+B,mBAAmB;CACjF;CAEA,KAA8B;EAC5B,AAAI,KAAKN,MAAW,KAAKM,OACvB,KAAKN,GAAQ,OAAO,UACpB,KAAKK,IAAc,cAAc,EAAE,SAAQ,MAAQ,EAAoB,CAAI,CAAC;CAEhF;CAEA,GAA0B,GAA8C;EAGtE,AAFA,KAAKF,GAA2B,GAChC,KAAKI,KAAqB,KAAU,MACpC,KAAKA,IAAoB,iBAAiB,SAAS,KAAKC,EAAc;CACxE;CAEA,KAA6B;EAE3B,AADA,KAAKD,IAAoB,oBAAoB,SAAS,KAAKC,EAAc,GACzE,KAAKD,KAAqB;CAC5B;CAEA,MAAkB,MAAiB;EACjC,AAAI,KAAK,KAAK,aACZ,EAAM,eAAe,GACrB,EAAM,yBAAyB;CAEnC;AACF"}
@@ -0,0 +1,14 @@
1
+ import { ReactiveController, ReactiveElement } from './types.js';
2
+ type ButtonBehaviorHost = ReactiveElement & {
3
+ disabled: boolean;
4
+ readOnly: boolean;
5
+ _internals?: ElementInternals;
6
+ };
7
+ export declare class TypeButtonController<T extends ButtonBehaviorHost> implements ReactiveController {
8
+ #private;
9
+ private host;
10
+ constructor(host: T);
11
+ hostConnected(): void;
12
+ hostUpdated(): void;
13
+ }
14
+ export {};
@@ -0,0 +1,22 @@
1
+ //#region src/internal/controllers/type-button.controller.ts
2
+ var e = class {
3
+ #e = null;
4
+ #t = 0;
5
+ constructor(e) {
6
+ this.host = e, this.host.addController(this);
7
+ }
8
+ hostConnected() {
9
+ this.host.hasAttribute("tabindex") && (this.#t = this.host.tabIndex);
10
+ }
11
+ hostUpdated() {
12
+ if (this.host.readOnly) {
13
+ this.host._internals.role && this.host._internals.role !== "none" && (this.#e = this.host._internals.role), this.host._internals.role = "none", this.host.tabIndex = -1, this.host.removeAttribute("tabindex");
14
+ return;
15
+ }
16
+ !this.host._internals.role || this.host._internals.role === "none" ? this.host._internals.role = this.#e ?? "button" : this.#e = this.host._internals.role, this.host.tabIndex = this.host.disabled ? -1 : this.#t;
17
+ }
18
+ };
19
+ //#endregion
20
+ export { e as TypeButtonController };
21
+
22
+ //# sourceMappingURL=type-button.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-button.controller.js","names":["#initialTabIndex","#enabledRole"],"sources":["../../../src/internal/controllers/type-button.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype ButtonBehaviorHost = ReactiveElement & {\n disabled: boolean;\n readOnly: boolean;\n _internals?: ElementInternals;\n};\n\nexport class TypeButtonController<T extends ButtonBehaviorHost> implements ReactiveController {\n #enabledRole: string | null = null;\n #initialTabIndex = 0;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n if (this.host.hasAttribute('tabindex')) {\n this.#initialTabIndex = this.host.tabIndex;\n }\n }\n\n hostUpdated() {\n if (this.host.readOnly) {\n if (this.host._internals!.role && this.host._internals!.role !== 'none') {\n this.#enabledRole = this.host._internals!.role;\n }\n\n this.host._internals!.role = 'none';\n this.host.tabIndex = -1;\n this.host.removeAttribute('tabindex');\n return;\n }\n\n if (!this.host._internals!.role || this.host._internals!.role === 'none') {\n this.host._internals!.role = this.#enabledRole ?? 'button';\n } else {\n this.#enabledRole = this.host._internals!.role;\n }\n\n this.host.tabIndex = this.host.disabled ? -1 : this.#initialTabIndex;\n }\n}\n"],"mappings":";AAWA,IAAa,IAAb,MAA8F;CAC5F,KAA8B;CAC9B,KAAmB;CAEnB,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,AAAI,KAAK,KAAK,aAAa,UAAU,MACnC,KAAKA,KAAmB,KAAK,KAAK;CAEtC;CAEA,cAAc;EACZ,IAAI,KAAK,KAAK,UAAU;GAOtB,AANI,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,WAC/D,KAAKC,KAAe,KAAK,KAAK,WAAY,OAG5C,KAAK,KAAK,WAAY,OAAO,QAC7B,KAAK,KAAK,WAAW,IACrB,KAAK,KAAK,gBAAgB,UAAU;GACpC;EACF;EAQA,AANI,CAAC,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,SAChE,KAAK,KAAK,WAAY,OAAO,KAAKA,MAAgB,WAElD,KAAKA,KAAe,KAAK,KAAK,WAAY,MAG5C,KAAK,KAAK,WAAW,KAAK,KAAK,WAAW,KAAK,KAAKD;CACtD;AACF"}
@@ -0,0 +1,16 @@
1
+ import { ReactiveController, ReactiveElement } from './types.js';
2
+ type CommandBehaviorHost = ReactiveElement & {
3
+ command?: string;
4
+ commandForElement: HTMLElement | null;
5
+ disabled: boolean;
6
+ readOnly: boolean;
7
+ };
8
+ export declare class TypeCommandController<T extends CommandBehaviorHost> implements ReactiveController {
9
+ #private;
10
+ private host;
11
+ constructor(host: T);
12
+ hostUpdated(): void;
13
+ hostDisconnected(): void;
14
+ get target(): HTMLElement | null;
15
+ }
16
+ export {};
@@ -0,0 +1,36 @@
1
+ import { getFlattenedDOMTree as e } from "../utils.js";
2
+ //#region src/internal/controllers/type-command.controller.ts
3
+ var t = class {
4
+ constructor(e) {
5
+ this.host = e, this.host.addController(this);
6
+ }
7
+ hostUpdated() {
8
+ this.#e(), !this.host.readOnly && !this.host.disabled && this.host.addEventListener("click", this.#t);
9
+ }
10
+ hostDisconnected() {
11
+ this.#e();
12
+ }
13
+ #e() {
14
+ this.host.removeEventListener("click", this.#t);
15
+ }
16
+ #t = (e) => {
17
+ e.defaultPrevented || this.#n();
18
+ };
19
+ #n() {
20
+ if (this.host.readOnly || this.host.disabled || !this.host.command) return !1;
21
+ let e = this.target;
22
+ return e ? (e.dispatchEvent(new globalThis.CommandEvent("command", {
23
+ command: this.host.command,
24
+ source: this.host
25
+ })), !0) : (console.warn("commandForElement", this.host.commandForElement || this.host.getAttribute("commandfor"), "not found"), !1);
26
+ }
27
+ get target() {
28
+ if (this.host.commandForElement) return this.host.commandForElement;
29
+ let t = this.host.getAttribute("commandfor");
30
+ return t ? e(this.host.getRootNode()).find((e) => e.id === t) ?? null : null;
31
+ }
32
+ };
33
+ //#endregion
34
+ export { t as TypeCommandController };
35
+
36
+ //# sourceMappingURL=type-command.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-command.controller.js","names":["#removeCommandBehavior","#onCommandClick","#dispatchCommand"],"sources":["../../../src/internal/controllers/type-command.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getFlattenedDOMTree } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype CommandBehaviorHost = ReactiveElement & {\n command?: string;\n commandForElement: HTMLElement | null;\n disabled: boolean;\n readOnly: boolean;\n};\n\nexport class TypeCommandController<T extends CommandBehaviorHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostUpdated() {\n this.#removeCommandBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.host.addEventListener('click', this.#onCommandClick);\n }\n }\n\n hostDisconnected() {\n this.#removeCommandBehavior();\n }\n\n #removeCommandBehavior() {\n this.host.removeEventListener('click', this.#onCommandClick);\n }\n\n #onCommandClick = (event: Event) => {\n if (!event.defaultPrevented) {\n this.#dispatchCommand();\n }\n };\n\n #dispatchCommand() {\n if (this.host.readOnly || this.host.disabled || !this.host.command) {\n return false;\n }\n\n const target = this.target;\n if (!target) {\n console.warn(\n 'commandForElement',\n this.host.commandForElement || this.host.getAttribute('commandfor'),\n 'not found'\n );\n return false;\n }\n\n target.dispatchEvent(new globalThis.CommandEvent('command', { command: this.host.command, source: this.host }));\n return true;\n }\n\n get target(): HTMLElement | null {\n if (this.host.commandForElement) {\n return this.host.commandForElement;\n }\n\n const id = this.host.getAttribute('commandfor');\n if (!id) {\n return null;\n }\n\n return getFlattenedDOMTree(this.host.getRootNode() as HTMLElement).find(el => el.id === id) ?? null;\n }\n}\n"],"mappings":";;AAaA,IAAa,IAAb,MAAgG;CAC9F,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,cAAc;EAEZ,AADA,KAAKA,GAAuB,GACxB,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,YACpC,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAe;CAE5D;CAEA,mBAAmB;EACjB,KAAKD,GAAuB;CAC9B;CAEA,KAAyB;EACvB,KAAK,KAAK,oBAAoB,SAAS,KAAKC,EAAe;CAC7D;CAEA,MAAmB,MAAiB;EAClC,AAAK,EAAM,oBACT,KAAKC,GAAiB;CAE1B;CAEA,KAAmB;EACjB,IAAI,KAAK,KAAK,YAAY,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,SACzD,OAAO;EAGT,IAAM,IAAS,KAAK;EAWpB,OAVK,KASL,EAAO,cAAc,IAAI,WAAW,aAAa,WAAW;GAAE,SAAS,KAAK,KAAK;GAAS,QAAQ,KAAK;EAAK,CAAC,CAAC,GACvG,OATL,QAAQ,KACN,qBACA,KAAK,KAAK,qBAAqB,KAAK,KAAK,aAAa,YAAY,GAClE,WACF,GACO;CAKX;CAEA,IAAI,SAA6B;EAC/B,IAAI,KAAK,KAAK,mBACZ,OAAO,KAAK,KAAK;EAGnB,IAAM,IAAK,KAAK,KAAK,aAAa,YAAY;EAK9C,OAJK,IAIE,EAAoB,KAAK,KAAK,YAAY,CAAgB,EAAE,MAAK,MAAM,EAAG,OAAO,CAAE,KAAK,OAHtF;CAIX;AACF"}
@@ -0,0 +1,12 @@
1
+ import { ReactiveController, ReactiveElement } from './types.js';
2
+ type InterestInvokerHost = ReactiveElement & {
3
+ interestForElement: HTMLElement | null;
4
+ };
5
+ export declare class TypeInterestInvokerController<T extends InterestInvokerHost> implements ReactiveController {
6
+ #private;
7
+ private host;
8
+ constructor(host: T);
9
+ hostConnected(): void;
10
+ hostDisconnected(): void;
11
+ }
12
+ export {};
@@ -0,0 +1,38 @@
1
+ import { getFlattenedDOMTree as e } from "../utils.js";
2
+ //#region src/internal/controllers/type-interest-invoker.controller.ts
3
+ var t = class {
4
+ constructor(e) {
5
+ this.host = e, this.host.addController(this);
6
+ }
7
+ hostConnected() {
8
+ this.host.addEventListener("mouseenter", this.#e), this.host.addEventListener("mouseleave", this.#t), this.host.addEventListener("focus", this.#e), this.host.addEventListener("blur", this.#t);
9
+ }
10
+ hostDisconnected() {
11
+ this.host.removeEventListener("mouseenter", this.#e), this.host.removeEventListener("mouseleave", this.#t), this.host.removeEventListener("focus", this.#e), this.host.removeEventListener("blur", this.#t);
12
+ }
13
+ #e = () => {
14
+ if (this.#n(), this.host.interestForElement) {
15
+ let e = new Event("interest", { cancelable: !0 });
16
+ e.source = this.host, this.host.interestForElement.dispatchEvent(e);
17
+ }
18
+ };
19
+ #t = () => {
20
+ if (this.#n(), this.host.interestForElement) {
21
+ let e = new Event("loseinterest", { cancelable: !0 });
22
+ e.source = this.host, this.host.interestForElement.dispatchEvent(e);
23
+ }
24
+ };
25
+ #n() {
26
+ let t = this.host.getAttribute("interestfor");
27
+ t && !this.host.interestForElement && (this.host.interestForElement = e(this.host.getRootNode()).find((e) => e.id === t) ?? null);
28
+ let n = this.host.getAttribute("popovertarget");
29
+ if (n && !t) {
30
+ let t = e(this.host.getRootNode()).find((e) => e.id === n);
31
+ t && t.popover === "hint" && (this.host.interestForElement = t);
32
+ }
33
+ }
34
+ };
35
+ //#endregion
36
+ export { t as TypeInterestInvokerController };
37
+
38
+ //# sourceMappingURL=type-interest-invoker.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-interest-invoker.controller.js","names":["#onInterest","#onLoseInterest","#updateInterestForElement"],"sources":["../../../src/internal/controllers/type-interest-invoker.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getFlattenedDOMTree } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype InterestInvokerHost = ReactiveElement & {\n interestForElement: HTMLElement | null;\n};\n\nexport class TypeInterestInvokerController<T extends InterestInvokerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('mouseenter', this.#onInterest);\n this.host.addEventListener('mouseleave', this.#onLoseInterest);\n this.host.addEventListener('focus', this.#onInterest);\n this.host.addEventListener('blur', this.#onLoseInterest);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('mouseenter', this.#onInterest);\n this.host.removeEventListener('mouseleave', this.#onLoseInterest);\n this.host.removeEventListener('focus', this.#onInterest);\n this.host.removeEventListener('blur', this.#onLoseInterest);\n }\n\n #onInterest = () => {\n this.#updateInterestForElement();\n if (this.host.interestForElement) {\n const event = new Event('interest', { cancelable: true }) as InterestEvent;\n event.source = this.host;\n this.host.interestForElement.dispatchEvent(event);\n }\n };\n\n #onLoseInterest = () => {\n this.#updateInterestForElement();\n if (this.host.interestForElement) {\n const event = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n event.source = this.host;\n this.host.interestForElement.dispatchEvent(event);\n }\n };\n\n #updateInterestForElement() {\n const interestForIdRef = this.host.getAttribute('interestfor');\n if (interestForIdRef && !this.host.interestForElement) {\n this.host.interestForElement =\n getFlattenedDOMTree(this.host.getRootNode()).find(element => element.id === interestForIdRef) ?? null;\n }\n\n const popoverTargetIdRef = this.host.getAttribute('popovertarget');\n if (popoverTargetIdRef && !interestForIdRef) {\n const target = getFlattenedDOMTree(this.host.getRootNode()).find(element => element.id === popoverTargetIdRef);\n if (target && target.popover === 'hint') {\n this.host.interestForElement = target;\n }\n }\n }\n}\n"],"mappings":";;AAYA,IAAa,IAAb,MAAwG;CACtG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAId,AAHA,KAAK,KAAK,iBAAiB,cAAc,KAAKA,EAAW,GACzD,KAAK,KAAK,iBAAiB,cAAc,KAAKC,EAAe,GAC7D,KAAK,KAAK,iBAAiB,SAAS,KAAKD,EAAW,GACpD,KAAK,KAAK,iBAAiB,QAAQ,KAAKC,EAAe;CACzD;CAEA,mBAAmB;EAIjB,AAHA,KAAK,KAAK,oBAAoB,cAAc,KAAKD,EAAW,GAC5D,KAAK,KAAK,oBAAoB,cAAc,KAAKC,EAAe,GAChE,KAAK,KAAK,oBAAoB,SAAS,KAAKD,EAAW,GACvD,KAAK,KAAK,oBAAoB,QAAQ,KAAKC,EAAe;CAC5D;CAEA,WAAoB;EAElB,IADA,KAAKC,GAA0B,GAC3B,KAAK,KAAK,oBAAoB;GAChC,IAAM,IAAQ,IAAI,MAAM,YAAY,EAAE,YAAY,GAAK,CAAC;GAExD,AADA,EAAM,SAAS,KAAK,MACpB,KAAK,KAAK,mBAAmB,cAAc,CAAK;EAClD;CACF;CAEA,WAAwB;EAEtB,IADA,KAAKA,GAA0B,GAC3B,KAAK,KAAK,oBAAoB;GAChC,IAAM,IAAQ,IAAI,MAAM,gBAAgB,EAAE,YAAY,GAAK,CAAC;GAE5D,AADA,EAAM,SAAS,KAAK,MACpB,KAAK,KAAK,mBAAmB,cAAc,CAAK;EAClD;CACF;CAEA,KAA4B;EAC1B,IAAM,IAAmB,KAAK,KAAK,aAAa,aAAa;EAC7D,AAAI,KAAoB,CAAC,KAAK,KAAK,uBACjC,KAAK,KAAK,qBACR,EAAoB,KAAK,KAAK,YAAY,CAAC,EAAE,MAAK,MAAW,EAAQ,OAAO,CAAgB,KAAK;EAGrG,IAAM,IAAqB,KAAK,KAAK,aAAa,eAAe;EACjE,IAAI,KAAsB,CAAC,GAAkB;GAC3C,IAAM,IAAS,EAAoB,KAAK,KAAK,YAAY,CAAC,EAAE,MAAK,MAAW,EAAQ,OAAO,CAAkB;GAC7G,AAAI,KAAU,EAAO,YAAY,WAC/B,KAAK,KAAK,qBAAqB;EAEnC;CACF;AACF"}
@@ -0,0 +1,19 @@
1
+ import { ButtonType } from '../../mixins/button.types.js';
2
+ import { ReactiveController, ReactiveElement } from './types.js';
3
+ type NativeButtonBehaviorHost = ReactiveElement & {
4
+ disabled: boolean;
5
+ form: HTMLFormElement | null | string;
6
+ name?: string;
7
+ readOnly: boolean;
8
+ type?: ButtonType;
9
+ value?: string;
10
+ };
11
+ export declare class TypeNativeButtonController<T extends NativeButtonBehaviorHost> implements ReactiveController {
12
+ #private;
13
+ private host;
14
+ constructor(host: T);
15
+ get defaultType(): ButtonType | undefined;
16
+ hostUpdated(): void;
17
+ hostDisconnected(): void;
18
+ }
19
+ export {};
@@ -0,0 +1,54 @@
1
+ import { onKeys as e, stopEvent as t } from "../utils.js";
2
+ //#region src/internal/controllers/type-native-button.controller.ts
3
+ var n = class {
4
+ #e;
5
+ #t;
6
+ #n;
7
+ constructor(e) {
8
+ this.host = e, this.host.addController(this);
9
+ }
10
+ get defaultType() {
11
+ return this.#e;
12
+ }
13
+ hostUpdated() {
14
+ this.#r(), this.#i(), !this.host.readOnly && !this.host.disabled && (this.host.addEventListener("click", this.#o), this.host.addEventListener("keyup", this.#a));
15
+ }
16
+ hostDisconnected() {
17
+ this.#i(), this.#u();
18
+ }
19
+ #r() {
20
+ !this.host.type && !this.host.hasAttribute("type") && this.host.form instanceof HTMLFormElement && (this.#e = "submit");
21
+ }
22
+ #i() {
23
+ this.host.removeEventListener("click", this.#o), this.host.removeEventListener("keyup", this.#a);
24
+ }
25
+ #a = (t) => {
26
+ e(["Enter", "Space"], t, () => this.host.click());
27
+ };
28
+ #o = (e) => {
29
+ if (this.host.disabled) {
30
+ t(e);
31
+ return;
32
+ }
33
+ this.host.type === "submit" && this.host.form instanceof HTMLFormElement ? this.#s(this.host.form) : this.host.type === "reset" && this.host.form instanceof HTMLFormElement && this.host.form.reset();
34
+ };
35
+ #s(e) {
36
+ this.#u(), this.#l(), this.#n = e, e.addEventListener("submit", this.#c, { once: !0 }), this.#t?.remove(), e.appendChild(this.#t), e.requestSubmit(this.#t);
37
+ }
38
+ #c = () => {
39
+ let e = this.#t;
40
+ this.#n = void 0, setTimeout(() => {
41
+ e?.remove(), this.#t === e && (this.#t = void 0);
42
+ }, 0);
43
+ };
44
+ #l() {
45
+ this.#t || (this.#t = globalThis.document.createElement("button"), this.#t.type = "submit", this.#t.style.display = "none"), this.#t.name = this.host.name ?? "", this.#t.value = this.host.value ?? "";
46
+ }
47
+ #u() {
48
+ this.#n?.removeEventListener("submit", this.#c), this.#n = void 0, this.#t?.remove(), this.#t = void 0;
49
+ }
50
+ };
51
+ //#endregion
52
+ export { n as TypeNativeButtonController };
53
+
54
+ //# sourceMappingURL=type-native-button.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-native-button.controller.js","names":["#defaultType","#setButtonType","#removeNativeButtonBehavior","#onNativeButtonClick","#onNativeButtonKeyup","#removeSubmitter","#requestSubmit","#createSubmitter","#submitterForm","#onSubmit","#submitter"],"sources":["../../../src/internal/controllers/type-native-button.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { onKeys, stopEvent } from '../utils.js';\nimport type { ButtonType } from '../../mixins/button.types.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype NativeButtonBehaviorHost = ReactiveElement & {\n disabled: boolean;\n form: HTMLFormElement | null | string;\n name?: string;\n readOnly: boolean;\n type?: ButtonType;\n value?: string;\n};\n\nexport class TypeNativeButtonController<T extends NativeButtonBehaviorHost> implements ReactiveController {\n #defaultType: ButtonType | undefined;\n #submitter: HTMLButtonElement | undefined;\n #submitterForm: HTMLFormElement | undefined;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n get defaultType() {\n return this.#defaultType;\n }\n\n hostUpdated() {\n this.#setButtonType();\n this.#removeNativeButtonBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.host.addEventListener('click', this.#onNativeButtonClick);\n this.host.addEventListener('keyup', this.#onNativeButtonKeyup);\n }\n }\n\n hostDisconnected() {\n this.#removeNativeButtonBehavior();\n this.#removeSubmitter();\n }\n\n #setButtonType() {\n if (!this.host.type && !this.host.hasAttribute('type') && this.host.form instanceof HTMLFormElement) {\n this.#defaultType = 'submit';\n }\n }\n\n #removeNativeButtonBehavior() {\n this.host.removeEventListener('click', this.#onNativeButtonClick);\n this.host.removeEventListener('keyup', this.#onNativeButtonKeyup);\n }\n\n #onNativeButtonKeyup = (event: KeyboardEvent) => {\n onKeys(['Enter', 'Space'], event, () => this.host.click());\n };\n\n #onNativeButtonClick = (event: Event) => {\n if (this.host.disabled) {\n stopEvent(event);\n return;\n }\n\n if (this.host.type === 'submit' && this.host.form instanceof HTMLFormElement) {\n this.#requestSubmit(this.host.form);\n } else if (this.host.type === 'reset' && this.host.form instanceof HTMLFormElement) {\n this.host.form.reset();\n }\n };\n\n #requestSubmit(form: HTMLFormElement) {\n this.#removeSubmitter();\n this.#createSubmitter();\n this.#submitterForm = form;\n form.addEventListener('submit', this.#onSubmit, { once: true });\n this.#submitter?.remove();\n form.appendChild(this.#submitter!);\n form.requestSubmit(this.#submitter);\n }\n\n #onSubmit = () => {\n const submitter = this.#submitter;\n this.#submitterForm = undefined;\n setTimeout(() => {\n submitter?.remove();\n if (this.#submitter === submitter) {\n this.#submitter = undefined;\n }\n }, 0);\n };\n\n #createSubmitter() {\n if (!this.#submitter) {\n this.#submitter = globalThis.document.createElement('button');\n this.#submitter.type = 'submit';\n this.#submitter.style.display = 'none';\n }\n\n this.#submitter.name = this.host.name ?? '';\n this.#submitter.value = this.host.value ?? '';\n }\n\n #removeSubmitter() {\n this.#submitterForm?.removeEventListener('submit', this.#onSubmit);\n this.#submitterForm = undefined;\n this.#submitter?.remove();\n this.#submitter = undefined;\n }\n}\n"],"mappings":";;AAgBA,IAAa,IAAb,MAA0G;CACxG;CACA;CACA;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,IAAI,cAAc;EAChB,OAAO,KAAKA;CACd;CAEA,cAAc;EAGZ,AAFA,KAAKC,GAAe,GACpB,KAAKC,GAA4B,GAC7B,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,aACpC,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAoB,GAC7D,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAoB;CAEjE;CAEA,mBAAmB;EAEjB,AADA,KAAKF,GAA4B,GACjC,KAAKG,GAAiB;CACxB;CAEA,KAAiB;EACf,AAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,KAAK,aAAa,MAAM,KAAK,KAAK,KAAK,gBAAgB,oBAClF,KAAKL,KAAe;CAExB;CAEA,KAA8B;EAE5B,AADA,KAAK,KAAK,oBAAoB,SAAS,KAAKG,EAAoB,GAChE,KAAK,KAAK,oBAAoB,SAAS,KAAKC,EAAoB;CAClE;CAEA,MAAwB,MAAyB;EAC/C,EAAO,CAAC,SAAS,OAAO,GAAG,SAAa,KAAK,KAAK,MAAM,CAAC;CAC3D;CAEA,MAAwB,MAAiB;EACvC,IAAI,KAAK,KAAK,UAAU;GACtB,EAAU,CAAK;GACf;EACF;EAEA,AAAI,KAAK,KAAK,SAAS,YAAY,KAAK,KAAK,gBAAgB,kBAC3D,KAAKE,GAAe,KAAK,KAAK,IAAI,IACzB,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,gBAAgB,mBACjE,KAAK,KAAK,KAAK,MAAM;CAEzB;CAEA,GAAe,GAAuB;EAOpC,AANA,KAAKD,GAAiB,GACtB,KAAKE,GAAiB,GACtB,KAAKC,KAAiB,GACtB,EAAK,iBAAiB,UAAU,KAAKC,IAAW,EAAE,MAAM,GAAK,CAAC,GAC9D,KAAKC,IAAY,OAAO,GACxB,EAAK,YAAY,KAAKA,EAAW,GACjC,EAAK,cAAc,KAAKA,EAAU;CACpC;CAEA,WAAkB;EAChB,IAAM,IAAY,KAAKA;EAEvB,AADA,KAAKF,KAAiB,KAAA,GACtB,iBAAiB;GAEf,AADA,GAAW,OAAO,GACd,KAAKE,OAAe,MACtB,KAAKA,KAAa,KAAA;EAEtB,GAAG,CAAC;CACN;CAEA,KAAmB;EAQjB,AAPK,KAAKA,OACR,KAAKA,KAAa,WAAW,SAAS,cAAc,QAAQ,GAC5D,KAAKA,GAAW,OAAO,UACvB,KAAKA,GAAW,MAAM,UAAU,SAGlC,KAAKA,GAAW,OAAO,KAAK,KAAK,QAAQ,IACzC,KAAKA,GAAW,QAAQ,KAAK,KAAK,SAAS;CAC7C;CAEA,KAAmB;EAIjB,AAHA,KAAKF,IAAgB,oBAAoB,UAAU,KAAKC,EAAS,GACjE,KAAKD,KAAiB,KAAA,GACtB,KAAKE,IAAY,OAAO,GACxB,KAAKA,KAAa,KAAA;CACpB;AACF"}
@@ -0,0 +1,16 @@
1
+ import { PopoverTargetAction } from '../../mixins/button.types.js';
2
+ import { ReactiveController, ReactiveElement } from './types.js';
3
+ type PopoverTriggerHost = ReactiveElement & {
4
+ disabled: boolean;
5
+ popoverTargetAction?: PopoverTargetAction;
6
+ popoverTargetElement: HTMLElement | null;
7
+ popovertarget?: string;
8
+ };
9
+ export declare class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {
10
+ #private;
11
+ private host;
12
+ constructor(host: T);
13
+ hostConnected(): void;
14
+ hostDisconnected(): void;
15
+ }
16
+ export {};
@@ -0,0 +1,21 @@
1
+ import { getFlattenedDOMTree as e, getHostAnchor as t } from "../utils.js";
2
+ //#region src/internal/controllers/type-popover-trigger.controller.ts
3
+ var n = class {
4
+ constructor(e) {
5
+ this.host = e, this.host.addController(this);
6
+ }
7
+ hostConnected() {
8
+ this.host.addEventListener("click", this.#e);
9
+ }
10
+ hostDisconnected() {
11
+ this.host.removeEventListener("click", this.#e);
12
+ }
13
+ #e = () => {
14
+ let n = this.host, r = this.host.popoverTargetElement;
15
+ !r && this.host.popovertarget && (r = e(this.host.getRootNode()).find((e) => e.id === this.host.popovertarget) ?? null, this.host.popoverTargetElement = r), r?.anchor && (n = t(r)), !(!r || this.host.disabled) && (this.host.popoverTargetAction === "hide" ? r.hidePopover() : this.host.popoverTargetAction === "show" ? r.showPopover({ source: n }) : r.togglePopover({ source: n }));
16
+ };
17
+ };
18
+ //#endregion
19
+ export { n as TypePopoverTriggerController };
20
+
21
+ //# sourceMappingURL=type-popover-trigger.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-popover-trigger.controller.js","names":["#onClick"],"sources":["../../../src/internal/controllers/type-popover-trigger.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PopoverTargetAction } from '../../mixins/button.types.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\n popovertarget?: string;\n};\n\nexport class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('click', this.#onClick);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('click', this.#onClick);\n }\n\n #onClick = () => {\n let source = this.host as HTMLElement;\n let popoverTargetElement = this.host.popoverTargetElement;\n\n if (!popoverTargetElement && this.host.popovertarget) {\n popoverTargetElement =\n getFlattenedDOMTree(this.host.getRootNode()).find(element => element.id === this.host.popovertarget) ?? null;\n this.host.popoverTargetElement = popoverTargetElement;\n }\n\n if ((popoverTargetElement as PopoverAnchorElement)?.anchor) {\n source = getHostAnchor(popoverTargetElement as PopoverAnchorElement);\n }\n\n if (!popoverTargetElement || this.host.disabled) {\n return;\n }\n\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n } else if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n };\n}\n"],"mappings":";;AAeA,IAAa,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,SAAS,KAAKA,EAAQ;CACnD;CAEA,mBAAmB;EACjB,KAAK,KAAK,oBAAoB,SAAS,KAAKA,EAAQ;CACtD;CAEA,WAAiB;EACf,IAAI,IAAS,KAAK,MACd,IAAuB,KAAK,KAAK;EAErC,AAAI,CAAC,KAAwB,KAAK,KAAK,kBACrC,IACE,EAAoB,KAAK,KAAK,YAAY,CAAC,EAAE,MAAK,MAAW,EAAQ,OAAO,KAAK,KAAK,aAAa,KAAK,MAC1G,KAAK,KAAK,uBAAuB,IAG9B,GAA+C,WAClD,IAAS,EAAc,CAA4C,IAGjE,GAAC,KAAwB,KAAK,KAAK,cAInC,KAAK,KAAK,wBAAwB,SACpC,EAAqB,YAAY,IACxB,KAAK,KAAK,wBAAwB,SAC3C,EAAqB,YAAY,EAAE,UAAO,CAAC,IAE3C,EAAqB,cAAc,EAAE,UAAO,CAAC;CAEjD;AACF"}
@@ -0,0 +1,8 @@
1
+ export interface ReactiveController {
2
+ hostConnected?(): void;
3
+ hostDisconnected?(): void;
4
+ hostUpdated?(): void;
5
+ }
6
+ export interface ReactiveElement extends HTMLElement {
7
+ addController(controller: ReactiveController): void;
8
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport class FormControlError extends Error {\n constructor(formControlName: string, message: string) {\n super(`(${formControlName}): ${message}`);\n this.name = 'FormControlError';\n }\n}\n"],"mappings":";AAGA,IAAa,IAAb,cAAsC,MAAM;CAC1C,YAAY,GAAyB,GAAiB;AAEpD,EADA,MAAM,IAAI,EAAgB,KAAK,IAAU,EACzC,KAAK,OAAO"}
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport class FormControlError extends Error {\n constructor(formControlName: string, message: string) {\n super(`(${formControlName}): ${message}`);\n this.name = 'FormControlError';\n }\n}\n"],"mappings":";AAGA,IAAa,IAAb,cAAsC,MAAM;CAC1C,YAAY,GAAyB,GAAiB;EAEpD,AADA,MAAM,IAAI,EAAgB,KAAK,GAAS,GACxC,KAAK,OAAO;CACd;AACF"}
@@ -37,16 +37,19 @@ function s(e, t) {
37
37
  }
38
38
  return n;
39
39
  }
40
- function c(e, t, i, a) {
41
- let o = i[e];
42
- return o === void 0 ? a?.includes(e) ? r({ valueMissing: !0 }, `missing required property: ${e}`) : n : d(t, o);
40
+ function c(e, t, i) {
41
+ let { name: a, schema: o } = e, s = t[a];
42
+ return s === void 0 ? i?.includes(a) ? r({ valueMissing: !0 }, `missing required property: ${a}`) : n : d(o, s);
43
43
  }
44
44
  function l(e, t) {
45
45
  if (typeof t != "object" || !t || Array.isArray(t)) return r({ typeMismatch: !0 }, `expected type object, received type ${typeof t}`);
46
46
  let i = Object.keys(t), a = Object.keys(e.properties), o = i.filter((e) => !a.includes(e));
47
47
  if (o.length > 0 && !e.additionalProperties) return r({ badInput: !0 }, `additional properties not allowed: ${o.join(", ")}`);
48
48
  for (let [n, r] of Object.entries(e.properties)) {
49
- let i = c(n, r, t, e.required);
49
+ let i = c({
50
+ name: n,
51
+ schema: r
52
+ }, t, e.required);
50
53
  if (!i.validity.valid) return i;
51
54
  }
52
55
  return n;
@@ -68,29 +71,15 @@ function d(e, t) {
68
71
  }
69
72
  }
70
73
  function f(e, t) {
71
- let n = t.type, r;
72
- switch (n) {
73
- case "string":
74
- r = e;
75
- break;
76
- case "number":
77
- r = parseFloat(e);
78
- break;
79
- case "boolean":
80
- r = !!e || e === "true";
81
- break;
74
+ switch (t.type) {
75
+ case "string": return e;
76
+ case "number": return parseFloat(e);
77
+ case "boolean": return !!e || e === "true";
82
78
  case "array":
83
- r = JSON.parse(e);
84
- break;
85
- case "object":
86
- r = JSON.parse(e);
87
- break;
88
- case "enum":
89
- r = t.enum.includes(e) ? e : void 0;
90
- break;
79
+ case "object": return JSON.parse(e);
80
+ case "enum": return t.enum.includes(e) ? e : void 0;
91
81
  default: return;
92
82
  }
93
- return r;
94
83
  }
95
84
  //#endregion
96
85
  export { t as parseValueSchema, d as validateSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../src/internal/schema.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Schema } from './types.js';\nimport { FormControlError } from './errors.js';\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- caller specifies T for typed return\nexport function parseValueSchema<T>(formControlName: string, value: string, schema: Schema): T {\n const parsedValue = parseControlValue(value, schema);\n if (parsedValue === undefined) {\n throw new FormControlError(formControlName, `unsupported value type ${typeof value}`);\n }\n return parsedValue as T;\n}\n\ntype ValidationResult = { validity: Partial<ValidityState>; message: string };\n\nconst VALID: ValidationResult = { validity: { valid: true }, message: '' };\n\nfunction invalid(validity: Partial<ValidityState>, message: string): ValidationResult {\n return { validity: { ...validity, valid: false }, message };\n}\n\nfunction validateString(schema: Schema & { type: 'string' }, value: unknown): ValidationResult {\n if (typeof value !== 'string') {\n return invalid({ typeMismatch: true }, `expected string, got ${typeof value}`);\n }\n if (schema.minLength !== undefined && value.length < schema.minLength) {\n return invalid({ tooShort: true }, `string length ${value.length} is less than minimum length ${schema.minLength}`);\n }\n if (schema.maxLength !== undefined && value.length > schema.maxLength) {\n return invalid(\n { tooLong: true },\n `string length ${value.length} is greater than maximum length ${schema.maxLength}`\n );\n }\n if (schema.pattern && !new RegExp(schema.pattern).test(value)) {\n return invalid({ patternMismatch: true }, `string does not match pattern ${schema.pattern}`);\n }\n return VALID;\n}\n\nfunction validateNumber(schema: Schema & { type: 'number' }, value: unknown): ValidationResult {\n if (typeof value !== 'number') {\n return invalid({ typeMismatch: true }, `expected type number, received type ${typeof value}`);\n }\n if (isNaN(value as unknown as number)) {\n return invalid({ typeMismatch: true }, `expected type number, received type NaN`);\n }\n if (schema.minimum !== undefined && value < schema.minimum) {\n return invalid({ rangeUnderflow: true }, `number ${value} is less than minimum ${schema.minimum}`);\n }\n if (schema.maximum !== undefined && value > schema.maximum) {\n return invalid({ rangeOverflow: true }, `number ${value} is greater than maximum ${schema.maximum}`);\n }\n return VALID;\n}\n\nfunction validateBoolean(value: unknown): ValidationResult {\n if (typeof value !== 'boolean') {\n return invalid({ typeMismatch: true }, `expected boolean, got ${typeof value}`);\n }\n return VALID;\n}\n\nfunction validateArray(schema: Schema & { type: 'array' }, value: unknown): ValidationResult {\n if (!Array.isArray(value)) {\n return invalid({ typeMismatch: true }, `expected type array, received type ${typeof value}`);\n }\n if (schema.minItems !== undefined && value.length < schema.minItems) {\n return invalid(\n { rangeUnderflow: true },\n `array length ${value.length} is less than minimum length ${schema.minItems}`\n );\n }\n if (schema.maxItems !== undefined && value.length > schema.maxItems) {\n return invalid(\n { rangeOverflow: true },\n `array length ${value.length} is greater than maximum length ${schema.maxItems}`\n );\n }\n for (const item of value) {\n const result = validateSchema(schema.items, item);\n if (!result.validity.valid) {\n return result;\n }\n }\n return VALID;\n}\n\nfunction validateObjectProperty(\n prop: string,\n propSchema: Schema,\n value: Record<string, unknown>,\n required?: string[]\n): ValidationResult {\n const propValue = value[prop];\n if (propValue === undefined) {\n if (required?.includes(prop)) {\n return invalid({ valueMissing: true }, `missing required property: ${prop}`);\n }\n return VALID;\n }\n return validateSchema(propSchema, propValue);\n}\n\nfunction validateObject(schema: Schema & { type: 'object' }, value: unknown): ValidationResult {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return invalid({ typeMismatch: true }, `expected type object, received type ${typeof value}`);\n }\n\n const valueProperties = Object.keys(value as object);\n const schemaProperties = Object.keys(schema.properties);\n\n const additionalProps = valueProperties.filter(prop => !schemaProperties.includes(prop));\n if (additionalProps.length > 0 && !schema.additionalProperties) {\n return invalid({ badInput: true }, `additional properties not allowed: ${additionalProps.join(', ')}`);\n }\n\n for (const [prop, propSchema] of Object.entries(schema.properties)) {\n const result = validateObjectProperty(prop, propSchema, value as Record<string, unknown>, schema.required);\n if (!result.validity.valid) {\n return result;\n }\n }\n return VALID;\n}\n\nfunction validateEnum(schema: Schema & { type: 'enum' }, value: unknown): ValidationResult {\n if (!schema.enum.includes(value as string | number)) {\n return invalid({ typeMismatch: true }, `value must be one of: ${schema.enum.join(', ')}`);\n }\n return VALID;\n}\n\nexport function validateSchema(schema: Schema, value: unknown): ValidationResult {\n if (!schema || typeof schema !== 'object') {\n return invalid({ badInput: true }, 'invalid schema, schema must be a non-null object');\n }\n\n if (!('type' in schema)) {\n return invalid({ badInput: true }, 'schema must have \"type\" property');\n }\n\n switch (schema.type) {\n case 'string':\n return validateString(schema, value);\n case 'number':\n return validateNumber(schema, value);\n case 'boolean':\n return validateBoolean(value);\n case 'array':\n return validateArray(schema, value);\n case 'object':\n return validateObject(schema, value);\n case 'enum':\n return validateEnum(schema, value);\n default:\n return invalid({ badInput: true }, `unsupported type: ${(schema as { type: string }).type}`);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- caller specifies T for typed return\nexport function parseControlValue<T>(value: string, schema: Schema): T | undefined {\n const schemaType = schema.type;\n let parsedValue: unknown;\n\n switch (schemaType) {\n case 'string': {\n parsedValue = value;\n break;\n }\n case 'number': {\n parsedValue = parseFloat(value);\n break;\n }\n case 'boolean': {\n parsedValue = !!value || value === 'true';\n break;\n }\n case 'array': {\n parsedValue = JSON.parse(value);\n break;\n }\n case 'object': {\n parsedValue = JSON.parse(value);\n break;\n }\n case 'enum': {\n parsedValue = schema.enum.includes(value) ? value : undefined;\n break;\n }\n default: {\n const _exhaustiveCheck: never = schemaType;\n return undefined;\n }\n }\n return parsedValue as T;\n}\n"],"mappings":";;AAOA,SAAgB,EAAoB,GAAyB,GAAe,GAAmB;CAC7F,IAAM,IAAc,EAAkB,GAAO,EAAO;AACpD,KAAI,MAAgB,KAAA,EAClB,OAAM,IAAI,EAAiB,GAAiB,0BAA0B,OAAO,IAAQ;AAEvF,QAAO;;AAKT,IAAM,IAA0B;CAAE,UAAU,EAAE,OAAO,IAAM;CAAE,SAAS;CAAI;AAE1E,SAAS,EAAQ,GAAkC,GAAmC;AACpF,QAAO;EAAE,UAAU;GAAE,GAAG;GAAU,OAAO;GAAO;EAAE;EAAS;;AAG7D,SAAS,EAAe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AAQ,EAAE,cAAc,IAAM,EAAE,yBAAyB,EAAO,KAAK,KAAK,KAAK,GAAG;;AAK7F,SAAgB,EAAe,GAAgB,GAAkC;AAC/E,KAAI,CAAC,KAAU,OAAO,KAAW,SAC/B,QAAO,EAAQ,EAAE,UAAU,IAAM,EAAE,mDAAmD;AAGxF,KAAI,EAAE,UAAU,GACd,QAAO,EAAQ,EAAE,UAAU,IAAM,EAAE,qCAAmC;AAGxE,SAAQ,EAAO,MAAf;EACE,KAAK,SACH,QAAO,EAAe,GAAQ,EAAM;EACtC,KAAK,SACH,QAAO,EAAe,GAAQ,EAAM;EACtC,KAAK,UACH,QAAO,EAAgB,EAAM;EAC/B,KAAK,QACH,QAAO,EAAc,GAAQ,EAAM;EACrC,KAAK,SACH,QAAO,EAAe,GAAQ,EAAM;EACtC,KAAK,OACH,QAAO,EAAa,GAAQ,EAAM;EACpC,QACE,QAAO,EAAQ,EAAE,UAAU,IAAM,EAAE,qBAAsB,EAA4B,OAAO;;;AAKlG,SAAgB,EAAqB,GAAe,GAA+B;CACjF,IAAM,IAAa,EAAO,MACtB;AAEJ,SAAQ,GAAR;EACE,KAAK;AACH,OAAc;AACd;EAEF,KAAK;AACH,OAAc,WAAW,EAAM;AAC/B;EAEF,KAAK;AACH,OAAc,CAAC,CAAC,KAAS,MAAU;AACnC;EAEF,KAAK;AACH,OAAc,KAAK,MAAM,EAAM;AAC/B;EAEF,KAAK;AACH,OAAc,KAAK,MAAM,EAAM;AAC/B;EAEF,KAAK;AACH,OAAc,EAAO,KAAK,SAAS,EAAM,GAAG,IAAQ,KAAA;AACpD;EAEF,QAEE;;AAGJ,QAAO"}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../../src/internal/schema.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Schema } from './types.js';\nimport { FormControlError } from './errors.js';\n\nexport function parseValueSchema<T>(formControlName: string, value: string, schema: Schema): T {\n const parsedValue = parseControlValue(value, schema);\n if (parsedValue === undefined) {\n throw new FormControlError(formControlName, `unsupported value type ${typeof value}`);\n }\n return parsedValue as T;\n}\n\ntype ValidationResult = { validity: Partial<ValidityState>; message: string };\n\nconst VALID: ValidationResult = { validity: { valid: true }, message: '' };\n\nfunction invalid(validity: Partial<ValidityState>, message: string): ValidationResult {\n return { validity: { ...validity, valid: false }, message };\n}\n\nfunction validateString(schema: Schema & { type: 'string' }, value: unknown): ValidationResult {\n if (typeof value !== 'string') {\n return invalid({ typeMismatch: true }, `expected string, got ${typeof value}`);\n }\n if (schema.minLength !== undefined && value.length < schema.minLength) {\n return invalid({ tooShort: true }, `string length ${value.length} is less than minimum length ${schema.minLength}`);\n }\n if (schema.maxLength !== undefined && value.length > schema.maxLength) {\n return invalid(\n { tooLong: true },\n `string length ${value.length} is greater than maximum length ${schema.maxLength}`\n );\n }\n if (schema.pattern && !new RegExp(schema.pattern).test(value)) {\n return invalid({ patternMismatch: true }, `string does not match pattern ${schema.pattern}`);\n }\n return VALID;\n}\n\nfunction validateNumber(schema: Schema & { type: 'number' }, value: unknown): ValidationResult {\n if (typeof value !== 'number') {\n return invalid({ typeMismatch: true }, `expected type number, received type ${typeof value}`);\n }\n if (isNaN(value as unknown as number)) {\n return invalid({ typeMismatch: true }, `expected type number, received type NaN`);\n }\n if (schema.minimum !== undefined && value < schema.minimum) {\n return invalid({ rangeUnderflow: true }, `number ${value} is less than minimum ${schema.minimum}`);\n }\n if (schema.maximum !== undefined && value > schema.maximum) {\n return invalid({ rangeOverflow: true }, `number ${value} is greater than maximum ${schema.maximum}`);\n }\n return VALID;\n}\n\nfunction validateBoolean(value: unknown): ValidationResult {\n if (typeof value !== 'boolean') {\n return invalid({ typeMismatch: true }, `expected boolean, got ${typeof value}`);\n }\n return VALID;\n}\n\nfunction validateArray(schema: Schema & { type: 'array' }, value: unknown): ValidationResult {\n if (!Array.isArray(value)) {\n return invalid({ typeMismatch: true }, `expected type array, received type ${typeof value}`);\n }\n if (schema.minItems !== undefined && value.length < schema.minItems) {\n return invalid(\n { rangeUnderflow: true },\n `array length ${value.length} is less than minimum length ${schema.minItems}`\n );\n }\n if (schema.maxItems !== undefined && value.length > schema.maxItems) {\n return invalid(\n { rangeOverflow: true },\n `array length ${value.length} is greater than maximum length ${schema.maxItems}`\n );\n }\n for (const item of value) {\n const result = validateSchema(schema.items, item);\n if (!result.validity.valid) {\n return result;\n }\n }\n return VALID;\n}\n\nfunction validateObjectProperty(\n property: { name: string; schema: Schema },\n value: Record<string, unknown>,\n required?: string[]\n): ValidationResult {\n const { name, schema: propSchema } = property;\n const propValue = value[name];\n if (propValue === undefined) {\n if (required?.includes(name)) {\n return invalid({ valueMissing: true }, `missing required property: ${name}`);\n }\n return VALID;\n }\n return validateSchema(propSchema, propValue);\n}\n\nfunction validateObject(schema: Schema & { type: 'object' }, value: unknown): ValidationResult {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return invalid({ typeMismatch: true }, `expected type object, received type ${typeof value}`);\n }\n\n const valueProperties = Object.keys(value as object);\n const schemaProperties = Object.keys(schema.properties);\n\n const additionalProps = valueProperties.filter(prop => !schemaProperties.includes(prop));\n if (additionalProps.length > 0 && !schema.additionalProperties) {\n return invalid({ badInput: true }, `additional properties not allowed: ${additionalProps.join(', ')}`);\n }\n\n for (const [prop, propSchema] of Object.entries(schema.properties)) {\n const result = validateObjectProperty(\n { name: prop, schema: propSchema },\n value as Record<string, unknown>,\n schema.required\n );\n if (!result.validity.valid) {\n return result;\n }\n }\n return VALID;\n}\n\nfunction validateEnum(schema: Schema & { type: 'enum' }, value: unknown): ValidationResult {\n if (!schema.enum.includes(value as string | number)) {\n return invalid({ typeMismatch: true }, `value must be one of: ${schema.enum.join(', ')}`);\n }\n return VALID;\n}\n\nexport function validateSchema(schema: Schema, value: unknown): ValidationResult {\n if (!schema || typeof schema !== 'object') {\n return invalid({ badInput: true }, 'invalid schema, schema must be a non-null object');\n }\n\n if (!('type' in schema)) {\n return invalid({ badInput: true }, 'schema must have \"type\" property');\n }\n\n switch (schema.type) {\n case 'string':\n return validateString(schema, value);\n case 'number':\n return validateNumber(schema, value);\n case 'boolean':\n return validateBoolean(value);\n case 'array':\n return validateArray(schema, value);\n case 'object':\n return validateObject(schema, value);\n case 'enum':\n return validateEnum(schema, value);\n default:\n return invalid({ badInput: true }, `unsupported type: ${(schema as { type: string }).type}`);\n }\n}\n\nexport function parseControlValue<T>(value: string, schema: Schema): T | undefined {\n const schemaType = schema.type;\n\n switch (schemaType) {\n case 'string':\n return value as T;\n case 'number':\n return parseFloat(value) as T;\n case 'boolean':\n return (!!value || value === 'true') as T;\n case 'array':\n case 'object':\n return JSON.parse(value) as T;\n case 'enum':\n return (schema.enum.includes(value) ? value : undefined) as T;\n default: {\n const _exhaustiveCheck: never = schemaType;\n return undefined;\n }\n }\n}\n"],"mappings":";;AAMA,SAAgB,EAAoB,GAAyB,GAAe,GAAmB;CAC7F,IAAM,IAAc,EAAkB,GAAO,CAAM;CACnD,IAAI,MAAgB,KAAA,GAClB,MAAM,IAAI,EAAiB,GAAiB,0BAA0B,OAAO,GAAO;CAEtF,OAAO;AACT;AAIA,IAAM,IAA0B;CAAE,UAAU,EAAE,OAAO,GAAK;CAAG,SAAS;AAAG;AAEzE,SAAS,EAAQ,GAAkC,GAAmC;CACpF,OAAO;EAAE,UAAU;GAAE,GAAG;GAAU,OAAO;EAAM;EAAG;CAAQ;AAC5D;AAEA,SAAS,EAAe,GAAqC,GAAkC;CAgB7F,OAfI,OAAO,KAAU,WAGjB,EAAO,cAAc,KAAA,KAAa,EAAM,SAAS,EAAO,YACnD,EAAQ,EAAE,UAAU,GAAK,GAAG,iBAAiB,EAAM,OAAO,+BAA+B,EAAO,WAAW,IAEhH,EAAO,cAAc,KAAA,KAAa,EAAM,SAAS,EAAO,YACnD,EACL,EAAE,SAAS,GAAK,GAChB,iBAAiB,EAAM,OAAO,kCAAkC,EAAO,WAC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,IACd,OAAO,EAAQ,EAAE,UAAU,GAAK,GAAG,oCAAkC;CAGvE,QAAQ,EAAO,MAAf;EACE,KAAK,UACH,OAAO,EAAe,GAAQ,CAAK;EACrC,KAAK,UACH,OAAO,EAAe,GAAQ,CAAK;EACrC,KAAK,WACH,OAAO,EAAgB,CAAK;EAC9B,KAAK,SACH,OAAO,EAAc,GAAQ,CAAK;EACpC,KAAK,UACH,OAAO,EAAe,GAAQ,CAAK;EACrC,KAAK,QACH,OAAO,EAAa,GAAQ,CAAK;EACnC,SACE,OAAO,EAAQ,EAAE,UAAU,GAAK,GAAG,qBAAsB,EAA4B,MAAM;CAC/F;AACF;AAEA,SAAgB,EAAqB,GAAe,GAA+B;CAGjF,QAFmB,EAAO,MAE1B;EACE,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO,WAAW,CAAK;EACzB,KAAK,WACH,OAAQ,CAAC,CAAC,KAAS,MAAU;EAC/B,KAAK;EACL,KAAK,UACH,OAAO,KAAK,MAAM,CAAK;EACzB,KAAK,QACH,OAAQ,EAAO,KAAK,SAAS,CAAK,IAAI,IAAQ,KAAA;EAChD,SAEE;CAEJ;AACF"}
@@ -1,4 +1,4 @@
1
- export type FormControlValue = string | number | File | File[] | null | object;
1
+ export type FormControlValue = string | number | boolean | File | File[] | FormData | null | object;
2
2
  interface SchemaBase {
3
3
  type: string;
4
4
  description?: string;
@@ -44,17 +44,31 @@ export interface FormControlMetadata {
44
44
  strict?: boolean;
45
45
  }
46
46
  interface FormControlInstance extends HTMLElement {
47
- value: any;
47
+ value: FormControlValue | undefined;
48
+ defaultValue: string;
48
49
  form: HTMLFormElement | null;
49
- readonly: boolean;
50
+ readOnly: boolean;
51
+ disabled: boolean;
50
52
  name: string;
51
53
  noValidate: boolean;
52
54
  willValidate: boolean;
53
55
  validity: ValidityState;
54
56
  validationMessage: string;
55
- required?: boolean;
57
+ required: boolean;
58
+ pattern: string;
59
+ min: number | null;
60
+ max: number | null;
61
+ step: number | null;
62
+ minLength: number;
63
+ maxLength: number;
64
+ labels: NodeList;
65
+ composedLabel: string;
66
+ valueAsString: string;
67
+ valueAsNumber: number;
56
68
  checkValidity(): boolean;
57
69
  reportValidity(): boolean;
70
+ reset(): void;
71
+ setCustomValidity(message: string): void;
58
72
  }
59
73
  /**
60
74
  * @event input - Dispatched when the input value changes
@@ -1 +1,18 @@
1
1
  export declare function isObjectLiteral(item: unknown): boolean;
2
+ export declare function attachInternals(element: HTMLElement & {
3
+ _internals?: ElementInternals;
4
+ }): ElementInternals;
5
+ export declare function toggleState(internals: ElementInternals, state: string, force: boolean): void;
6
+ export type PopoverAnchorElement = HTMLElement & {
7
+ anchor?: HTMLElement | string;
8
+ _activeTrigger?: HTMLElement;
9
+ };
10
+ export declare function getFlattenedDOMTree(node: Node, depth?: number): HTMLElement[];
11
+ export declare function getHostAnchor(host: PopoverAnchorElement): HTMLElement;
12
+ export declare function getStringValue(value: unknown): string | null;
13
+ export declare function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null): boolean;
14
+ export declare function isFormElement(value: unknown): value is HTMLFormElement;
15
+ export declare function onKeys(events: string[], event: KeyboardEvent, callback: () => void): void;
16
+ export declare function removeEmptyTextNode(node: Node): void;
17
+ export declare function setAttributeValue(element: HTMLElement, attribute: string, value: string | null): void;
18
+ export declare function stopEvent(event: Event): void;
@@ -4,7 +4,59 @@ function e(e) {
4
4
  let t = Object.getPrototypeOf(e);
5
5
  return t === null || t === Object.prototype;
6
6
  }
7
+ function t(e) {
8
+ return e._internals === void 0 && (e._internals = e.attachInternals()), e._internals;
9
+ }
10
+ function n(e, t, n) {
11
+ n ? e.states.add(t) : e.states.delete(t);
12
+ }
13
+ function r(e, t = 10) {
14
+ return Array.from(f(e)).reduce((e, n) => [...e, [n, [...Array.from(f(n)).map((e) => [e, r(e, t)])]]], []).flat(t);
15
+ }
16
+ function i(e) {
17
+ let t = e.anchor ?? e._activeTrigger;
18
+ return typeof t == "string" && t.length ? e.parentNode ? r(e.parentNode).find((e) => e.id === t) ?? globalThis.document.body : globalThis.document.body : t instanceof HTMLElement && t !== globalThis.document.body ? t : globalThis.document.body;
19
+ }
20
+ function a(e) {
21
+ return typeof e == "string" && e.length ? e : e === "" ? "" : null;
22
+ }
23
+ function o(e, t, n) {
24
+ return n === null ? !e.hasAttribute(t) : e.getAttribute(t) === n;
25
+ }
26
+ function s(e) {
27
+ return typeof HTMLFormElement < "u" && e instanceof HTMLFormElement;
28
+ }
29
+ function c(e, t, n) {
30
+ e.includes(t.code) && n();
31
+ }
32
+ function l(e) {
33
+ e?.wholeText?.trim() === "" && e.parentNode?.removeChild(e);
34
+ }
35
+ function u(e, t, n) {
36
+ n === null ? e.removeAttribute(t) : e.setAttribute(t, n);
37
+ }
38
+ function d(e) {
39
+ e.preventDefault(), e.stopPropagation();
40
+ }
41
+ function f(e) {
42
+ if (p(e)) return Array.from(e.documentElement.children);
43
+ if (m(e)) return Array.from(e.shadowRoot.children);
44
+ if (h(e)) {
45
+ let t = e.assignedElements();
46
+ return t.length ? t : Array.from(e.children);
47
+ }
48
+ return Array.from(e.children ?? []);
49
+ }
50
+ function p(e) {
51
+ return typeof Document < "u" && e instanceof Document && !!e.documentElement;
52
+ }
53
+ function m(e) {
54
+ return typeof HTMLElement < "u" && e instanceof HTMLElement && !!e.shadowRoot;
55
+ }
56
+ function h(e) {
57
+ return typeof HTMLSlotElement < "u" && e instanceof HTMLSlotElement && !!e.assignedElements;
58
+ }
7
59
  //#endregion
8
- export { e as isObjectLiteral };
60
+ export { t as attachInternals, r as getFlattenedDOMTree, i as getHostAnchor, a as getStringValue, o as hasAttributeValue, s as isFormElement, e as isObjectLiteral, c as onKeys, l as removeEmptyTextNode, u as setAttributeValue, d as stopEvent, n as toggleState };
9
61
 
10
62
  //# sourceMappingURL=utils.js.map