@nvidia-elements/forms 2.0.11 → 2.0.13

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 (64) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/custom-elements.json +8 -39
  3. package/dist/examples/csv.examples.js +1 -2
  4. package/dist/examples/csv.examples.js.map +1 -1
  5. package/dist/examples/light.examples.js +1 -2
  6. package/dist/examples/light.examples.js.map +1 -1
  7. package/dist/examples/simple.examples.js +1 -2
  8. package/dist/examples/simple.examples.js.map +1 -1
  9. package/dist/examples/visualization.examples.js +1 -2
  10. package/dist/examples/visualization.examples.js.map +1 -1
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +2 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/internal/controllers/state-active.controller.js +1 -2
  15. package/dist/internal/controllers/state-active.controller.js.map +1 -1
  16. package/dist/internal/controllers/state-current.controller.js +3 -16
  17. package/dist/internal/controllers/state-current.controller.js.map +1 -1
  18. package/dist/internal/controllers/state-disabled.controller.js +1 -2
  19. package/dist/internal/controllers/state-disabled.controller.js.map +1 -1
  20. package/dist/internal/controllers/state-expanded.controller.js +1 -2
  21. package/dist/internal/controllers/state-expanded.controller.js.map +1 -1
  22. package/dist/internal/controllers/state-pressed.controller.js +1 -2
  23. package/dist/internal/controllers/state-pressed.controller.js.map +1 -1
  24. package/dist/internal/controllers/state-readonly.controller.js +1 -2
  25. package/dist/internal/controllers/state-readonly.controller.js.map +1 -1
  26. package/dist/internal/controllers/state-selected.controller.js +3 -16
  27. package/dist/internal/controllers/state-selected.controller.js.map +1 -1
  28. package/dist/internal/controllers/type-anchor.controller.js +1 -2
  29. package/dist/internal/controllers/type-anchor.controller.js.map +1 -1
  30. package/dist/internal/controllers/type-button.controller.js +2 -7
  31. package/dist/internal/controllers/type-button.controller.js.map +1 -1
  32. package/dist/internal/controllers/type-command.controller.js +1 -2
  33. package/dist/internal/controllers/type-command.controller.js.map +1 -1
  34. package/dist/internal/controllers/type-interest-invoker.controller.js +2 -3
  35. package/dist/internal/controllers/type-interest-invoker.controller.js.map +1 -1
  36. package/dist/internal/controllers/type-popover-trigger.controller.js +1 -2
  37. package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -1
  38. package/dist/internal/controllers/type-submit.controller.js +2 -7
  39. package/dist/internal/controllers/type-submit.controller.js.map +1 -1
  40. package/dist/internal/errors.js +1 -2
  41. package/dist/internal/errors.js.map +1 -1
  42. package/dist/internal/index.js +1 -2
  43. package/dist/internal/schema.js +1 -2
  44. package/dist/internal/schema.js.map +1 -1
  45. package/dist/internal/types.d.ts +0 -3
  46. package/dist/internal/utils.d.ts +0 -2
  47. package/dist/internal/utils.js +2 -3
  48. package/dist/internal/utils.js.map +1 -1
  49. package/dist/mixins/button.d.ts +6 -0
  50. package/dist/mixins/button.js +12 -19
  51. package/dist/mixins/button.js.map +1 -1
  52. package/dist/mixins/checkbox.js +2 -9
  53. package/dist/mixins/checkbox.js.map +1 -1
  54. package/dist/mixins/control.js +3 -12
  55. package/dist/mixins/control.js.map +1 -1
  56. package/dist/mixins/index.d.ts +5 -0
  57. package/dist/mixins/select.js +1 -2
  58. package/dist/mixins/select.js.map +1 -1
  59. package/dist/mixins/slider.js +1 -2
  60. package/dist/mixins/slider.js.map +1 -1
  61. package/dist/validators/index.d.ts +2 -0
  62. package/dist/validators/index.js +1 -2
  63. package/dist/validators/index.js.map +1 -1
  64. package/package.json +7 -7
@@ -1,5 +1,5 @@
1
1
  import { removeEmptyTextNode as e } from "../utils.js";
2
- //#region src/internal/controllers/type-anchor.controller.ts
2
+ // src/internal/controllers/type-anchor.controller.ts
3
3
  var t = class {
4
4
  #e = null;
5
5
  #t = !1;
@@ -45,7 +45,6 @@ var t = class {
45
45
  this.host.disabled && (e.preventDefault(), e.stopImmediatePropagation());
46
46
  };
47
47
  };
48
- //#endregion
49
48
  export { t as TypeAnchorController };
50
49
 
51
50
  //# sourceMappingURL=type-anchor.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-anchor.controller.js","names":[],"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:not([name]), 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,KAAK;CACd;CAEA,cAAc;EACZ,KAAK,GAA4B;EACjC,IAAM,IAAS,KAAK;EAcpB,AAbA,KAAK,KAAY,EAAQ,GAErB,IACF,KAAK,KAAK,WAAY,OAAO,IAAI,QAAQ,IAEzC,KAAK,KAAK,WAAY,OAAO,OAAO,QAAQ,GAG1C,KAAK,OACP,KAAK,GAAc,MAAM,iBAAiB,QAC1C,KAAK,KAAK,MAAM,SAAS,YAG3B,KAAK,GAA0B,CAAM;CACvC;CAEA,mBAAmB;EACjB,KAAK,GAA2B;CAClC;CAEA,IAAI,KAAU;EACZ,OAAO,KAAK,MAAkB,KAAK;CACrC;CAEA,IAAI,KAAiB;EACnB,OAAO,KAAK,KAAK,YACb,cAA+B,qCAAqC,CAAC,EACrE,iBAAiB,CAAC,EAClB,MAAK,MAAW,GAAS,YAAY,GAAG;CAC9C;CAEA,IAAI,KAAgB;EAClB,OAAO,KAAK,KAAK,eAAe,YAAY,MAAO,KAAK,KAAK,gBAAsC;CACrG;CAEA,IAAI,KAAe;EACjB,OAAO,KAAK,KAAK,YAAY,cAA+B,kBAAkB;CAChF;CAEA,IAAI,KAAc;EAChB,OAAO,KAAK,KAAK,YAAY,cAA+B,mBAAmB;CACjF;CAEA,KAA8B;EAC5B,AAAI,KAAK,MAAW,KAAK,OACvB,KAAK,GAAQ,OAAO,UACpB,KAAK,IAAc,cAAc,CAAC,CAAC,SAAQ,MAAQ,EAAoB,CAAI,CAAC;CAEhF;CAEA,GAA0B,GAA8C;EAGtE,AAFA,KAAK,GAA2B,GAChC,KAAK,KAAqB,KAAU,MACpC,KAAK,IAAoB,iBAAiB,SAAS,KAAK,EAAc;CACxE;CAEA,KAA6B;EAE3B,AADA,KAAK,IAAoB,oBAAoB,SAAS,KAAK,EAAc,GACzE,KAAK,KAAqB;CAC5B;CAEA,MAAkB,MAAiB;EACjC,AAAI,KAAK,KAAK,aACZ,EAAM,eAAe,GACrB,EAAM,yBAAyB;CAEnC;AACF"}
