@nvidia-elements/core 2.8.1 → 2.9.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 (177) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/accordion/accordion2.js +4 -4
  3. package/dist/alert/alert-group2.js +1 -1
  4. package/dist/alert/alert2.js +1 -1
  5. package/dist/avatar/avatar-group2.js +1 -1
  6. package/dist/avatar/avatar2.js +1 -1
  7. package/dist/badge/badge2.js +1 -1
  8. package/dist/breadcrumb/breadcrumb2.js +1 -1
  9. package/dist/bundle.d.ts +2 -0
  10. package/dist/bundles/index.d.ts +205 -0
  11. package/dist/bundles/index.js +6 -6
  12. package/dist/button/button2.js +1 -1
  13. package/dist/button-group/button-group2.js +1 -1
  14. package/dist/card/card2.js +4 -4
  15. package/dist/chat-message/chat-message2.js +1 -1
  16. package/dist/checkbox/checkbox-group2.js +1 -1
  17. package/dist/checkbox/checkbox2.js +1 -1
  18. package/dist/color/color2.js +1 -1
  19. package/dist/combobox/combobox2.js +1 -1
  20. package/dist/copy-button/copy-button2.js +1 -1
  21. package/dist/custom-elements-jsx.d.ts +109 -0
  22. package/dist/custom-elements-vue.d.ts +107 -0
  23. package/dist/custom-elements.json +3321 -66
  24. package/dist/data.html.json +94 -0
  25. package/dist/data.snippets.json +45 -45
  26. package/dist/date/date2.js +1 -1
  27. package/dist/datetime/datetime2.js +1 -1
  28. package/dist/dialog/dialog-footer2.js +1 -1
  29. package/dist/dialog/dialog-header2.js +1 -1
  30. package/dist/dialog/dialog2.js +1 -1
  31. package/dist/divider/divider2.js +1 -1
  32. package/dist/dot/dot2.js +1 -1
  33. package/dist/drawer/drawer-content2.js +1 -1
  34. package/dist/drawer/drawer-footer2.js +1 -1
  35. package/dist/drawer/drawer-header2.js +1 -1
  36. package/dist/drawer/drawer2.js +1 -1
  37. package/dist/dropdown/dropdown-footer2.js +1 -1
  38. package/dist/dropdown/dropdown-header2.js +1 -1
  39. package/dist/dropdown/dropdown2.js +1 -1
  40. package/dist/dropdown-group/dropdown-group.js +1 -1
  41. package/dist/dropzone/dropzone2.js +1 -1
  42. package/dist/file/file2.js +1 -1
  43. package/dist/format-bytes/format-bytes2.js +1 -1
  44. package/dist/format-datetime/format-datetime2.js +1 -1
  45. package/dist/format-number/format-number2.js +1 -1
  46. package/dist/format-relative-time/format-relative-time2.js +1 -1
  47. package/dist/format-truncate/format-truncate2.js +1 -1
  48. package/dist/forms/control/control2.js +1 -1
  49. package/dist/forms/control-group/control-group2.js +1 -1
  50. package/dist/forms/control-message/control-message2.js +1 -1
  51. package/dist/gauge/gauge2.js +1 -1
  52. package/dist/grid/cell/cell2.js +1 -1
  53. package/dist/grid/column/column2.js +1 -1
  54. package/dist/grid/footer/footer2.js +1 -1
  55. package/dist/grid/grid2.js +1 -1
  56. package/dist/grid/header/header2.js +1 -1
  57. package/dist/grid/placeholder/placeholder2.js +1 -1
  58. package/dist/grid/row/row2.js +1 -1
  59. package/dist/icon/icon2.js +2 -2
  60. package/dist/icon-button/icon-button2.js +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/input/input-group2.js +1 -1
  63. package/dist/input/input2.js +1 -1
  64. package/dist/internal/controllers/gesture.controller.d.ts +122 -42
  65. package/dist/internal/controllers/gesture.controller.examples.js.map +1 -1
  66. package/dist/internal/controllers/gesture.controller.examples.json +2 -2
  67. package/dist/internal/controllers/gesture.controller.js +300 -159
  68. package/dist/internal/controllers/gesture.controller.js.map +1 -1
  69. package/dist/internal/controllers/key-state.controller.d.ts +18 -0
  70. package/dist/internal/controllers/key-state.controller.js +84 -0
  71. package/dist/internal/controllers/key-state.controller.js.map +1 -0
  72. package/dist/internal/controllers/keynav-spatial.controller.d.ts +4 -1
  73. package/dist/internal/controllers/keynav-spatial.controller.js +7 -6
  74. package/dist/internal/controllers/keynav-spatial.controller.js.map +1 -1
  75. package/dist/internal/index.d.ts +2 -0
  76. package/dist/internal/index.js +29 -27
  77. package/dist/internal/services/global.service.js +1 -1
  78. package/dist/internal/utils/dom.d.ts +1 -0
  79. package/dist/internal/utils/dom.js +42 -38
  80. package/dist/internal/utils/dom.js.map +1 -1
  81. package/dist/internal/utils/focus.d.ts +2 -0
  82. package/dist/internal/utils/focus.js +14 -7
  83. package/dist/internal/utils/focus.js.map +1 -1
  84. package/dist/internal/utils/numeric.d.ts +3 -0
  85. package/dist/internal/utils/numeric.js +14 -0
  86. package/dist/internal/utils/numeric.js.map +1 -0
  87. package/dist/logo/logo2.js +1 -1
  88. package/dist/menu/menu-item2.js +1 -1
  89. package/dist/menu/menu2.js +1 -1
  90. package/dist/month/month2.js +1 -1
  91. package/dist/notification/notification-group2.js +1 -1
  92. package/dist/notification/notification2.js +1 -1
  93. package/dist/page/page-panel/page-panel-content2.js +1 -1
  94. package/dist/page/page-panel/page-panel-footer2.js +1 -1
  95. package/dist/page/page-panel/page-panel-header2.js +1 -1
  96. package/dist/page/page-panel/page-panel2.js +1 -1
  97. package/dist/page/page2.js +1 -1
  98. package/dist/page-header/page-header2.js +1 -1
  99. package/dist/page-loader/page-loader2.js +1 -1
  100. package/dist/pagination/pagination2.js +1 -1
  101. package/dist/panel/panel2.js +4 -4
  102. package/dist/password/password2.js +1 -1
  103. package/dist/preferences-input/preferences-input2.js +1 -1
  104. package/dist/progress-bar/progress-bar2.js +1 -1
  105. package/dist/progress-ring/progress-ring2.js +1 -1
  106. package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
  107. package/dist/pulse/pulse2.js +1 -1
  108. package/dist/radio/radio-group2.js +1 -1
  109. package/dist/radio/radio2.js +1 -1
  110. package/dist/range/range2.js +1 -1
  111. package/dist/resize-handle/resize-handle2.js +6 -10
  112. package/dist/resize-handle/resize-handle2.js.map +1 -1
  113. package/dist/search/search2.js +1 -1
  114. package/dist/select/select2.js +1 -1
  115. package/dist/skeleton/skeleton2.js +1 -1
  116. package/dist/sort-button/sort-button2.js +1 -1
  117. package/dist/sparkline/sparkline2.js +1 -1
  118. package/dist/star-rating/star-rating2.js +1 -1
  119. package/dist/steps/steps2.js +2 -2
  120. package/dist/switch/switch-group2.js +1 -1
  121. package/dist/switch/switch2.js +1 -1
  122. package/dist/tabs/tabs-group2.js +1 -1
  123. package/dist/tabs/tabs2.js +2 -2
  124. package/dist/tag/tag2.js +1 -1
  125. package/dist/textarea/textarea2.js +1 -1
  126. package/dist/time/time2.js +1 -1
  127. package/dist/toast/toast2.js +1 -1
  128. package/dist/toggletip/toggletip-footer2.js +1 -1
  129. package/dist/toggletip/toggletip-header2.js +1 -1
  130. package/dist/toggletip/toggletip2.js +1 -1
  131. package/dist/toolbar/toolbar2.js +1 -1
  132. package/dist/tooltip/tooltip2.js +1 -1
  133. package/dist/tree/tree-node2.js +1 -1
  134. package/dist/tree/tree2.js +1 -1
  135. package/dist/viewport/define.d.ts +7 -0
  136. package/dist/viewport/define.js +7 -0
  137. package/dist/viewport/define.js.map +1 -0
  138. package/dist/viewport/index.d.ts +3 -0
  139. package/dist/viewport/index.js +3 -0
  140. package/dist/viewport/viewport-animation.controller.d.ts +21 -0
  141. package/dist/viewport/viewport-animation.controller.js +93 -0
  142. package/dist/viewport/viewport-animation.controller.js.map +1 -0
  143. package/dist/viewport/viewport-autofit.controller.d.ts +18 -0
  144. package/dist/viewport/viewport-autofit.controller.js +105 -0
  145. package/dist/viewport/viewport-autofit.controller.js.map +1 -0
  146. package/dist/viewport/viewport-fitting.utils.d.ts +36 -0
  147. package/dist/viewport/viewport-fitting.utils.js +35 -0
  148. package/dist/viewport/viewport-fitting.utils.js.map +1 -0
  149. package/dist/viewport/viewport-gesture-navigation.controller.d.ts +29 -0
  150. package/dist/viewport/viewport-gesture-navigation.controller.js +311 -0
  151. package/dist/viewport/viewport-gesture-navigation.controller.js.map +1 -0
  152. package/dist/viewport/viewport-gridlines.d.ts +38 -0
  153. package/dist/viewport/viewport-gridlines.js +6 -0
  154. package/dist/viewport/viewport-gridlines.js.map +1 -0
  155. package/dist/viewport/viewport-gridlines.utils.d.ts +11 -0
  156. package/dist/viewport/viewport-gridlines.utils.js +54 -0
  157. package/dist/viewport/viewport-gridlines.utils.js.map +1 -0
  158. package/dist/viewport/viewport-gridlines2.js +154 -0
  159. package/dist/viewport/viewport-gridlines2.js.map +1 -0
  160. package/dist/viewport/viewport-navigation.controller.d.ts +27 -0
  161. package/dist/viewport/viewport-navigation.controller.js +142 -0
  162. package/dist/viewport/viewport-navigation.controller.js.map +1 -0
  163. package/dist/viewport/viewport-navigation.types.d.ts +9 -0
  164. package/dist/viewport/viewport-projection.utils.d.ts +7 -0
  165. package/dist/viewport/viewport-projection.utils.js +25 -0
  166. package/dist/viewport/viewport-projection.utils.js.map +1 -0
  167. package/dist/viewport/viewport.d.ts +92 -0
  168. package/dist/viewport/viewport.examples.js +6 -0
  169. package/dist/viewport/viewport.examples.js.map +1 -0
  170. package/dist/viewport/viewport.examples.json +60 -0
  171. package/dist/viewport/viewport.js +6 -0
  172. package/dist/viewport/viewport.js.map +1 -0
  173. package/dist/viewport/viewport.types.d.ts +66 -0
  174. package/dist/viewport/viewport2.js +375 -0
  175. package/dist/viewport/viewport2.js.map +1 -0
  176. package/dist/week/week2.js +1 -1
  177. package/package.json +13 -1
