@nvidia-elements/core 2.0.0 → 2.0.2

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 (170) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -1
  3. package/dist/_virtual/{_@oxc-project_runtime@0.132.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
  4. package/dist/accordion/accordion2.js +5 -5
  5. package/dist/alert/alert-group2.js +2 -2
  6. package/dist/alert/alert2.js +2 -2
  7. package/dist/avatar/avatar-group2.js +1 -1
  8. package/dist/avatar/avatar2.js +2 -2
  9. package/dist/badge/badge2.js +2 -2
  10. package/dist/breadcrumb/breadcrumb2.js +2 -2
  11. package/dist/bundles/index.d.ts +2 -11
  12. package/dist/bundles/index.js +6 -6
  13. package/dist/button/button2.js +2 -2
  14. package/dist/button-group/button-group2.js +2 -2
  15. package/dist/card/card2.js +5 -5
  16. package/dist/chat-message/chat-message2.js +2 -2
  17. package/dist/checkbox/checkbox-group2.js +2 -2
  18. package/dist/checkbox/checkbox2.js +2 -2
  19. package/dist/color/color2.js +2 -2
  20. package/dist/combobox/combobox2.js +31 -31
  21. package/dist/combobox/combobox2.js.map +1 -1
  22. package/dist/copy-button/copy-button2.js +2 -2
  23. package/dist/custom-elements.json +168 -733
  24. package/dist/date/date2.js +2 -2
  25. package/dist/datetime/datetime2.js +2 -2
  26. package/dist/dialog/dialog-footer2.js +2 -2
  27. package/dist/dialog/dialog-header2.js +2 -2
  28. package/dist/dialog/dialog2.js +2 -2
  29. package/dist/divider/divider2.js +2 -2
  30. package/dist/dot/dot2.js +2 -2
  31. package/dist/drawer/drawer-content2.js +2 -2
  32. package/dist/drawer/drawer-footer2.js +2 -2
  33. package/dist/drawer/drawer-header2.js +2 -2
  34. package/dist/drawer/drawer2.js +2 -2
  35. package/dist/dropdown/dropdown-footer2.js +2 -2
  36. package/dist/dropdown/dropdown-header2.js +2 -2
  37. package/dist/dropdown/dropdown2.js +2 -2
  38. package/dist/dropdown-group/dropdown-group.js +2 -2
  39. package/dist/dropzone/dropzone2.js +2 -2
  40. package/dist/file/file2.js +1 -1
  41. package/dist/format-datetime/format-datetime2.js +2 -2
  42. package/dist/format-number/format-number2.js +2 -2
  43. package/dist/format-relative-time/format-relative-time2.js +6 -3
  44. package/dist/format-relative-time/format-relative-time2.js.map +1 -1
  45. package/dist/forms/control/control.js +1 -1
  46. package/dist/forms/control/control.js.map +1 -1
  47. package/dist/forms/control/control2.js +39 -21
  48. package/dist/forms/control/control2.js.map +1 -1
  49. package/dist/forms/control-group/control-group.js +1 -1
  50. package/dist/forms/control-group/control-group.js.map +1 -1
  51. package/dist/forms/control-group/control-group2.js +2 -2
  52. package/dist/forms/control-group/control-group2.js.map +1 -1
  53. package/dist/forms/control-message/control-message2.js +2 -2
  54. package/dist/forms/utils/states.d.ts +6 -3
  55. package/dist/forms/utils/states.js +40 -32
  56. package/dist/forms/utils/states.js.map +1 -1
  57. package/dist/grid/cell/cell2.js +1 -1
  58. package/dist/grid/column/column2.js +2 -2
  59. package/dist/grid/footer/footer2.js +2 -2
  60. package/dist/grid/grid2.js +2 -2
  61. package/dist/grid/header/header2.js +2 -2
  62. package/dist/grid/placeholder/placeholder2.js +1 -1
  63. package/dist/grid/row/row2.js +2 -2
  64. package/dist/icon/icon2.js +3 -3
  65. package/dist/icon-button/icon-button2.js +2 -2
  66. package/dist/index.js +1 -1
  67. package/dist/input/input-group2.js +1 -1
  68. package/dist/input/input2.js +2 -2
  69. package/dist/internal/controllers/keynav-grid.controller.js +22 -18
  70. package/dist/internal/controllers/keynav-grid.controller.js.map +1 -1
  71. package/dist/internal/controllers/keynav-list.controller.d.ts +1 -0
  72. package/dist/internal/controllers/keynav-list.controller.js +6 -1
  73. package/dist/internal/controllers/keynav-list.controller.js.map +1 -1
  74. package/dist/internal/controllers/type-native-popover.controller.js +70 -40
  75. package/dist/internal/controllers/type-native-popover.controller.js.map +1 -1
  76. package/dist/internal/index.d.ts +0 -9
  77. package/dist/internal/index.js +20 -29
  78. package/dist/internal/services/global.service.js +1 -1
  79. package/dist/internal/services/log.service.js +1 -1
  80. package/dist/internal/services/log.service.js.map +1 -1
  81. package/dist/internal/types/index.d.ts +3 -0
  82. package/dist/internal/types/index.js.map +1 -1
  83. package/dist/internal/utils/dom.d.ts +1 -1
  84. package/dist/internal/utils/dom.js +71 -54
  85. package/dist/internal/utils/dom.js.map +1 -1
  86. package/dist/logo/logo2.js +2 -2
  87. package/dist/menu/menu-item2.js +2 -2
  88. package/dist/menu/menu2.js +2 -2
  89. package/dist/month/month2.js +2 -2
  90. package/dist/notification/notification-group2.js +2 -2
  91. package/dist/notification/notification2.js +2 -2
  92. package/dist/page/page-panel/page-panel-content2.js +1 -1
  93. package/dist/page/page-panel/page-panel-footer2.js +2 -2
  94. package/dist/page/page-panel/page-panel-header2.js +2 -2
  95. package/dist/page/page-panel/page-panel2.js +2 -2
  96. package/dist/page/page2.js +2 -2
  97. package/dist/page-header/page-header2.js +1 -1
  98. package/dist/page-loader/page-loader2.js +2 -2
  99. package/dist/pagination/pagination2.js +2 -2
  100. package/dist/panel/panel2.js +5 -5
  101. package/dist/password/password2.js +2 -2
  102. package/dist/preferences-input/preferences-input2.js +2 -2
  103. package/dist/progress-bar/progress-bar2.js +2 -2
  104. package/dist/progress-ring/progress-ring2.js +2 -2
  105. package/dist/progressive-filter-chip/progressive-filter-chip2.js +2 -2
  106. package/dist/pulse/pulse2.js +2 -2
  107. package/dist/radio/radio-group2.js +2 -2
  108. package/dist/radio/radio2.js +2 -2
  109. package/dist/range/range2.js +2 -2
  110. package/dist/resize-handle/resize-handle2.js +2 -2
  111. package/dist/search/search2.js +2 -2
  112. package/dist/select/select.d.ts +1 -0
  113. package/dist/select/select.global.js +6 -0
  114. package/dist/select/select.global.js.map +1 -0
  115. package/dist/select/select2.js +64 -46
  116. package/dist/select/select2.js.map +1 -1
  117. package/dist/skeleton/skeleton2.js +2 -2
  118. package/dist/sort-button/sort-button2.js +2 -2
  119. package/dist/sparkline/sparkline.utils.js +4 -2
  120. package/dist/sparkline/sparkline.utils.js.map +1 -1
  121. package/dist/sparkline/sparkline2.js +2 -2
  122. package/dist/star-rating/star-rating2.js +2 -2
  123. package/dist/steps/steps2.js +3 -3
  124. package/dist/switch/switch-group2.js +2 -2
  125. package/dist/switch/switch2.js +2 -2
  126. package/dist/tabs/tabs-group2.js +2 -2
  127. package/dist/tabs/tabs2.js +3 -3
  128. package/dist/tag/tag2.js +2 -2
  129. package/dist/textarea/textarea2.js +1 -1
  130. package/dist/time/time2.js +2 -2
  131. package/dist/toast/toast2.js +2 -2
  132. package/dist/toggletip/toggletip-footer2.js +2 -2
  133. package/dist/toggletip/toggletip-header2.js +2 -2
  134. package/dist/toggletip/toggletip2.js +2 -2
  135. package/dist/toolbar/toolbar2.js +2 -2
  136. package/dist/tooltip/tooltip2.js +2 -2
  137. package/dist/tree/tree-node2.js +2 -2
  138. package/dist/tree/tree2.js +2 -2
  139. package/dist/week/week2.js +2 -2
  140. package/package.json +10 -10
  141. package/dist/internal/controllers/state-active.controller.d.ts +0 -18
  142. package/dist/internal/controllers/state-active.controller.js +0 -29
  143. package/dist/internal/controllers/state-active.controller.js.map +0 -1
  144. package/dist/internal/controllers/state-current.controller.d.ts +0 -18
  145. package/dist/internal/controllers/state-current.controller.js +0 -28
  146. package/dist/internal/controllers/state-current.controller.js.map +0 -1
  147. package/dist/internal/controllers/state-disabled.controller.d.ts +0 -18
  148. package/dist/internal/controllers/state-disabled.controller.js +0 -20
  149. package/dist/internal/controllers/state-disabled.controller.js.map +0 -1
  150. package/dist/internal/controllers/state-pressed.controller.d.ts +0 -18
  151. package/dist/internal/controllers/state-pressed.controller.js +0 -20
  152. package/dist/internal/controllers/state-pressed.controller.js.map +0 -1
  153. package/dist/internal/controllers/type-button.controller.d.ts +0 -18
  154. package/dist/internal/controllers/type-button.controller.examples.js +0 -6
  155. package/dist/internal/controllers/type-button.controller.examples.js.map +0 -1
  156. package/dist/internal/controllers/type-button.controller.examples.json +0 -16
  157. package/dist/internal/controllers/type-button.controller.js +0 -21
  158. package/dist/internal/controllers/type-button.controller.js.map +0 -1
  159. package/dist/internal/controllers/type-command.controller.d.ts +0 -25
  160. package/dist/internal/controllers/type-command.controller.js +0 -38
  161. package/dist/internal/controllers/type-command.controller.js.map +0 -1
  162. package/dist/internal/controllers/type-interest.controller.d.ts +0 -23
  163. package/dist/internal/controllers/type-interest.controller.js +0 -51
  164. package/dist/internal/controllers/type-interest.controller.js.map +0 -1
  165. package/dist/internal/controllers/type-native-popover-trigger.controller.d.ts +0 -16
  166. package/dist/internal/controllers/type-native-popover-trigger.controller.js +0 -25
  167. package/dist/internal/controllers/type-native-popover-trigger.controller.js.map +0 -1
  168. package/dist/internal/controllers/type-submit.controller.d.ts +0 -22
  169. package/dist/internal/controllers/type-submit.controller.js +0 -49
  170. package/dist/internal/controllers/type-submit.controller.js.map +0 -1
@@ -9,36 +9,37 @@ function h() {
9
9
  }
10
10
  var g = class {
11
11
  #e = [];
12
- get #t() {
12
+ #t;
13
+ get #n() {
13
14
  return {
14
15
  grid: this.host,
15
16
  ...this.host.keynavGridConfig
16
17
  };
17
18
  }
18
- get #n() {
19
- let e = Array.from(this.#t.rows);
20
- return this.#t.columnRow && e.unshift(this.#t.columnRow), e;
21
- }
22
19
  get #r() {
23
- return [...Array.from(this.#t.columns ?? []), ...Array.from(this.#t.cells)];
20
+ let e = Array.from(this.#n.rows);
21
+ return this.#n.columnRow && e.unshift(this.#n.columnRow), e;
22
+ }
23
+ get #i() {
24
+ return [...Array.from(this.#n.columns ?? []), ...Array.from(this.#n.cells)];
24
25
  }
25
26
  constructor(e) {
26
27
  this.host = e, this.host.addController(this);
27
28
  }
28
29
  async hostConnected() {
29
- await this.host.updateComplete, o(this.#r), this.#t.grid.addEventListener("keyup", (e) => this.#s(e)), this.#t.grid.addEventListener("keydown", (e) => this.#a(e)), this.#t.grid.addEventListener("mouseup", (e) => this.#i(e)), this.#e.push(t(this.host, n(() => o(this.#r), 500)));
30
+ await this.host.updateComplete, this.host.isConnected && (this.#t = this.#n.grid, o(this.#i), this.#t.addEventListener("keyup", this.#l), this.#t.addEventListener("keydown", this.#u), this.#t.addEventListener("mouseup", this.#d), this.#e.push(t(this.host, n(() => o(this.#i), 500))));
30
31
  }
31
32
  hostDisconnected() {
32
- this.#e.forEach((e) => e?.disconnect());
33
+ this.#e.forEach((e) => e?.disconnect()), this.#e.length = 0, this.#t?.removeEventListener("keyup", this.#l), this.#t?.removeEventListener("keydown", this.#u), this.#t?.removeEventListener("mouseup", this.#d), this.#t = void 0;
33
34
  }
34
- #i(e) {
35
+ #a(e) {
35
36
  if (!p(e)) {
36
- let t = e.composedPath()[0], n = this.#r.find((e) => e === t) ? t : null;
37
- n && this.#o(e, n);
37
+ let t = e.composedPath()[0], n = this.#i.find((e) => e === t) ? t : null;
38
+ n && this.#s(e, n);
38
39
  }
39
40
  }
40
- #a(t) {
41
- let n = Array.from(this.#n), i = Array.from(this.#r);
41
+ #o(t) {
42
+ let n = Array.from(this.#r), i = Array.from(this.#i);
42
43
  if (e.state.env !== "production" && f(n)) {
43
44
  r.warn("Invalid grid structure, all rows must have the same number of cells");
44
45
  return;
@@ -49,11 +50,11 @@ var g = class {
49
50
  ctrlKey: t.ctrlKey,
50
51
  dir: this.host.dir
51
52
  }), a = Array.from(u(n[r])).filter((e) => !!i.find((t) => t === e))[e];
52
- this.#o(t, a), t.preventDefault();
53
+ this.#s(t, a), t.preventDefault();
53
54
  }
54
55
  }
55
- #o(e, t) {
56
- c(this.#r, t);
56
+ #s(e, t) {
57
+ c(this.#i, t);
57
58
  let n = d(t), r = n.filter((e) => s(e));
58
59
  r.length === 1 && n.length === 1 ? i(r[0]) : i(t);
59
60
  let a = {
@@ -67,10 +68,13 @@ var g = class {
67
68
  detail: a
68
69
  }));
69
70
  }
70
- #s(e) {
71
- let t = Array.from(this.#r).find((e) => e.tabIndex === 0);
71
+ #c(e) {
72
+ let t = Array.from(this.#i).find((e) => e.tabIndex === 0);
72
73
  e.code === "Escape" && t?.focus(), e.code === "Enter" && t === e.composedPath()[0] && d(t)[0]?.focus();
73
74
  }
75
+ #l = (e) => this.#c(e);
76
+ #u = (e) => this.#o(e);
77
+ #d = (e) => this.#a(e);
74
78
  };
75
79
  function _(e, t) {
76
80
  let n = t === "rtl" ? l.ArrowRight : l.ArrowLeft, r = t === "rtl" ? l.ArrowLeft : l.ArrowRight;
@@ -1 +1 @@
1
- {"version":3,"file":"keynav-grid.controller.js","names":["#config","#hostRows","#hostCells","#updateCellActivation","#keynavCell","#clickCell","#observers","#setActiveCell"],"sources":["../../../src/internal/controllers/keynav-grid.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 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { onChildListMutation, throttle } from '../utils/events.js';\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport {\n validKeyNavigationCode,\n isContextMenuClick,\n getFlattenedDOMTree,\n getFlattenedFocusableItems,\n KeynavCode,\n hasInvalidDOMGrid\n} from '../utils/dom.js';\nimport {\n focusElement,\n getActiveElement,\n initializeKeyListItems,\n setActiveKeyListItem,\n isSimpleFocusable\n} from '../utils/focus.js';\n\nexport interface KeynavGridConfig {\n grid?: HTMLElement;\n columnRow?: HTMLElement;\n columns?: NodeListOf<HTMLElement> | HTMLElement[];\n rows: NodeListOf<HTMLElement> | HTMLElement[];\n cells: NodeListOf<HTMLElement> | HTMLElement[];\n}\n\nexport interface KeynavGridElement {\n keynavGridConfig: KeynavGridConfig;\n}\n\n/**\n * https://w3c.github.io/aria-practices/#gridNav_focus\n */\nexport function keyNavigationGrid<T extends ReactiveElement & KeynavGridElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationGridController(instance));\n}\n\nexport class KeyNavigationGridController<T extends ReactiveElement & KeynavGridElement> implements ReactiveController {\n #observers: MutationObserver[] = [];\n\n get #config() {\n return {\n grid: this.host,\n ...this.host.keynavGridConfig\n };\n }\n\n get #hostRows() {\n const rows = Array.from(this.#config.rows);\n\n if (this.#config.columnRow) {\n rows.unshift(this.#config.columnRow);\n }\n\n return rows;\n }\n\n get #hostCells() {\n return [...Array.from(this.#config.columns ?? []), ...Array.from(this.#config.cells)];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n initializeKeyListItems(this.#hostCells);\n this.#config.grid.addEventListener('keyup', (e: KeyboardEvent) => this.#updateCellActivation(e));\n this.#config.grid.addEventListener('keydown', (e: KeyboardEvent) => this.#keynavCell(e));\n this.#config.grid.addEventListener('mouseup', (e: MouseEvent) => this.#clickCell(e));\n this.#observers.push(\n onChildListMutation(\n this.host,\n throttle(() => initializeKeyListItems(this.#hostCells), 500)\n )\n );\n }\n\n hostDisconnected() {\n this.#observers.forEach(o => o?.disconnect());\n }\n\n #clickCell(e: MouseEvent) {\n if (!isContextMenuClick(e)) {\n const focusedElement = e.composedPath()[0] as HTMLElement;\n const activeCell = this.#hostCells.find(i => i === focusedElement) ? focusedElement : null;\n if (activeCell) {\n this.#setActiveCell(e, activeCell as HTMLElement);\n }\n }\n }\n\n #keynavCell(e: KeyboardEvent) {\n const rows = Array.from(this.#hostRows);\n const cells = Array.from(this.#hostCells);\n\n if (GlobalStateService.state.env !== 'production' && hasInvalidDOMGrid(rows)) {\n LogService.warn('Invalid grid structure, all rows must have the same number of cells');\n return;\n }\n\n if (validKeyNavigationCode(e) && isSimpleFocusable(getActiveElement() as Element)) {\n const { x, y } = getNextKeyGridItem(cells, rows, {\n code: e.code,\n ctrlKey: e.ctrlKey,\n dir: this.host.dir\n });\n\n const nextCell = Array.from(getFlattenedDOMTree(rows[y]!)).filter(c => !!cells.find(i => i === c))[\n x\n ] as HTMLElement;\n this.#setActiveCell(e, nextCell);\n e.preventDefault();\n }\n }\n\n #setActiveCell(e: KeyboardEvent | MouseEvent, activeCell: HTMLElement) {\n setActiveKeyListItem(this.#hostCells, activeCell);\n\n const items = getFlattenedFocusableItems(activeCell);\n const simpleItems = items.filter(i => isSimpleFocusable(i));\n\n if (simpleItems.length === 1 && items.length === 1) {\n focusElement(simpleItems[0]!);\n } else {\n focusElement(activeCell);\n }\n\n const detail = { code: e instanceof KeyboardEvent ? e.code : null, shiftKey: e.shiftKey, activeItem: activeCell };\n activeCell.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n\n #updateCellActivation(e: KeyboardEvent) {\n const activeCell = Array.from(this.#hostCells).find(i => i.tabIndex === 0) as HTMLElement;\n if (e.code === 'Escape') {\n activeCell?.focus();\n }\n\n if (e.code === 'Enter' && activeCell === e.composedPath()[0]) {\n getFlattenedFocusableItems(activeCell as HTMLElement)[0]?.focus();\n }\n }\n}\n\nfunction getGridDelta(code: KeynavCode | string, dir: string): { dx: number; dy: number } | null {\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (code === KeynavCode.ArrowUp) return { dx: 0, dy: -1 };\n if (code === KeynavCode.ArrowDown) return { dx: 0, dy: 1 };\n if (code === start) return { dx: -1, dy: 0 };\n if (code === end) return { dx: 1, dy: 0 };\n if (code === KeynavCode.PageUp) return { dx: 0, dy: -4 };\n if (code === KeynavCode.PageDown) return { dx: 0, dy: 4 };\n return null;\n}\n\nfunction applyGridHomeEnd(\n code: KeynavCode | string,\n position: { x: number; y: number },\n bounds: { columnCount: number; rowCount: number; ctrlKey: boolean }\n) {\n const { x, y } = position;\n const { columnCount, rowCount, ctrlKey } = bounds;\n if (code === KeynavCode.End) {\n return { x: columnCount, y: ctrlKey ? rowCount : y };\n }\n\n if (code === KeynavCode.Home) {\n return { x: 0, y: ctrlKey ? 0 : y };\n }\n\n return { x, y };\n}\n\nexport function getNextKeyGridItem(\n cells: HTMLElement[],\n rows: HTMLElement[],\n config: { code: KeynavCode | string; ctrlKey: boolean; dir: string }\n) {\n const currentCell = cells.find(i => i.tabIndex === 0) as HTMLElement;\n const currentRow = rows.find(r => getFlattenedDOMTree(r).find(c => c === currentCell)) as HTMLElement;\n const currentRowCells = Array.from(getFlattenedDOMTree(currentRow)).filter(c => !!cells.find(i => i === c));\n const rowCount = rows.length - 1;\n const columnCount = currentRowCells.length - 1;\n\n let x = currentRowCells.indexOf(currentCell);\n let y = rows.indexOf(currentRow);\n\n const delta = getGridDelta(config.code, config.dir);\n if (delta) {\n x = Math.max(0, Math.min(columnCount, x + delta.dx));\n y = Math.max(0, Math.min(rowCount, y + delta.dy));\n } else {\n ({ x, y } = applyGridHomeEnd(config.code, { x, y }, { columnCount, rowCount, ctrlKey: config.ctrlKey }));\n }\n\n return { x, y };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAA4B,CAAQ,CAAC;AACrF;AAEA,IAAa,IAAb,MAAsH;CACpH,KAAiC,CAAC;CAElC,IAAIA,KAAU;EACZ,OAAO;GACL,MAAM,KAAK;GACX,GAAG,KAAK,KAAK;EACf;CACF;CAEA,IAAIC,KAAY;EACd,IAAM,IAAO,MAAM,KAAK,KAAKD,GAAQ,IAAI;EAMzC,OAJI,KAAKA,GAAQ,aACf,EAAK,QAAQ,KAAKA,GAAQ,SAAS,GAG9B;CACT;CAEA,IAAIE,KAAa;EACf,OAAO,CAAC,GAAG,MAAM,KAAK,KAAKF,GAAQ,WAAW,CAAC,CAAC,GAAG,GAAG,MAAM,KAAK,KAAKA,GAAQ,KAAK,CAAC;CACtF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,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S3C,OARI,MAAS,EAAW,MACf;EAAE,GAAG;EAAa,GAAG,IAAU,IAAW;CAAE,IAGjD,MAAS,EAAW,OACf;EAAE,GAAG;EAAG,GAAG,IAAU,IAAI;CAAE,IAG7B;EAAE;EAAG;CAAE;AAChB;AAEA,SAAgB,EACd,GACA,GACA,GACA;CACA,IAAM,IAAc,EAAM,MAAK,MAAK,EAAE,aAAa,CAAC,GAC9C,IAAa,EAAK,MAAK,MAAK,EAAoB,CAAC,EAAE,MAAK,MAAK,MAAM,CAAW,CAAC,GAC/E,IAAkB,MAAM,KAAK,EAAoB,CAAU,CAAC,EAAE,QAAO,MAAK,CAAC,CAAC,EAAM,MAAK,MAAK,MAAM,CAAC,CAAC,GACpG,IAAW,EAAK,SAAS,GACzB,IAAc,EAAgB,SAAS,GAEzC,IAAI,EAAgB,QAAQ,CAAW,GACvC,IAAI,EAAK,QAAQ,CAAU,GAEzB,IAAQ,EAAa,EAAO,MAAM,EAAO,GAAG;CAQlD,OAPI,KACF,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAa,IAAI,EAAM,EAAE,CAAC,GACnD,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAU,IAAI,EAAM,EAAE,CAAC,KAE/C,eAAW,EAAiB,EAAO,MAAM;EAAE;EAAG;CAAE,GAAG;EAAE;EAAa;EAAU,SAAS,EAAO;CAAQ,CAAC,GAGjG;EAAE;EAAG;CAAE;AAChB"}
1
+ {"version":3,"file":"keynav-grid.controller.js","names":["#config","#hostRows","#hostCells","#grid","#onKeyUp","#onKeyDown","#onMouseUp","#observers","#setActiveCell","#updateCellActivation","#keynavCell","#clickCell"],"sources":["../../../src/internal/controllers/keynav-grid.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 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { onChildListMutation, throttle } from '../utils/events.js';\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport {\n validKeyNavigationCode,\n isContextMenuClick,\n getFlattenedDOMTree,\n getFlattenedFocusableItems,\n KeynavCode,\n hasInvalidDOMGrid\n} from '../utils/dom.js';\nimport {\n focusElement,\n getActiveElement,\n initializeKeyListItems,\n setActiveKeyListItem,\n isSimpleFocusable\n} from '../utils/focus.js';\n\nexport interface KeynavGridConfig {\n grid?: HTMLElement;\n columnRow?: HTMLElement;\n columns?: NodeListOf<HTMLElement> | HTMLElement[];\n rows: NodeListOf<HTMLElement> | HTMLElement[];\n cells: NodeListOf<HTMLElement> | HTMLElement[];\n}\n\nexport interface KeynavGridElement {\n keynavGridConfig: KeynavGridConfig;\n}\n\n/**\n * https://w3c.github.io/aria-practices/#gridNav_focus\n */\nexport function keyNavigationGrid<T extends ReactiveElement & KeynavGridElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationGridController(instance));\n}\n\nexport class KeyNavigationGridController<T extends ReactiveElement & KeynavGridElement> implements ReactiveController {\n #observers: MutationObserver[] = [];\n #grid?: HTMLElement;\n\n get #config() {\n return {\n grid: this.host,\n ...this.host.keynavGridConfig\n };\n }\n\n get #hostRows() {\n const rows = Array.from(this.#config.rows);\n\n if (this.#config.columnRow) {\n rows.unshift(this.#config.columnRow);\n }\n\n return rows;\n }\n\n get #hostCells() {\n return [...Array.from(this.#config.columns ?? []), ...Array.from(this.#config.cells)];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.#grid = this.#config.grid;\n initializeKeyListItems(this.#hostCells);\n this.#grid.addEventListener('keyup', this.#onKeyUp);\n this.#grid.addEventListener('keydown', this.#onKeyDown);\n this.#grid.addEventListener('mouseup', this.#onMouseUp);\n this.#observers.push(\n onChildListMutation(\n this.host,\n throttle(() => initializeKeyListItems(this.#hostCells), 500)\n )\n );\n }\n\n hostDisconnected() {\n this.#observers.forEach(o => o?.disconnect());\n this.#observers.length = 0;\n this.#grid?.removeEventListener('keyup', this.#onKeyUp);\n this.#grid?.removeEventListener('keydown', this.#onKeyDown);\n this.#grid?.removeEventListener('mouseup', this.#onMouseUp);\n this.#grid = undefined;\n }\n\n #clickCell(e: MouseEvent) {\n if (!isContextMenuClick(e)) {\n const focusedElement = e.composedPath()[0] as HTMLElement;\n const activeCell = this.#hostCells.find(i => i === focusedElement) ? focusedElement : null;\n if (activeCell) {\n this.#setActiveCell(e, activeCell as HTMLElement);\n }\n }\n }\n\n #keynavCell(e: KeyboardEvent) {\n const rows = Array.from(this.#hostRows);\n const cells = Array.from(this.#hostCells);\n\n if (GlobalStateService.state.env !== 'production' && hasInvalidDOMGrid(rows)) {\n LogService.warn('Invalid grid structure, all rows must have the same number of cells');\n return;\n }\n\n if (validKeyNavigationCode(e) && isSimpleFocusable(getActiveElement() as Element)) {\n const { x, y } = getNextKeyGridItem(cells, rows, {\n code: e.code,\n ctrlKey: e.ctrlKey,\n dir: this.host.dir\n });\n\n const nextCell = Array.from(getFlattenedDOMTree(rows[y]!)).filter(c => !!cells.find(i => i === c))[\n x\n ] as HTMLElement;\n this.#setActiveCell(e, nextCell);\n e.preventDefault();\n }\n }\n\n #setActiveCell(e: KeyboardEvent | MouseEvent, activeCell: HTMLElement) {\n setActiveKeyListItem(this.#hostCells, activeCell);\n\n const items = getFlattenedFocusableItems(activeCell);\n const simpleItems = items.filter(i => isSimpleFocusable(i));\n\n if (simpleItems.length === 1 && items.length === 1) {\n focusElement(simpleItems[0]!);\n } else {\n focusElement(activeCell);\n }\n\n const detail = { code: e instanceof KeyboardEvent ? e.code : null, shiftKey: e.shiftKey, activeItem: activeCell };\n activeCell.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n\n #updateCellActivation(e: KeyboardEvent) {\n const activeCell = Array.from(this.#hostCells).find(i => i.tabIndex === 0) as HTMLElement;\n if (e.code === 'Escape') {\n activeCell?.focus();\n }\n\n if (e.code === 'Enter' && activeCell === e.composedPath()[0]) {\n getFlattenedFocusableItems(activeCell as HTMLElement)[0]?.focus();\n }\n }\n\n #onKeyUp = (e: KeyboardEvent) => this.#updateCellActivation(e);\n\n #onKeyDown = (e: KeyboardEvent) => this.#keynavCell(e);\n\n #onMouseUp = (e: MouseEvent) => this.#clickCell(e);\n}\n\nfunction getGridDelta(code: KeynavCode | string, dir: string): { dx: number; dy: number } | null {\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (code === KeynavCode.ArrowUp) return { dx: 0, dy: -1 };\n if (code === KeynavCode.ArrowDown) return { dx: 0, dy: 1 };\n if (code === start) return { dx: -1, dy: 0 };\n if (code === end) return { dx: 1, dy: 0 };\n if (code === KeynavCode.PageUp) return { dx: 0, dy: -4 };\n if (code === KeynavCode.PageDown) return { dx: 0, dy: 4 };\n return null;\n}\n\nfunction applyGridHomeEnd(\n code: KeynavCode | string,\n position: { x: number; y: number },\n bounds: { columnCount: number; rowCount: number; ctrlKey: boolean }\n) {\n const { x, y } = position;\n const { columnCount, rowCount, ctrlKey } = bounds;\n if (code === KeynavCode.End) {\n return { x: columnCount, y: ctrlKey ? rowCount : y };\n }\n\n if (code === KeynavCode.Home) {\n return { x: 0, y: ctrlKey ? 0 : y };\n }\n\n return { x, y };\n}\n\nexport function getNextKeyGridItem(\n cells: HTMLElement[],\n rows: HTMLElement[],\n config: { code: KeynavCode | string; ctrlKey: boolean; dir: string }\n) {\n const currentCell = cells.find(i => i.tabIndex === 0) as HTMLElement;\n const currentRow = rows.find(r => getFlattenedDOMTree(r).find(c => c === currentCell)) as HTMLElement;\n const currentRowCells = Array.from(getFlattenedDOMTree(currentRow)).filter(c => !!cells.find(i => i === c));\n const rowCount = rows.length - 1;\n const columnCount = currentRowCells.length - 1;\n\n let x = currentRowCells.indexOf(currentCell);\n let y = rows.indexOf(currentRow);\n\n const delta = getGridDelta(config.code, config.dir);\n if (delta) {\n x = Math.max(0, Math.min(columnCount, x + delta.dx));\n y = Math.max(0, Math.min(rowCount, y + delta.dy));\n } else {\n ({ x, y } = applyGridHomeEnd(config.code, { x, y }, { columnCount, rowCount, ctrlKey: config.ctrlKey }));\n }\n\n return { x, y };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAA4B,CAAQ,CAAC;AACrF;AAEA,IAAa,IAAb,MAAsH;CACpH,KAAiC,CAAC;CAClC;CAEA,IAAIA,KAAU;EACZ,OAAO;GACL,MAAM,KAAK;GACX,GAAG,KAAK,KAAK;EACf;CACF;CAEA,IAAIC,KAAY;EACd,IAAM,IAAO,MAAM,KAAK,KAAKD,GAAQ,IAAI;EAMzC,OAJI,KAAKA,GAAQ,aACf,EAAK,QAAQ,KAAKA,GAAQ,SAAS,GAG9B;CACT;CAEA,IAAIE,KAAa;EACf,OAAO,CAAC,GAAG,MAAM,KAAK,KAAKF,GAAQ,WAAW,CAAC,CAAC,GAAG,GAAG,MAAM,KAAK,KAAKA,GAAQ,KAAK,CAAC;CACtF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,MAAM,gBAAgB;EACpB,MAAM,KAAK,KAAK,gBACX,KAAK,KAAK,gBAEf,KAAKG,KAAQ,KAAKH,GAAQ,MAC1B,EAAuB,KAAKE,EAAU,GACtC,KAAKC,GAAM,iBAAiB,SAAS,KAAKC,EAAQ,GAClD,KAAKD,GAAM,iBAAiB,WAAW,KAAKE,EAAU,GACtD,KAAKF,GAAM,iBAAiB,WAAW,KAAKG,EAAU,GACtD,KAAKC,GAAW,KACd,EACE,KAAK,MACL,QAAe,EAAuB,KAAKL,EAAU,GAAG,G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IAAU,IAAW;CAAE,IAGjD,MAAS,EAAW,OACf;EAAE,GAAG;EAAG,GAAG,IAAU,IAAI;CAAE,IAG7B;EAAE;EAAG;CAAE;AAChB;AAEA,SAAgB,EACd,GACA,GACA,GACA;CACA,IAAM,IAAc,EAAM,MAAK,MAAK,EAAE,aAAa,CAAC,GAC9C,IAAa,EAAK,MAAK,MAAK,EAAoB,CAAC,EAAE,MAAK,MAAK,MAAM,CAAW,CAAC,GAC/E,IAAkB,MAAM,KAAK,EAAoB,CAAU,CAAC,EAAE,QAAO,MAAK,CAAC,CAAC,EAAM,MAAK,MAAK,MAAM,CAAC,CAAC,GACpG,IAAW,EAAK,SAAS,GACzB,IAAc,EAAgB,SAAS,GAEzC,IAAI,EAAgB,QAAQ,CAAW,GACvC,IAAI,EAAK,QAAQ,CAAU,GAEzB,IAAQ,EAAa,EAAO,MAAM,EAAO,GAAG;CAQlD,OAPI,KACF,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAa,IAAI,EAAM,EAAE,CAAC,GACnD,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAU,IAAI,EAAM,EAAE,CAAC,KAE/C,eAAW,EAAiB,EAAO,MAAM;EAAE;EAAG;CAAE,GAAG;EAAE;EAAa;EAAU,SAAS,EAAO;CAAQ,CAAC,GAGjG;EAAE;EAAG;CAAE;AAChB"}
@@ -18,6 +18,7 @@ export declare class KeyNavigationListController<T extends ReactiveElement & Key
18
18
  private host;
19
19
  constructor(host: T);
20
20
  hostConnected(): Promise<void>;
21
+ hostDisconnected(): void;
21
22
  }
22
23
  interface KeyListConfig {
23
24
  code: KeynavCode;
@@ -23,7 +23,10 @@ var o = class {
23
23
  return this.host.hasAttribute("nve-keynav-disabled");
24
24
  }
25
25
  async hostConnected() {
26
- await this.host.updateComplete, this.#n(), this.host.addEventListener("pointerup", (e) => this.#r(e)), this.host.addEventListener("keydown", (e) => this.#i(e));
26
+ await this.host.updateComplete, this.host.isConnected && (this.#n(), this.host.addEventListener("pointerup", this.#s), this.host.addEventListener("keydown", this.#c));
27
+ }
28
+ hostDisconnected() {
29
+ this.host.removeEventListener("pointerup", this.#s), this.host.removeEventListener("keydown", this.#c);
27
30
  }
28
31
  #n() {
29
32
  let { manageFocus: e, manageTabindex: n, items: r } = this.#e;
@@ -67,6 +70,8 @@ var o = class {
67
70
  detail: c
68
71
  }));
69
72
  }
73
+ #s = (e) => this.#r(e);
74
+ #c = (e) => this.#i(e);
70
75
  };
71
76
  function s(e) {
72
77
  let { code: t, layout: n, dir: i } = e, a = i === "rtl" ? r.ArrowRight : r.ArrowLeft, o = i === "rtl" ? r.ArrowLeft : r.ArrowRight;
@@ -1 +1 @@
1
- {"version":3,"file":"keynav-list.controller.js","names":["#config","#keynavDisabled","#initializeTabIndex","#clickItem","#focusItem","#getActiveItem","#setActiveItem"],"sources":["../../../src/internal/controllers/keynav-list.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 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { focusElement, initializeKeyListItems, setActiveKeyListItem } from '../utils/focus.js';\nimport { KeynavCode, validKeyNavigationCode } from '../utils/dom.js';\n\nexport interface KeynavListConfig {\n items: NodeListOf<HTMLElement> | HTMLElement[];\n layout?: 'both' | 'horizontal' | 'vertical';\n manageFocus?: boolean;\n manageTabindex?: boolean;\n loop?: boolean;\n dir?: string | null;\n}\n\nexport interface KeynavListElement {\n keynavListConfig: KeynavListConfig;\n}\n\n/** https://webaim.org/techniques/keyboard/ */\nexport function keyNavigationList<T extends ReactiveElement & KeynavListElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationListController(instance));\n}\n\nexport class KeyNavigationListController<T extends ReactiveElement & KeynavListElement> implements ReactiveController {\n get #config(): KeynavListConfig & { items: HTMLElement[] } {\n return {\n layout: 'horizontal',\n manageFocus: true,\n manageTabindex: true,\n loop: false,\n dir: this.host.getAttribute('rtl'),\n ...this.host.keynavListConfig,\n items: Array.from(this.host.keynavListConfig.items).filter(\n (i: HTMLElement & { disabled?: boolean }) => !i.disabled\n )\n };\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n /** @private attr nve-keynav-disabled is an internal API for advanced use cases only */\n get #keynavDisabled() {\n return this.host.hasAttribute('nve-keynav-disabled');\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n this.#initializeTabIndex();\n this.host.addEventListener('pointerup', (e: PointerEvent) => this.#clickItem(e));\n this.host.addEventListener('keydown', (e: KeyboardEvent) => this.#focusItem(e));\n }\n\n #initializeTabIndex() {\n const { manageFocus, manageTabindex, items } = this.#config;\n if (manageFocus && manageTabindex && !this.#keynavDisabled) {\n initializeKeyListItems(items);\n }\n }\n\n #clickItem(e: PointerEvent) {\n const item = this.#getActiveItem(e, this.#config.items);\n if (item) {\n this.#setActiveItem(e, item);\n }\n }\n\n #focusItem(e: KeyboardEvent) {\n if (validKeyNavigationCode(e) && !this.#keynavDisabled) {\n const { loop, layout, dir, items } = this.#config;\n const activeItem = this.#getActiveItem(e, items);\n if (activeItem) {\n const { next, previous } = getNextKeyListItem(activeItem, Array.from(items), {\n loop,\n layout,\n dir,\n code: e.code as KeynavCode\n });\n\n if (next !== previous) {\n this.#setActiveItem(e, items[next]!, items[previous]);\n }\n }\n }\n }\n\n #getActiveItem(e: Event, items: HTMLElement[]) {\n const focusedElement = e.composedPath()[0] as HTMLElement;\n return items.find(i => i === focusedElement) ? focusedElement : null;\n }\n\n #setActiveItem(e: KeyboardEvent | PointerEvent, activeItem: HTMLElement, previousItem?: HTMLElement) {\n const { manageFocus, manageTabindex, items } = this.#config;\n if (manageFocus) {\n if (manageTabindex) {\n setActiveKeyListItem(items, activeItem);\n }\n\n focusElement(activeItem);\n e.preventDefault();\n }\n\n const detail = {\n activeItem,\n previousItem,\n code: e instanceof KeyboardEvent ? e.code : null,\n metaKey: e.ctrlKey || e.metaKey,\n items\n };\n activeItem.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n}\n\ninterface KeyListConfig {\n code: KeynavCode;\n loop?: boolean;\n layout?: 'horizontal' | 'vertical' | 'both';\n dir: string | null | undefined;\n}\n\nfunction resolveArrowDirection(config: KeyListConfig): 'backward' | 'forward' | null {\n const { code, layout, dir } = config;\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (layout !== 'horizontal') {\n if (code === KeynavCode.ArrowUp) return 'backward';\n if (code === KeynavCode.ArrowDown) return 'forward';\n }\n\n if (layout !== 'vertical') {\n if (code === start) return 'backward';\n if (code === end) return 'forward';\n }\n\n return null;\n}\n\nfunction resolveSpecialKey(code: KeynavCode): 'home' | 'end' | 'pageup' | 'pagedown' | null {\n if (code === KeynavCode.End) return 'end';\n if (code === KeynavCode.Home) return 'home';\n if (code === KeynavCode.PageUp) return 'pageup';\n if (code === KeynavCode.PageDown) return 'pagedown';\n return null;\n}\n\nfunction navigateWithLoop(current: number, step: number, options: { limit: number; loop: boolean | undefined }) {\n const { limit, loop } = options;\n const next = current + step;\n if (next >= 0 && next <= limit) return next;\n return loop ? (step < 0 ? limit : 0) : current;\n}\n\nexport function getNextKeyListItem(item: HTMLElement, items: HTMLElement[], config: KeyListConfig) {\n let next = items.indexOf(item);\n const previous = next;\n const itemCount = items.length - 1;\n const direction = resolveArrowDirection(config);\n\n switch (direction ?? resolveSpecialKey(config.code)) {\n case 'backward':\n next = navigateWithLoop(next, -1, { limit: itemCount, loop: config.loop });\n break;\n case 'forward':\n next = navigateWithLoop(next, 1, { limit: itemCount, loop: config.loop });\n break;\n case 'end':\n next = itemCount;\n break;\n case 'home':\n next = 0;\n break;\n case 'pageup':\n next = Math.max(0, next - 4);\n break;\n case 'pag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IAAM,EAAE,UAAO,YAAS,GAClB,IAAO,IAAU;CAEvB,OADI,KAAQ,KAAK,KAAQ,IAAc,IAChC,IAAQ,IAAO,IAAI,IAAQ,IAAK;AACzC;AAEA,SAAgB,EAAmB,GAAmB,GAAsB,GAAuB;CACjG,IAAI,IAAO,EAAM,QAAQ,CAAI,GACvB,IAAW,GACX,IAAY,EAAM,SAAS;CAGjC,QAFkB,EAAsB,CAEhC,KAAa,EAAkB,EAAO,IAAI,GAAlD;EACE,KAAK;GACH,IAAO,EAAiB,GAAM,IAAI;IAAE,OAAO;IAAW,MAAM,EAAO;GAAK,CAAC;GACzE;EACF,KAAK;GACH,IAAO,EAAiB,GAAM,GAAG;IAAE,OAAO;IAAW,MAAM,EAAO;GAAK,CAAC;GACxE;EACF,KAAK;GACH,IAAO;GACP;EACF,KAAK;GACH,IAAO;GACP;EACF,KAAK;GACH,IAAO,KAAK,IAAI,GAAG,IAAO,CAAC;GAC3B;EACF,KAAK;GACH,IAAO,KAAK,IAAI,GAAW,IAAO,CAAC;GACnC;EACF,KAAK,MACH;CACJ;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B"}
1
+ {"version":3,"file":"keynav-list.controller.js","names":["#config","#keynavDisabled","#initializeTabIndex","#onPointerUp","#onKeyDown","#getActiveItem","#setActiveItem","#clickItem","#focusItem"],"sources":["../../../src/internal/controllers/keynav-list.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 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { focusElement, initializeKeyListItems, setActiveKeyListItem } from '../utils/focus.js';\nimport { KeynavCode, validKeyNavigationCode } from '../utils/dom.js';\n\nexport interface KeynavListConfig {\n items: NodeListOf<HTMLElement> | HTMLElement[];\n layout?: 'both' | 'horizontal' | 'vertical';\n manageFocus?: boolean;\n manageTabindex?: boolean;\n loop?: boolean;\n dir?: string | null;\n}\n\nexport interface KeynavListElement {\n keynavListConfig: KeynavListConfig;\n}\n\n/** https://webaim.org/techniques/keyboard/ */\nexport function keyNavigationList<T extends ReactiveElement & KeynavListElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationListController(instance));\n}\n\nexport class KeyNavigationListController<T extends ReactiveElement & KeynavListElement> implements ReactiveController {\n get #config(): KeynavListConfig & { items: HTMLElement[] } {\n return {\n layout: 'horizontal',\n manageFocus: true,\n manageTabindex: true,\n loop: false,\n dir: this.host.getAttribute('rtl'),\n ...this.host.keynavListConfig,\n items: Array.from(this.host.keynavListConfig.items).filter(\n (i: HTMLElement & { disabled?: boolean }) => !i.disabled\n )\n };\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n /** @private attr nve-keynav-disabled is an internal API for advanced use cases only */\n get #keynavDisabled() {\n return this.host.hasAttribute('nve-keynav-disabled');\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n this.#initializeTabIndex();\n this.host.addEventListener('pointerup', this.#onPointerUp);\n this.host.addEventListener('keydown', this.#onKeyDown);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.host.removeEventListener('keydown', this.#onKeyDown);\n }\n\n #initializeTabIndex() {\n const { manageFocus, manageTabindex, items } = this.#config;\n if (manageFocus && manageTabindex && !this.#keynavDisabled) {\n initializeKeyListItems(items);\n }\n }\n\n #clickItem(e: PointerEvent) {\n const item = this.#getActiveItem(e, this.#config.items);\n if (item) {\n this.#setActiveItem(e, item);\n }\n }\n\n #focusItem(e: KeyboardEvent) {\n if (validKeyNavigationCode(e) && !this.#keynavDisabled) {\n const { loop, layout, dir, items } = this.#config;\n const activeItem = this.#getActiveItem(e, items);\n if (activeItem) {\n const { next, previous } = getNextKeyListItem(activeItem, Array.from(items), {\n loop,\n layout,\n dir,\n code: e.code as KeynavCode\n });\n\n if (next !== previous) {\n this.#setActiveItem(e, items[next]!, items[previous]);\n }\n }\n }\n }\n\n #getActiveItem(e: Event, items: HTMLElement[]) {\n const focusedElement = e.composedPath()[0] as HTMLElement;\n return items.find(i => i === focusedElement) ? focusedElement : null;\n }\n\n #setActiveItem(e: KeyboardEvent | PointerEvent, activeItem: HTMLElement, previousItem?: HTMLElement) {\n const { manageFocus, manageTabindex, items } = this.#config;\n if (manageFocus) {\n if (manageTabindex) {\n setActiveKeyListItem(items, activeItem);\n }\n\n focusElement(activeItem);\n e.preventDefault();\n }\n\n const detail = {\n activeItem,\n previousItem,\n code: e instanceof KeyboardEvent ? e.code : null,\n metaKey: e.ctrlKey || e.metaKey,\n items\n };\n activeItem.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n\n #onPointerUp = (e: PointerEvent) => this.#clickItem(e);\n\n #onKeyDown = (e: KeyboardEvent) => this.#focusItem(e);\n}\n\ninterface KeyListConfig {\n code: KeynavCode;\n loop?: boolean;\n layout?: 'horizontal' | 'vertical' | 'both';\n dir: string | null | undefined;\n}\n\nfunction resolveArrowDirection(config: KeyListConfig): 'backward' | 'forward' | null {\n const { code, layout, dir } = config;\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (layout !== 'horizontal') {\n if (code === KeynavCode.ArrowUp) return 'backward';\n if (code === KeynavCode.ArrowDown) return 'forward';\n }\n\n if (layout !== 'vertical') {\n if (code === start) return 'backward';\n if (code === end) return 'forward';\n }\n\n return null;\n}\n\nfunction resolveSpecialKey(code: KeynavCode): 'home' | 'end' | 'pageup' | 'pagedown' | null {\n if (code === KeynavCode.End) return 'end';\n if (code === KeynavCode.Home) return 'home';\n if (code === KeynavCode.PageUp) return 'pageup';\n if (code === KeynavCode.PageDown) return 'pagedown';\n return null;\n}\n\nfunction navigateWithLoop(current: number, step: number, options: { limit: number; loop: boolean | undefined }) {\n const { limit, loop } = options;\n const next = current + step;\n if (next >= 0 && next <= limit) return next;\n return loop ? (step < 0 ? limit : 0) : current;\n}\n\nexport function getNextKeyListItem(item: HTMLElement, items: HTMLElement[], config: KeyListConfig) {\n let next = items.indexOf(item);\n const previous = next;\n const itemCount = items.length - 1;\n const direction = resolveArrowDirection(config);\n\n switch (direction ?? resolveSpecialKey(config.code)) {\n case 'backward':\n next = navigateWithLoop(next, -1, { limit: itemCount, loop: config.loop });\n break;\n case 'forward':\n next = navigateWithLoop(next, 1, { limit: itemCount, loop: config.loop });\n break;\n case 'end':\n next = itemCount;\n break;\n case 'home':\n next = 0;\n break;\n case 'pageup':\n next = Math.max(0, next - 4);\n break;\n case 'pagedown':\n next = Math.min(itemCount, next + 4);\n break;\n case null:\n break;\n }\n\n return { next, previous };\n}\n"],"mappings":";;;AAsBA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAA4B,CAAQ,CAAC;AACrF;AAEA,IAAa,IAAb,MAAsH;CACpH,IAAIA,KAAuD;EACzD,OAAO;GACL,QAAQ;GACR,aAAa;GACb,gBAAgB;GAChB,MAAM;GACN,KAAK,KAAK,KAAK,aAAa,KAAK;GACjC,GAAG,KAAK,KAAK;GACb,OAAO,MAAM,KAAK,KAAK,KAAK,iBAAiB,KAAK,EAAE,QACjD,MAA4C,CAAC,EAAE,QAClD;EACF;CACF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAGA,IAAIC,KAAkB;EACpB,OAAO,KAAK,KAAK,aAAa,qBAAqB;CACrD;CAEA,MAAM,gBAAgB;EACpB,MAAM,KAAK,KAAK,gBACX,KAAK,KAAK,gBACf,KAAKC,GAAoB,GACzB,KAAK,KAAK,iBAAiB,aAAa,KAAKC,EAAY,GACzD,KAAK,KAAK,iBAAiB,WAAW,KAAKC,EAAU;CACvD;CAEA,mB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AK;GACH,IAAO,KAAK,IAAI,GAAW,IAAO,CAAC;GACnC;EACF,KAAK,MACH;CACJ;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B"}
@@ -23,75 +23,105 @@ var c = class {
23
23
  };
24
24
  }
25
25
  async hostConnected() {
26
- i(this.host), this.host.popover = this.host.popoverType ?? null, await this.host.updateComplete, this.host.setAttribute("nve-popover", ""), this.#p(), this.#f(), this.#u(), this.host.inert = this.host.matches(":not(:popover-open)") && !!this.#e.length, this.host.addEventListener("beforetoggle", (e) => {
27
- e.newState === "open" && this.host._internals.states.add("transition-start");
28
- }), this.host.addEventListener("toggle", (e) => {
29
- this.host.behaviorTrigger && (this.host.hidden = e.newState === "closed"), e.newState === "open" && this.host.closeTimeout && this.#a(), e.newState === "closed" && (this.#s(), this.#o()), this.host.inert = this.host.matches(":not(:popover-open)"), this.host.modal && this.#m(e.newState === "open", e.target), this.host.dispatchEvent(new CustomEvent(e.newState === "open" && e.oldState !== "open" ? "open" : "close", {
30
- bubbles: !0,
31
- composed: !0,
32
- detail: { trigger: e.source }
33
- }));
34
- }), this.host.addEventListener("command", ((e) => {
35
- e.command === "toggle-popover" && this.host.togglePopover({ source: e.source }), e.command === "hide-popover" && (this.host.hidePopover(), this.#s()), e.command === "show-popover" && this.host.showPopover({ source: e.source });
36
- })), this.host.addEventListener("interest", ((e) => {
37
- if (e.source?.localName.includes("-")) {
38
- let t = this.host.openDelay ?? this.#c();
39
- t ? this.#t = setTimeout(() => {
40
- this.host.isConnected && this.host.showPopover({ source: e.source });
41
- }, t) : this.host.showPopover({ source: e.source });
42
- }
43
- })), this.host.addEventListener("loseinterest", ((e) => {
44
- e.source?.localName.includes("-") && this.host.hidePopover(), this.#t &&= (clearTimeout(this.#t), null);
45
- }));
26
+ i(this.host), this.host.popover = this.host.popoverType ?? null, await this.host.updateComplete, this.host.isConnected && (this.host.setAttribute("nve-popover", ""), this.#m(), this.#p(), this.#d(), this.host.inert = this.host.matches(":not(:popover-open)") && !!this.#e.length, this.host.addEventListener("beforetoggle", this.#b), this.host.addEventListener("toggle", this.#x), this.host.addEventListener("command", this.#S), this.host.addEventListener("interest", this.#C), this.host.addEventListener("loseinterest", this.#w));
46
27
  }
47
28
  #t = null;
48
29
  #n = null;
49
30
  #r = [];
50
31
  #i = null;
32
+ #a = null;
51
33
  async hostUpdated() {
52
- this.host.popover = this.host.popoverType ?? null, this.#p();
34
+ this.host.popover = this.host.popoverType ?? null, this.#m();
53
35
  }
54
36
  hostDisconnected() {
55
- this.#r.forEach((e) => e.disconnect()), this.#s(), this.#o();
56
- }
57
- #a() {
58
- this.#o(), this.host.closeTimeout && (this.#n = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout));
37
+ this.#r.forEach((e) => e.disconnect()), this.#r.length = 0, this.host.removeEventListener("beforetoggle", this.#b), this.host.removeEventListener("toggle", this.#x), this.host.removeEventListener("command", this.#S), this.host.removeEventListener("interest", this.#C), this.host.removeEventListener("loseinterest", this.#w), this.host.removeEventListener("pointerdown", this.#T), this.host.removeEventListener("pointerup", this.#E), this.#y(), this.#c(), this.#s();
59
38
  }
60
39
  #o() {
61
- this.#n &&= (clearTimeout(this.#n), null);
40
+ this.#s(), this.host.closeTimeout && (this.#n = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout));
62
41
  }