1
+ {"version":3,"file":"type-anchor.controller.js","names":["TypeAnchorController","host","#readOnly","#updateAnchorSlotAssignment","anchor","#anchor","#parentAnchor","#setupAnchorClickBehavior","#removeAnchorClickBehavior","#slottedAnchor","element","#defaultSlot","#anchorSlot","removeEmptyTextNode","node","#anchorClickTarget","#onAnchorClick","event"],"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:not([name]), 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,IAAaA,IAAb,MAA8F;CAC5F,KAA+C;CAC/C,KAAY;CAEZ,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CA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AK,aACZE,EAAM,eAAe,GACrBA,EAAM,yBAAyB;CAEnC;AACF"}
@@ -1,4 +1,4 @@
1
- //#region src/internal/controllers/type-button.controller.ts
1
+ // src/internal/controllers/type-button.controller.ts
2
2
  var e = class {
3
3
  #e = null;
4
4
  #t = 0;
@@ -10,18 +10,13 @@ var e = class {
10
10
  this.#n === void 0 && this.host.hasAttribute("tabindex") && (this.#t = this.host.tabIndex);
11
11
  }
12
12
  hostUpdated() {
13
- if (this.#r(), this.host.readOnly) {
14
- this.host._internals.role && this.host._internals.role !== "none" && (this.#e = this.host._internals.role), this.host._internals.role = "none";
15
- return;
16
- }
17
- !this.host._internals.role || this.host._internals.role === "none" ? this.host._internals.role = this.#e ?? "button" : this.#e = this.host._internals.role;
13
+ this.#r(), this.host.readOnly ? (this.host._internals.role && this.host._internals.role !== "none" && (this.#e = this.host._internals.role), this.host._internals.role = "none") : !this.host._internals.role || this.host._internals.role === "none" ? this.host._internals.role = this.#e ?? "button" : this.#e = this.host._internals.role;
18
14
  }
19
15
  #r() {
20
16
  let e = this.host.disabled || this.host.readOnly, t = this.#n === void 0 || this.#n && !e;
21
17
  e && this.#n === !1 && (this.#t = this.host.tabIndex), this.#n = e, this.host.readOnly ? (this.host.tabIndex = -1, this.host.removeAttribute("tabindex")) : this.host.disabled ? this.host.tabIndex = -1 : t && (this.host.tabIndex = this.#t);
22
18
  }
23
19
  };
24
- //#endregion
25
20
  export { e as TypeButtonController };
26
21
 
27
22
  //# sourceMappingURL=type-button.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-button.controller.js","names":[],"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 #enabledTabIndex = 0;\n #unavailable?: boolean;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n if (this.#unavailable === undefined && this.host.hasAttribute('tabindex')) {\n this.#enabledTabIndex = this.host.tabIndex;\n }\n }\n\n hostUpdated() {\n this.#updateTabIndex();\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 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\n #updateTabIndex() {\n const unavailable = this.host.disabled || this.host.readOnly;\n const restore = this.#unavailable === undefined || (this.#unavailable && !unavailable);\n\n if (unavailable && this.#unavailable === false) {\n this.#enabledTabIndex = this.host.tabIndex;\n }\n\n this.#unavailable = unavailable;\n if (this.host.readOnly) {\n this.host.tabIndex = -1;\n this.host.removeAttribute('tabindex');\n } else if (this.host.disabled) {\n this.host.tabIndex = -1;\n } else if (restore) {\n this.host.tabIndex = this.#enabledTabIndex;\n }\n }\n}\n"],"mappings":";AAWA,IAAa,IAAb,MAA8F;CAC5F,KAA8B;CAC9B,KAAmB;CACnB;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,AAAI,KAAK,OAAiB,KAAA,KAAa,KAAK,KAAK,aAAa,UAAU,MACtE,KAAK,KAAmB,KAAK,KAAK;CAEtC;CAEA,cAAc;EAEZ,IADA,KAAK,GAAgB,GACjB,KAAK,KAAK,UAAU;GAKtB,AAJI,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,WAC/D,KAAK,KAAe,KAAK,KAAK,WAAY,OAG5C,KAAK,KAAK,WAAY,OAAO;GAC7B;EACF;EAEA,AAAI,CAAC,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,SAChE,KAAK,KAAK,WAAY,OAAO,KAAK,MAAgB,WAElD,KAAK,KAAe,KAAK,KAAK,WAAY;CAE9C;CAEA,KAAkB;EAChB,IAAM,IAAc,KAAK,KAAK,YAAY,KAAK,KAAK,UAC9C,IAAU,KAAK,OAAiB,KAAA,KAAc,KAAK,MAAgB,CAAC;EAO1E,AALI,KAAe,KAAK,OAAiB,OACvC,KAAK,KAAmB,KAAK,KAAK,WAGpC,KAAK,KAAe,GAChB,KAAK,KAAK,YACZ,KAAK,KAAK,WAAW,IACrB,KAAK,KAAK,gBAAgB,UAAU,KAC3B,KAAK,KAAK,WACnB,KAAK,KAAK,WAAW,KACZ,MACT,KAAK,KAAK,WAAW,KAAK;CAE9B;AACF"}