@@ -0,0 +1,18 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export interface KeyStateControllerOptions {
3
+ readonly watchedCodes: ReadonlyArray<string>;
4
+ }
5
+ type KeyStateHost = ReactiveControllerHost & Pick<HTMLElement, 'ownerDocument'>;
6
+ /** Provides host-scoped access to shared raw keyboard state without assigning interaction semantics to any key. */
7
+ export declare class KeyStateController implements ReactiveController {
8
+ #private;
9
+ constructor(host: KeyStateHost, { watchedCodes }: KeyStateControllerOptions);
10
+ /** Enables shared keyboard tracking during the host's connected lifecycle. */
11
+ get enabled(): boolean;
12
+ set enabled(value: boolean);
13
+ /** Returns whether a key identified by `KeyboardEvent.code` is currently held. */
14
+ isPressed(code: string): boolean;
15
+ hostConnected(): void;
16
+ hostDisconnected(): void;
17
+ }
18
+ export {};
@@ -0,0 +1,84 @@
1
+ //#region src/internal/controllers/key-state.controller.ts
2
+ var e = class {
3
+ #e;
4
+ #t = /* @__PURE__ */ new Set();
5
+ #n = /* @__PURE__ */ new Set();
6
+ constructor(e) {
7
+ this.#e = e;
8
+ }
9
+ subscribe(e) {
10
+ this.#n.has(e) || (this.#n.size === 0 && this.#r(), this.#n.add(e));
11
+ }
12
+ unsubscribe(e) {
13
+ !this.#n.delete(e) || this.#n.size > 0 || (this.#i(), this.#t.clear());
14
+ }
15
+ isPressed(e) {
16
+ return this.#t.has(e);
17
+ }
18
+ #r() {
19
+ let e = this.#e.defaultView;
20
+ e?.addEventListener("keydown", this.#a, !0), e?.addEventListener("keyup", this.#o, !0), e?.addEventListener("blur", this.#c), this.#e.addEventListener("visibilitychange", this.#s);
21
+ }
22
+ #i() {
23
+ let e = this.#e.defaultView;
24
+ e?.removeEventListener("keydown", this.#a, !0), e?.removeEventListener("keyup", this.#o, !0), e?.removeEventListener("blur", this.#c), this.#e.removeEventListener("visibilitychange", this.#s);
25
+ }
26
+ #a = (e) => {
27
+ this.#t.has(e.code) || (this.#t.add(e.code), this.#l(e.code));
28
+ };
29
+ #o = (e) => {
30
+ this.#t.delete(e.code) && this.#l(e.code);
31
+ };
32
+ #s = () => {
33
+ this.#e.visibilityState === "hidden" && this.#c();
34
+ };
35
+ #c = () => {
36
+ if (this.#t.size === 0) return;
37
+ let e = [...this.#t];
38
+ this.#t.clear();
39
+ for (let t of this.#n) e.some((e) => t.watchedCodes.has(e)) && t.requestUpdate();
40
+ };
41
+ #l(e) {
42
+ for (let t of this.#n) t.watchedCodes.has(e) && t.requestUpdate();
43
+ }
44
+ }, t = /* @__PURE__ */ new WeakMap();
45
+ function n(n) {
46
+ let r = t.get(n);
47
+ return r || (r = new e(n), t.set(n, r)), r;
48
+ }
49
+ var r = class {
50
+ #e;
51
+ #t;
52
+ #n = !1;
53
+ #r = !1;
54
+ #i;
55
+ constructor(e, { watchedCodes: t }) {
56
+ this.#e = e, this.#t = {
57
+ watchedCodes: new Set(t),
58
+ requestUpdate: () => e.requestUpdate()
59
+ }, e.addController(this);
60
+ }
61
+ get enabled() {
62
+ return this.#r;
63
+ }
64
+ set enabled(e) {
65
+ e !== this.#r && (this.#r = e, this.#a());
66
+ }
67
+ isPressed(e) {
68
+ return this.#i?.isPressed(e) ?? !1;
69
+ }
70
+ hostConnected() {
71
+ this.#n = !0, this.#a();
72
+ }
73
+ hostDisconnected() {
74
+ this.#n = !1, this.#a();
75
+ }
76
+ #a() {
77
+ let e = this.#n && this.#r ? n(this.#e.ownerDocument) : void 0;
78
+ e !== this.#i && (this.#i?.unsubscribe(this.#t), this.#i = e, this.#i?.subscribe(this.#t));
79
+ }
80
+ };
81
+ //#endregion
82
+ export { r as KeyStateController };
83
+
84
+ //# sourceMappingURL=key-state.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-state.controller.js","names":[],"sources":["../../../src/internal/controllers/key-state.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, ReactiveControllerHost } from 'lit';\n\nexport interface KeyStateControllerOptions {\n readonly watchedCodes: ReadonlyArray<string>;\n}\n\ntype KeyStateHost = ReactiveControllerHost & Pick<HTMLElement, 'ownerDocument'>;\n\ninterface KeyStateSubscriber {\n readonly watchedCodes: ReadonlySet<string>;\n readonly requestUpdate: () => void;\n}\n\n/** Owns the keyboard state and global listeners shared by active controllers in one document. */\nclass DocumentKeyStateSource {\n readonly #document: Document;\n readonly #pressedCodes = new Set<string>();\n readonly #subscribers = new Set<KeyStateSubscriber>();\n\n constructor(document: Document) {\n this.#document = document;\n }\n\n subscribe(subscriber: KeyStateSubscriber): void {\n if (this.#subscribers.has(subscriber)) return;\n if (this.#subscribers.size === 0) this.#addListeners();\n this.#subscribers.add(subscriber);\n }\n\n unsubscribe(subscriber: KeyStateSubscriber): void {\n if (!this.#subscribers.delete(subscriber) || this.#subscribers.size > 0) return;\n this.#removeListeners();\n this.#pressedCodes.clear();\n }\n\n isPressed(code: string): boolean {\n return this.#pressedCodes.has(code);\n }\n\n #addListeners(): void {\n const view = this.#document.defaultView;\n view?.addEventListener('keydown', this.#handleKeyDown, true);\n view?.addEventListener('keyup', this.#handleKeyUp, true);\n view?.addEventListener('blur', this.#clear);\n this.#document.addEventListener('visibilitychange', this.#handleVisibilityChange);\n }\n\n #removeListeners(): void {\n const view = this.#document.defaultView;\n view?.removeEventListener('keydown', this.#handleKeyDown, true);\n view?.removeEventListener('keyup', this.#handleKeyUp, true);\n view?.removeEventListener('blur', this.#clear);\n this.#document.removeEventListener('visibilitychange', this.#handleVisibilityChange);\n }\n\n #handleKeyDown = (event: KeyboardEvent): void => {\n if (this.#pressedCodes.has(event.code)) return;\n this.#pressedCodes.add(event.code);\n this.#notifySubscribers(event.code);\n };\n\n #handleKeyUp = (event: KeyboardEvent): void => {\n if (!this.#pressedCodes.delete(event.code)) return;\n this.#notifySubscribers(event.code);\n };\n\n #handleVisibilityChange = (): void => {\n if (this.#document.visibilityState === 'hidden') this.#clear();\n };\n\n #clear = (): void => {\n if (this.#pressedCodes.size === 0) return;\n const changedCodes = [...this.#pressedCodes];\n this.#pressedCodes.clear();\n for (const subscriber of this.#subscribers) {\n if (changedCodes.some(code => subscriber.watchedCodes.has(code))) subscriber.requestUpdate();\n }\n };\n\n #notifySubscribers(code: string): void {\n for (const subscriber of this.#subscribers) {\n if (subscriber.watchedCodes.has(code)) subscriber.requestUpdate();\n }\n }\n}\n\nconst documentKeyStateSources = new WeakMap<Document, DocumentKeyStateSource>();\n\nfunction keyStateSourceFor(document: Document): DocumentKeyStateSource {\n let source = documentKeyStateSources.get(document);\n if (!source) {\n source = new DocumentKeyStateSource(document);\n documentKeyStateSources.set(document, source);\n }\n return source;\n}\n\n/** Provides host-scoped access to shared raw keyboard state without assigning interaction semantics to any key. */\nexport class KeyStateController implements ReactiveController {\n readonly #host: KeyStateHost;\n readonly #subscriber: KeyStateSubscriber;\n #connected = false;\n #enabled = false;\n #source?: DocumentKeyStateSource;\n\n constructor(host: KeyStateHost, { watchedCodes }: KeyStateControllerOptions) {\n this.#host = host;\n this.#subscriber = {\n watchedCodes: new Set(watchedCodes),\n requestUpdate: () => host.requestUpdate()\n };\n host.addController(this);\n }\n\n /** Enables shared keyboard tracking during the host's connected lifecycle. */\n get enabled(): boolean {\n return this.#enabled;\n }\n\n set enabled(value: boolean) {\n if (value === this.#enabled) return;\n this.#enabled = value;\n this.#syncSubscription();\n }\n\n /** Returns whether a key identified by `KeyboardEvent.code` is currently held. */\n isPressed(code: string): boolean {\n return this.#source?.isPressed(code) ?? false;\n }\n\n hostConnected(): void {\n this.#connected = true;\n this.#syncSubscription();\n }\n\n hostDisconnected(): void {\n this.#connected = false;\n this.#syncSubscription();\n }\n\n #syncSubscription(): void {\n const source = this.#connected && this.#enabled ? keyStateSourceFor(this.#host.ownerDocument) : undefined;\n if (source === this.#source) return;\n this.#source?.unsubscribe(this.#subscriber);\n this.#source = source;\n this.#source?.subscribe(this.#subscriber);\n }\n}\n"],"mappings":";AAiBA,IAAM,IAAN,MAA6B;CAC3B;CACA,qBAAyB,IAAI,IAAY;CACzC,qBAAwB,IAAI,IAAwB;CAEpD,YAAY,GAAoB;EAC9B,KAAK,KAAY;CACnB;CAEA,UAAU,GAAsC;EAC1C,KAAK,GAAa,IAAI,CAAU,MAChC,KAAK,GAAa,SAAS,KAAG,KAAK,GAAc,GACrD,KAAK,GAAa,IAAI,CAAU;CAClC;CAEA,YAAY,GAAsC;EAC5C,CAAC,KAAK,GAAa,OAAO,CAAU,KAAK,KAAK,GAAa,OAAO,MACtE,KAAK,GAAiB,GACtB,KAAK,GAAc,MAAM;CAC3B;CAEA,UAAU,GAAuB;EAC/B,OAAO,KAAK,GAAc,IAAI,CAAI;CACpC;CAEA,KAAsB;EACpB,IAAM,IAAO,KAAK,G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AAwB,IAAI,GAAU,CAAM,IAEvC;AACT;AAGA,IAAa,IAAb,MAA8D;CAC5D;CACA;CACA,KAAa;CACb,KAAW;CACX;CAEA,YAAY,GAAoB,EAAE,mBAA2C;EAM3E,AALA,KAAK,KAAQ,GACb,KAAK,KAAc;GACjB,cAAc,IAAI,IAAI,CAAY;GAClC,qBAAqB,EAAK,cAAc;EAC1C,GACA,EAAK,cAAc,IAAI;CACzB;CAGA,IAAI,UAAmB;EACrB,OAAO,KAAK;CACd;CAEA,IAAI,QAAQ,GAAgB;EACtB,MAAU,KAAK,OACnB,KAAK,KAAW,GAChB,KAAK,GAAkB;CACzB;CAGA,UAAU,GAAuB;EAC/B,OAAO,KAAK,IAAS,UAAU,CAAI,KAAK;CAC1C;CAEA,gBAAsB;EAEpB,AADA,KAAK,KAAa,IAClB,KAAK,GAAkB;CACzB;CAEA,mBAAyB;EAEvB,AADA,KAAK,KAAa,IAClB,KAAK,GAAkB;CACzB;CAEA,KAA0B;EACxB,IAAM,IAAS,KAAK,MAAc,KAAK,KAAW,EAAkB,KAAK,GAAM,aAAa,IAAI,KAAA;EAC5F,MAAW,KAAK,OACpB,KAAK,IAAS,YAAY,KAAK,EAAW,GAC1C,KAAK,KAAU,GACf,KAAK,IAAS,UAAU,KAAK,EAAW;CAC1C;AACF"}
@@ -1,6 +1,9 @@
1
1
  import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
2
  type SpatialKeyHost = ReactiveControllerHost & HTMLElement;
3
3
  export type SpatialKeyHandling = 'handled' | 'ignored';