63
42
  #s() {
64
- this.#t &&= (clearTimeout(this.#t), null);
43
+ this.#n &&= (clearTimeout(this.#n), null);
65
44
  }
66
45
  #c() {
46
+ this.#t &&= (clearTimeout(this.#t), null);
47
+ }
48
+ #l() {
67
49
  let e = getComputedStyle(this.host).interestDelayStart;
68
50
  if (!e) return 0;
69
51
  let t = parseFloat(e);
70
52
  return e.endsWith("ms") ? t : t * 1e3;
71
53
  }
72
- #l = !1;
73
- #u() {
74
- this.host.addEventListener("pointerdown", (e) => {
75
- this.host.modal && this.host.matches(":popover-open") && (this.#l = t(e, this.host));
76
- }), this.host.addEventListener("pointerup", (e) => {
77
- this.#l && this.host.popoverDismissible && this.host.modal && this.host.matches(":popover-open") && !s(this.host) && t(e, this.host) && this.host.hidePopover();
78
- });
54
+ #u = !1;
55
+ #d() {
56
+ this.host.removeEventListener("pointerdown", this.#T), this.host.removeEventListener("pointerup", this.#E), this.host.addEventListener("pointerdown", this.#T), this.host.addEventListener("pointerup", this.#E);
79
57
  }
80
- get #d() {
58
+ get #f() {
81
59
  return this.host.trigger ? o(this.host, this.host.trigger) : null;
82
60
  }