1
+ {"version":3,"file":"type-button.controller.js","names":["TypeButtonController","host","#unavailable","#enabledTabIndex","#updateTabIndex","#enabledRole","unavailable","restore"],"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 #enabledTabIndex = 0;\n #unavailable?: boolean;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n if (this.#unavailable === undefined && this.host.hasAttribute('tabindex')) {\n this.#enabledTabIndex = this.host.tabIndex;\n }\n }\n\n hostUpdated() {\n this.#updateTabIndex();\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 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\n #updateTabIndex() {\n const unavailable = this.host.disabled || this.host.readOnly;\n const restore = this.#unavailable === undefined || (this.#unavailable && !unavailable);\n\n if (unavailable && this.#unavailable === false) {\n this.#enabledTabIndex = this.host.tabIndex;\n }\n\n this.#unavailable = unavailable;\n if (this.host.readOnly) {\n this.host.tabIndex = -1;\n this.host.removeAttribute('tabindex');\n } else if (this.host.disabled) {\n this.host.tabIndex = -1;\n } else if (restore) {\n this.host.tabIndex = this.#enabledTabIndex;\n }\n }\n}\n"],"mappings":";AAWA,IAAaA,IAAb,MAA8F;CAC5F,KAA8B;CAC9B,KAAmB;CACnB;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,AAAI,KAAKC,OAAiB,KAAA,KAAa,KAAK,KAAK,aAAa,UAAU,MACtE,KAAKC,KAAmB,KAAK,KAAK;CAEtC;CAEA,cAAc;EAEZ,AADA,KAAKC,GAAgB,GACjB,KAAK,KAAK,YACR,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,WAC/D,KAAKC,KAAe,KAAK,KAAK,WAAY,OAG5C,KAAK,KAAK,WAAY,OAAO,UAI3B,CAAC,KAAK,KAAK,WAAY,QAAQ,KAAK,KAAK,WAAY,SAAS,SAChE,KAAK,KAAK,WAAY,OAAO,KAAKA,MAAgB,WAElD,KAAKA,KAAe,KAAK,KAAK,WAAY;CAE9C;CAEA,KAAkB;EAChB,IAAMC,IAAc,KAAK,KAAK,YAAY,KAAK,KAAK,UAC9CC,IAAU,KAAKL,OAAiB,KAAA,KAAc,KAAKA,MAAgB,CAACI;EAO1E,AALIA,KAAe,KAAKJ,OAAiB,OACvC,KAAKC,KAAmB,KAAK,KAAK,WAGpC,KAAKD,KAAeI,GAChB,KAAK,KAAK,YACZ,KAAK,KAAK,WAAW,IACrB,KAAK,KAAK,gBAAgB,UAAU,KAC3B,KAAK,KAAK,WACnB,KAAK,KAAK,WAAW,KACZC,MACT,KAAK,KAAK,WAAW,KAAKJ;CAE9B;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { getFlattenedDOMTree as e } from "../utils.js";
2
- //#region src/internal/controllers/type-command.controller.ts
2
+ // src/internal/controllers/type-command.controller.ts
3
3
  var t = class {
4
4
  #e;
5
5
  constructor(e, { events: t = ["click"] } = {}) {
@@ -31,7 +31,6 @@ var t = class {
31
31
  return t ? e(this.host.getRootNode()).find((e) => e.id === t) ?? null : null;
32
32
  }
33
33
  };
34
- //#endregion
35
34
  export { t as TypeCommandController };
36
35
 
37
36
  //# sourceMappingURL=type-command.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-command.controller.js","names":[],"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\ntype TypeCommandControllerOptions = {\n events?: readonly string[];\n};\n\nexport class TypeCommandController<T extends CommandBehaviorHost> implements ReactiveController {\n readonly #events: readonly string[];\n\n constructor(\n private host: T,\n { events = ['click'] }: TypeCommandControllerOptions = {}\n ) {\n this.#events = [...new Set(events)];\n this.host.addController(this);\n }\n\n hostUpdated() {\n this.#removeCommandBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.#events.forEach(eventType => this.host.addEventListener(eventType, this.#onCommand));\n }\n }\n\n hostDisconnected() {\n this.#removeCommandBehavior();\n }\n\n #removeCommandBehavior() {\n this.#events.forEach(eventType => this.host.removeEventListener(eventType, this.#onCommand));\n }\n\n #onCommand = (event: Event) => {\n if (!event.defaultPrevented) {\n this.invoke();\n }\n };\n\n /** Dispatches the configured command for controls that handle their own activation. */\n invoke() {\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":";;AAiBA,IAAa,IAAb,MAAgG;CAC9F;CAEA,YACE,GACA,EAAE,YAAS,CAAC,OAAO,MAAoC,CAAC,GACxD;EAEA,AAJQ,KAAA,OAAA,GAGR,KAAK,KAAU,CAAC,GAAG,IAAI,IAAI,CAAM,CAAC,GAClC,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,cAAc;EAEZ,AADA,KAAK,GAAuB,GACxB,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,YACpC,KAAK,GAAQ,SAAQ,MAAa,KAAK,KAAK,iBAAiB,GAAW,KAAK,EAAU,CAAC;CAE5F;CAEA,mBAAmB;EACjB,KAAK,GAAuB;CAC9B;CAEA,KAAyB;EACvB,KAAK,GAAQ,SAAQ,MAAa,KAAK,KAAK,oBAAoB,GAAW,KAAK,EAAU,CAAC;CAC7F;CAEA,MAAc,MAAiB;EAC7B,AAAK,EAAM,oBACT,KAAK,OAAO;CAEhB;CAGA,SAAS;EACP,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,CAAC,CAAC,MAAK,MAAM,EAAG,OAAO,CAAE,KAAK,OAHtF;CAIX;AACF"}
1
+ {"version":3,"file":"type-command.controller.js","names":["TypeCommandController","host","#events","events","#removeCommandBehavior","eventType","#onCommand","event","target","id","getFlattenedDOMTree","el"],"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\ntype TypeCommandControllerOptions = {\n events?: readonly string[];\n};\n\nexport class TypeCommandController<T extends CommandBehaviorHost> implements ReactiveController {\n readonly #events: readonly string[];\n\n constructor(\n private host: T,\n { events = ['click'] }: TypeCommandControllerOptions = {}\n ) {\n this.#events = [...new Set(events)];\n this.host.addController(this);\n }\n\n hostUpdated() {\n this.#removeCommandBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.#events.forEach(eventType => this.host.addEventListener(eventType, this.#onCommand));\n }\n }\n\n hostDisconnected() {\n this.#removeCommandBehavior();\n }\n\n #removeCommandBehavior() {\n this.#events.forEach(eventType => this.host.removeEventListener(eventType, this.#onCommand));\n }\n\n #onCommand = (event: Event) => {\n if (!event.defaultPrevented) {\n this.invoke();\n }\n };\n\n /** Dispatches the configured command for controls that handle their own activation. */\n invoke() {\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":";;AAiBA,IAAaA,IAAb,MAAgG;CAC9F;CAEA,YACE,GACA,EAAE,YAAS,CAAC,OAAO,MAAoC,CAAC,GACxD;EAEA,AAJQ,KAAA,OAAAC,GAGR,KAAKC,KAAU,CAAC,GAAG,IAAI,IAAIC,CAAM,CAAC,GAClC,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,cAAc;EAEZ,AADA,KAAKC,GAAuB,GACxB,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,YACpC,KAAKF,GAAQ,SAAQ,MAAa,KAAK,KAAK,iBAAiBG,GAAW,KAAKC,EAAU,CAAC;CAE5F;CAEA,mBAAmB;EACjB,KAAKF,GAAuB;CAC9B;CAEA,KAAyB;EACvB,KAAKF,GAAQ,SAAQ,MAAa,KAAK,KAAK,oBAAoBG,GAAW,KAAKC,EAAU,CAAC;CAC7F;CAEA,MAAc,MAAiB;EAC7B,AAAKC,EAAM,oBACT,KAAK,OAAO;CAEhB;CAGA,SAAS;EACP,IAAI,KAAK,KAAK,YAAY,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,SACzD,OAAO;EAGT,IAAMC,IAAS,KAAK;EAWpB,OAVKA,KASLA,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,IAAMC,IAAK,KAAK,KAAK,aAAa,YAAY;EAK9C,OAJKA,IAIEC,EAAoB,KAAK,KAAK,YAAY,CAAgB,CAAC,CAAC,MAAK,MAAMC,EAAG,OAAOF,CAAE,KAAK,OAHtF;CAIX;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { getFlattenedDOMTree as e } from "../utils.js";
2
- //#region src/internal/controllers/type-interest-invoker.controller.ts
2
+ // src/internal/controllers/type-interest-invoker.controller.ts
3
3
  var t = class {
4
4
  #e = null;
5
5
  constructor(e) {
@@ -31,7 +31,7 @@ var t = class {
31
31
  let e = this.host.getAttribute("interestfor");
32
32
  if (e) return this.#e = null, this.#s(e);
33
33
  let t = this.host.interestForElement;
34
- if (!(!t || t === this.#e)) return this.#e = null, t;
34
+ if (t && t !== this.#e) return this.#e = null, t;
35
35
  }
36
36
  #o() {
37
37
  let e = this.host.popoverTargetElement;
@@ -43,7 +43,6 @@ var t = class {
43
43
  return t ? e(this.host.getRootNode()).find((e) => e.id === t) ?? null : null;
44
44
  }
45
45
  };
46
- //#endregion
47
46
  export { t as TypeInterestInvokerController };
48
47
 
49
48
  //# sourceMappingURL=type-interest-invoker.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-interest-invoker.controller.js","names":[],"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 popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypeInterestInvokerController<T extends InterestInvokerHost> implements ReactiveController {\n #inferredInterestForElement: HTMLElement | null = null;\n\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 = (event: Event) => {\n if (event.type === 'focus' && !this.host.matches(':focus-visible')) {\n return;\n }\n\n if (this.host.popoverTargetElement?.matches(':popover-open')) {\n return;\n }\n\n this.#dispatchInterestEvent('interest');\n };\n\n #onLoseInterest = () => this.#dispatchInterestEvent('loseinterest');\n\n #dispatchInterestEvent(type: 'interest' | 'loseinterest') {\n const target = this.#getInterestForElement();\n if (!target) {\n return;\n }\n\n const event = new Event(type, { cancelable: true }) as InterestEvent;\n event.source = this.host;\n target.dispatchEvent(event);\n }\n\n #getInterestForElement() {\n const explicitTarget = this.#getExplicitInterestForElement();\n if (explicitTarget !== undefined) {\n return explicitTarget;\n }\n\n const inferredTarget = this.#getHintPopoverTarget();\n const previousTarget = this.#inferredInterestForElement;\n this.#inferredInterestForElement = inferredTarget;\n if (inferredTarget && this.host.interestForElement !== inferredTarget) {\n this.host.interestForElement = inferredTarget;\n } else if (!inferredTarget && previousTarget && this.host.interestForElement === previousTarget) {\n this.host.interestForElement = null;\n }\n return inferredTarget;\n }\n\n #getExplicitInterestForElement(): HTMLElement | null | undefined {\n const interestForIdRef = this.host.getAttribute('interestfor');\n if (interestForIdRef) {\n this.#inferredInterestForElement = null;\n return this.#getElementById(interestForIdRef);\n }\n\n const interestForElement = this.host.interestForElement;\n if (!interestForElement || interestForElement === this.#inferredInterestForElement) {\n return undefined;\n }\n\n this.#inferredInterestForElement = null;\n return interestForElement;\n }\n\n #getHintPopoverTarget() {\n const popoverTarget = this.host.popoverTargetElement;\n if (popoverTarget instanceof HTMLElement && popoverTarget.popover === 'hint') {\n return popoverTarget;\n }\n\n const target = this.#getElementById(this.host.getAttribute('popovertarget'));\n return target instanceof HTMLElement && target.popover === 'hint' ? target : null;\n }\n\n #getElementById(id: string | null) {\n return id ? (getFlattenedDOMTree(this.host.getRootNode()).find(element => element.id === id) ?? null) : null;\n }\n}\n"],"mappings":";;AAaA,IAAa,IAAb,MAAwG;CACtG,KAAkD;CAElD,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAId,AAHA,KAAK,KAAK,iBAAiB,cAAc,KAAK,EAAW,GACzD,KAAK,KAAK,iBAAiB,cAAc,KAAK,EAAe,GAC7D,KAAK,KAAK,iBAAiB,SAAS,KAAK,EAAW,GACpD,KAAK,KAAK,iBAAiB,QAAQ,KAAK,EAAe;CACzD;CAEA,mBAAmB;EAIjB,AAHA,KAAK,KAAK,oBAAoB,cAAc,KAAK,EAAW,GAC5D,KAAK,KAAK,oBAAoB,cAAc,KAAK,EAAe,GAChE,KAAK,KAAK,oBAAoB,SAAS,KAAK,EAAW,GACvD,KAAK,KAAK,oBAAoB,QAAQ,KAAK,EAAe;CAC5D;CAEA,MAAe,MAAiB;EAC1B,EAAM,SAAS,WAAW,CAAC,KAAK,KAAK,QAAQ,gBAAgB,KAI7D,KAAK,KAAK,sBAAsB,QAAQ,eAAe,KAI3D,KAAK,GAAuB,UAAU;CACxC;CAEA,WAAwB,KAAK,GAAuB,cAAc;CAElE,GAAuB,GAAmC;EACxD,IAAM,IAAS,KAAK,GAAuB;EAC3C,IAAI,CAAC,GACH;EAGF,IAAM,IAAQ,IAAI,MAAM,GAAM,EAAE,YAAY,GAAK,CAAC;EAElD,AADA,EAAM,SAAS,KAAK,MACpB,EAAO,cAAc,CAAK;CAC5B;CAEA,KAAyB;EACvB,IAAM,IAAiB,KAAK,GAA+B;EAC3D,IAAI,MAAmB,KAAA,GACrB,OAAO;EAGT,IAAM,IAAiB,KAAK,GAAsB,GAC5C,IAAiB,KAAK;EAO5B,OANA,KAAK,KAA8B,GAC/B,KAAkB,KAAK,KAAK,uBAAuB,IACrD,KAAK,KAAK,qBAAqB,IACtB,CAAC,KAAkB,KAAkB,KAAK,KAAK,uBAAuB,MAC/E,KAAK,KAAK,qBAAqB,OAE1B;CACT;CAEA,KAAiE;EAC/D,IAAM,IAAmB,KAAK,KAAK,aAAa,aAAa;EAC7D,IAAI,GAEF,OADA,KAAK,KAA8B,MAC5B,KAAK,GAAgB,CAAgB;EAG9C,IAAM,IAAqB,KAAK,KAAK;EACjC,OAAC,KAAsB,MAAuB,KAAK,KAKvD,OADA,KAAK,KAA8B,MAC5B;CACT;CAEA,KAAwB;EACtB,IAAM,IAAgB,KAAK,KAAK;EAChC,IAAI,aAAyB,eAAe,EAAc,YAAY,QACpE,OAAO;EAGT,IAAM,IAAS,KAAK,GAAgB,KAAK,KAAK,aAAa,eAAe,CAAC;EAC3E,OAAO,aAAkB,eAAe,EAAO,YAAY,SAAS,IAAS;CAC/E;CAEA,GAAgB,GAAmB;EACjC,OAAO,IAAM,EAAoB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAAK,MAAW,EAAQ,OAAO,CAAE,KAAK,OAAQ;CAC1G;AACF"}
1
+ {"version":3,"file":"type-interest-invoker.controller.js","names":["TypeInterestInvokerController","host","#onInterest","#onLoseInterest","event","#dispatchInterestEvent","target","#getInterestForElement","type","explicitTarget","#getExplicitInterestForElement","inferredTarget","#getHintPopoverTarget","previousTarget","#inferredInterestForElement","interestForIdRef","#getElementById","interestForElement","popoverTarget","id","getFlattenedDOMTree","element"],"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 popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypeInterestInvokerController<T extends InterestInvokerHost> implements ReactiveController {\n #inferredInterestForElement: HTMLElement | null = null;\n\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 = (event: Event) => {\n if (event.type === 'focus' && !this.host.matches(':focus-visible')) {\n return;\n }\n\n if (this.host.popoverTargetElement?.matches(':popover-open')) {\n return;\n }\n\n this.#dispatchInterestEvent('interest');\n };\n\n #onLoseInterest = () => this.#dispatchInterestEvent('loseinterest');\n\n #dispatchInterestEvent(type: 'interest' | 'loseinterest') {\n const target = this.#getInterestForElement();\n if (!target) {\n return;\n }\n\n const event = new Event(type, { cancelable: true }) as InterestEvent;\n event.source = this.host;\n target.dispatchEvent(event);\n }\n\n #getInterestForElement() {\n const explicitTarget = this.#getExplicitInterestForElement();\n if (explicitTarget !== undefined) {\n return explicitTarget;\n }\n\n const inferredTarget = this.#getHintPopoverTarget();\n const previousTarget = this.#inferredInterestForElement;\n this.#inferredInterestForElement = inferredTarget;\n if (inferredTarget && this.host.interestForElement !== inferredTarget) {\n this.host.interestForElement = inferredTarget;\n } else if (!inferredTarget && previousTarget && this.host.interestForElement === previousTarget) {\n this.host.interestForElement = null;\n }\n return inferredTarget;\n }\n\n #getExplicitInterestForElement(): HTMLElement | null | undefined {\n const interestForIdRef = this.host.getAttribute('interestfor');\n if (interestForIdRef) {\n this.#inferredInterestForElement = null;\n return this.#getElementById(interestForIdRef);\n }\n\n const interestForElement = this.host.interestForElement;\n if (!interestForElement || interestForElement === this.#inferredInterestForElement) {\n return undefined;\n }\n\n this.#inferredInterestForElement = null;\n return interestForElement;\n }\n\n #getHintPopoverTarget() {\n const popoverTarget = this.host.popoverTargetElement;\n if (popoverTarget instanceof HTMLElement && popoverTarget.popover === 'hint') {\n return popoverTarget;\n }\n\n const target = this.#getElementById(this.host.getAttribute('popovertarget'));\n return target instanceof HTMLElement && target.popover === 'hint' ? target : null;\n }\n\n #getElementById(id: string | null) {\n return id ? (getFlattenedDOMTree(this.host.getRootNode()).find(element => element.id === id) ?? null) : null;\n }\n}\n"],"mappings":";;AAaA,IAAaA,IAAb,MAAwG;CACtG,KAAkD;CAElD,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAId,AAHA,KAAK,KAAK,iBAAiB,cAAc,KAAKC,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,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a,IAAMC,EAAoB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAAK,MAAWC,EAAQ,OAAOF,CAAE,KAAK,OAAQ;CAC1G;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { getFlattenedDOMTree as e, getHostAnchor as t } from "../utils.js";
2
- //#region src/internal/controllers/type-popover-trigger.controller.ts
2
+ // src/internal/controllers/type-popover-trigger.controller.ts
3
3
  var n = class {
4
4
  constructor(e) {
5
5
  this.host = e, this.host.addController(this);
@@ -38,7 +38,6 @@ var n = class {
38
38
  }
39
39
  }
40
40
  };
41
- //#endregion
42
41
  export { n as TypePopoverTriggerController };
43
42
 
44
43
  //# sourceMappingURL=type-popover-trigger.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-popover-trigger.controller.js","names":[],"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 '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\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 #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement as PopoverAnchorElement);\n }\n\n return this.host as HTMLElement;\n }\n\n #invokePopover(popoverTargetElement: HTMLElement) {\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n return false;\n }\n\n const source = this.#getPopoverSource(popoverTargetElement);\n if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n\n return popoverTargetElement.matches(':popover-open');\n }\n\n #handoverInterest() {\n if (this.host.interestForElement) {\n const loseInterest = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n loseInterest.source = this.host;\n this.host.interestForElement.dispatchEvent(loseInterest);\n }\n }\n}\n"],"mappings":";;AAiBA,IAAa,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,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version":3,"file":"type-popover-trigger.controller.js","names":["TypePopoverTriggerController","host","#onClick","popoverTargetElement","controllerResolvedTarget","#resolvedPopoverTarget","resolvedPopoverTarget","getFlattenedDOMTree","element","event","#resolvePopoverTarget","#invokePopover","#handoverInterest","getHostAnchor","source","#getPopoverSource","loseInterest"],"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 '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\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 #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement as PopoverAnchorElement);\n }\n\n return this.host as HTMLElement;\n }\n\n #invokePopover(popoverTargetElement: HTMLElement) {\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n return false;\n }\n\n const source = this.#getPopoverSource(popoverTargetElement);\n if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n\n return popoverTargetElement.matches(':popover-open');\n }\n\n #handoverInterest() {\n if (this.host.interestForElement) {\n const loseInterest = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n loseInterest.source = this.host;\n this.host.interestForElement.dispatchEvent(loseInterest);\n }\n }\n}\n"],"mappings":";;AAiBA,IAAaA,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAQ;CACnD;CAEA,mBAAmB;EACjB,KAAK,KAAK,oBAAoB,SAAS,KAAKA,EAAQ;CACtD;CAEA;CAEA,KAAwB;EACtB,IAAMC,IAAuB,KAAK,KAAK,sBACjCC,IAA2BD,MAAyB,KAAKE;EAE/D,IAAI,CAAC,KAAK,KAAK,aAAa,eAAe,GAOzC,OANA,KAAKA,KAAyB,KAAA,GAC1BD,KACF,KAAK,KAAK,uBAAuB,MAC1B,QAGFD;EAGT,IAAIA,KAAwB,CAACC,GAC3B,OAAOD;EAGT,IAAMG,IACJC,EAAoB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAC3C,MAAWC,EAAQ,OAAO,KAAK,KAAK,aAAa,eAAe,CAClE,KAAK;EAMP,OALIF,MAA0BH,MAC5B,KAAK,KAAK,uBAAuBG,IAEnC,KAAKD,KAAyBC,GAEvBA;CACT;CAEA,MAAY,MAAsB;EAChC,IAAIG,EAAM,oBAAoB,KAAK,KAAK,UACtC;EAGF,IAAMN,IAAuB,KAAKO,GAAsB;EACxD,AAAKP,KAID,KAAKQ,GAAeR,CAAoB,KAC1C,KAAKS,GAAkB;CAE3B;CAEA,GAAkB,GAAmC;EAKnD,OAJKT,EAA8C,SAC1CU,EAAcV,CAA4C,IAG5D,KAAK;CACd;CAEA,GAAe,GAAmC;EAChD,IAAI,KAAK,KAAK,wBAAwB,QAEpC,OADAA,EAAqB,YAAY,GAC1B;EAGT,IAAMW,IAAS,KAAKC,GAAkBZ,CAAoB;EAO1D,OANI,KAAK,KAAK,wBAAwB,SACpCA,EAAqB,YAAY,EAAE,UAAO,CAAC,IAE3CA,EAAqB,cAAc,EAAE,UAAO,CAAC,GAGxCA,EAAqB,QAAQ,eAAe;CACrD;CAEA,KAAoB;EAClB,IAAI,KAAK,KAAK,oBAAoB;GAChC,IAAMa,IAAe,IAAI,MAAM,gBAAgB,EAAE,YAAY,GAAK,CAAC;GAEnE,AADA,EAAa,SAAS,KAAK,MAC3B,KAAK,KAAK,mBAAmB,cAAcA,CAAY;EACzD;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { stopEvent as e } from "../utils.js";
2
- //#region src/internal/controllers/type-submit.controller.ts
2
+ // src/internal/controllers/type-submit.controller.ts
3
3
  var t = class {
4
4
  #e;
5
5
  #t;
@@ -26,11 +26,7 @@ var t = class {
26
26
  (e.key === " " || e.key === "Enter" || e.code === "Space" || e.code === "Enter") && this.host.click();
27
27
  };
28
28
  #o = (t) => {
29
- if (this.host.disabled) {
30
- e(t);
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();
29
+ this.host.disabled ? e(t) : 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
30
  };
35
31
  #s(e) {
36
32
  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);
@@ -48,7 +44,6 @@ var t = class {
48
44
  this.#n?.removeEventListener("submit", this.#c), this.#n = void 0, this.#t?.remove(), this.#t = void 0;
49
45
  }
50
46
  };
51
- //#endregion
52
47
  export { t as TypeSubmitController };
53
48
 
54
49
  //# sourceMappingURL=type-submit.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-submit.controller.js","names":[],"sources":["../../../src/internal/controllers/type-submit.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { stopEvent } from '../utils.js';\nimport type { ButtonType } from '../types/button.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype SubmitHost = 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 TypeSubmitController<T extends SubmitHost> 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.#removeSubmitBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.host.addEventListener('click', this.#onSubmitClick);\n this.host.addEventListener('keyup', this.#onSubmitKeyup);\n }\n }\n\n hostDisconnected() {\n this.#removeSubmitBehavior();\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 #removeSubmitBehavior() {\n this.host.removeEventListener('click', this.#onSubmitClick);\n this.host.removeEventListener('keyup', this.#onSubmitKeyup);\n }\n\n #onSubmitKeyup = (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Enter' || event.code === 'Space' || event.code === 'Enter') {\n this.host.click();\n }\n };\n\n #onSubmitClick = (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,MAAsF;CACpF;CACA;CACA;CAEA,YAAY,GAAiB;EAC3B,AADkB,KA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C;CAEA,WAAkB;EAChB,IAAM,IAAY,KAAK;EAEvB,AADA,KAAK,KAAiB,KAAA,GACtB,iBAAiB;GAEf,AADA,GAAW,OAAO,GACd,KAAK,OAAe,MACtB,KAAK,KAAa,KAAA;EAEtB,GAAG,CAAC;CACN;CAEA,KAAmB;EAQjB,AAPK,KAAK,OACR,KAAK,KAAa,WAAW,SAAS,cAAc,QAAQ,GAC5D,KAAK,GAAW,OAAO,UACvB,KAAK,GAAW,MAAM,UAAU,SAGlC,KAAK,GAAW,OAAO,KAAK,KAAK,QAAQ,IACzC,KAAK,GAAW,QAAQ,KAAK,KAAK,SAAS;CAC7C;CAEA,KAAmB;EAIjB,AAHA,KAAK,IAAgB,oBAAoB,UAAU,KAAK,EAAS,GACjE,KAAK,KAAiB,KAAA,GACtB,KAAK,IAAY,OAAO,GACxB,KAAK,KAAa,KAAA;CACpB;AACF"}
1
+ {"version":3,"file":"type-submit.controller.js","names":["TypeSubmitController","host","#defaultType","#setButtonType","#removeSubmitBehavior","#onSubmitClick","#onSubmitKeyup","#removeSubmitter","event","stopEvent","#requestSubmit","#createSubmitter","#submitterForm","form","#onSubmit","#submitter","submitter"],"sources":["../../../src/internal/controllers/type-submit.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { stopEvent } from '../utils.js';\nimport type { ButtonType } from '../types/button.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype SubmitHost = 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 TypeSubmitController<T extends SubmitHost> 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.#removeSubmitBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.host.addEventListener('click', this.#onSubmitClick);\n this.host.addEventListener('keyup', this.#onSubmitKeyup);\n }\n }\n\n hostDisconnected() {\n this.#removeSubmitBehavior();\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 #removeSubmitBehavior() {\n this.host.removeEventListener('click', this.#onSubmitClick);\n this.host.removeEventListener('keyup', this.#onSubmitKeyup);\n }\n\n #onSubmitKeyup = (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Enter' || event.code === 'Space' || event.code === 'Enter') {\n this.host.click();\n }\n };\n\n #onSubmitClick = (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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AE,MAAM,GAAK,CAAC,GAC9D,KAAKC,IAAY,OAAO,GACxBF,EAAK,YAAY,KAAKE,EAAW,GACjCF,EAAK,cAAc,KAAKE,EAAU;CACpC;CAEA,WAAkB;EAChB,IAAMC,IAAY,KAAKD;EAEvB,AADA,KAAKH,KAAiB,KAAA,GACtB,iBAAiB;GAEf,AADAI,GAAW,OAAO,GACd,KAAKD,OAAeC,MACtB,KAAKD,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,KAAKH,IAAgB,oBAAoB,UAAU,KAAKE,EAAS,GACjE,KAAKF,KAAiB,KAAA,GACtB,KAAKG,IAAY,OAAO,GACxB,KAAKA,KAAa,KAAA;CACpB;AACF"}
@@ -1,10 +1,9 @@
1
- //#region src/internal/errors.ts
1
+ // src/internal/errors.ts
2
2
  var e = class extends Error {
3
3
  constructor(e, t) {
4
4
  super(`(${e}): ${t}`), this.name = "FormControlError";
5
5
  }
6
6
  };
7
- //#endregion
8
7
  export { e as FormControlError };
9
8
 
10
9
  //# sourceMappingURL=errors.js.map
@@ -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;EAEpD,AADA,MAAM,IAAI,EAAgB,KAAK,GAAS,GACxC,KAAK,OAAO;CACd;AACF"}
1
+ {"version":3,"file":"errors.js","names":["FormControlError","formControlName","message"],"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,IAAaA,IAAb,cAAsC,MAAM;CAC1C,YAAY,GAAyB,GAAiB;EAEpD,AADA,MAAM,IAAIC,EAAgB,KAAKC,GAAS,GACxC,KAAK,OAAO;CACd;AACF"}
@@ -1,2 +1 @@
1
- import { TypeCommandController as e } from "./controllers/type-command.controller.js";
2
- export { e as TypeCommandController };
1
+ export { TypeCommandController } from "./controllers/type-command.controller.js";
@@ -1,5 +1,5 @@
1
1
  import { FormControlError as e } from "./errors.js";
2
- //#region src/internal/schema.ts
2
+ // src/internal/schema.ts
3
3
  function t(t, n, r) {
4
4
  let i = f(n, r);
5
5
  if (i === void 0) throw new e(t, `unsupported value type ${typeof n}`);
@@ -81,7 +81,6 @@ function f(e, t) {
81
81
  default: return;
82
82
  }
83
83
  }
84
- //#endregion
85
84
  export { f as parseControlValue, t as parseValueSchema, d as validateSchema };
86
85
 
87
86
  //# sourceMappingURL=schema.js.map
@@ -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\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,WACzE,IAEE,EAAO,WAAW,CAAC,IAAI,OAAO,EAAO,OAAO,CAAC,CAAC,KAAK,CAAK,IACnD,EAAQ,EAAE,iBAAiB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AO,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
+ {"version":3,"file":"schema.js","names":["parseValueSchema","parsedValue","parseControlValue","value","schema","FormControlError","formControlName","VALID","invalid","validity","validateString","validateNumber","validateBoolean","validateArray","item","result","validateSchema","validateObjectProperty","propSchema","property","propValue","name","required","validateObject","valueProperties","schemaProperties","additionalProps","prop","validateEnum"],"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,SAAgBA,EAAoB,GAAyB,GAAe,GAAmB;CAC7F,IAAMC,IAAcC,EAAkBC,GAAOC,CAAM;CACnD,IAAIH,MAAgB,KAAA,GAClB,MAAM,IAAII,EAAiBC,GAAiB,0BAA0B,OAAOH,GAAO;CAEtF,OAAOF;AACT;AAIA,IAAMM,IAA0B;CAAE,UAAU,EAAE,OAAO,GAAK;CAAG,SAAS;AAAG;AAEzE,SAASC,EAAQ,GAAkC,GAAmC;CACpF,OAAO;EAAE,UAAU;GAAE,GAAGC;GAAU,OAAO;EAAM;EAAG;CAAQ;AAC5D;AAEA,SAASC,EAAe,GAAqC,GAAkC;CAgB7F,OAfI,OAAOP,KAAU,WAGjBC,EAAO,cAAc,KAAA,KAAaD,EAAM,SAASC,EAAO,YACnDI,EAAQ,EAAE,UAAU,GAAK,GAAG,iBAAiBL,EAAM,OAAO,+BAA+BC,EAAO,WAAW,IAEhHA,EAAO,cAAc,KAAA,KAAaD,EAAM,SAASC,EAAO,YACnDI,EACL,EAAE,SAAS,GAAK,GAChB,iBAAiBL,EAAM,OAAO,kCAAkCC,EAAO,WACzE,IAEEA,EAAO,WAAW,CAAC,IAAI,OAAOA,EAAO,OAAO,CAAC,CAAC,KAAKD,CAAK,IACnDK,EAAQ,EAAE,iBAAiB,GAAK,GAAG,iCAAiCJ,EAAO,SAAS,IAEtFG,IAdEC,EAAQ,EAAE,cAAc,GAAK,GAAG,wBAAwB,OAAOL,G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Af;EACE,KAAK,UACH,OAAOM,EAAeN,GAAQD,CAAK;EACrC,KAAK,UACH,OAAOQ,EAAeP,GAAQD,CAAK;EACrC,KAAK,WACH,OAAOS,EAAgBT,CAAK;EAC9B,KAAK,SACH,OAAOU,EAAcT,GAAQD,CAAK;EACpC,KAAK,UACH,OAAOoB,EAAenB,GAAQD,CAAK;EACrC,KAAK,QACH,OAAOyB,EAAaxB,GAAQD,CAAK;EACnC,SACE,OAAOK,EAAQ,EAAE,UAAU,GAAK,GAAG,qBAAsBJ,EAA4B,MAAM;CAC/F;AACF;AAEA,SAAgBF,EAAqB,GAAe,GAA+B;CAGjF,QAFmBE,EAAO,MAE1B;EACE,KAAK,UACH,OAAOD;EACT,KAAK,UACH,OAAO,WAAWA,CAAK;EACzB,KAAK,WACH,OAAQ,CAAC,CAACA,KAASA,MAAU;EAC/B,KAAK;EACL,KAAK,UACH,OAAO,KAAK,MAAMA,CAAK;EACzB,KAAK,QACH,OAAQC,EAAO,KAAK,SAASD,CAAK,IAAIA,IAAQ,KAAA;EAChD,SAEE;CAEJ;AACF"}
@@ -80,9 +80,6 @@ export interface FormControl {
80
80
  metadata: FormControlMetadata;
81
81
  localName?: string;
82
82
  }
83
- export type ChangeEvent = Event & {
84
- type: 'change';
85
- };
86
83
  export interface ValidatorResult {
87
84
  validity: Partial<ValidityState>;
88
85
  message?: string;
@@ -5,14 +5,12 @@ export declare function attachInternals(element: HTMLElement & {
5
5
  export declare function toggleState(internals: ElementInternals, state: string, force: boolean): void;
6
6
  export type PopoverAnchorElement = HTMLElement & {
7
7
  anchor?: HTMLElement | string;
8
- _activeTrigger?: HTMLElement;
9
8
  };
10
9
  export declare function getFlattenedDOMTree(node: Node, depth?: number): HTMLElement[];
11
10
  export declare function getHostAnchor(host: PopoverAnchorElement): HTMLElement;
12
11
  export declare function getStringValue(value: unknown): string | null;
13
12
  export declare function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null): boolean;
14
13
  export declare function isFormElement(value: unknown): value is HTMLFormElement;
15
- export declare function onKeys(events: string[], event: KeyboardEvent, callback: () => void): void;
16
14
  export declare function removeEmptyTextNode(node: Node): void;
17
15
  export declare function setAttributeValue(element: HTMLElement, attribute: string, value: string | null): void;
18
16
  export declare function stopEvent(event: Event): void;
@@ -1,4 +1,4 @@
1
- //#region src/internal/utils.ts
1
+ // src/internal/utils.ts
2
2
  function e(e) {
3
3
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
4
4
  let t = Object.getPrototypeOf(e);
@@ -14,7 +14,7 @@ function r(e, t = 10) {
14
14
  return Array.from(d(e)).reduce((e, n) => [...e, [n, [...Array.from(d(n)).map((e) => [e, r(e, t)])]]], []).flat(t);
15
15
  }
16
16
  function i(e) {
17
- let t = e.anchor ?? e._activeTrigger;
17
+ let t = e.anchor;
18
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
19
  }
20
20
  function a(e) {
@@ -53,7 +53,6 @@ function p(e) {
53
53
  function m(e) {
54
54
  return typeof HTMLSlotElement < "u" && e instanceof HTMLSlotElement && !!e.assignedElements;
55
55
  }
56
- //#endregion
57
56
  export { t as attachInternals, r as getFlattenedDOMTree, i as getHostAnchor, a as getStringValue, o as hasAttributeValue, s as isFormElement, e as isObjectLiteral, c as removeEmptyTextNode, l as setAttributeValue, u as stopEvent, n as toggleState };
58
57
 
59
58
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function onKeys(events: string[], event: KeyboardEvent, callback: () => void) {\n if (events.includes(event.code)) {\n callback();\n }\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgB,EAAgB,GAAe;CAC7C,IAAI,CAAC,KAAQ,OAAO,KAAS,YAAY,MAAM,QAAQ,CAAI,GACzD,OAAO;CAET,IAAM,IAAQ,OAAO,eAAe,CAAI;CACxC,OAAO,MAAU,QAAQ,MAAU,OAAO;AAC5C;AAEA,SAAgB,EAAgB,GAA0D;CAKxF,OAJI,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAa,EAAQ,gBAAgB,IAGxC,EAAQ;AACjB;AAEA,SAAgB,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAI,IACF,EAAU,OAAO,IAAI,CAAK,IAE1B,EAAU,OAAO,OAAO,CAAK;AAEjC;AAIA,SAAgB,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAK,EAAY,CAAI,CAAC,CAAC,CAAC,QAC3B,GAAc,MAAY,CACzB,GAAG,GACH,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,EAAY,CAAC,CAAC,C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,IAAM,IAAU,EAAK,iBAAiB;EACtC,OAAO,EAAQ,SAAS,IAAU,MAAM,KAAK,EAAK,QAAQ;CAC5D;CAEA,OAAO,MAAM,KAAM,EAAqB,YAAY,CAAC,CAAC;AACxD;AAEA,SAAS,EAAe,GAA8B;CACpD,OAAO,OAAO,WAAa,OAAe,aAAgB,YAAY,EAAQ,EAAK;AACrF;AAEA,SAAS,EAAwB,GAA8D;CAC7F,OAAO,OAAO,cAAgB,OAAe,aAAgB,eAAe,EAAQ,EAAK;AAC3F;AAEA,SAAS,EAAc,GAAqC;CAC1D,OAAO,OAAO,kBAAoB,OAAe,aAAgB,mBAAmB,EAAQ,EAAK;AACnG"}
1
+ {"version":3,"file":"utils.js","names":["isObjectLiteral","item","proto","attachInternals","element","toggleState","force","internals","state","getFlattenedDOMTree","getChildren","node","p","i","depth","getHostAnchor","anchor","host","getStringValue","value","hasAttributeValue","attribute","isFormElement","removeEmptyTextNode","setAttributeValue","stopEvent","event","isDocumentNode","isElementWithShadowRoot","isSlotElement","slotted"],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgBA,EAAgB,GAAe;CAC7C,IAAI,CAACC,KAAQ,OAAOA,KAAS,YAAY,MAAM,QAAQA,CAAI,GACzD,OAAO;CAET,IAAMC,IAAQ,OAAO,eAAeD,CAAI;CACxC,OAAOC,MAAU,QAAQA,MAAU,OAAO;AAC5C;AAEA,SAAgBC,EAAgB,GAA0D;CAKxF,OAJIC,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAaA,EAAQ,gBAAgB,IAGxCA,EAAQ;AACjB;AAEA,SAAgBC,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAIC,IACFC,EAAU,OAAO,IAAIC,CAAK,IAE1BD,EAAU,OAAO,OAAOC,CAAK;AAEjC;AAIA,SAAgBC,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAKC,EAAYC,CAAI,CAAC,CAAC,CAAC,QAC3B,GAAc,MAAY,CACzB,GAAGC,GACH,CAAC,GAAG,CAAC,GAAG,MAAM,KAAKF,EAAY,CAAC,CAAC,CAAC,CAAC,KAAI,MAAK,CAACG,GAAGJ,EAAoBI,GAAGC,CAAK,CAAC,CAAC,CAAC,CAAC,CAClF,GACA,CAAC,CACH,CAAC,CACD,KAAKA,CAAK;AACd;AAEA,SAAgBC,EAAc,GAA4B;CACxD,IAAMC,IAASC,EAAK;CAgBpB,OAdI,OAAOD,KAAW,YAAYA,EAAO,SAClCC,EAAK,aAKRR,EAAoBQ,EAAK,UAAkB,CAAC,CAAC,MAAK,MAAWb,EAAQ,OAAOY,CAAM,KAAK,WAAW,SAAS,OAJpG,WAAW,SAAS,OAQ3BA,aAAkB,eAAeA,MAAW,WAAW,SAAS,OAC3DA,IAGF,WAAW,SAAS;A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Ac,GAAqC;CAC1D,OAAO,OAAO,kBAAoB,OAAelB,aAAgB,mBAAmB,EAAQA,EAAK;AACnG"}
@@ -1,4 +1,5 @@
1
1
  import type { ButtonFormControlMixinInstance } from '../internal/types/button.js';
2
+ /** @public */
2
3
  export type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from '../internal/types/button.js';
3
4
  interface ButtonFormControlHost {
4
5
  connectedCallback?(): void;
@@ -11,6 +12,9 @@ type Constructor = (new (...args: any[]) => HTMLElement & ButtonFormControlHost)
11
12
  observedAttributes?: string[];
12
13
  };
13
14
  type ButtonFormControlConstructor<TBase extends Constructor> = new (...args: ConstructorParameters<TBase>) => InstanceType<TBase> & ButtonFormControlMixinInstance;
15
+ /** @public
16
+ * @public
17
+ */
14
18
  export type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonFormControlConstructor<TBase> & {
15
19
  formAssociated: boolean;
16
20
  observedAttributes: string[];
@@ -18,5 +22,7 @@ export type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonForm
18
22
  /**
19
23
  * @description A mixin that adds native button-style form, command, popover, and interaction behavior.
20
24
  * @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/
25
+ * @public
21
26
  */
27
+ /** @public */
22
28
  export declare function ButtonFormControlMixin<TBase extends Constructor>(SuperClass: TBase): ButtonFormControlMixinReturn<TBase>;
@@ -12,7 +12,7 @@ import { StateExpandedController as h } from "../internal/controllers/state-expa
12
12
  import { StatePressedController as g } from "../internal/controllers/state-pressed.controller.js";
13
13
  import { StateReadOnlyController as _ } from "../internal/controllers/state-readonly.controller.js";
14
14
  import { StateSelectedController as v } from "../internal/controllers/state-selected.controller.js";
15
- //#region src/mixins/button.ts
15
+ // src/mixins/button.ts
16
16
  var y = {
17
17
  commandfor: "commandForElement",
18
18
  interestfor: "interestForElement",
@@ -242,21 +242,15 @@ function b(b) {
242
242
  });
243
243
  }
244
244
  #y(e, t, n) {
245
- if (e !== "commandfor" && e !== "interestfor" && e !== "popovertarget") {
246
- if (e === "form" && (i(this.#a) && n === null || (this.#a = n, this.#j("form", t))), e === "popovertargetaction") {
247
- this.#D({
248
- property: "popoverTargetAction",
249
- value: n,
250
- reflect: !1
251
- });
252
- return;
253
- }
254
- this.#D({
255
- property: e,
256
- value: n,
257
- reflect: !1
258
- });
259
- }
245
+ e !== "commandfor" && e !== "interestfor" && e !== "popovertarget" && (e === "form" && (i(this.#a) && n === null || (this.#a = n, this.#j("form", t))), e === "popovertargetaction" ? this.#D({
246
+ property: "popoverTargetAction",
247
+ value: n,
248
+ reflect: !1
249
+ }) : this.#D({
250
+ property: e,
251
+ value: n,
252
+ reflect: !1
253
+ }));
260
254
  }
261
255
  #b(e, t) {
262
256
  let n = y[e];
@@ -276,7 +270,7 @@ function b(b) {
276
270
  }
277
271
  #w({ property: e, value: t, reflect: n, attribute: i = e }) {
278
272
  let a = this.#T(e);
279
- a === t && (!n || r(this, i, t ? "" : null)) || (this.#E(e, t), !(n && this.#A(i, t ? "" : null)) && (this.#j(e, a), this.#g()));
273
+ (a !== t || n && !r(this, i, t ? "" : null)) && (this.#E(e, t), !(n && this.#A(i, t ? "" : null)) && (this.#j(e, a), this.#g()));
280
274
  }
281
275
  #T(e) {
282
276
  return {
@@ -292,7 +286,7 @@ function b(b) {
292
286
  }
293
287
  #D({ property: e, value: t, attribute: i = e, reflect: a = !0 }) {
294
288
  let o = this.#O(e), s = n(t);
295
- o === s && (!a || r(this, i, s)) || (this.#k(e, s), !(a && this.#A(i, s)) && (this.#j(e, o), this.#g()));
289
+ (o !== s || a && !r(this, i, s)) && (this.#k(e, s), !(a && this.#A(i, s)) && (this.#j(e, o), this.#g()));
296
290
  }
297
291
  #O(e) {
298
292
  return {
@@ -328,7 +322,6 @@ function b(b) {
328
322
  }
329
323
  };
330
324
  }
331
- //#endregion
332
325
  export { b as ButtonFormControlMixin };
333
326
 
334
327
  //# sourceMappingURL=button.js.map