4
+ export interface KeyNavigationSpatialControllerOptions {
5
+ readonly isEnabled?: () => boolean;
6
+ }
4
7
  export type SpatialKeyCommand = {
5
8
  readonly ctrlKey: boolean;
6
9
  readonly event: KeyboardEvent;
@@ -17,7 +20,7 @@ export type SpatialKeyCommand = {
17
20
  /** Converts direct-host keyboard input into spatial direction and zoom commands. */
18
21
  export declare class KeyNavigationSpatialController implements ReactiveController {
19
22
  #private;
20
- constructor(host: SpatialKeyHost);
23
+ constructor(host: SpatialKeyHost, { isEnabled }?: KeyNavigationSpatialControllerOptions);
21
24
  hostConnected(): void;
22
25
  hostDisconnected(): void;
23
26
  }
@@ -1,17 +1,18 @@
1
1
  //#region src/internal/controllers/keynav-spatial.controller.ts
2
2
  var e = class {
3
3
  #e;
4
- constructor(e) {
5
- this.#e = e, e.addController(this);
4
+ #t;
5
+ constructor(e, { isEnabled: t = () => !0 } = {}) {
6
+ this.#e = e, this.#t = t, e.addController(this);
6
7
  }
7
8
  hostConnected() {
8
- this.#e.addEventListener("keydown", this.#t);
9
+ this.#e.addEventListener("keydown", this.#n);
9
10
  }
10
11
  hostDisconnected() {
11
- this.#e.removeEventListener("keydown", this.#t);
12
+ this.#e.removeEventListener("keydown", this.#n);
12
13
  }
13
- #t = (e) => {
14
- if (e.composedPath()[0] !== this.#e) return;
14
+ #n = (e) => {
15
+ if (!this.#t() || e.composedPath()[0] !== this.#e) return;
15
16
  let n = t(e);
16
17
  n && this.#e.dispatchEvent(new CustomEvent("nve-key", {
17
18
  bubbles: !1,
@@ -1 +1 @@
1
- {"version":3,"file":"keynav-spatial.controller.js","names":[],"sources":["../../../src/internal/controllers/keynav-spatial.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, ReactiveControllerHost } from 'lit';\n\ntype SpatialKeyHost = ReactiveControllerHost & HTMLElement;\n\nexport type SpatialKeyHandling = 'handled' | 'ignored';\n\nexport type SpatialKeyCommand =\n | {\n readonly ctrlKey: boolean;\n readonly event: KeyboardEvent;\n readonly kind: 'direction';\n readonly horizontal: -1 | 0 | 1;\n readonly key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp';\n readonly shiftKey: boolean;\n readonly vertical: -1 | 0 | 1;\n }\n | {\n readonly event: KeyboardEvent;\n readonly kind: 'zoom';\n readonly key: '+' | '-' | '=';\n };\n\n/** Converts direct-host keyboard input into spatial direction and zoom commands. */\nexport class KeyNavigationSpatialController implements ReactiveController {\n readonly #host: SpatialKeyHost;\n\n constructor(host: SpatialKeyHost) {\n this.#host = host;\n host.addController(this);\n }\n\n hostConnected(): void {\n this.#host.addEventListener('keydown', this.#handleKeydown);\n }\n\n hostDisconnected(): void {\n this.#host.removeEventListener('keydown', this.#handleKeydown);\n }\n\n #handleKeydown = (event: KeyboardEvent): void => {\n if (event.composedPath()[0] !== this.#host) return;\n const command = getSpatialKeyCommand(event);\n if (!command) return;\n this.#host.dispatchEvent(\n new CustomEvent<SpatialKeyCommand>('nve-key', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: command\n })\n );\n };\n}\n\nfunction getSpatialKeyCommand(event: KeyboardEvent): SpatialKeyCommand | undefined {\n switch (event.key) {\n case 'ArrowDown':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: -1\n };\n case 'ArrowLeft':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: -1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowRight':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowUp':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 1\n };\n case '+':\n case '-':\n case '=':\n return { event, key: event.key, kind: 'zoom' };\n default:\n return undefined;\n }\n}\n"],"mappings":";AA0BA,IAAa,IAAb,MAA0E;CACxE;CAEA,YAAY,GAAsB;EAEhC,AADA,KAAK,KAAQ,GACb,EAAK,cAAc,IAAI;CACzB;CAEA,gBAAsB;EACpB,KAAK,GAAM,iBAAiB,WAAW,KAAK,EAAc;CAC5D;CAEA,mBAAyB;EACvB,KAAK,GAAM,oBAAoB,WAAW,KAAK,EAAc;CAC/D;CAEA,MAAkB,MAA+B;EAC/C,IAAI,EAAM,aAAa,CAAC,CAAC,OAAO,KAAK,IAAO;EAC5C,IAAM,IAAU,EAAqB,CAAK;EACrC,KACL,KAAK,GAAM,cACT,IAAI,YAA+B,WAAW;GAC5C,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;EACV,CAAC,CACH;CACF;AACF;AAEA,SAAS,EAAqB,GAAqD;CACjF,QAAQ,EAAM,KAAd;EACE,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,cACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,WACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK;EACL,KAAK;EACL,KAAK,KACH,OAAO;GAAE;GAAO,KAAK,EAAM;GAAK,MAAM;EAAO;EAC/C,SACE;CACJ;AACF"}
1
+ {"version":3,"file":"keynav-spatial.controller.js","names":[],"sources":["../../../src/internal/controllers/keynav-spatial.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, ReactiveControllerHost } from 'lit';\n\ntype SpatialKeyHost = ReactiveControllerHost & HTMLElement;\n\nexport type SpatialKeyHandling = 'handled' | 'ignored';\n\nexport interface KeyNavigationSpatialControllerOptions {\n readonly isEnabled?: () => boolean;\n}\n\nexport type SpatialKeyCommand =\n | {\n readonly ctrlKey: boolean;\n readonly event: KeyboardEvent;\n readonly kind: 'direction';\n readonly horizontal: -1 | 0 | 1;\n readonly key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp';\n readonly shiftKey: boolean;\n readonly vertical: -1 | 0 | 1;\n }\n | {\n readonly event: KeyboardEvent;\n readonly kind: 'zoom';\n readonly key: '+' | '-' | '=';\n };\n\n/** Converts direct-host keyboard input into spatial direction and zoom commands. */\nexport class KeyNavigationSpatialController implements ReactiveController {\n readonly #host: SpatialKeyHost;\n readonly #isEnabled: () => boolean;\n\n constructor(host: SpatialKeyHost, { isEnabled = () => true }: KeyNavigationSpatialControllerOptions = {}) {\n this.#host = host;\n this.#isEnabled = isEnabled;\n host.addController(this);\n }\n\n hostConnected(): void {\n this.#host.addEventListener('keydown', this.#handleKeydown);\n }\n\n hostDisconnected(): void {\n this.#host.removeEventListener('keydown', this.#handleKeydown);\n }\n\n #handleKeydown = (event: KeyboardEvent): void => {\n if (!this.#isEnabled() || event.composedPath()[0] !== this.#host) return;\n const command = getSpatialKeyCommand(event);\n if (!command) return;\n this.#host.dispatchEvent(\n new CustomEvent<SpatialKeyCommand>('nve-key', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: command\n })\n );\n };\n}\n\nfunction getSpatialKeyCommand(event: KeyboardEvent): SpatialKeyCommand | undefined {\n switch (event.key) {\n case 'ArrowDown':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: -1\n };\n case 'ArrowLeft':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: -1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowRight':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowUp':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 1\n };\n case '+':\n case '-':\n case '=':\n return { event, key: event.key, kind: 'zoom' };\n default:\n return undefined;\n }\n}\n"],"mappings":";AA8BA,IAAa,IAAb,MAA0E;CACxE;CACA;CAEA,YAAY,GAAsB,EAAE,qBAAkB,OAAgD,CAAC,GAAG;EAGxG,AAFA,KAAK,KAAQ,GACb,KAAK,KAAa,GAClB,EAAK,cAAc,IAAI;CACzB;CAEA,gBAAsB;EACpB,KAAK,GAAM,iBAAiB,WAAW,KAAK,EAAc;CAC5D;CAEA,mBAAyB;EACvB,KAAK,GAAM,oBAAoB,WAAW,KAAK,EAAc;CAC/D;CAEA,MAAkB,MAA+B;EAC/C,IAAI,CAAC,KAAK,GAAW,KAAK,EAAM,aAAa,CAAC,CAAC,OAAO,KAAK,IAAO;EAClE,IAAM,IAAU,EAAqB,CAAK;EACrC,KACL,KAAK,GAAM,cACT,IAAI,YAA+B,WAAW;GAC5C,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;EACV,CAAC,CACH;CACF;AACF;AAEA,SAAS,EAAqB,GAAqD;CACjF,QAAQ,EAAM,KAAd;EACE,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,cACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,WACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK;EACL,KAAK;EACL,KAAK,KACH,OAAO;GAAE;GAAO,KAAK,EAAM;GAAK,MAAM;EAAO;EAC/C,SACE;CACJ;AACF"}
@@ -4,6 +4,7 @@
4
4
  export * from './controllers/audit.controller.js';
5
5
  export * from './controllers/gesture.controller.js';
6
6
  export * from './controllers/i18n.controller.js';
7
+ export * from './controllers/key-state.controller.js';
7
8
  export * from './controllers/keynav-grid.controller.js';
8
9
  export * from './controllers/keynav-list.controller.js';
9
10
  export * from './controllers/keynav-spatial.controller.js';
@@ -34,4 +35,5 @@ export * from './utils/objects.js';
34
35
  export * from './utils/strings.js';
35
36
  export * from './utils/focus.js';
36
37
  export * from './utils/keynav.js';
38
+ export * from './utils/numeric.js';
37
39
  export * from './utils/supports.js';
@@ -6,30 +6,32 @@ import { AuditController as p, audit as m, excessiveInstanceLimit as h } from ".
6
6
  import { GestureController as g } from "./controllers/gesture.controller.js";
7
7
  import { I18nService as _, I18nService_ as v } from "./services/i18n.service.js";
8
8
  import { I18nController as y, i18n as b } from "./controllers/i18n.controller.js";
9
- import { debounce as x, onChildListMutation as S, stopEvent as C, throttle as w } from "./utils/events.js";
10
- import { LogService as T } from "./services/log.service.js";
11
- import { focusElement as E, focusElementTimeout as D, getActiveElement as O, initializeKeyListItems as k, isFocusable as A, isSimpleFocusable as j, onListboxActivate as M, setActiveKeyListItem as N } from "./utils/focus.js";
12
- import { KeynavCode as P, appendAnchorName as F, appendRootNodeStyle as I, applySlotContentStates as L, clickOutsideElementBounds as R, createGhostElement as z, define as B, defineElement as V, endOfScrollBox as H, generateId as U, getAnchorNames as W, getAttributeChanges as G, getAttributeListChanges as K, getChildren as q, getDisplayValue as J, getElementUpdate as Y, getFlattenedDOMTree as X, getFlattenedFocusableItems as Z, getPropertyChanges as Q, getThemeTokens as $, hasHorizontalScrollBar as ee, hasInvalidDOMGrid as te, hasScrollBar as ne, isContextMenuClick as re, matchesElementName as ie, openEyeDropper as ae, parseTokenNumber as oe, removeAnchorName as se, removeEmptySlotWhitespace as ce, removeEmptyTextNode as le, sameOrderedStringArray as ue, sameRenderRoot as de, scrollBarWidth as fe, slotContainsOnlyWhitespace as pe, styleSheetToString as me, supportsScopedRegistry as he, uniqueNonEmptyStrings as ge, validKeyNavigationCode as _e } from "./utils/dom.js";
13
- import { KeyNavigationGridController as ve, getNextKeyGridItem as ye, keyNavigationGrid as be } from "./controllers/keynav-grid.controller.js";
14
- import { KeyNavigationListController as xe, getNextKeyListItem as Se, keyNavigationList as Ce } from "./controllers/keynav-list.controller.js";
15
- import { KeyNavigationSpatialController as we } from "./controllers/keynav-spatial.controller.js";
16
- import { associateAriaDescribedBy as Te, associateAriaLabel as Ee, associateControlGroup as De, associateDataList as Oe, associateLabel as ke, attachInternals as Ae } from "./utils/a11y.js";
17
- import { StateExpandedController as je, stateExpanded as Me } from "./controllers/state-expanded.controller.js";
18
- import { StateHighlightedController as Ne, stateHighlighted as Pe } from "./controllers/state-highlighted.controller.js";
19
- import { StateScrollController as Fe, stateScroll as Ie } from "./controllers/state-scroll.controller.js";
20
- import { StateSelectedController as Le, stateSelected as Re } from "./controllers/state-selected.controller.js";
21
- import { TypeAnchorController as ze, typeAnchor as Be } from "./controllers/type-anchor.controller.js";
22
- import { TypeClosableController as Ve } from "./controllers/type-closable.controller.js";
23
- import { TypeExpandableController as He } from "./controllers/type-expandable.controller.js";
24
- import { TypeSelectableController as Ue } from "./controllers/type-selectable.controller.js";
25
- import { TypeNativePopoverController as We } from "./controllers/type-native-popover.controller.js";
26
- import { TypeSSRController as Ge, typeSSR as Ke } from "./controllers/type-ssr.controller.js";
27
- import { hostAttr as qe } from "./decorators/host-attr.js";
28
- import { scopedRegistry as Je } from "./decorators/scoped-registry.js";
29
- import { colorStateStyles as Ye, statusStateStyles as Xe, supportStateStyles as Ze, useStyles as Qe } from "./styles/index.js";
30
- import { supportsCSSLegacyInsetArea as $e, supportsCSSPositionArea as et, supportsNativeCSSAnchorPosition as tt } from "./utils/supports.js";
31
- import { popoverStyles as nt } from "./styles/popover2.js";
32
- import { TransitionService as rt } from "./services/transition.service.js";
33
- import { statusIcons as it } from "./types/index.js";
34
- import { createLightDismiss as at, onKeys as ot } from "./utils/keynav.js";
35
- export { p as AuditController, e as DOCS_URL, g as GestureController, l as GlobalState, u as GlobalStateService, y as I18nController, _ as I18nService, v as I18nService_, ve as KeyNavigationGridController, xe as KeyNavigationListController, we as KeyNavigationSpatialController, P as KeynavCode, T as LogService, je as StateExpandedController, Ne as StateHighlightedController, Fe as StateScrollController, Le as StateSelectedController, rt as TransitionService, ze as TypeAnchorController, Ve as TypeClosableController, He as TypeExpandableController, We as TypeNativePopoverController, Ge as TypeSSRController, Ue as TypeSelectableController, F as appendAnchorName, I as appendRootNodeStyle, L as applySlotContentStates, Te as associateAriaDescribedBy, Ee as associateAriaLabel, De as associateControlGroup, Oe as associateDataList, ke as associateLabel, Ae as attachInternals, m as audit, d as auditParentElement, f as auditSlots, R as clickOutsideElementBounds, Ye as colorStateStyles, z as createGhostElement, at as createLightDismiss, x as debounce, r as deepMerge, B as define, V as defineElement, H as endOfScrollBox, h as excessiveInstanceLimit, E as focusElement, D as focusElementTimeout, t as formatFileSize, i as formatStandardNumber, U as generateId, O as getActiveElement, W as getAnchorNames, G as getAttributeChanges, K as getAttributeListChanges, q as getChildren, a as getDifference, J as getDisplayValue, Y as getElementUpdate, X as getFlattenedDOMTree, Z as getFlattenedFocusableItems, ye as getNextKeyGridItem, Se as getNextKeyListItem, Q as getPropertyChanges, $ as getThemeTokens, ee as hasHorizontalScrollBar, te as hasInvalidDOMGrid, ne as hasScrollBar, qe as hostAttr, b as i18n, k as initializeKeyListItems, re as isContextMenuClick, A as isFocusable, o as isObject, s as isObjectLiteral, j as isSimpleFocusable, be as keyNavigationGrid, Ce as keyNavigationList, ie as matchesElementName, S as onChildListMutation, ot as onKeys, M as onListboxActivate, ae as openEyeDropper, oe as parseTokenNumber, c as parseVersion, nt as popoverStyles, se as removeAnchorName, ce as removeEmptySlotWhitespace, le as removeEmptyTextNode, ue as sameOrderedStringArray, de as sameRenderRoot, Je as scopedRegistry, fe as scrollBarWidth, N as setActiveKeyListItem, n as shiftLeft, pe as slotContainsOnlyWhitespace, Me as stateExpanded, Pe as stateHighlighted, Ie as stateScroll, Re as stateSelected, it as statusIcons, Xe as statusStateStyles, C as stopEvent, me as styleSheetToString, Ze as supportStateStyles, $e as supportsCSSLegacyInsetArea, et as supportsCSSPositionArea, tt as supportsNativeCSSAnchorPosition, he as supportsScopedRegistry, w as throttle, Be as typeAnchor, Ke as typeSSR, ge as uniqueNonEmptyStrings, Qe as useStyles, _e as validKeyNavigationCode };
9
+ import { KeyStateController as x } from "./controllers/key-state.controller.js";
10
+ import { debounce as S, onChildListMutation as C, stopEvent as w, throttle as T } from "./utils/events.js";
11
+ import { LogService as E } from "./services/log.service.js";
12
+ import { focusElement as D, focusElementTimeout as O, getActiveElement as k, initializeKeyListItems as A, isFocusable as j, isImmediateRootActiveElement as M, isSimpleFocusable as N, onListboxActivate as P, setActiveKeyListItem as F } from "./utils/focus.js";
13
+ import { KeynavCode as I, appendAnchorName as L, appendRootNodeStyle as R, applySlotContentStates as z, clickOutsideElementBounds as B, createGhostElement as V, define as H, defineElement as U, endOfScrollBox as W, generateId as G, getAnchorNames as K, getAttributeChanges as q, getAttributeListChanges as J, getChildren as Y, getCustomElementRegistry as X, getDisplayValue as Z, getElementUpdate as Q, getFlattenedDOMTree as $, getFlattenedFocusableItems as ee, getPropertyChanges as te, getThemeTokens as ne, hasHorizontalScrollBar as re, hasInvalidDOMGrid as ie, hasScrollBar as ae, isContextMenuClick as oe, matchesElementName as se, openEyeDropper as ce, parseTokenNumber as le, removeAnchorName as ue, removeEmptySlotWhitespace as de, removeEmptyTextNode as fe, sameOrderedStringArray as pe, sameRenderRoot as me, scrollBarWidth as he, slotContainsOnlyWhitespace as ge, styleSheetToString as _e, supportsScopedRegistry as ve, uniqueNonEmptyStrings as ye, validKeyNavigationCode as be } from "./utils/dom.js";
14
+ import { KeyNavigationGridController as xe, getNextKeyGridItem as Se, keyNavigationGrid as Ce } from "./controllers/keynav-grid.controller.js";
15
+ import { KeyNavigationListController as we, getNextKeyListItem as Te, keyNavigationList as Ee } from "./controllers/keynav-list.controller.js";
16
+ import { KeyNavigationSpatialController as De } from "./controllers/keynav-spatial.controller.js";
17
+ import { associateAriaDescribedBy as Oe, associateAriaLabel as ke, associateControlGroup as Ae, associateDataList as je, associateLabel as Me, attachInternals as Ne } from "./utils/a11y.js";
18
+ import { StateExpandedController as Pe, stateExpanded as Fe } from "./controllers/state-expanded.controller.js";
19
+ import { StateHighlightedController as Ie, stateHighlighted as Le } from "./controllers/state-highlighted.controller.js";
20
+ import { StateScrollController as Re, stateScroll as ze } from "./controllers/state-scroll.controller.js";
21
+ import { StateSelectedController as Be, stateSelected as Ve } from "./controllers/state-selected.controller.js";
22
+ import { TypeAnchorController as He, typeAnchor as Ue } from "./controllers/type-anchor.controller.js";
23
+ import { TypeClosableController as We } from "./controllers/type-closable.controller.js";
24
+ import { TypeExpandableController as Ge } from "./controllers/type-expandable.controller.js";
25
+ import { TypeSelectableController as Ke } from "./controllers/type-selectable.controller.js";
26
+ import { TypeNativePopoverController as qe } from "./controllers/type-native-popover.controller.js";
27
+ import { TypeSSRController as Je, typeSSR as Ye } from "./controllers/type-ssr.controller.js";
28
+ import { hostAttr as Xe } from "./decorators/host-attr.js";
29
+ import { scopedRegistry as Ze } from "./decorators/scoped-registry.js";
30
+ import { colorStateStyles as Qe, statusStateStyles as $e, supportStateStyles as et, useStyles as tt } from "./styles/index.js";
31
+ import { supportsCSSLegacyInsetArea as nt, supportsCSSPositionArea as rt, supportsNativeCSSAnchorPosition as it } from "./utils/supports.js";
32
+ import { popoverStyles as at } from "./styles/popover2.js";
33
+ import { TransitionService as ot } from "./services/transition.service.js";
34
+ import { statusIcons as st } from "./types/index.js";
35
+ import { createLightDismiss as ct, onKeys as lt } from "./utils/keynav.js";
36
+ import { finiteOr as ut, nonnegativeFiniteOr as dt, positiveFiniteOr as ft } from "./utils/numeric.js";
37
+ export { p as AuditController, e as DOCS_URL, g as GestureController, l as GlobalState, u as GlobalStateService, y as I18nController, _ as I18nService, v as I18nService_, xe as KeyNavigationGridController, we as KeyNavigationListController, De as KeyNavigationSpatialController, x as KeyStateController, I as KeynavCode, E as LogService, Pe as StateExpandedController, Ie as StateHighlightedController, Re as StateScrollController, Be as StateSelectedController, ot as TransitionService, He as TypeAnchorController, We as TypeClosableController, Ge as TypeExpandableController, qe as TypeNativePopoverController, Je as TypeSSRController, Ke as TypeSelectableController, L as appendAnchorName, R as appendRootNodeStyle, z as applySlotContentStates, Oe as associateAriaDescribedBy, ke as associateAriaLabel, Ae as associateControlGroup, je as associateDataList, Me as associateLabel, Ne as attachInternals, m as audit, d as auditParentElement, f as auditSlots, B as clickOutsideElementBounds, Qe as colorStateStyles, V as createGhostElement, ct as createLightDismiss, S as debounce, r as deepMerge, H as define, U as defineElement, W as endOfScrollBox, h as excessiveInstanceLimit, ut as finiteOr, D as focusElement, O as focusElementTimeout, t as formatFileSize, i as formatStandardNumber, G as generateId, k as getActiveElement, K as getAnchorNames, q as getAttributeChanges, J as getAttributeListChanges, Y as getChildren, X as getCustomElementRegistry, a as getDifference, Z as getDisplayValue, Q as getElementUpdate, $ as getFlattenedDOMTree, ee as getFlattenedFocusableItems, Se as getNextKeyGridItem, Te as getNextKeyListItem, te as getPropertyChanges, ne as getThemeTokens, re as hasHorizontalScrollBar, ie as hasInvalidDOMGrid, ae as hasScrollBar, Xe as hostAttr, b as i18n, A as initializeKeyListItems, oe as isContextMenuClick, j as isFocusable, M as isImmediateRootActiveElement, o as isObject, s as isObjectLiteral, N as isSimpleFocusable, Ce as keyNavigationGrid, Ee as keyNavigationList, se as matchesElementName, dt as nonnegativeFiniteOr, C as onChildListMutation, lt as onKeys, P as onListboxActivate, ce as openEyeDropper, le as parseTokenNumber, c as parseVersion, at as popoverStyles, ft as positiveFiniteOr, ue as removeAnchorName, de as removeEmptySlotWhitespace, fe as removeEmptyTextNode, pe as sameOrderedStringArray, me as sameRenderRoot, Ze as scopedRegistry, he as scrollBarWidth, F as setActiveKeyListItem, n as shiftLeft, ge as slotContainsOnlyWhitespace, Fe as stateExpanded, Le as stateHighlighted, ze as stateScroll, Ve as stateSelected, st as statusIcons, $e as statusStateStyles, w as stopEvent, _e as styleSheetToString, et as supportStateStyles, nt as supportsCSSLegacyInsetArea, rt as supportsCSSPositionArea, it as supportsNativeCSSAnchorPosition, ve as supportsScopedRegistry, T as throttle, Ue as typeAnchor, Ye as typeSSR, ye as uniqueNonEmptyStrings, tt as useStyles, be as validKeyNavigationCode };
@@ -19,7 +19,7 @@ var a = class {
19
19
  i18nRegistry: {},
20
20
  audit: {}
21
21
  }
22
- }, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.8.1"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.8.1"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
22
+ }, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.9.0"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.9.0"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
23
23
  }
24
24
  get state() {
25
25
  return globalThis.NVE_ELEMENTS.state;
@@ -16,6 +16,7 @@ export declare function getElementUpdate(element: HTMLElement, key: string, call
16
16
  export declare function clickOutsideElementBounds(event: PointerEvent | MouseEvent, element: HTMLElement): boolean;
17
17
  /** parses number out of basic calc generated by the design tokens */
18
18
  export declare function parseTokenNumber(value: string): number;
19
+ export declare function getCustomElementRegistry(element: Element): CustomElementRegistry | undefined;
19
20
  /** true if the browser supports scoped custom element registries */
20
21
  export declare const supportsScopedRegistry: boolean;
21
22
  /** defines an element with the given custom element registry */
@@ -78,53 +78,57 @@ function d(e, t) {
78
78
  function f(e) {
79
79
  return parseInt(e.includes("calc") ? e.split("*")[1].replace("px)", "").trim() : e, 10) || 0;
80
80
  }
81
- var p = globalThis.CustomElementRegistry && "initialize" in CustomElementRegistry.prototype;
82
- function m(t, n) {
81
+ function p(e) {
82
+ let t = e.getRootNode(), n = e.ownerDocument.defaultView?.CustomElementRegistry ?? globalThis.CustomElementRegistry;
83
+ return n && "customElementRegistry" in t && t.customElementRegistry instanceof n ? t.customElementRegistry : e.ownerDocument.defaultView?.customElements || (typeof customElements > "u" ? void 0 : customElements);
84
+ }
85
+ var m = globalThis.CustomElementRegistry && "initialize" in CustomElementRegistry.prototype;
86
+ function h(t, n) {
83
87
  Object.entries(t.elementDefinitions ?? {}).filter(([e, t]) => !n.get(t.metadata.tag)).forEach(([e, t]) => {
84
- m(t, n);
88
+ h(t, n);
85
89
  }), n.get(t.metadata.tag) || (n.define(t.metadata.tag, t), n === customElements && e.dispatch("NVE_ELEMENT_DEFINE", { elementRegistry: { [t.metadata.tag]: t.metadata.version } }));
86
90
  }
87
- function h(t) {
91
+ function g(t) {
88
92
  let { version: n } = t.metadata;
89
- p && !customElements.get(t.metadata.tag) ? (customElements.define(t.metadata.tag, t), e.dispatch("NVE_ELEMENT_DEFINE", { elementRegistry: { [t.metadata.tag]: t.metadata.version } })) : m(t, customElements), e.state.elementRegistry[t.metadata.tag] !== n && globalThis?.location?.hostname === "localhost" && import("./audit-logs.js").then((e) => console.warn(e.getDuplicatePackageVersionWarning(t.metadata.tag, n)));
93
+ m && !customElements.get(t.metadata.tag) ? (customElements.define(t.metadata.tag, t), e.dispatch("NVE_ELEMENT_DEFINE", { elementRegistry: { [t.metadata.tag]: t.metadata.version } })) : h(t, customElements), e.state.elementRegistry[t.metadata.tag] !== n && globalThis?.location?.hostname === "localhost" && import("./audit-logs.js").then((e) => console.warn(e.getDuplicatePackageVersionWarning(t.metadata.tag, n)));
90
94
  }
91
- function g(e) {
95
+ function _(e) {
92
96
  return e.buttons === 2 && !e.ctrlKey || e.buttons === 1 && e.ctrlKey;
93
97
  }
94
- function _(e, t = 10) {
95
- return v(e, t).filter((e) => n(e));
96
- }
97
98
  function v(e, t = 10) {
98
- return Array.from(r(e)).reduce((e, n) => [...e, [n, [...Array.from(r(n)).map((e) => [e, v(e, t)])]]], []).flat(t);
99
+ return y(e, t).filter((e) => n(e));
99
100
  }
100
- function y(e) {
101
- return x.has(e.code);
101
+ function y(e, t = 10) {
102
+ return Array.from(r(e)).reduce((e, n) => [...e, [n, [...Array.from(r(n)).map((e) => [e, y(e, t)])]]], []).flat(t);
102
103
  }
103
- var b = /* @__PURE__ */ function(e) {
104
+ function b(e) {
105
+ return S.has(e.code);
106
+ }
107
+ var x = /* @__PURE__ */ function(e) {
104
108
  return e.End = "End", e.Home = "Home", e.PageUp = "PageUp", e.PageDown = "PageDown", e.ArrowUp = "ArrowUp", e.ArrowDown = "ArrowDown", e.ArrowLeft = "ArrowLeft", e.ArrowRight = "ArrowRight", e;
105
- }({}), x = new Set(Object.values(b));
106
- function S(e) {
109
+ }({}), S = new Set(Object.values(x));
110
+ function C(e) {
107
111
  return e.some((t) => t.children.length !== e[0].children.length);
108
112
  }
109
- function C(e) {
113
+ function w(e) {
110
114
  e?.wholeText?.trim() === "" && e.remove();
111
115
  }
112
- function w() {
116
+ function T() {
113
117
  let e = globalThis.document.createElement("div");
114
118
  e.style.setProperty("width", "100px"), e.style.setProperty("height", "100px"), e.style.setProperty("overflow", "scroll"), e.style.setProperty("position", "absolute"), e.style.setProperty("top", "-9999px"), globalThis.document.body.appendChild(e);
115
119
  let t = e.offsetWidth - e.clientWidth;
116
120
  return globalThis.document.body.removeChild(e), t;
117
121
  }
118
- function T(e) {
122
+ function E(e) {
119
123
  return e.scrollHeight > e.clientHeight;
120
124
  }
121
- function E(e) {
125
+ function D(e) {
122
126
  return e.scrollWidth > e.clientWidth;
123
127
  }
124
- function D(e, t = 0) {
128
+ function O(e, t = 0) {
125
129
  return e.scrollTop + e.offsetHeight + t >= e.scrollHeight;
126
130
  }
127
- async function O() {
131
+ async function k() {
128
132
  let e = globalThis.EyeDropper;
129
133
  if (!e) return t.warn("EyeDropper API is unavailable"), "";
130
134
  try {
@@ -133,7 +137,7 @@ async function O() {
133
137
  return t.warn(`EyeDropper selection failed: ${e.message}`), "";
134
138
  }
135
139
  }
136
- function k(e = globalThis.document.querySelector(":root")) {
140
+ function A(e = globalThis.document.querySelector(":root")) {
137
141
  let t = getComputedStyle(e), n = [];
138
142
  try {
139
143
  n = Array.from(globalThis.parent.document.styleSheets);
@@ -152,48 +156,48 @@ function k(e = globalThis.document.querySelector(":root")) {
152
156
  [n[0]]: t.getPropertyValue(n[0])
153
157
  }), {});
154
158
  }
155
- function A(e) {
156
- j(e) && e.assignedNodes().forEach((e) => e.parentNode?.removeChild(e));
157
- }
158
159
  function j(e) {
160
+ M(e) && e.assignedNodes().forEach((e) => e.parentNode?.removeChild(e));
161
+ }
162
+ function M(e) {
159
163
  let t = !e.assignedNodes().find((e) => e.nodeType !== Node.TEXT_NODE), n = !e.assignedNodes().find((e) => e.nodeType === Node.TEXT_NODE && (e.textContent ?? "").trim() !== "");
160
164
  return t && n;
161
165
  }
162
- function M(e, t) {
166
+ function N(e, t) {
163
167
  let n = e.assignedNodes(), r = e.name ?? "slot";
164
168
  n.length ? t._internals.states.add(`has-${r}`) : t._internals.states.delete(`has-${r}`);
165
169
  }
166
- function N(e) {
170
+ function P(e) {
167
171
  return e?.label || e?.value || "";
168
172
  }
169
- function P(e, t) {
173
+ function F(e, t) {
170
174
  return e.localName === t.metadata.tag;
171
175
  }
172
- function F(e) {
176
+ function I(e) {
173
177
  let t = globalThis.document.createElement("div"), { width: n } = e.getBoundingClientRect();
174
178
  return t.setAttribute("nve-ghost", ""), t.style.minWidth = `${n}px`, t.style.maxWidth = `${n}px`, t.style.height = "1px", t.slot = e.slot, t;
175
179
  }
176
- function I(e, t) {
180
+ function L(e, t) {
177
181
  let n = e.getRootNode(), r = t.getRootNode(), i = n instanceof ShadowRoot && r instanceof ShadowRoot && n === r, a = n === globalThis.document && r === globalThis.document;
178
182
  return i || a || n === r;
179
183
  }
180
- function L(e) {
184
+ function R(e) {
181
185
  return e.style.anchorName?.split(",")?.map((e) => e.trim())?.filter((e) => e !== "none" && e !== "") ?? [];
182
186
  }
183
- function R(e, t) {
184
- let n = L(e);
185
- e.style.anchorName = n.filter((e) => e !== t).join(",");
186
- }
187
187
  function z(e, t) {
188
- e.style.anchorName = Array.from(/* @__PURE__ */ new Set([...L(e), t])).join(",");
188
+ let n = R(e);
189
+ e.style.anchorName = n.filter((e) => e !== t).join(",");
189
190
  }
190
191
  function B(e, t) {
192
+ e.style.anchorName = Array.from(/* @__PURE__ */ new Set([...R(e), t])).join(",");
193
+ }
194
+ function V(e, t) {
191
195
  return e.length === t.length && e.every((e, n) => e === t[n]);
192
196
  }
193
- function V(e) {
197
+ function H(e) {
194
198
  return Array.from(new Set(Array.from(e).filter((e) => typeof e == "string" && e.length > 0)));
195
199
  }
196
200
  //#endregion
197
- export { b as KeynavCode, z as appendAnchorName, s as appendRootNodeStyle, M as applySlotContentStates, d as clickOutsideElementBounds, F as createGhostElement, h as define, m as defineElement, D as endOfScrollBox, i as generateId, L as getAnchorNames, a as getAttributeChanges, o as getAttributeListChanges, r as getChildren, N as getDisplayValue, u as getElementUpdate, v as getFlattenedDOMTree, _ as getFlattenedFocusableItems, l as getPropertyChanges, k as getThemeTokens, E as hasHorizontalScrollBar, S as hasInvalidDOMGrid, T as hasScrollBar, g as isContextMenuClick, P as matchesElementName, O as openEyeDropper, f as parseTokenNumber, R as removeAnchorName, A as removeEmptySlotWhitespace, C as removeEmptyTextNode, B as sameOrderedStringArray, I as sameRenderRoot, w as scrollBarWidth, j as slotContainsOnlyWhitespace, c as styleSheetToString, p as supportsScopedRegistry, V as uniqueNonEmptyStrings, y as validKeyNavigationCode };
201
+ export { x as KeynavCode, B as appendAnchorName, s as appendRootNodeStyle, N as applySlotContentStates, d as clickOutsideElementBounds, I as createGhostElement, g as define, h as defineElement, O as endOfScrollBox, i as generateId, R as getAnchorNames, a as getAttributeChanges, o as getAttributeListChanges, r as getChildren, p as getCustomElementRegistry, P as getDisplayValue, u as getElementUpdate, y as getFlattenedDOMTree, v as getFlattenedFocusableItems, l as getPropertyChanges, A as getThemeTokens, D as hasHorizontalScrollBar, C as hasInvalidDOMGrid, E as hasScrollBar, _ as isContextMenuClick, F as matchesElementName, k as openEyeDropper, f as parseTokenNumber, z as removeAnchorName, j as removeEmptySlotWhitespace, w as removeEmptyTextNode, V as sameOrderedStringArray, L as sameRenderRoot, T as scrollBarWidth, M as slotContainsOnlyWhitespace, c as styleSheetToString, m as supportsScopedRegistry, H as uniqueNonEmptyStrings, b as validKeyNavigationCode };
198
202
 
199
203
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","names":[],"sources":["../../../src/internal/utils/dom.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport type { ElementDefinition } from '../types/index.js';\nimport { isFocusable } from './focus.js';\n\nexport function getChildren(node: Document | Node | HTMLElement): Element[] {\n if (node instanceof Document && node.documentElement) {\n return Array.from(node.documentElement.children); // root document children\n } else if (node instanceof HTMLElement && node.shadowRoot) {\n return Array.from(node.shadowRoot.children); // shadow root direct children\n } else if (node instanceof HTMLSlotElement && node.assignedElements) {\n const slotted = node.assignedElements(); // slotted elements\n return slotted.length ? slotted : Array.from(node.children); // slot fallback\n } else {\n return Array.from((node as HTMLElement).children); // light DOM direct children\n }\n}\n\nexport function generateId() {\n const uint32 = self.crypto.getRandomValues(new Uint32Array(1))[0]!;\n return `_${uint32.toString(16)}`;\n}\n\nexport function getAttributeChanges(element: HTMLElement, attr: string, fn: (attrValue: string | null) => void) {\n fn(element.getAttribute(attr));\n const observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.attributeName === attr) {\n fn((mutation.target as HTMLElement).getAttribute(attr));\n }\n });\n });\n observer.observe(element, { attributes: true, subtree: true });\n return observer;\n}\n\nexport function getAttributeListChanges(element: HTMLElement, attrs: string[], fn: (mutation: MutationRecord) => void) {\n const observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.attributeName && attrs.includes(mutation.attributeName)) {\n fn(mutation);\n }\n });\n });\n observer.observe(element, { attributes: true, subtree: true });\n return observer;\n}\n\n/**\n * Appends styles to the render root of a given element. This is useful for\n * styles that apply outside the scope of the element's shadow\n * root such as UA styles --webkit-* that won't work in a ::slotted selector\n */\nexport function appendRootNodeStyle(host: HTMLElement, styles: string) {\n const stylesheet = new CSSStyleSheet();\n stylesheet.replaceSync(styles);\n const root = host.getRootNode() as Document | ShadowRoot;\n if (root.adoptedStyleSheets) {\n const hasStyleSheet = root.adoptedStyleSheets\n .map(s => styleSheetToString(s))\n .find(s => s === styleSheetToString(stylesheet));\n if (!hasStyleSheet) {\n root.adoptedStyleSheets = [...Array.from(root.adoptedStyleSheets), stylesheet];\n }\n }\n return stylesheet;\n}\n\nexport function styleSheetToString(stylesheet: CSSStyleSheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n}\n\n/** Intercepts a property setter on an element so `callback` fires on every assignment. Does not use a MutationObserver. */\nexport function getPropertyChanges(element: HTMLElement, key: string, callback: (value: unknown) => void) {\n const proto = Object.getPrototypeOf(element);\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n if (!descriptor) return;\n const own = Object.getOwnPropertyDescriptor(element, key);\n if (own && own.configurable === false) return;\n Object.defineProperty(element, key, {\n configurable: true,\n get: descriptor.get,\n set: (val: unknown) => {\n descriptor.set!.call(element, val);\n callback(val);\n }\n });\n\n return () => {\n if (own) {\n Object.defineProperty(element, key, own);\n return;\n }\n\n Reflect.deleteProperty(element, key);\n };\n}\n\n/* used for cases of needing to know a property update outside of lit, example a native input value prop change */\nexport function getElementUpdate(element: HTMLElement, key: string, callback: (value: unknown) => void) {\n if (element.hasAttribute(key)) {\n callback(element.getAttribute(key));\n } else if ((element as unknown as Record<string, unknown>)[key] !== undefined) {\n callback((element as unknown as Record<string, unknown>)[key]);\n }\n\n const cleanupPropertyChanges = getPropertyChanges(element, key, callback);\n const observer = getAttributeChanges(element, key, val => callback(val));\n const disconnect = observer.disconnect.bind(observer);\n\n observer.disconnect = () => {\n cleanupPropertyChanges?.();\n disconnect();\n };\n\n return observer;\n}\n\nexport function clickOutsideElementBounds(event: PointerEvent | MouseEvent, element: HTMLElement) {\n const { left, right, top, bottom } = element.getBoundingClientRect();\n return event.clientX < left || event.clientX > right || event.clientY < top || event.clientY > bottom;\n}\n\n/** parses number out of basic calc generated by the design tokens */\nexport function parseTokenNumber(value: string) {\n return parseInt(value.includes('calc') ? value.split('*')[1]!.replace('px)', '').trim() : value, 10) || 0;\n}\n\n/** true if the browser supports scoped custom element registries */\nexport const supportsScopedRegistry =\n globalThis.CustomElementRegistry && 'initialize' in CustomElementRegistry.prototype;\n\n/** defines an element with the given custom element registry */\nexport function defineElement(element: ElementDefinition, customElementRegistry: CustomElementRegistry) {\n Object.entries(element.elementDefinitions ?? {})\n .filter(([_tag, e]) => !customElementRegistry.get(e.metadata.tag))\n .forEach(([_tag, e]) => {\n defineElement(e, customElementRegistry);\n });\n\n if (!customElementRegistry.get(element.metadata.tag)) {\n customElementRegistry.define(element.metadata.tag, element);\n\n if (customElementRegistry === customElements) {\n GlobalStateService.dispatch('NVE_ELEMENT_DEFINE', {\n elementRegistry: { [element.metadata.tag]: element.metadata.version }\n });\n }\n }\n}\n\n/** defines an element with the global custom element registry */\nexport function define(element: ElementDefinition) {\n const { version } = element.metadata;\n\n // if scoped registry supported, register only the root element to global registry\n if (supportsScopedRegistry && !customElements.get(element.metadata.tag)) {\n customElements.define(element.metadata.tag, element);\n GlobalStateService.dispatch('NVE_ELEMENT_DEFINE', {\n elementRegistry: { [element.metadata.tag]: element.metadata.version }\n });\n } else {\n // if scoped registry not supported, register the element and all its children to the global registry\n defineElement(element, customElements);\n }\n\n // warn on duplicate version\n if (\n GlobalStateService.state.elementRegistry[element.metadata.tag] !== version &&\n globalThis?.location?.hostname === 'localhost'\n ) {\n void import('./audit-logs.js').then(m =>\n console.warn(m.getDuplicatePackageVersionWarning(element.metadata.tag, version))\n );\n }\n}\n\nexport function isContextMenuClick(event: MouseEvent) {\n return (event.buttons === 2 && !event.ctrlKey) || (event.buttons === 1 && event.ctrlKey);\n}\n\nexport function getFlattenedFocusableItems(element: Node, depth = 10) {\n return getFlattenedDOMTree(element, depth).filter((e: HTMLElement) => isFocusable(e)) as HTMLElement[];\n}\n\n/**\n * Preserves visual DOM ordering when using slots within Shadow DOM\n * See more information/resources on Shadow DOM linear traversal\n * https://nolanlawson.com/2021/02/13/managing-focus-in-the-shadow-dom/\n * https://www.abeautifulsite.net/posts/querying-through-shadow-roots/\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 validKeyNavigationCode(e: KeyboardEvent) {\n return keynavCodes.has(e.code);\n}\n\nexport enum KeynavCode {\n End = 'End',\n Home = 'Home',\n PageUp = 'PageUp',\n PageDown = 'PageDown',\n ArrowUp = 'ArrowUp',\n ArrowDown = 'ArrowDown',\n ArrowLeft = 'ArrowLeft',\n ArrowRight = 'ArrowRight'\n}\n\nconst keynavCodes: Set<string> = new Set(Object.values(KeynavCode));\n\nexport function hasInvalidDOMGrid(rows: HTMLElement[]) {\n return rows.some(row => row.children.length !== rows[0]!.children.length);\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n (node as Text).remove();\n }\n}\n\nexport function scrollBarWidth() {\n const div = globalThis.document.createElement('div');\n div.style.setProperty('width', '100px');\n div.style.setProperty('height', '100px');\n div.style.setProperty('overflow', 'scroll');\n div.style.setProperty('position', 'absolute');\n div.style.setProperty('top', '-9999px');\n globalThis.document.body.appendChild(div);\n const width = div.offsetWidth - div.clientWidth;\n globalThis.document.body.removeChild(div);\n return width;\n}\n\nexport function hasScrollBar(el: HTMLElement) {\n return el.scrollHeight > el.clientHeight;\n}\n\nexport function hasHorizontalScrollBar(el: HTMLElement) {\n return el.scrollWidth > el.clientWidth;\n}\n\nexport function endOfScrollBox(element: HTMLElement, offset = 0) {\n return element.scrollTop + element.offsetHeight + offset >= element.scrollHeight;\n}\n\nexport async function openEyeDropper(): Promise<string> {\n const EyeDropperConstructor = (\n globalThis as unknown as { EyeDropper?: new () => { open: () => Promise<{ sRGBHex: string }> } }\n ).EyeDropper;\n\n if (!EyeDropperConstructor) {\n LogService.warn('EyeDropper API is unavailable');\n return '';\n }\n\n try {\n return (await new EyeDropperConstructor().open()).sRGBHex;\n } catch (e) {\n LogService.warn(`EyeDropper selection failed: ${(e as Error).message}`);\n return '';\n }\n}\n\n/**\n * provides a object with key/value of the currently applied design tokens\n */\nexport function getThemeTokens(element = globalThis.document.querySelector(':root')!) {\n // default root or provided element\n const styles = getComputedStyle(element);\n let parent: CSSStyleSheet[] = [];\n\n // check for parent iframe, same domain iframes change how the browser accesses style sheets\n try {\n parent = Array.from(globalThis.parent.document.styleSheets);\n } catch {\n // if not accessible, skip\n }\n\n return [...parent, ...Array.from(globalThis.document.styleSheets)]\n .reduce((finalArr: string[][], sheet) => {\n let rules: CSSRule[] = [];\n try {\n rules = [...sheet.cssRules];\n } catch {\n // if the style sheet is not accessible, skip\n }\n return finalArr.concat(\n rules\n .filter(rule => rule.type === 1)\n .reduce((propValArr: string[][], rule) => {\n const props = [...(rule as CSSStyleRule).style]\n .filter((p: string) => p.trim().includes('--nve'))\n .map((propName: string) => [\n propName.trim(),\n (rule as CSSStyleRule).style.getPropertyValue(propName).trim()\n ]);\n return [...propValArr, ...props];\n }, [])\n );\n }, [])\n .reduce(\n (p: Record<string, string>, token: string[]) => ({ ...p, [token[0]!]: styles.getPropertyValue(token[0]!) }),\n {}\n );\n}\n\nexport function removeEmptySlotWhitespace(slot: HTMLSlotElement) {\n if (slotContainsOnlyWhitespace(slot)) {\n slot.assignedNodes().forEach((node: Node) => node.parentNode?.removeChild(node));\n }\n}\n\nexport function slotContainsOnlyWhitespace(slot: HTMLSlotElement) {\n const hasNoElements = !slot.assignedNodes().find(i => i.nodeType !== Node.TEXT_NODE);\n const hasOnlyEmptyTextNodes = !slot\n .assignedNodes()\n .find(i => i.nodeType === Node.TEXT_NODE && (i.textContent ?? '').trim() !== '');\n return hasNoElements && hasOnlyEmptyTextNodes;\n}\n\nexport function applySlotContentStates(slot: HTMLSlotElement, element: HTMLElement & { _internals: ElementInternals }) {\n const nodes = slot.assignedNodes();\n const name = slot.name ?? 'slot';\n\n if (nodes.length) {\n element._internals.states.add(`has-${name}`);\n } else {\n element._internals.states.delete(`has-${name}`);\n }\n}\n\nexport function getDisplayValue(option?: { label?: string; value?: string }): string {\n return option?.label || option?.value || '';\n}\n\n/** determines if HTML element matches the given component tag */\nexport function matchesElementName(element: Partial<HTMLElement>, component: { metadata: { tag: string } }) {\n return element.localName === component.metadata.tag;\n}\n\nexport function createGhostElement(sourceElement: HTMLElement) {\n const ghost = globalThis.document.createElement('div');\n const { width } = sourceElement.getBoundingClientRect();\n ghost.setAttribute('nve-ghost', '');\n ghost.style.minWidth = `${width}px`;\n ghost.style.maxWidth = `${width}px`;\n ghost.style.height = '1px';\n ghost.slot = sourceElement.slot;\n return ghost;\n}\n\nexport function sameRenderRoot(element1: HTMLElement, element2: HTMLElement) {\n const root1 = element1.getRootNode();\n const root2 = element2.getRootNode();\n const sameShadowRoot = root1 instanceof ShadowRoot && root2 instanceof ShadowRoot && root1 === root2;\n const sameDocumentRoot = root1 === globalThis.document && root2 === globalThis.document;\n const sameUnattachedRoot = root1 === root2;\n return sameShadowRoot || sameDocumentRoot || sameUnattachedRoot;\n}\n\nexport function getAnchorNames(element: HTMLElement): string[] {\n return (\n element.style.anchorName\n ?.split(',')\n ?.map(name => name.trim())\n ?.filter(name => name !== 'none' && name !== '') ?? []\n );\n}\n\nexport function removeAnchorName(element: HTMLElement, name: string) {\n const anchorNames = getAnchorNames(element);\n element.style.anchorName = anchorNames.filter(i => i !== name).join(',');\n}\n\nexport function appendAnchorName(element: HTMLElement, name: string) {\n element.style.anchorName = Array.from(new Set([...getAnchorNames(element), name])).join(',');\n}\n\n/**\n * Returns true when both arrays have the same length and each index is strictly equal (`===`).\n */\nexport function sameOrderedStringArray(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\n\n/**\n * Returns unique non-empty strings in first-seen order (insertion order of a `Set` over the filtered list).\n */\nexport function uniqueNonEmptyStrings(values: Iterable<string | null | undefined>): string[] {\n return Array.from(\n new Set(Array.from(values).filter((value): value is string => typeof value === 'string' && value.length > 0))\n );\n}\n"],"mappings":";;;;AAQA,SAAgB,EAAY,GAAgD;CAC1E,IAAI,aAAgB,YAAY,EAAK,iBACnC,OAAO,MAAM,KAAK,EAAK,gBAAgB,QAAQ;CAC1C,IAAI,aAAgB,eAAe,EAAK,YAC7C,OAAO,MAAM,KAAK,EAAK,WAAW,QAAQ;CACrC,IAAI,aAAgB,mBAAmB,EAAK,kBAAk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,GAAuB;CAC3E,IAAM,IAAQ,EAAS,YAAY,GAC7B,IAAQ,EAAS,YAAY,GAC7B,IAAiB,aAAiB,cAAc,aAAiB,cAAc,MAAU,GACzF,IAAmB,MAAU,WAAW,YAAY,MAAU,WAAW;CAE/E,OAAO,KAAkB,KADE,MAAU;AAEvC;AAEA,SAAgB,EAAe,GAAgC;CAC7D,OACE,EAAQ,MAAM,YACV,MAAM,GAAG,CAAC,EACV,KAAI,MAAQ,EAAK,KAAK,CAAC,CAAC,EACxB,QAAO,MAAQ,MAAS,UAAU,MAAS,EAAE,KAAK,CAAC;AAE3D;AAEA,SAAgB,EAAiB,GAAsB,GAAc;CACnE,IAAM,IAAc,EAAe,CAAO;CAC1C,EAAQ,MAAM,aAAa,EAAY,QAAO,MAAK,MAAM,CAAI,CAAC,CAAC,KAAK,GAAG;AACzE;AAEA,SAAgB,EAAiB,GAAsB,GAAc;CACnE,EAAQ,MAAM,aAAa,MAAM,qBAAK,IAAI,IAAI,CAAC,GAAG,EAAe,CAAO,GAAG,CAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;AAC7F;AAKA,SAAgB,EAAuB,GAAsB,GAA+B;CAC1F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAO,MAAU,MAAU,EAAE,EAAM;AAC9E;AAKA,SAAgB,EAAsB,GAAuD;CAC3F,OAAO,MAAM,KACX,IAAI,IAAI,MAAM,KAAK,CAAM,CAAC,CAAC,QAAQ,MAA2B,OAAO,KAAU,YAAY,EAAM,SAAS,CAAC,CAAC,CAC9G;AACF"}
1
+ {"version":3,"file":"dom.js","names":[],"sources":["../../../src/internal/utils/dom.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport type { ElementDefinition } from '../types/index.js';\nimport { isFocusable } from './focus.js';\n\nexport function getChildren(node: Document | Node | HTMLElement): Element[] {\n if (node instanceof Document && node.documentElement) {\n return Array.from(node.documentElement.children); // root document children\n } else if (node instanceof HTMLElement && node.shadowRoot) {\n return Array.from(node.shadowRoot.children); // shadow root direct children\n } else if (node instanceof HTMLSlotElement && node.assignedElements) {\n const slotted = node.assignedElements(); // slotted elements\n return slotted.length ? slotted : Array.from(node.children); // slot fallback\n } else {\n return Array.from((node as HTMLElement).children); // light DOM direct children\n }\n}\n\nexport function generateId() {\n const uint32 = self.crypto.getRandomValues(new Uint32Array(1))[0]!;\n return `_${uint32.toString(16)}`;\n}\n\nexport function getAttributeChanges(element: HTMLElement, attr: string, fn: (attrValue: string | null) => void) {\n fn(element.getAttribute(attr));\n const observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.attributeName === attr) {\n fn((mutation.target as HTMLElement).getAttribute(attr));\n }\n });\n });\n observer.observe(element, { attributes: true, subtree: true });\n return observer;\n}\n\nexport function getAttributeListChanges(element: HTMLElement, attrs: string[], fn: (mutation: MutationRecord) => void) {\n const observer = new MutationObserver(mutations => {\n mutations.forEach(mutation => {\n if (mutation.attributeName && attrs.includes(mutation.attributeName)) {\n fn(mutation);\n }\n });\n });\n observer.observe(element, { attributes: true, subtree: true });\n return observer;\n}\n\n/**\n * Appends styles to the render root of a given element. This is useful for\n * styles that apply outside the scope of the element's shadow\n * root such as UA styles --webkit-* that won't work in a ::slotted selector\n */\nexport function appendRootNodeStyle(host: HTMLElement, styles: string) {\n const stylesheet = new CSSStyleSheet();\n stylesheet.replaceSync(styles);\n const root = host.getRootNode() as Document | ShadowRoot;\n if (root.adoptedStyleSheets) {\n const hasStyleSheet = root.adoptedStyleSheets\n .map(s => styleSheetToString(s))\n .find(s => s === styleSheetToString(stylesheet));\n if (!hasStyleSheet) {\n root.adoptedStyleSheets = [...Array.from(root.adoptedStyleSheets), stylesheet];\n }\n }\n return stylesheet;\n}\n\nexport function styleSheetToString(stylesheet: CSSStyleSheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n}\n\n/** Intercepts a property setter on an element so `callback` fires on every assignment. Does not use a MutationObserver. */\nexport function getPropertyChanges(element: HTMLElement, key: string, callback: (value: unknown) => void) {\n const proto = Object.getPrototypeOf(element);\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n if (!descriptor) return;\n const own = Object.getOwnPropertyDescriptor(element, key);\n if (own && own.configurable === false) return;\n Object.defineProperty(element, key, {\n configurable: true,\n get: descriptor.get,\n set: (val: unknown) => {\n descriptor.set!.call(element, val);\n callback(val);\n }\n });\n\n return () => {\n if (own) {\n Object.defineProperty(element, key, own);\n return;\n }\n\n Reflect.deleteProperty(element, key);\n };\n}\n\n/* used for cases of needing to know a property update outside of lit, example a native input value prop change */\nexport function getElementUpdate(element: HTMLElement, key: string, callback: (value: unknown) => void) {\n if (element.hasAttribute(key)) {\n callback(element.getAttribute(key));\n } else if ((element as unknown as Record<string, unknown>)[key] !== undefined) {\n callback((element as unknown as Record<string, unknown>)[key]);\n }\n\n const cleanupPropertyChanges = getPropertyChanges(element, key, callback);\n const observer = getAttributeChanges(element, key, val => callback(val));\n const disconnect = observer.disconnect.bind(observer);\n\n observer.disconnect = () => {\n cleanupPropertyChanges?.();\n disconnect();\n };\n\n return observer;\n}\n\nexport function clickOutsideElementBounds(event: PointerEvent | MouseEvent, element: HTMLElement) {\n const { left, right, top, bottom } = element.getBoundingClientRect();\n return event.clientX < left || event.clientX > right || event.clientY < top || event.clientY > bottom;\n}\n\n/** parses number out of basic calc generated by the design tokens */\nexport function parseTokenNumber(value: string) {\n return parseInt(value.includes('calc') ? value.split('*')[1]!.replace('px)', '').trim() : value, 10) || 0;\n}\n\nexport function getCustomElementRegistry(element: Element): CustomElementRegistry | undefined {\n const root = element.getRootNode();\n const CustomElementRegistryConstructor =\n element.ownerDocument.defaultView?.CustomElementRegistry ?? globalThis.CustomElementRegistry;\n if (\n CustomElementRegistryConstructor &&\n 'customElementRegistry' in root &&\n root.customElementRegistry instanceof CustomElementRegistryConstructor\n ) {\n return root.customElementRegistry;\n }\n const documentRegistry = element.ownerDocument.defaultView?.customElements;\n if (documentRegistry) return documentRegistry;\n return typeof customElements === 'undefined' ? undefined : customElements;\n}\n\n/** true if the browser supports scoped custom element registries */\nexport const supportsScopedRegistry =\n globalThis.CustomElementRegistry && 'initialize' in CustomElementRegistry.prototype;\n\n/** defines an element with the given custom element registry */\nexport function defineElement(element: ElementDefinition, customElementRegistry: CustomElementRegistry) {\n Object.entries(element.elementDefinitions ?? {})\n .filter(([_tag, e]) => !customElementRegistry.get(e.metadata.tag))\n .forEach(([_tag, e]) => {\n defineElement(e, customElementRegistry);\n });\n\n if (!customElementRegistry.get(element.metadata.tag)) {\n customElementRegistry.define(element.metadata.tag, element);\n\n if (customElementRegistry === customElements) {\n GlobalStateService.dispatch('NVE_ELEMENT_DEFINE', {\n elementRegistry: { [element.metadata.tag]: element.metadata.version }\n });\n }\n }\n}\n\n/** defines an element with the global custom element registry */\nexport function define(element: ElementDefinition) {\n const { version } = element.metadata;\n\n // if scoped registry supported, register only the root element to global registry\n if (supportsScopedRegistry && !customElements.get(element.metadata.tag)) {\n customElements.define(element.metadata.tag, element);\n GlobalStateService.dispatch('NVE_ELEMENT_DEFINE', {\n elementRegistry: { [element.metadata.tag]: element.metadata.version }\n });\n } else {\n // if scoped registry not supported, register the element and all its children to the global registry\n defineElement(element, customElements);\n }\n\n // warn on duplicate version\n if (\n GlobalStateService.state.elementRegistry[element.metadata.tag] !== version &&\n globalThis?.location?.hostname === 'localhost'\n ) {\n void import('./audit-logs.js').then(m =>\n console.warn(m.getDuplicatePackageVersionWarning(element.metadata.tag, version))\n );\n }\n}\n\nexport function isContextMenuClick(event: MouseEvent) {\n return (event.buttons === 2 && !event.ctrlKey) || (event.buttons === 1 && event.ctrlKey);\n}\n\nexport function getFlattenedFocusableItems(element: Node, depth = 10) {\n return getFlattenedDOMTree(element, depth).filter((e: HTMLElement) => isFocusable(e)) as HTMLElement[];\n}\n\n/**\n * Preserves visual DOM ordering when using slots within Shadow DOM\n * See more information/resources on Shadow DOM linear traversal\n * https://nolanlawson.com/2021/02/13/managing-focus-in-the-shadow-dom/\n * https://www.abeautifulsite.net/posts/querying-through-shadow-roots/\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 validKeyNavigationCode(e: KeyboardEvent) {\n return keynavCodes.has(e.code);\n}\n\nexport enum KeynavCode {\n End = 'End',\n Home = 'Home',\n PageUp = 'PageUp',\n PageDown = 'PageDown',\n ArrowUp = 'ArrowUp',\n ArrowDown = 'ArrowDown',\n ArrowLeft = 'ArrowLeft',\n ArrowRight = 'ArrowRight'\n}\n\nconst keynavCodes: Set<string> = new Set(Object.values(KeynavCode));\n\nexport function hasInvalidDOMGrid(rows: HTMLElement[]) {\n return rows.some(row => row.children.length !== rows[0]!.children.length);\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n (node as Text).remove();\n }\n}\n\nexport function scrollBarWidth() {\n const div = globalThis.document.createElement('div');\n div.style.setProperty('width', '100px');\n div.style.setProperty('height', '100px');\n div.style.setProperty('overflow', 'scroll');\n div.style.setProperty('position', 'absolute');\n div.style.setProperty('top', '-9999px');\n globalThis.document.body.appendChild(div);\n const width = div.offsetWidth - div.clientWidth;\n globalThis.document.body.removeChild(div);\n return width;\n}\n\nexport function hasScrollBar(el: HTMLElement) {\n return el.scrollHeight > el.clientHeight;\n}\n\nexport function hasHorizontalScrollBar(el: HTMLElement) {\n return el.scrollWidth > el.clientWidth;\n}\n\nexport function endOfScrollBox(element: HTMLElement, offset = 0) {\n return element.scrollTop + element.offsetHeight + offset >= element.scrollHeight;\n}\n\nexport async function openEyeDropper(): Promise<string> {\n const EyeDropperConstructor = (\n globalThis as unknown as { EyeDropper?: new () => { open: () => Promise<{ sRGBHex: string }> } }\n ).EyeDropper;\n\n if (!EyeDropperConstructor) {\n LogService.warn('EyeDropper API is unavailable');\n return '';\n }\n\n try {\n return (await new EyeDropperConstructor().open()).sRGBHex;\n } catch (e) {\n LogService.warn(`EyeDropper selection failed: ${(e as Error).message}`);\n return '';\n }\n}\n\n/**\n * provides a object with key/value of the currently applied design tokens\n */\nexport function getThemeTokens(element = globalThis.document.querySelector(':root')!) {\n // default root or provided element\n const styles = getComputedStyle(element);\n let parent: CSSStyleSheet[] = [];\n\n // check for parent iframe, same domain iframes change how the browser accesses style sheets\n try {\n parent = Array.from(globalThis.parent.document.styleSheets);\n } catch {\n // if not accessible, skip\n }\n\n return [...parent, ...Array.from(globalThis.document.styleSheets)]\n .reduce((finalArr: string[][], sheet) => {\n let rules: CSSRule[] = [];\n try {\n rules = [...sheet.cssRules];\n } catch {\n // if the style sheet is not accessible, skip\n }\n return finalArr.concat(\n rules\n .filter(rule => rule.type === 1)\n .reduce((propValArr: string[][], rule) => {\n const props = [...(rule as CSSStyleRule).style]\n .filter((p: string) => p.trim().includes('--nve'))\n .map((propName: string) => [\n propName.trim(),\n (rule as CSSStyleRule).style.getPropertyValue(propName).trim()\n ]);\n return [...propValArr, ...props];\n }, [])\n );\n }, [])\n .reduce(\n (p: Record<string, string>, token: string[]) => ({ ...p, [token[0]!]: styles.getPropertyValue(token[0]!) }),\n {}\n );\n}\n\nexport function removeEmptySlotWhitespace(slot: HTMLSlotElement) {\n if (slotContainsOnlyWhitespace(slot)) {\n slot.assignedNodes().forEach((node: Node) => node.parentNode?.removeChild(node));\n }\n}\n\nexport function slotContainsOnlyWhitespace(slot: HTMLSlotElement) {\n const hasNoElements = !slot.assignedNodes().find(i => i.nodeType !== Node.TEXT_NODE);\n const hasOnlyEmptyTextNodes = !slot\n .assignedNodes()\n .find(i => i.nodeType === Node.TEXT_NODE && (i.textContent ?? '').trim() !== '');\n return hasNoElements && hasOnlyEmptyTextNodes;\n}\n\nexport function applySlotContentStates(slot: HTMLSlotElement, element: HTMLElement & { _internals: ElementInternals }) {\n const nodes = slot.assignedNodes();\n const name = slot.name ?? 'slot';\n\n if (nodes.length) {\n element._internals.states.add(`has-${name}`);\n } else {\n element._internals.states.delete(`has-${name}`);\n }\n}\n\nexport function getDisplayValue(option?: { label?: string; value?: string }): string {\n return option?.label || option?.value || '';\n}\n\n/** determines if HTML element matches the given component tag */\nexport function matchesElementName(element: Partial<HTMLElement>, component: { metadata: { tag: string } }) {\n return element.localName === component.metadata.tag;\n}\n\nexport function createGhostElement(sourceElement: HTMLElement) {\n const ghost = globalThis.document.createElement('div');\n const { width } = sourceElement.getBoundingClientRect();\n ghost.setAttribute('nve-ghost', '');\n ghost.style.minWidth = `${width}px`;\n ghost.style.maxWidth = `${width}px`;\n ghost.style.height = '1px';\n ghost.slot = sourceElement.slot;\n return ghost;\n}\n\nexport function sameRenderRoot(element1: HTMLElement, element2: HTMLElement) {\n const root1 = element1.getRootNode();\n const root2 = element2.getRootNode();\n const sameShadowRoot = root1 instanceof ShadowRoot && root2 instanceof ShadowRoot && root1 === root2;\n const sameDocumentRoot = root1 === globalThis.document && root2 === globalThis.document;\n const sameUnattachedRoot = root1 === root2;\n return sameShadowRoot || sameDocumentRoot || sameUnattachedRoot;\n}\n\nexport function getAnchorNames(element: HTMLElement): string[] {\n return (\n element.style.anchorName\n ?.split(',')\n ?.map(name => name.trim())\n ?.filter(name => name !== 'none' && name !== '') ?? []\n );\n}\n\nexport function removeAnchorName(element: HTMLElement, name: string) {\n const anchorNames = getAnchorNames(element);\n element.style.anchorName = anchorNames.filter(i => i !== name).join(',');\n}\n\nexport function appendAnchorName(element: HTMLElement, name: string) {\n element.style.anchorName = Array.from(new Set([...getAnchorNames(element), name])).join(',');\n}\n\n/**\n * Returns true when both arrays have the same length and each index is strictly equal (`===`).\n */\nexport function sameOrderedStringArray(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\n\n/**\n * Returns unique non-empty strings in first-seen order (insertion order of a `Set` over the filtered list).\n */\nexport function uniqueNonEmptyStrings(values: Iterable<string | null | undefined>): string[] {\n return Array.from(\n new Set(Array.from(values).filter((value): value is string => typeof value === 'string' && value.length > 0))\n );\n}\n"],"mappings":";;;;AAQA,SAAgB,EAAY,GAAgD;CAC1E,IAAI,aAAgB,YAAY,EAAK,iBACnC,OAAO,MAAM,KAAK,EAAK,gBAAgB,QAAQ;CAC1C,IAAI,aAAgB,eAAe,EAAK,YAC7C,OAAO,MAAM,KAAK,EAAK,WAAW,QAAQ;CACrC,IAAI,aAAgB,mBAAmB,EAAK,kBAAkB;EACnE,IAAM,IAAU,EAAK,iBAAiB;EACtC,OAAO,EAAQ,SAAS,IAAU,MAAM,KAAK,EAAK,QAAQ;CAC5D;CACE,OAAO,MAAM,KAAM,EAAqB,QAAQ;AAEpD;AAEA,SAAgB,IAAa;CAE3B,OAAO,IADQ,KAAK,OAAO,gCAAgB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,EACpD,CAAO,SAAS,EAAE;AAC/B;AAEA,SAAgB,EAAoB,GAAsB,GAAc,GAAwC;CAC9G,EAAG,EAAQ,aAAa,CAAI,CAAC;CAC7B,IAAM,IAAW,IAAI,kBAAiB,MAAa;EACjD,EAAU,SAAQ,MAAY;GAC5B,AAAI,EAAS,kBAAkB,KAC7B,EAAI,EAAS,OAAuB,aAAa,CAAI,CAAC;EAE1D,CAAC;CACH,CAAC;CAED,OADA,EAAS,QAAQ,GAAS;EAAE,YAAY;EAAM,SAAS;CAAK,CAAC,GACtD;AACT;AAEA,SAAgB,EAAwB,GAAsB,GAAiB,GAAwC;CACrH,IAAM,IAAW,IAAI,kBAAiB,MAAa;EACjD,EAAU,SAAQ,MAAY;GAC5B,AAAI,EAAS,iBAAiB,EAA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,MAAM,CAAI,CAAC,CAAC,KAAK,GAAG;AACzE;AAEA,SAAgB,EAAiB,GAAsB,GAAc;CACnE,EAAQ,MAAM,aAAa,MAAM,qBAAK,IAAI,IAAI,CAAC,GAAG,EAAe,CAAO,GAAG,CAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;AAC7F;AAKA,SAAgB,EAAuB,GAAsB,GAA+B;CAC1F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAO,MAAU,MAAU,EAAE,EAAM;AAC9E;AAKA,SAAgB,EAAsB,GAAuD;CAC3F,OAAO,MAAM,KACX,IAAI,IAAI,MAAM,KAAK,CAAM,CAAC,CAAC,QAAQ,MAA2B,OAAO,KAAU,YAAY,EAAM,SAAS,CAAC,CAAC,CAC9G;AACF"}
@@ -2,6 +2,8 @@ export declare function isFocusable(element: Element): boolean;
2
2
  /** returns interactive elements that does not require advanced keyboard interactions like arrow/navigation */
3
3
  export declare function isSimpleFocusable(element: Element): boolean;
4
4
  export declare function getActiveElement(root?: Document | ShadowRoot): Element | null;
5
+ /** Returns whether an element itself owns focus in its immediate document or shadow root. */
6
+ export declare function isImmediateRootActiveElement(element: Element): boolean;
5
7
  export declare function focusElement(element: HTMLElement): void;
6
8
  export declare function focusElementTimeout(element: HTMLElement): void;
7
9
  export declare function setActiveKeyListItem(items: NodeListOf<HTMLElement> | HTMLElement[], item: HTMLElement): void;