83
- async #f() {
61
+ async #p() {
84
62
  await new Promise((e) => requestAnimationFrame(e)), this.#r.push(r(this.host, ["hidden"], () => {
85
63
  this.host.isConnected && !this.host.hidden && !this.host.matches(":popover-open") && this.host.showPopover(), this.host.isConnected && this.host.hidden && this.host.matches(":popover-open") && this.host.hidePopover();
86
64
  })), this.host.isConnected && !this.#e.length && !this.host.hidden && !this.host.matches(":popover-open") && (this.host.popover = "manual", this.host.showPopover());
87
65
  }
88
- #p() {
89
- let e = this.#d;
90
- this.#i && this.#i !== e && (this.#i.popoverTargetElement = null, this.#i.removeAttribute("popovertarget")), e && (this.host.popoverType === "hint" ? (e.addEventListener("mouseenter", () => this.host.showPopover({ source: e })), e.addEventListener("mouseleave", () => this.host.hidePopover()), e.addEventListener("focusout", () => this.host.hidePopover())) : (this.host.id = this.host.id ? this.host.id : n(), e.popoverTargetElement = this.host, e.setAttribute("popovertarget", this.host.id)), this.#i = e);
66
+ #m() {
67
+ let e = this.#f;
68
+ if (this.#i && this.#i !== e && this.#v(this.#i), this.#a && this.#a !== e && this.#y(), !e) {
69
+ this.#i = null;
70
+ return;
71
+ }
72
+ this.host.popoverType === "hint" ? this.#h(e) : this.#g(e), this.#i = e;
73
+ }
74
+ #h(e) {
75
+ this.#a !== e && (e.addEventListener("mouseenter", this.#D), e.addEventListener("mouseleave", this.#O), e.addEventListener("focusout", this.#O), this.#a = e);
76
+ }
77
+ #g(e) {
78
+ this.#y(), this.host.id = this.host.id ? this.host.id : n(), e.popoverTargetElement = this.host, e.setAttribute("popovertarget", this.host.id);
91
79
  }
92
- #m(t, n) {
80
+ #_(t, n) {
93
81
  t ? this.host.getRootNode().activeElement !== this.host && !this.host.shadowRoot.activeElement && e(this.host) : e(n);
94
82
  }
83
+ #v(e) {
84
+ e.popoverTargetElement = null, e.removeAttribute("popovertarget"), this.#a === e && this.#y();
85
+ }
86
+ #y() {
87
+ this.#a?.removeEventListener("mouseenter", this.#D), this.#a?.removeEventListener("mouseleave", this.#O), this.#a?.removeEventListener("focusout", this.#O), this.#a = null;
88
+ }
89
+ #b = (e) => {
90
+ e.newState === "open" && this.host._internals.states.add("transition-start");
91
+ };
92
+ #x = (e) => {
93
+ this.host.behaviorTrigger && (this.host.hidden = e.newState === "closed"), e.newState === "open" && this.host.closeTimeout && this.#o(), e.newState === "closed" && (this.#c(), this.#s()), this.host.inert = this.host.matches(":not(:popover-open)"), this.host.modal && this.#_(e.newState === "open", e.target), this.host.dispatchEvent(new CustomEvent(e.newState === "open" && e.oldState !== "open" ? "open" : "close", {
94
+ bubbles: !0,
95
+ composed: !0,
96
+ detail: { trigger: e.source }
97
+ }));
98
+ };
99
+ #S = (e) => {
100
+ e.command === "toggle-popover" && this.host.togglePopover({ source: e.source }), e.command === "hide-popover" && (this.host.hidePopover(), this.#c()), e.command === "show-popover" && this.host.showPopover({ source: e.source });
101
+ };
102
+ #C = (e) => {
103
+ if (e.source?.localName.includes("-")) {
104
+ let t = this.host.openDelay ?? this.#l();
105
+ t ? this.#t = setTimeout(() => {
106
+ this.host.isConnected && this.host.showPopover({ source: e.source });
107
+ }, t) : this.host.showPopover({ source: e.source });
108
+ }
109
+ };
110
+ #w = (e) => {
111
+ e.source?.localName.includes("-") && this.host.hidePopover(), this.#c();
112
+ };
113
+ #T = (e) => {
114
+ this.host.modal && this.host.matches(":popover-open") && (this.#u = t(e, this.host));
115
+ };
116
+ #E = (e) => {
117
+ this.#u && this.host.popoverDismissible && this.host.modal && this.host.matches(":popover-open") && !s(this.host) && t(e, this.host) && this.host.hidePopover();
118
+ };
119
+ #D = (e) => {
120
+ this.host.showPopover({ source: e.currentTarget });
121
+ };
122
+ #O = () => {
123
+ this.host.hidePopover();
124
+ };
95
125
  };
96
126
  //#endregion
97
127
  export { c as TypeNativePopoverController };
@@ -1 +1 @@
1
- {"version":3,"file":"type-native-popover.controller.js","names":["#nativeTriggers","#updateLegacyTriggers","#setupLegacyTriggers","#setupModalLightDismiss","#setCloseTimeout","#clearInterestTimeout","#clearCloseTimeout","#toggleFocus","#parseInterestDelay","#interestTimeout","#observers","#closeTimeout","#pointerdownWithinModal","#legacyHostTrigger","#previousLegacyTrigger"],"sources":["../../../src/internal/controllers/type-native-popover.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 'lit';\nimport { clickOutsideElementBounds, generateId, getAttributeListChanges } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\nimport { focusElement } from '../utils/focus.js';\nimport { getHostAnchor, getHostTrigger, hasOpenPopover } from './type-native-popover.utils.js';\nimport type { PopoverType } from '../types/index.js';\nimport type { InterestEvent } from './type-interest.controller.js';\n\nexport interface NativePopover extends ReactiveElement {\n anchor?: HTMLElement | string;\n closeTimeout?: number;\n popoverType?: PopoverType;\n modal?: boolean;\n popoverDismissible?: boolean;\n _activeTrigger?: HTMLElement;\n _internals?: ElementInternals;\n\n /** @deprecated */\n trigger?: HTMLElement | string;\n /** @deprecated */\n openDelay?: number;\n /** @deprecated */\n behaviorTrigger?: boolean;\n}\n\n/**\n * https://open-ui.org/components/popup.research.explainer\n */\nexport class TypeNativePopoverController<T extends NativePopover> implements ReactiveController {\n get #nativeTriggers(): HTMLElement[] {\n const root = this.host.getRootNode() as HTMLElement;\n const popoverTargetTriggers = Array.from(\n root.querySelectorAll(`[popovertarget=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const commandForTriggers = Array.from(\n root.querySelectorAll(`[commandfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const interestForTriggers = Array.from(\n root.querySelectorAll(`[interestfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n return [...popoverTargetTriggers, ...commandForTriggers, ...interestForTriggers];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n\n const showPopover = this.host.showPopover;\n this.host.showPopover = (options?: ShowPopoverOptions) => {\n if (this.host.isConnected) {\n // provide legacy fallback for source anchor or trigger if not provided, this can happen if the popover is dynamically created in the DOM without the use of the standard popover api or legacy trigger based api\n let source: HTMLElement | Element | null = options?.source ?? null;\n if (!source) {\n if (this.host.anchor) {\n source = getHostAnchor(this.host);\n } else if (this.host.trigger) {\n source = getHostTrigger(this.host, this.host.trigger);\n } else {\n source = globalThis.document.activeElement;\n }\n }\n\n showPopover.call(this.host, { source: source as HTMLElement });\n }\n };\n }\n\n // eslint-disable-next-line max-lines-per-function\n async hostConnected() {\n attachInternals(this.host);\n this.host.popover = this.host.popoverType ?? null;\n await this.host.updateComplete;\n this.host.setAttribute('nve-popover', '');\n this.#updateLegacyTriggers();\n this.#setupLegacyTriggers(); // eslint-disable-line @typescript-eslint/no-floating-promises\n this.#setupModalLightDismiss();\n this.host.inert = this.host.matches(':not(:popover-open)') && !!this.#nativeTriggers.length;\n\n this.host.addEventListener('beforetoggle', e => {\n if (e.newState === 'open') {\n this.host._internals!.states.add('transition-start');\n }\n });\n\n this.host.addEventListener('toggle', (e: ToggleEvent) => {\n if (this.host.behaviorTrigger) {\n this.host.hidden = e.newState === 'closed';\n }\n\n if (e.newState === 'open' && this.host.closeTimeout) {\n this.#setCloseTimeout();\n }\n\n if (e.newState === 'closed') {\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n this.host.inert = this.host.matches(':not(:popover-open)');\n\n if (this.host.modal) {\n this.#toggleFocus(e.newState === 'open', e.target as HTMLElement);\n }\n\n this.host.dispatchEvent(\n new CustomEvent(e.newState === 'open' && e.oldState !== 'open' ? 'open' : 'close', {\n bubbles: true,\n composed: true,\n detail: { trigger: e.source }\n })\n );\n });\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API#creating_declarative_popovers\n this.host.addEventListener('command', ((e: CommandEvent) => {\n if (e.command === 'toggle-popover') {\n this.host.togglePopover({ source: e.source as HTMLElement });\n }\n\n if (e.command === 'hide-popover') {\n this.host.hidePopover();\n this.#clearInterestTimeout();\n }\n\n if (e.command === 'show-popover') {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }) as EventListener);\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using_interest_invokers\n this.host.addEventListener('interest', ((e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n const interestDelayStart = this.host.openDelay ?? this.#parseInterestDelay();\n if (interestDelayStart) {\n this.#interestTimeout = setTimeout(() => {\n if (this.host.isConnected) {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }, interestDelayStart);\n } else {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }\n }) as EventListener);\n\n this.host.addEventListener('loseinterest', ((e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n this.host.hidePopover();\n }\n\n if (this.#interestTimeout) {\n clearTimeout(this.#interestTimeout);\n this.#interestTimeout = null;\n }\n }) as EventListener);\n }\n\n #interestTimeout: ReturnType<typeof setTimeout> | null = null;\n #closeTimeout: ReturnType<typeof setTimeout> | null = null;\n #observers: MutationObserver[] = [];\n #previousLegacyTrigger: HTMLButtonElement | null = null;\n\n async hostUpdated() {\n this.host.popover = this.host.popoverType ?? null;\n this.#updateLegacyTriggers();\n }\n\n hostDisconnected() {\n this.#observers.forEach(observer => observer.disconnect());\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n #setCloseTimeout() {\n this.#clearCloseTimeout();\n if (this.host.closeTimeout) {\n this.#closeTimeout = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout);\n }\n }\n\n #clearCloseTimeout() {\n if (this.#closeTimeout) {\n clearTimeout(this.#closeTimeout);\n this.#closeTimeout = null;\n }\n }\n\n #clearInterestTimeout() {\n if (this.#interestTimeout) {\n clearTimeout(this.#interestTimeout);\n this.#interestTimeout = null;\n }\n }\n\n #parseInterestDelay(): number {\n const style = getComputedStyle(this.host);\n const raw = (style as unknown as { interestDelayStart: string }).interestDelayStart;\n if (!raw) {\n return 0;\n }\n const value = parseFloat(raw);\n return raw.endsWith('ms') ? value : value * 1000;\n }\n\n #pointerdownWithinModal = false;\n\n #setupModalLightDismiss() {\n this.host.addEventListener('pointerdown', e => {\n if (this.host.modal && this.host.matches(':popover-open')) {\n this.#pointerdownWithinModal = clickOutsideElementBounds(e, this.host);\n }\n });\n\n this.host.addEventListener('pointerup', e => {\n if (\n this.#pointerdownWithinModal &&\n this.host.popoverDismissible &&\n this.host.modal &&\n this.host.matches(':popover-open') &&\n !hasOpenPopover(this.host) &&\n clickOutsideElementBounds(e, this.host)\n ) {\n this.host.hidePopover();\n }\n });\n }\n\n get #legacyHostTrigger(): HTMLElement | null {\n return this.host.trigger ? (getHostTrigger(this.host, this.host.trigger) as HTMLButtonElement) : null;\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n async #setupLegacyTriggers() {\n await new Promise(r => requestAnimationFrame(r));\n\n // setup hidden updates for legacy triggers\n this.#observers.push(\n getAttributeListChanges(this.host, ['hidden'], () => {\n if (this.host.isConnected && !this.host.hidden && !this.host.matches(':popover-open')) {\n this.host.showPopover();\n }\n\n if (this.host.isConnected && this.host.hidden && this.host.matches(':popover-open')) {\n this.host.hidePopover();\n }\n })\n );\n\n // determine if popover is open by default\n if (\n this.host.isConnected &&\n !this.#nativeTriggers.length &&\n !this.host.hidden &&\n !this.host.matches(':popover-open')\n ) {\n this.host.popover = 'manual';\n this.host.showPopover();\n }\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n #updateLegacyTriggers() {\n const trigger = this.#legacyHostTrigger as HTMLButtonElement;\n\n // Clean up previous trigger if it changed\n if (this.#previousLegacyTrigger && this.#previousLegacyTrigger !== trigger) {\n this.#previousLegacyTrigger.popoverTargetElement = null;\n this.#previousLegacyTrigger.removeAttribute('popovertarget');\n }\n\n // if not a hint type setup native popovertarget\n if (trigger) {\n if (this.host.popoverType === 'hint') {\n trigger.addEventListener('mouseenter', () => this.host.showPopover({ source: trigger as HTMLElement }));\n trigger.addEventListener('mouseleave', () => this.host.hidePopover());\n trigger.addEventListener('focusout', () => this.host.hidePopover());\n } else {\n this.host.id = this.host.id ? this.host.id : generateId();\n trigger.popoverTargetElement = this.host;\n trigger.setAttribute('popovertarget', this.host.id);\n }\n this.#previousLegacyTrigger = trigger;\n }\n }\n\n #toggleFocus(open: boolean, target: HTMLElement) {\n if (open) {\n // only focus popover if not the active element and not containing the active element already\n if ((this.host.getRootNode() as Document).activeElement !== this.host && !this.host.shadowRoot!.activeElement) {\n focusElement(this.host);\n }\n } else {\n focusElement(target);\n }\n }\n}\n"],"mappings":";;;;;AA+BA,IAAa,IAAb,MAAgG;CAC9F,IAAIA,KAAiC;EACnC,IAAM,IAAO,KAAK,KAAK,YAAY,GAC7B,IAAwB,MAAM,KAClC,EAAK,iBAAiB,mBAAmB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACnG,GAEM,IAAqB,MAAM,KAC/B,EAAK,iBAAiB,gBAAgB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CAChG,GAEM,IAAsB,MAAM,KAChC,EAAK,iBAAiB,iBAAiB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACjG;EAEA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AAK,KAAK,QAAQ,eAAe,KAClF,KAAK,KAAK,YAAY,GAGpB,KAAK,KAAK,eAAe,KAAK,KAAK,UAAU,KAAK,KAAK,QAAQ,eAAe,KAChF,KAAK,KAAK,YAAY;EAE1B,CAAC,CACH,GAIE,KAAK,KAAK,eACV,CAAC,KAAKV,GAAgB,UACtB,CAAC,KAAK,KAAK,UACX,CAAC,KAAK,KAAK,QAAQ,eAAe,MAElC,KAAK,KAAK,UAAU,UACpB,KAAK,KAAK,YAAY;CAE1B;CAKA,KAAwB;EACtB,IAAM,IAAU,KAAKa;EASrB,AANI,KAAKC,MAA0B,KAAKA,OAA2B,MACjE,KAAKA,GAAuB,uBAAuB,MACnD,KAAKA,GAAuB,gBAAgB,eAAe,IAIzD,MACE,KAAK,KAAK,gBAAgB,UAC5B,EAAQ,iBAAiB,oBAAoB,KAAK,KAAK,YAAY,EAAE,QAAQ,EAAuB,CAAC,CAAC,GACtG,EAAQ,iBAAiB,oBAAoB,KAAK,KAAK,YAAY,CAAC,GACpE,EAAQ,iBAAiB,kBAAkB,KAAK,KAAK,YAAY,CAAC,MAElE,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,EAAW,GACxD,EAAQ,uBAAuB,KAAK,MACpC,EAAQ,aAAa,iBAAiB,KAAK,KAAK,EAAE,IAEpD,KAAKA,KAAyB;CAElC;CAEA,GAAa,GAAe,GAAqB;EAC/C,AAAI,IAEG,KAAK,KAAK,YAAY,EAAe,kBAAkB,KAAK,QAAQ,CAAC,KAAK,KAAK,WAAY,iBAC9F,EAAa,KAAK,IAAI,IAGxB,EAAa,CAAM;CAEvB;AACF"}
1
+ {"version":3,"file":"type-native-popover.controller.js","names":["#nativeTriggers","#updateLegacyTriggers","#setupLegacyTriggers","#setupModalLightDismiss","#onBeforeToggle","#onToggle","#onCommand","#onInterest","#onLoseInterest","#observers","#onPointerDown","#onPointerUp","#removeHintTrigger","#clearInterestTimeout","#clearCloseTimeout","#closeTimeout","#interestTimeout","#legacyHostTrigger","#previousLegacyTrigger","#clearLegacyTrigger","#hintTrigger","#setupHintTrigger","#setupPopoverTargetTrigger","#onHintMouseEnter","#onHintMouseLeave","#setCloseTimeout","#toggleFocus","#parseInterestDelay","#pointerdownWithinModal"],"sources":["../../../src/internal/controllers/type-native-popover.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 'lit';\nimport { clickOutsideElementBounds, generateId, getAttributeListChanges } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\nimport { focusElement } from '../utils/focus.js';\nimport { getHostAnchor, getHostTrigger, hasOpenPopover } from './type-native-popover.utils.js';\nimport type { InterestEvent, PopoverType } from '../types/index.js';\n\nexport interface NativePopover extends ReactiveElement {\n anchor?: HTMLElement | string;\n closeTimeout?: number;\n popoverType?: PopoverType;\n modal?: boolean;\n popoverDismissible?: boolean;\n _activeTrigger?: HTMLElement;\n _internals?: ElementInternals;\n\n /** @deprecated */\n trigger?: HTMLElement | string;\n /** @deprecated */\n openDelay?: number;\n /** @deprecated */\n behaviorTrigger?: boolean;\n}\n\n/**\n * https://open-ui.org/components/popup.research.explainer\n */\nexport class TypeNativePopoverController<T extends NativePopover> implements ReactiveController {\n get #nativeTriggers(): HTMLElement[] {\n const root = this.host.getRootNode() as HTMLElement;\n const popoverTargetTriggers = Array.from(\n root.querySelectorAll(`[popovertarget=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const commandForTriggers = Array.from(\n root.querySelectorAll(`[commandfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const interestForTriggers = Array.from(\n root.querySelectorAll(`[interestfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n return [...popoverTargetTriggers, ...commandForTriggers, ...interestForTriggers];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n\n const showPopover = this.host.showPopover;\n this.host.showPopover = (options?: ShowPopoverOptions) => {\n if (this.host.isConnected) {\n // provide legacy fallback for source anchor or trigger if not provided, this can happen if the popover is dynamically created in the DOM without the use of the standard popover api or legacy trigger based api\n let source: HTMLElement | Element | null = options?.source ?? null;\n if (!source) {\n if (this.host.anchor) {\n source = getHostAnchor(this.host);\n } else if (this.host.trigger) {\n source = getHostTrigger(this.host, this.host.trigger);\n } else {\n source = globalThis.document.activeElement;\n }\n }\n\n showPopover.call(this.host, { source: source as HTMLElement });\n }\n };\n }\n\n async hostConnected() {\n attachInternals(this.host);\n this.host.popover = this.host.popoverType ?? null;\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.host.setAttribute('nve-popover', '');\n this.#updateLegacyTriggers();\n this.#setupLegacyTriggers(); // eslint-disable-line @typescript-eslint/no-floating-promises\n this.#setupModalLightDismiss();\n this.host.inert = this.host.matches(':not(:popover-open)') && !!this.#nativeTriggers.length;\n\n this.host.addEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.addEventListener('toggle', this.#onToggle as EventListener);\n this.host.addEventListener('command', this.#onCommand as EventListener);\n this.host.addEventListener('interest', this.#onInterest as EventListener);\n this.host.addEventListener('loseinterest', this.#onLoseInterest as EventListener);\n }\n\n #interestTimeout: ReturnType<typeof setTimeout> | null = null;\n #closeTimeout: ReturnType<typeof setTimeout> | null = null;\n #observers: MutationObserver[] = [];\n #previousLegacyTrigger: HTMLButtonElement | null = null;\n #hintTrigger: HTMLButtonElement | null = null;\n\n async hostUpdated() {\n this.host.popover = this.host.popoverType ?? null;\n this.#updateLegacyTriggers();\n }\n\n hostDisconnected() {\n this.#observers.forEach(observer => observer.disconnect());\n this.#observers.length = 0;\n this.host.removeEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.removeEventListener('toggle', this.#onToggle as EventListener);\n this.host.removeEventListener('command', this.#onCommand as EventListener);\n this.host.removeEventListener('interest', this.#onInterest as EventListener);\n this.host.removeEventListener('loseinterest', this.#onLoseInterest as EventListener);\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.#removeHintTrigger();\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n #setCloseTimeout() {\n this.#clearCloseTimeout();\n if (this.host.closeTimeout) {\n this.#closeTimeout = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout);\n }\n }\n\n #clearCloseTimeout() {\n if (this.#closeTimeout) {\n clearTimeout(this.#closeTimeout);\n this.#closeTimeout = null;\n }\n }\n\n #clearInterestTimeout() {\n if (this.#interestTimeout) {\n clearTimeout(this.#interestTimeout);\n this.#interestTimeout = null;\n }\n }\n\n #parseInterestDelay(): number {\n const style = getComputedStyle(this.host);\n const raw = (style as unknown as { interestDelayStart: string }).interestDelayStart;\n if (!raw) {\n return 0;\n }\n const value = parseFloat(raw);\n return raw.endsWith('ms') ? value : value * 1000;\n }\n\n #pointerdownWithinModal = false;\n\n #setupModalLightDismiss() {\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.host.addEventListener('pointerdown', this.#onPointerDown);\n this.host.addEventListener('pointerup', this.#onPointerUp);\n }\n\n get #legacyHostTrigger(): HTMLElement | null {\n return this.host.trigger ? (getHostTrigger(this.host, this.host.trigger) as HTMLButtonElement) : null;\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n async #setupLegacyTriggers() {\n await new Promise(r => requestAnimationFrame(r));\n\n // setup hidden updates for legacy triggers\n this.#observers.push(\n getAttributeListChanges(this.host, ['hidden'], () => {\n if (this.host.isConnected && !this.host.hidden && !this.host.matches(':popover-open')) {\n this.host.showPopover();\n }\n\n if (this.host.isConnected && this.host.hidden && this.host.matches(':popover-open')) {\n this.host.hidePopover();\n }\n })\n );\n\n // determine if popover is open by default\n if (\n this.host.isConnected &&\n !this.#nativeTriggers.length &&\n !this.host.hidden &&\n !this.host.matches(':popover-open')\n ) {\n this.host.popover = 'manual';\n this.host.showPopover();\n }\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n #updateLegacyTriggers() {\n const trigger = this.#legacyHostTrigger as HTMLButtonElement;\n\n if (this.#previousLegacyTrigger && this.#previousLegacyTrigger !== trigger) {\n this.#clearLegacyTrigger(this.#previousLegacyTrigger);\n }\n\n if (this.#hintTrigger && this.#hintTrigger !== trigger) {\n this.#removeHintTrigger();\n }\n\n if (!trigger) {\n this.#previousLegacyTrigger = null;\n return;\n }\n\n if (this.host.popoverType === 'hint') {\n this.#setupHintTrigger(trigger);\n } else {\n this.#setupPopoverTargetTrigger(trigger);\n }\n this.#previousLegacyTrigger = trigger;\n }\n\n #setupHintTrigger(trigger: HTMLButtonElement) {\n if (this.#hintTrigger === trigger) return;\n\n trigger.addEventListener('mouseenter', this.#onHintMouseEnter);\n trigger.addEventListener('mouseleave', this.#onHintMouseLeave);\n trigger.addEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = trigger;\n }\n\n #setupPopoverTargetTrigger(trigger: HTMLButtonElement) {\n this.#removeHintTrigger();\n this.host.id = this.host.id ? this.host.id : generateId();\n trigger.popoverTargetElement = this.host;\n trigger.setAttribute('popovertarget', this.host.id);\n }\n\n #toggleFocus(open: boolean, target: HTMLElement) {\n if (open) {\n // only focus popover if not the active element and not containing the active element already\n if ((this.host.getRootNode() as Document).activeElement !== this.host && !this.host.shadowRoot!.activeElement) {\n focusElement(this.host);\n }\n } else {\n focusElement(target);\n }\n }\n\n #clearLegacyTrigger(trigger: HTMLButtonElement) {\n trigger.popoverTargetElement = null;\n trigger.removeAttribute('popovertarget');\n if (this.#hintTrigger === trigger) {\n this.#removeHintTrigger();\n }\n }\n\n #removeHintTrigger() {\n this.#hintTrigger?.removeEventListener('mouseenter', this.#onHintMouseEnter);\n this.#hintTrigger?.removeEventListener('mouseleave', this.#onHintMouseLeave);\n this.#hintTrigger?.removeEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = null;\n }\n\n #onBeforeToggle = (e: ToggleEvent) => {\n if (e.newState === 'open') {\n this.host._internals!.states.add('transition-start');\n }\n };\n\n #onToggle = (e: ToggleEvent) => {\n if (this.host.behaviorTrigger) {\n this.host.hidden = e.newState === 'closed';\n }\n\n if (e.newState === 'open' && this.host.closeTimeout) {\n this.#setCloseTimeout();\n }\n\n if (e.newState === 'closed') {\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n this.host.inert = this.host.matches(':not(:popover-open)');\n\n if (this.host.modal) {\n this.#toggleFocus(e.newState === 'open', e.target as HTMLElement);\n }\n\n this.host.dispatchEvent(\n new CustomEvent(e.newState === 'open' && e.oldState !== 'open' ? 'open' : 'close', {\n bubbles: true,\n composed: true,\n detail: { trigger: e.source }\n })\n );\n };\n\n #onCommand = (e: CommandEvent) => {\n if (e.command === 'toggle-popover') {\n this.host.togglePopover({ source: e.source as HTMLElement });\n }\n\n if (e.command === 'hide-popover') {\n this.host.hidePopover();\n this.#clearInterestTimeout();\n }\n\n if (e.command === 'show-popover') {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n };\n\n #onInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n const interestDelayStart = this.host.openDelay ?? this.#parseInterestDelay();\n if (interestDelayStart) {\n this.#interestTimeout = setTimeout(() => {\n if (this.host.isConnected) {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }, interestDelayStart);\n } else {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }\n };\n\n #onLoseInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n this.host.hidePopover();\n }\n\n this.#clearInterestTimeout();\n };\n\n #onPointerDown = (e: PointerEvent) => {\n if (this.host.modal && this.host.matches(':popover-open')) {\n this.#pointerdownWithinModal = clickOutsideElementBounds(e, this.host);\n }\n };\n\n #onPointerUp = (e: PointerEvent) => {\n if (\n this.#pointerdownWithinModal &&\n this.host.popoverDismissible &&\n this.host.modal &&\n this.host.matches(':popover-open') &&\n !hasOpenPopover(this.host) &&\n clickOutsideElementBounds(e, this.host)\n ) {\n this.host.hidePopover();\n }\n };\n\n #onHintMouseEnter = (e: MouseEvent) => {\n this.host.showPopover({ source: e.currentTarget as HTMLElement });\n };\n\n #onHintMouseLeave = () => {\n this.host.hidePopover();\n };\n}\n"],"mappings":";;;;;AA8BA,IAAa,IAAb,MAAgG;CAC9F,IAAIA,KAAiC;EACnC,IAAM,IAAO,KAAK,KAAK,YAAY,GAC7B,IAAwB,MAAM,KAClC,EAAK,iBAAiB,mBAAmB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACnG,GAEM,IAAqB,MAAM,KAC/B,EAAK,iBAAiB,gBAAgB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CAChG,GAEM,IAAsB,MAAM,KAChC,EAAK,iBAAiB,iBAAiB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACjG;EAEA,OAAO;GAAC,GAAG;GAAuB,GAAG;GAAoB,GAAG;EAAmB;CACjF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;EAE5B,IAAM,IAAc,KAAK,KAAK;EAC9B,KAAK,KAAK,eAAe,MAAiC;GACxD,IAAI,KAAK,KAAK,aAAa;IAEzB,IAAI,IAAuC,GAAS,UAAU;IAW9D,AAVA,AAMI,MALE,KAAK,KAAK,SACH,EAAc,KAAK,IAAI,IACvB,KAAK,KAAK,UACV,EAAe,KAAK,MAAM,KAAK,KAAK,OAAO,IAE3C,WAAW,SAAS,eAIjC,EAAY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KAAK,KAAK,YAAY,EAAE,QAAQ,EAAE,OAAsB,CAAC;EAE7D;CACF;CAEA,MAAmB,MAAqB;EAMtC,AALwB,EAAE,QAAQ,UAAU,SAAS,GAAG,KAEtD,KAAK,KAAK,YAAY,GAGxB,KAAKH,GAAsB;CAC7B;CAEA,MAAkB,MAAoB;EACpC,AAAI,KAAK,KAAK,SAAS,KAAK,KAAK,QAAQ,eAAe,MACtD,KAAKe,KAA0B,EAA0B,GAAG,KAAK,IAAI;CAEzE;CAEA,MAAgB,MAAoB;EAClC,AACE,KAAKA,MACL,KAAK,KAAK,sBACV,KAAK,KAAK,SACV,KAAK,KAAK,QAAQ,eAAe,KACjC,CAAC,EAAe,KAAK,IAAI,KACzB,EAA0B,GAAG,KAAK,IAAI,KAEtC,KAAK,KAAK,YAAY;CAE1B;CAEA,MAAqB,MAAkB;EACrC,KAAK,KAAK,YAAY,EAAE,QAAQ,EAAE,cAA6B,CAAC;CAClE;CAEA,WAA0B;EACxB,KAAK,KAAK,YAAY;CACxB;AACF"}
@@ -5,25 +5,16 @@ export * from './controllers/audit.controller.js';
5
5
  export * from './controllers/i18n.controller.js';
6
6
  export * from './controllers/keynav-grid.controller.js';
7
7
  export * from './controllers/keynav-list.controller.js';
8
- export * from './controllers/state-active.controller.js';
9
- export * from './controllers/state-current.controller.js';
10
- export * from './controllers/state-disabled.controller.js';
11
8
  export * from './controllers/state-expanded.controller.js';
12
9
  export * from './controllers/state-highlighted.controller.js';
13
10
  export * from './controllers/state-scroll.controller.js';
14
11
  export * from './controllers/state-selected.controller.js';
15
- export * from './controllers/state-pressed.controller.js';
16
12
  export * from './controllers/type-anchor.controller.js';
17
13
  export * from './controllers/type-closable.controller.js';
18
- export * from './controllers/type-command.controller.js';
19
- export * from './controllers/type-interest.controller.js';
20
14
  export * from './controllers/type-expandable.controller.js';
21
15
  export * from './controllers/type-selectable.controller.js';
22
- export * from './controllers/type-button.controller.js';
23
- export * from './controllers/type-native-popover-trigger.controller.js';
24
16
  export * from './controllers/type-native-popover.controller.js';
25
17
  export * from './controllers/type-ssr.controller.js';
26
- export * from './controllers/type-submit.controller.js';
27
18
  export * from './controllers/type-touch.controller.js';
28
19
  export * from './decorators/host-attr.js';
29
20
  export * from './decorators/scoped-registry.js';
@@ -12,32 +12,23 @@ import { KeynavCode as N, appendAnchorName as P, appendRootNodeStyle as F, apply
12
12
  import { KeyNavigationGridController as _e, getNextKeyGridItem as ve, keyNavigationGrid as ye } from "./controllers/keynav-grid.controller.js";
13
13
  import { KeyNavigationListController as be, getNextKeyListItem as xe, keyNavigationList as Se } from "./controllers/keynav-list.controller.js";
14
14
  import { associateAriaDescribedBy as Ce, associateAriaLabel as we, associateControlGroup as Te, associateDataList as Ee, associateLabel as De, attachInternals as Oe } from "./utils/a11y.js";
15
- import { StateActiveController as ke, stateActive as Ae } from "./controllers/state-active.controller.js";
16
- import { StateCurrentController as je, stateCurrent as Me } from "./controllers/state-current.controller.js";
17
- import { StateDisabledController as Ne, stateDisabled as Pe } from "./controllers/state-disabled.controller.js";
18
- import { StateExpandedController as Fe, stateExpanded as Ie } from "./controllers/state-expanded.controller.js";
19
- import { StateHighlightedController as Le, stateHighlighted as Re } from "./controllers/state-highlighted.controller.js";
20
- import { StateScrollController as ze, stateScroll as Be } from "./controllers/state-scroll.controller.js";
21
- import { StateSelectedController as Ve, stateSelected as He } from "./controllers/state-selected.controller.js";
22
- import { StatePressedController as Ue, statePressed as We } from "./controllers/state-pressed.controller.js";
23
- import { TypeAnchorController as Ge, typeAnchor as Ke } from "./controllers/type-anchor.controller.js";
24
- import { TypeClosableController as qe } from "./controllers/type-closable.controller.js";
25
- import { TypeCommandController as Je, typeCommand as Ye } from "./controllers/type-command.controller.js";
26
- import { TypeInterestController as Xe, typeInterest as Ze } from "./controllers/type-interest.controller.js";
27
- import { TypeExpandableController as Qe } from "./controllers/type-expandable.controller.js";
28
- import { TypeSelectableController as $e } from "./controllers/type-selectable.controller.js";
29
- import { TypeButtonController as et, typeButton as tt } from "./controllers/type-button.controller.js";
30
- import { TypeNativePopoverTriggerController as nt, typeNativePopoverTrigger as rt } from "./controllers/type-native-popover-trigger.controller.js";
31
- import { TypeNativePopoverController as it } from "./controllers/type-native-popover.controller.js";
32
- import { TypeSSRController as at, typeSSR as ot } from "./controllers/type-ssr.controller.js";
33
- import { createLightDismiss as st, onKeys as ct } from "./utils/keynav.js";
34
- import { TypeSubmitController as lt, typeSubmit as ut } from "./controllers/type-submit.controller.js";
35
- import { NveTouchEvent as dt, TypeTouchController as ft, typeTouch as pt } from "./controllers/type-touch.controller.js";
36
- import { hostAttr as mt } from "./decorators/host-attr.js";
37
- import { scopedRegistry as ht } from "./decorators/scoped-registry.js";
38
- import { colorStateStyles as gt, statusStateStyles as _t, supportStateStyles as vt, useStyles as yt } from "./styles/index.js";
39
- import { supportsCSSLegacyInsetArea as bt, supportsCSSPositionArea as xt, supportsNativeCSSAnchorPosition as St } from "./utils/supports.js";
40
- import { popoverStyles as Ct } from "./styles/popover2.js";
41
- import { TransitionService as wt } from "./services/transition.service.js";
42
- import { statusIcons as Tt } from "./types/index.js";
43
- export { p as AuditController, e as DOCS_URL, l as GlobalState, u as GlobalStateService, v as I18nController, g as I18nService, _ as I18nService_, _e as KeyNavigationGridController, be as KeyNavigationListController, N as KeynavCode, w as LogService, dt as NveTouchEvent, ke as StateActiveController, je as StateCurrentController, Ne as StateDisabledController, Fe as StateExpandedController, Le as StateHighlightedController, Ue as StatePressedController, ze as StateScrollController, Ve as StateSelectedController, wt as TransitionService, Ge as TypeAnchorController, et as TypeButtonController, qe as TypeClosableController, Je as TypeCommandController, Qe as TypeExpandableController, Xe as TypeInterestController, it as TypeNativePopoverController, nt as TypeNativePopoverTriggerController, at as TypeSSRController, $e as TypeSelectableController, lt as TypeSubmitController, ft as TypeTouchController, P as appendAnchorName, F as appendRootNodeStyle, I as applySlotContentStates, Ce as associateAriaDescribedBy, we as associateAriaLabel, Te as associateControlGroup, Ee as associateDataList, De as associateLabel, Oe as attachInternals, m as audit, d as auditParentElement, f as auditSlots, L as clickOutsideElementBounds, gt as colorStateStyles, R as createGhostElement, st as createLightDismiss, b as debounce, r as deepMerge, z as define, B as defineElement, V as endOfScrollBox, h as excessiveInstanceLimit, T as focusElement, E as focusElementTimeout, t as formatFileSize, i as formatStandardNumber, H as generateId, D as getActiveElement, U as getAnchorNames, W as getAttributeChanges, G as getAttributeListChanges, K as getChildren, a as getDifference, q as getDisplayValue, J as getElementUpdate, Y as getFlattenedDOMTree, X as getFlattenedFocusableItems, ve as getNextKeyGridItem, xe as getNextKeyListItem, Z as getPropertyChanges, Q as getThemeTokens, $ as hasHorizontalScrollBar, ee as hasInvalidDOMGrid, te as hasScrollBar, mt as hostAttr, y as i18n, O as initializeKeyListItems, ne as isContextMenuClick, k as isFocusable, o as isObject, s as isObjectLiteral, A as isSimpleFocusable, ye as keyNavigationGrid, Se as keyNavigationList, re as matchesElementName, x as onChildListMutation, ct as onKeys, j as onListboxActivate, ie as openEyeDropper, ae as parseTokenNumber, c as parseVersion, Ct as popoverStyles, oe as removeAnchorName, se as removeEmptySlotWhitespace, ce as removeEmptyTextNode, le as sameOrderedStringArray, ue as sameRenderRoot, ht as scopedRegistry, de as scrollBarWidth, M as setActiveKeyListItem, n as shiftLeft, fe as slotContainsOnlyWhitespace, Ae as stateActive, Me as stateCurrent, Pe as stateDisabled, Ie as stateExpanded, Re as stateHighlighted, We as statePressed, Be as stateScroll, He as stateSelected, Tt as statusIcons, _t as statusStateStyles, S as stopEvent, pe as styleSheetToString, vt as supportStateStyles, bt as supportsCSSLegacyInsetArea, xt as supportsCSSPositionArea, St as supportsNativeCSSAnchorPosition, me as supportsScopedRegistry, C as throttle, Ke as typeAnchor, tt as typeButton, Ye as typeCommand, Ze as typeInterest, rt as typeNativePopoverTrigger, ot as typeSSR, ut as typeSubmit, pt as typeTouch, he as uniqueNonEmptyStrings, yt as useStyles, ge as validKeyNavigationCode };
15
+ import { StateExpandedController as ke, stateExpanded as Ae } from "./controllers/state-expanded.controller.js";
16
+ import { StateHighlightedController as je, stateHighlighted as Me } from "./controllers/state-highlighted.controller.js";
17
+ import { StateScrollController as Ne, stateScroll as Pe } from "./controllers/state-scroll.controller.js";
18
+ import { StateSelectedController as Fe, stateSelected as Ie } from "./controllers/state-selected.controller.js";
19
+ import { TypeAnchorController as Le, typeAnchor as Re } from "./controllers/type-anchor.controller.js";
20
+ import { TypeClosableController as ze } from "./controllers/type-closable.controller.js";
21
+ import { TypeExpandableController as Be } from "./controllers/type-expandable.controller.js";
22
+ import { TypeSelectableController as Ve } from "./controllers/type-selectable.controller.js";
23
+ import { TypeNativePopoverController as He } from "./controllers/type-native-popover.controller.js";
24
+ import { TypeSSRController as Ue, typeSSR as We } from "./controllers/type-ssr.controller.js";
25
+ import { NveTouchEvent as Ge, TypeTouchController as Ke, typeTouch as qe } from "./controllers/type-touch.controller.js";
26
+ import { hostAttr as Je } from "./decorators/host-attr.js";
27
+ import { scopedRegistry as Ye } from "./decorators/scoped-registry.js";
28
+ import { colorStateStyles as Xe, statusStateStyles as Ze, supportStateStyles as Qe, useStyles as $e } from "./styles/index.js";
29
+ import { supportsCSSLegacyInsetArea as et, supportsCSSPositionArea as tt, supportsNativeCSSAnchorPosition as nt } from "./utils/supports.js";
30
+ import { popoverStyles as rt } from "./styles/popover2.js";
31
+ import { TransitionService as it } from "./services/transition.service.js";
32
+ import { statusIcons as at } from "./types/index.js";
33
+ import { createLightDismiss as ot, onKeys as st } from "./utils/keynav.js";
34
+ export { p as AuditController, e as DOCS_URL, l as GlobalState, u as GlobalStateService, v as I18nController, g as I18nService, _ as I18nService_, _e as KeyNavigationGridController, be as KeyNavigationListController, N as KeynavCode, w as LogService, Ge as NveTouchEvent, ke as StateExpandedController, je as StateHighlightedController, Ne as StateScrollController, Fe as StateSelectedController, it as TransitionService, Le as TypeAnchorController, ze as TypeClosableController, Be as TypeExpandableController, He as TypeNativePopoverController, Ue as TypeSSRController, Ve as TypeSelectableController, Ke as TypeTouchController, P as appendAnchorName, F as appendRootNodeStyle, I as applySlotContentStates, Ce as associateAriaDescribedBy, we as associateAriaLabel, Te as associateControlGroup, Ee as associateDataList, De as associateLabel, Oe as attachInternals, m as audit, d as auditParentElement, f as auditSlots, L as clickOutsideElementBounds, Xe as colorStateStyles, R as createGhostElement, ot as createLightDismiss, b as debounce, r as deepMerge, z as define, B as defineElement, V as endOfScrollBox, h as excessiveInstanceLimit, T as focusElement, E as focusElementTimeout, t as formatFileSize, i as formatStandardNumber, H as generateId, D as getActiveElement, U as getAnchorNames, W as getAttributeChanges, G as getAttributeListChanges, K as getChildren, a as getDifference, q as getDisplayValue, J as getElementUpdate, Y as getFlattenedDOMTree, X as getFlattenedFocusableItems, ve as getNextKeyGridItem, xe as getNextKeyListItem, Z as getPropertyChanges, Q as getThemeTokens, $ as hasHorizontalScrollBar, ee as hasInvalidDOMGrid, te as hasScrollBar, Je as hostAttr, y as i18n, O as initializeKeyListItems, ne as isContextMenuClick, k as isFocusable, o as isObject, s as isObjectLiteral, A as isSimpleFocusable, ye as keyNavigationGrid, Se as keyNavigationList, re as matchesElementName, x as onChildListMutation, st as onKeys, j as onListboxActivate, ie as openEyeDropper, ae as parseTokenNumber, c as parseVersion, rt as popoverStyles, oe as removeAnchorName, se as removeEmptySlotWhitespace, ce as removeEmptyTextNode, le as sameOrderedStringArray, ue as sameRenderRoot, Ye as scopedRegistry, de as scrollBarWidth, M as setActiveKeyListItem, n as shiftLeft, fe as slotContainsOnlyWhitespace, Ae as stateExpanded, Me as stateHighlighted, Pe as stateScroll, Ie as stateSelected, at as statusIcons, Ze as statusStateStyles, S as stopEvent, pe as styleSheetToString, Qe as supportStateStyles, et as supportsCSSLegacyInsetArea, tt as supportsCSSPositionArea, nt as supportsNativeCSSAnchorPosition, me as supportsScopedRegistry, C as throttle, Re as typeAnchor, We as typeSSR, qe as typeTouch, he as uniqueNonEmptyStrings, $e as useStyles, ge 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(new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.0.0"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.0.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)}`);
22
+ }, globalThis.NVE_ELEMENTS.state.versions = Array.from(new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.0.2"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.0.2"] = 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;
@@ -11,7 +11,7 @@ var t = "@nve: ", n = class {
11
11
  e.state.env !== "production" && (console.error(`${t}${n}`, ...r), this.#e("error", n, ...r));
12
12
  }
13
13
  static #e(e, t, ...n) {
14
- globalThis.document.dispatchEvent(new CustomEvent("NVE_ELEMENTS_LOG", { detail: {
14
+ globalThis.document?.dispatchEvent(new CustomEvent("NVE_ELEMENTS_LOG", { detail: {
15
15
  type: e,
16
16
  value: t,
17
17
  args: n
@@ -1 +1 @@
1
- {"version":3,"file":"log.service.js","names":["#dispatch"],"sources":["../../../src/internal/services/log.service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { GlobalStateService } from './global.service.js';\n\nconst prefix = '@nve: ';\n\nexport class LogService {\n static log(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.log(`${prefix}${value}`, ...args);\n }\n }\n\n static warn(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.warn(`${prefix}${value}`, ...args);\n this.#dispatch('warn', value, ...args);\n }\n }\n\n static error(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.error(`${prefix}${value}`, ...args);\n this.#dispatch('error', value, ...args);\n }\n }\n\n static #dispatch(type: 'warn' | 'error', value: string, ...args: unknown[]) {\n globalThis.document.dispatchEvent(new CustomEvent('NVE_ELEMENTS_LOG', { detail: { type, value, args } }));\n }\n}\n"],"mappings":";;AAKA,IAAM,IAAS,UAEF,IAAb,MAAwB;CACtB,OAAO,IAAI,GAAe,GAAG,GAAiB;EAC5C,AAAI,EAAmB,MAAM,QAAQ,gBACnC,QAAQ,IAAI,GAAG,IAAS,KAAS,GAAG,CAAI;CAE5C;CAEA,OAAO,KAAK,GAAe,GAAG,GAAiB;EAC7C,AAAI,EAAmB,MAAM,QAAQ,iBACnC,QAAQ,KAAK,GAAG,IAAS,KAAS,GAAG,CAAI,GACzC,KAAKA,GAAU,QAAQ,GAAO,GAAG,CAAI;CAEzC;CAEA,OAAO,MAAM,GAAe,GAAG,GAAiB;EAC9C,AAAI,EAAmB,MAAM,QAAQ,iBACnC,QAAQ,MAAM,GAAG,IAAS,KAAS,GAAG,CAAI,GAC1C,KAAKA,GAAU,SAAS,GAAO,GAAG,CAAI;CAE1C;CAEA,OAAOA,GAAU,GAAwB,GAAe,GAAG,GAAiB;EAC1E,WAAW,SAAS,cAAc,IAAI,YAAY,oBAAoB,EAAE,QAAQ;GAAE;GAAM;GAAO;EAAK,EAAE,CAAC,CAAC;CAC1G;AACF"}
1
+ {"version":3,"file":"log.service.js","names":["#dispatch"],"sources":["../../../src/internal/services/log.service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { GlobalStateService } from './global.service.js';\n\nconst prefix = '@nve: ';\n\nexport class LogService {\n static log(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.log(`${prefix}${value}`, ...args);\n }\n }\n\n static warn(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.warn(`${prefix}${value}`, ...args);\n this.#dispatch('warn', value, ...args);\n }\n }\n\n static error(value: string, ...args: unknown[]) {\n if (GlobalStateService.state.env !== 'production') {\n console.error(`${prefix}${value}`, ...args);\n this.#dispatch('error', value, ...args);\n }\n }\n\n static #dispatch(type: 'warn' | 'error', value: string, ...args: unknown[]) {\n globalThis.document?.dispatchEvent(new CustomEvent('NVE_ELEMENTS_LOG', { detail: { type, value, args } }));\n }\n}\n"],"mappings":";;AAKA,IAAM,IAAS,UAEF,IAAb,MAAwB;CACtB,OAAO,IAAI,GAAe,GAAG,GAAiB;EAC5C,AAAI,EAAmB,MAAM,QAAQ,gBACnC,QAAQ,IAAI,GAAG,IAAS,KAAS,GAAG,CAAI;CAE5C;CAEA,OAAO,KAAK,GAAe,GAAG,GAAiB;EAC7C,AAAI,EAAmB,MAAM,QAAQ,iBACnC,QAAQ,KAAK,GAAG,IAAS,KAAS,GAAG,CAAI,GACzC,KAAKA,GAAU,QAAQ,GAAO,GAAG,CAAI;CAEzC;CAEA,OAAO,MAAM,GAAe,GAAG,GAAiB;EAC9C,AAAI,EAAmB,MAAM,QAAQ,iBACnC,QAAQ,MAAM,GAAG,IAAS,KAAS,GAAG,CAAI,GAC1C,KAAKA,GAAU,SAAS,GAAO,GAAG,CAAI;CAE1C;CAEA,OAAOA,GAAU,GAAwB,GAAe,GAAG,GAAiB;EAC1E,WAAW,UAAU,cAAc,IAAI,YAAY,oBAAoB,EAAE,QAAQ;GAAE;GAAM;GAAO;EAAK,EAAE,CAAC,CAAC;CAC3G;AACF"}
@@ -66,6 +66,9 @@ export type TaskStatus = 'scheduled' | 'queued' | 'pending' | 'starting' | 'runn
66
66
  * - `hint` no light dismiss, no auto focus, open/close on hover/focus
67
67
  */
68
68
  export type PopoverType = 'auto' | 'manual' | 'hint' | 'inline';
69
+ export type InterestEvent = Event & {
70
+ source: HTMLElement;
71
+ };
69
72
  /** Controls how the popover aligns along the edge of its anchor element.
70
73
  * - `start` - Aligns the popover to the beginning edge of the anchor for left or top alignment.
71
74
  * - `end` - Aligns the popover to the ending edge of the anchor for right or bottom alignment.