@nvidia-elements/core 2.7.3 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +8 -0
  3. package/dist/_virtual/{_@oxc-project_runtime@0.139.0 → _@oxc-project_runtime@0.147.0}/helpers/esm/decorate.js +1 -1
  4. package/dist/accordion/accordion.examples.json +9 -9
  5. package/dist/accordion/accordion2.js +5 -5
  6. package/dist/accordion/accordion2.js.map +1 -1
  7. package/dist/alert/alert-group2.js +2 -2
  8. package/dist/alert/alert-group2.js.map +1 -1
  9. package/dist/alert/alert.examples.json +3 -3
  10. package/dist/alert/alert2.js +2 -2
  11. package/dist/alert/alert2.js.map +1 -1
  12. package/dist/avatar/avatar-group2.js +1 -1
  13. package/dist/avatar/avatar-group2.js.map +1 -1
  14. package/dist/avatar/avatar2.js +2 -2
  15. package/dist/avatar/avatar2.js.map +1 -1
  16. package/dist/badge/badge.examples.json +2 -2
  17. package/dist/badge/badge2.js +2 -2
  18. package/dist/badge/badge2.js.map +1 -1
  19. package/dist/breadcrumb/breadcrumb.examples.json +1 -1
  20. package/dist/breadcrumb/breadcrumb2.js +2 -2
  21. package/dist/breadcrumb/breadcrumb2.js.map +1 -1
  22. package/dist/bundles/index.d.ts +8 -0
  23. package/dist/bundles/index.js +6 -6
  24. package/dist/button/button.examples.json +3 -3
  25. package/dist/button/button2.js +2 -2
  26. package/dist/button/button2.js.map +1 -1
  27. package/dist/button-group/button-group2.js +2 -2
  28. package/dist/button-group/button-group2.js.map +1 -1
  29. package/dist/card/card.examples.json +2 -2
  30. package/dist/card/card2.js +5 -5
  31. package/dist/card/card2.js.map +1 -1
  32. package/dist/chat-message/chat-message.examples.json +4 -4
  33. package/dist/chat-message/chat-message2.js +2 -2
  34. package/dist/chat-message/chat-message2.js.map +1 -1
  35. package/dist/checkbox/checkbox-group2.js +2 -2
  36. package/dist/checkbox/checkbox-group2.js.map +1 -1
  37. package/dist/checkbox/checkbox2.js +2 -2
  38. package/dist/checkbox/checkbox2.js.map +1 -1
  39. package/dist/color/color2.js +2 -2
  40. package/dist/color/color2.js.map +1 -1
  41. package/dist/combobox/combobox.examples.js.map +1 -1
  42. package/dist/combobox/combobox.examples.json +5 -5
  43. package/dist/combobox/combobox2.js +7 -5
  44. package/dist/combobox/combobox2.js.map +1 -1
  45. package/dist/copy-button/copy-button.examples.json +2 -2
  46. package/dist/copy-button/copy-button2.js +2 -2
  47. package/dist/copy-button/copy-button2.js.map +1 -1
  48. package/dist/custom-elements-jsx.d.ts +5 -1
  49. package/dist/custom-elements-vue.d.ts +5 -1
  50. package/dist/custom-elements.json +50 -34
  51. package/dist/data.html.json +2 -2
  52. package/dist/date/date2.js +2 -2
  53. package/dist/date/date2.js.map +1 -1
  54. package/dist/datetime/datetime2.js +2 -2
  55. package/dist/datetime/datetime2.js.map +1 -1
  56. package/dist/dialog/dialog-footer2.js +2 -2
  57. package/dist/dialog/dialog-footer2.js.map +1 -1
  58. package/dist/dialog/dialog-header2.js +2 -2
  59. package/dist/dialog/dialog-header2.js.map +1 -1
  60. package/dist/dialog/dialog.examples.json +3 -3
  61. package/dist/dialog/dialog2.js +2 -2
  62. package/dist/dialog/dialog2.js.map +1 -1
  63. package/dist/divider/divider.examples.json +1 -1
  64. package/dist/divider/divider2.js +2 -2
  65. package/dist/divider/divider2.js.map +1 -1
  66. package/dist/dot/dot2.js +2 -2
  67. package/dist/dot/dot2.js.map +1 -1
  68. package/dist/drawer/drawer-content2.js +2 -2
  69. package/dist/drawer/drawer-content2.js.map +1 -1
  70. package/dist/drawer/drawer-footer2.js +2 -2
  71. package/dist/drawer/drawer-footer2.js.map +1 -1
  72. package/dist/drawer/drawer-header2.js +2 -2
  73. package/dist/drawer/drawer-header2.js.map +1 -1
  74. package/dist/drawer/drawer2.js +2 -2
  75. package/dist/drawer/drawer2.js.map +1 -1
  76. package/dist/dropdown/dropdown-footer2.js +2 -2
  77. package/dist/dropdown/dropdown-footer2.js.map +1 -1
  78. package/dist/dropdown/dropdown-header2.js +2 -2
  79. package/dist/dropdown/dropdown-header2.js.map +1 -1
  80. package/dist/dropdown/dropdown2.js +2 -2
  81. package/dist/dropdown/dropdown2.js.map +1 -1
  82. package/dist/dropdown-group/dropdown-group.examples.json +4 -4
  83. package/dist/dropdown-group/dropdown-group.js +2 -2
  84. package/dist/dropdown-group/dropdown-group.js.map +1 -1
  85. package/dist/dropzone/dropzone.examples.json +1 -1
  86. package/dist/dropzone/dropzone2.js +2 -2
  87. package/dist/dropzone/dropzone2.js.map +1 -1
  88. package/dist/file/file2.js +1 -1
  89. package/dist/file/file2.js.map +1 -1
  90. package/dist/format-bytes/format-bytes2.js +2 -2
  91. package/dist/format-bytes/format-bytes2.js.map +1 -1
  92. package/dist/format-datetime/format-datetime.examples.json +3 -3
  93. package/dist/format-datetime/format-datetime2.js +2 -2
  94. package/dist/format-datetime/format-datetime2.js.map +1 -1
  95. package/dist/format-number/format-number2.js +2 -2
  96. package/dist/format-number/format-number2.js.map +1 -1
  97. package/dist/format-relative-time/format-relative-time2.js +2 -2
  98. package/dist/format-relative-time/format-relative-time2.js.map +1 -1
  99. package/dist/format-truncate/format-truncate.examples.json +4 -4
  100. package/dist/format-truncate/format-truncate2.js +2 -2
  101. package/dist/format-truncate/format-truncate2.js.map +1 -1
  102. package/dist/forms/actions.examples.json +1 -1
  103. package/dist/forms/control/control.examples.json +1 -1
  104. package/dist/forms/control/control2.js +2 -2
  105. package/dist/forms/control/control2.js.map +1 -1
  106. package/dist/forms/control-group/control-group2.js +2 -2
  107. package/dist/forms/control-group/control-group2.js.map +1 -1
  108. package/dist/forms/control-message/control-message2.js +2 -2
  109. package/dist/forms/control-message/control-message2.js.map +1 -1
  110. package/dist/forms/validation.examples.js.map +1 -1
  111. package/dist/gauge/gauge.examples.json +2 -2
  112. package/dist/gauge/gauge2.js +2 -2
  113. package/dist/gauge/gauge2.js.map +1 -1
  114. package/dist/grid/cell/cell2.js +1 -1
  115. package/dist/grid/cell/cell2.js.map +1 -1
  116. package/dist/grid/column/column2.js +2 -2
  117. package/dist/grid/column/column2.js.map +1 -1
  118. package/dist/grid/footer/footer2.js +2 -2
  119. package/dist/grid/footer/footer2.js.map +1 -1
  120. package/dist/grid/grid.examples.js.map +1 -1
  121. package/dist/grid/grid.examples.json +34 -34
  122. package/dist/grid/grid2.js +2 -2
  123. package/dist/grid/grid2.js.map +1 -1
  124. package/dist/grid/header/header2.js +2 -2
  125. package/dist/grid/header/header2.js.map +1 -1
  126. package/dist/grid/placeholder/placeholder2.js +1 -1
  127. package/dist/grid/placeholder/placeholder2.js.map +1 -1
  128. package/dist/grid/row/row2.js +2 -2
  129. package/dist/grid/row/row2.js.map +1 -1
  130. package/dist/icon/icon2.js +3 -3
  131. package/dist/icon/icon2.js.map +1 -1
  132. package/dist/icon-button/icon-button2.js +2 -2
  133. package/dist/icon-button/icon-button2.js.map +1 -1
  134. package/dist/index.js +1 -1
  135. package/dist/input/input-group2.js +1 -1
  136. package/dist/input/input-group2.js.map +1 -1
  137. package/dist/input/input2.js +2 -2
  138. package/dist/input/input2.js.map +1 -1
  139. package/dist/internal/controllers/audit.controller.js +9 -7
  140. package/dist/internal/controllers/audit.controller.js.map +1 -1
  141. package/dist/internal/controllers/gesture.controller.examples.js.map +1 -1
  142. package/dist/internal/controllers/gesture.controller.js +1 -3
  143. package/dist/internal/controllers/gesture.controller.js.map +1 -1
  144. package/dist/internal/controllers/i18n.controller.examples.js.map +1 -1
  145. package/dist/internal/controllers/i18n.controller.js.map +1 -1
  146. package/dist/internal/controllers/keynav-grid.controller.examples.json +1 -1
  147. package/dist/internal/controllers/keynav-grid.controller.js.map +1 -1
  148. package/dist/internal/controllers/keynav-list.controller.examples.json +1 -1
  149. package/dist/internal/controllers/keynav-list.controller.js +1 -4
  150. package/dist/internal/controllers/keynav-list.controller.js.map +1 -1
  151. package/dist/internal/controllers/keynav-spatial.controller.js.map +1 -1
  152. package/dist/internal/controllers/popover.examples.json +2 -2
  153. package/dist/internal/controllers/state-scroll.controller.js.map +1 -1
  154. package/dist/internal/controllers/type-anchor.controller.js.map +1 -1
  155. package/dist/internal/controllers/type-closable.controller.js.map +1 -1
  156. package/dist/internal/controllers/type-expandable.controller.js.map +1 -1
  157. package/dist/internal/controllers/type-native-popover.controller.js.map +1 -1
  158. package/dist/internal/controllers/type-native-popover.utils.js +2 -2
  159. package/dist/internal/controllers/type-native-popover.utils.js.map +1 -1
  160. package/dist/internal/controllers/type-selectable.controller.js.map +1 -1
  161. package/dist/internal/controllers/type-ssr.controller.js.map +1 -1
  162. package/dist/internal/services/global.service.js +1 -1
  163. package/dist/internal/services/global.utils.js.map +1 -1
  164. package/dist/internal/services/log.service.js.map +1 -1
  165. package/dist/internal/services/transition.service.js.map +1 -1
  166. package/dist/internal/utils/dom.js +2 -1
  167. package/dist/internal/utils/dom.js.map +1 -1
  168. package/dist/internal/utils/strings.js +1 -1
  169. package/dist/internal/utils/strings.js.map +1 -1
  170. package/dist/logo/logo.examples.json +1 -1
  171. package/dist/logo/logo2.js +2 -2
  172. package/dist/logo/logo2.js.map +1 -1
  173. package/dist/menu/menu-item2.js +2 -2
  174. package/dist/menu/menu-item2.js.map +1 -1
  175. package/dist/menu/menu.examples.js.map +1 -1
  176. package/dist/menu/menu.examples.json +4 -4
  177. package/dist/menu/menu2.js +2 -2
  178. package/dist/menu/menu2.js.map +1 -1
  179. package/dist/month/month2.js +2 -2
  180. package/dist/month/month2.js.map +1 -1
  181. package/dist/notification/notification-group2.js +2 -2
  182. package/dist/notification/notification-group2.js.map +1 -1
  183. package/dist/notification/notification.examples.json +3 -3
  184. package/dist/notification/notification2.js +2 -2
  185. package/dist/notification/notification2.js.map +1 -1
  186. package/dist/page/page-panel/page-panel-content2.js +1 -1
  187. package/dist/page/page-panel/page-panel-content2.js.map +1 -1
  188. package/dist/page/page-panel/page-panel-footer2.js +2 -2
  189. package/dist/page/page-panel/page-panel-footer2.js.map +1 -1
  190. package/dist/page/page-panel/page-panel-header2.js +2 -2
  191. package/dist/page/page-panel/page-panel-header2.js.map +1 -1
  192. package/dist/page/page-panel/page-panel2.js +2 -2
  193. package/dist/page/page-panel/page-panel2.js.map +1 -1
  194. package/dist/page/page.examples.json +10 -10
  195. package/dist/page/page2.js +2 -2
  196. package/dist/page/page2.js.map +1 -1
  197. package/dist/page-header/page-header.examples.json +1 -1
  198. package/dist/page-header/page-header2.js +1 -1
  199. package/dist/page-header/page-header2.js.map +1 -1
  200. package/dist/page-loader/page-loader2.js +2 -2
  201. package/dist/page-loader/page-loader2.js.map +1 -1
  202. package/dist/pagination/pagination.examples.json +6 -6
  203. package/dist/pagination/pagination2.js +2 -2
  204. package/dist/pagination/pagination2.js.map +1 -1
  205. package/dist/panel/panel2.js +5 -5
  206. package/dist/panel/panel2.js.map +1 -1
  207. package/dist/password/password2.js +2 -2
  208. package/dist/password/password2.js.map +1 -1
  209. package/dist/polyfills/index.js +1 -1
  210. package/dist/polyfills/index.js.map +1 -1
  211. package/dist/preferences-input/preferences-input.examples.json +1 -1
  212. package/dist/preferences-input/preferences-input2.js +2 -2
  213. package/dist/preferences-input/preferences-input2.js.map +1 -1
  214. package/dist/progress-bar/progress-bar.examples.json +1 -1
  215. package/dist/progress-bar/progress-bar2.js +2 -2
  216. package/dist/progress-bar/progress-bar2.js.map +1 -1
  217. package/dist/progress-ring/progress-ring2.js +2 -2
  218. package/dist/progress-ring/progress-ring2.js.map +1 -1
  219. package/dist/progressive-filter-chip/progressive-filter-chip2.js +2 -2
  220. package/dist/progressive-filter-chip/progressive-filter-chip2.js.map +1 -1
  221. package/dist/pulse/pulse2.js +2 -2
  222. package/dist/pulse/pulse2.js.map +1 -1
  223. package/dist/radio/radio-group2.js +2 -2
  224. package/dist/radio/radio-group2.js.map +1 -1
  225. package/dist/radio/radio2.js +2 -2
  226. package/dist/radio/radio2.js.map +1 -1
  227. package/dist/range/range.examples.json +1 -1
  228. package/dist/range/range2.js +4 -4
  229. package/dist/range/range2.js.map +1 -1
  230. package/dist/resize-handle/resize-handle.examples.json +4 -4
  231. package/dist/resize-handle/resize-handle2.js +2 -2
  232. package/dist/resize-handle/resize-handle2.js.map +1 -1
  233. package/dist/search/search2.js +2 -2
  234. package/dist/search/search2.js.map +1 -1
  235. package/dist/select/select2.js +2 -2
  236. package/dist/select/select2.js.map +1 -1
  237. package/dist/skeleton/skeleton2.js +2 -2
  238. package/dist/skeleton/skeleton2.js.map +1 -1
  239. package/dist/sort-button/sort-button2.js +2 -2
  240. package/dist/sort-button/sort-button2.js.map +1 -1
  241. package/dist/sparkline/sparkline.examples.json +2 -2
  242. package/dist/sparkline/sparkline.utils.js +1 -3
  243. package/dist/sparkline/sparkline.utils.js.map +1 -1
  244. package/dist/sparkline/sparkline2.js +8 -6
  245. package/dist/sparkline/sparkline2.js.map +1 -1
  246. package/dist/star-rating/star-rating2.js +2 -2
  247. package/dist/star-rating/star-rating2.js.map +1 -1
  248. package/dist/steps/steps2.js +3 -3
  249. package/dist/steps/steps2.js.map +1 -1
  250. package/dist/switch/switch-group2.js +2 -2
  251. package/dist/switch/switch-group2.js.map +1 -1
  252. package/dist/switch/switch2.js +2 -2
  253. package/dist/switch/switch2.js.map +1 -1
  254. package/dist/tabs/tabs-group2.js +2 -2
  255. package/dist/tabs/tabs-group2.js.map +1 -1
  256. package/dist/tabs/tabs.examples.json +4 -4
  257. package/dist/tabs/tabs2.js +3 -3
  258. package/dist/tabs/tabs2.js.map +1 -1
  259. package/dist/tag/tag.d.ts +2 -0
  260. package/dist/tag/tag.examples.js.map +1 -1
  261. package/dist/tag/tag.examples.json +20 -3
  262. package/dist/tag/tag.js +1 -1
  263. package/dist/tag/tag.js.map +1 -1
  264. package/dist/tag/tag2.js +3 -3
  265. package/dist/tag/tag2.js.map +1 -1
  266. package/dist/textarea/textarea.d.ts +7 -1
  267. package/dist/textarea/textarea.examples.js.map +1 -1
  268. package/dist/textarea/textarea.examples.json +22 -0
  269. package/dist/textarea/textarea.js +1 -1
  270. package/dist/textarea/textarea.js.map +1 -1
  271. package/dist/textarea/textarea2.js +10 -3
  272. package/dist/textarea/textarea2.js.map +1 -1
  273. package/dist/time/time2.js +2 -2
  274. package/dist/time/time2.js.map +1 -1
  275. package/dist/toast/toast.examples.json +1 -1
  276. package/dist/toast/toast2.js +2 -2
  277. package/dist/toast/toast2.js.map +1 -1
  278. package/dist/toggletip/toggletip-footer2.js +2 -2
  279. package/dist/toggletip/toggletip-footer2.js.map +1 -1
  280. package/dist/toggletip/toggletip-header2.js +2 -2
  281. package/dist/toggletip/toggletip-header2.js.map +1 -1
  282. package/dist/toggletip/toggletip2.js +2 -2
  283. package/dist/toggletip/toggletip2.js.map +1 -1
  284. package/dist/toolbar/toolbar2.js +2 -2
  285. package/dist/toolbar/toolbar2.js.map +1 -1
  286. package/dist/tooltip/tooltip.examples.js.map +1 -1
  287. package/dist/tooltip/tooltip.examples.json +2 -2
  288. package/dist/tooltip/tooltip2.js +2 -2
  289. package/dist/tooltip/tooltip2.js.map +1 -1
  290. package/dist/tree/tree-node2.js +2 -2
  291. package/dist/tree/tree-node2.js.map +1 -1
  292. package/dist/tree/tree.examples.js.map +1 -1
  293. package/dist/tree/tree2.js +2 -2
  294. package/dist/tree/tree2.js.map +1 -1
  295. package/dist/week/week2.js +2 -2
  296. package/dist/week/week2.js.map +1 -1
  297. package/package.json +9 -9
@@ -1 +1 @@
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,GAAG,CAC7D,CACF;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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,CAAC,CAAC,MAAK,MAAK,MAAM,CAAW,CAAC,GAC/E,IAAkB,MAAM,KAAK,EAAoB,CAAU,CAAC,CAAC,CAAC,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":[],"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,IAAI,KAAU;EACZ,OAAO;GACL,MAAM,KAAK;GACX,GAAG,KAAK,KAAK;EACf;CACF;CAEA,IAAI,KAAY;EACd,IAAM,IAAO,MAAM,KAAK,KAAK,GAAQ,IAAI;EAMzC,OAJI,KAAK,GAAQ,aACf,EAAK,QAAQ,KAAK,GAAQ,SAAS,GAG9B;CACT;CAEA,IAAI,KAAa;EACf,OAAO,CAAC,GAAG,MAAM,KAAK,KAAK,GAAQ,WAAW,CAAC,CAAC,GAAG,GAAG,MAAM,KAAK,KAAK,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,KAAK,KAAQ,KAAK,GAAQ,MAC1B,EAAuB,KAAK,EAAU,GACtC,KAAK,GAAM,iBAAiB,SAAS,KAAK,EAAQ,GAClD,KAAK,GAAM,iBAAiB,WAAW,KAAK,EAAU,GACtD,KAAK,GAAM,iBAAiB,WAAW,KAAK,EAAU,GACtD,KAAK,GAAW,KACd,EACE,KAAK,MACL,QAAe,EAAuB,KAAK,EAAU,GAAG,GAAG,CAC7D,CACF;CACF;CAEA,mBAAmB;EAMjB,AALA,KAAK,GAAW,SAAQ,MAAK,GAAG,WAAW,CAAC,GAC5C,KAAK,GAAW,SAAS,GACzB,KAAK,I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B;AAEA,SAAgB,EACd,GACA,GACA,GACA;CACA,IAAM,IAAc,EAAM,MAAK,MAAK,EAAE,aAAa,CAAC,GAC9C,IAAa,EAAK,MAAK,MAAK,EAAoB,CAAC,CAAC,CAAC,MAAK,MAAK,MAAM,CAAW,CAAC,GAC/E,IAAkB,MAAM,KAAK,EAAoB,CAAU,CAAC,CAAC,CAAC,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"}
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "id": "internal-controllers-keynav-list.controller-styles",
6
6
  "name": "styles",
7
- "template": "section { display: grid; gap: 4px; grid-template-columns: repeat(10, 50px); } .vertical { grid-template-rows: repeat(10,\n1fr); grid-template-columns: 50px; } .row { display: contents; } button { width: 100%; height: 30px; min-width: 30px;\ndisplay: block; } button[selected] { background: green; color: white; }\n",
7
+ "template": "section { display: grid; gap: 4px; grid-template-columns: repeat(10, 50px); } .vertical { grid-template-rows: repeat(10, 1fr); grid-template-columns: 50px; } .row { display: contents; } button { width: 100%; height:\n30px; min-width: 30px; display: block; } button[selected] { background: green; color: white; }\n",
8
8
  "summary": "",
9
9
  "description": "",
10
10
  "composition": false,
@@ -120,10 +120,7 @@ function d(e, t, n) {
120
120
  case "pageup":
121
121
  r = Math.max(0, r - 4);
122
122
  break;
123
- case "pagedown":
124
- r = Math.min(a, r + 4);
125
- break;
126
- case null: break;
123
+ case "pagedown": r = Math.min(a, r + 4);
127
124
  }
128
125
  return {
129
126
  next: r,
@@ -1 +1 @@
1
- {"version":3,"file":"keynav-list.controller.js","names":["#config","#keynavDisabled","#initializeTabIndex","#onPointerUp","#onKeyDown","#getPointerActiveItem","#setActiveItem","#getKeyboardActiveItem","#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, isFocusable, setActiveKeyListItem } from '../utils/focus.js';\nimport { KeynavCode, validKeyNavigationCode } from '../utils/dom.js';\n\nexport interface KeynavListConfig {\n items: NodeListOf<HTMLElement> | HTMLElement[];\n initialItem?: 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, initialItem } = this.#config;\n if (manageFocus && manageTabindex && !this.#keynavDisabled) {\n initializeKeyListItems(items);\n if (initialItem && items.includes(initialItem)) {\n setActiveKeyListItem(items, initialItem);\n }\n }\n }\n\n #clickItem(e: PointerEvent) {\n const item = this.#getPointerActiveItem(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.#getKeyboardActiveItem(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 #getKeyboardActiveItem(e: KeyboardEvent, items: HTMLElement[]) {\n const target = e.composedPath()[0];\n return target instanceof HTMLElement && items.includes(target) ? target : null;\n }\n\n #getPointerActiveItem(e: PointerEvent, items: HTMLElement[]) {\n const path = e.composedPath();\n const itemIndex = path.findIndex(item => item instanceof HTMLElement && items.includes(item));\n const item = path[itemIndex];\n\n if (!(item instanceof HTMLElement)) return null;\n\n const hasFocusableDescendant = path\n .slice(0, itemIndex)\n .some(descendant => descendant instanceof Element && isFocusable(descendant));\n return hasFocusableDescendant ? null : item;\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":";;;AAuBA,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,CAAC,CAAC,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,mBAAmB;EAEjB,AADA,KAAK,KAAK,oBAAoB,aAAa,KAAKD,EAAY,GAC5D,KAAK,KAAK,oBAAoB,WAAW,KAAKC,EAAU;CAC1D;CAEA,KAAsB;EACpB,IAAM,EAAE,gBAAa,mBAAgB,UAAO,mBAAgB,KAAKJ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AAG;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":[],"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, isFocusable, setActiveKeyListItem } from '../utils/focus.js';\nimport { KeynavCode, validKeyNavigationCode } from '../utils/dom.js';\n\nexport interface KeynavListConfig {\n items: NodeListOf<HTMLElement> | HTMLElement[];\n initialItem?: 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, initialItem } = this.#config;\n if (manageFocus && manageTabindex && !this.#keynavDisabled) {\n initializeKeyListItems(items);\n if (initialItem && items.includes(initialItem)) {\n setActiveKeyListItem(items, initialItem);\n }\n }\n }\n\n #clickItem(e: PointerEvent) {\n const item = this.#getPointerActiveItem(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.#getKeyboardActiveItem(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 #getKeyboardActiveItem(e: KeyboardEvent, items: HTMLElement[]) {\n const target = e.composedPath()[0];\n return target instanceof HTMLElement && items.includes(target) ? target : null;\n }\n\n #getPointerActiveItem(e: PointerEvent, items: HTMLElement[]) {\n const path = e.composedPath();\n const itemIndex = path.findIndex(item => item instanceof HTMLElement && items.includes(item));\n const item = path[itemIndex];\n\n if (!(item instanceof HTMLElement)) return null;\n\n const hasFocusableDescendant = path\n .slice(0, itemIndex)\n .some(descendant => descendant instanceof Element && isFocusable(descendant));\n return hasFocusableDescendant ? null : item;\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":";;;AAuBA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAA4B,CAAQ,CAAC;AACrF;AAEA,IAAa,IAAb,MAAsH;CACpH,IAAI,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,CAAC,CAAC,QACjD,MAA4C,CAAC,EAAE,QAClD;EACF;CACF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAGA,IAAI,KAAkB;EACpB,OAAO,KAAK,KAAK,aAAa,qBAAqB;CACrD;CAEA,MAAM,gBAAgB;EACpB,MAAM,KAAK,KAAK,gBACX,KAAK,KAAK,gBACf,KAAK,GAAoB,GACzB,KAAK,KAAK,iBAAiB,aAAa,KAAK,EAAY,GACzD,KAAK,KAAK,iBAAiB,WAAW,KAAK,EAAU;CACvD;CAEA,mBAAmB;EAEjB,AADA,KAAK,KAAK,oBAAoB,aAAa,KAAK,EAAY,GAC5D,KAAK,KAAK,oBAAoB,WAAW,KAAK,EAAU;CAC1D;CAEA,KAAsB;EACpB,IAAM,EAAE,gBAAa,mBAAgB,UAAO,mBA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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,YACH,IAAO,KAAK,IAAI,GAAW,IAAO,CAAC;CAIvC;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"keynav-spatial.controller.js","names":["#host","#handleKeydown"],"sources":["../../../src/internal/controllers/keynav-spatial.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\ntype SpatialKeyHost = ReactiveControllerHost & HTMLElement;\n\nexport type SpatialKeyHandling = 'handled' | 'ignored';\n\nexport type SpatialKeyCommand =\n | {\n readonly ctrlKey: boolean;\n readonly event: KeyboardEvent;\n readonly kind: 'direction';\n readonly horizontal: -1 | 0 | 1;\n readonly key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp';\n readonly shiftKey: boolean;\n readonly vertical: -1 | 0 | 1;\n }\n | {\n readonly event: KeyboardEvent;\n readonly kind: 'zoom';\n readonly key: '+' | '-' | '=';\n };\n\n/** Converts direct-host keyboard input into spatial direction and zoom commands. */\nexport class KeyNavigationSpatialController implements ReactiveController {\n readonly #host: SpatialKeyHost;\n\n constructor(host: SpatialKeyHost) {\n this.#host = host;\n host.addController(this);\n }\n\n hostConnected(): void {\n this.#host.addEventListener('keydown', this.#handleKeydown);\n }\n\n hostDisconnected(): void {\n this.#host.removeEventListener('keydown', this.#handleKeydown);\n }\n\n #handleKeydown = (event: KeyboardEvent): void => {\n if (event.composedPath()[0] !== this.#host) return;\n const command = getSpatialKeyCommand(event);\n if (!command) return;\n this.#host.dispatchEvent(\n new CustomEvent<SpatialKeyCommand>('nve-key', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: command\n })\n );\n };\n}\n\nfunction getSpatialKeyCommand(event: KeyboardEvent): SpatialKeyCommand | undefined {\n switch (event.key) {\n case 'ArrowDown':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: -1\n };\n case 'ArrowLeft':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: -1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowRight':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowUp':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 1\n };\n case '+':\n case '-':\n case '=':\n return { event, key: event.key, kind: 'zoom' };\n default:\n return undefined;\n }\n}\n"],"mappings":";AA0BA,IAAa,IAAb,MAA0E;CACxE;CAEA,YAAY,GAAsB;EAEhC,AADA,KAAKA,KAAQ,GACb,EAAK,cAAc,IAAI;CACzB;CAEA,gBAAsB;EACpB,KAAKA,GAAM,iBAAiB,WAAW,KAAKC,EAAc;CAC5D;CAEA,mBAAyB;EACvB,KAAKD,GAAM,oBAAoB,WAAW,KAAKC,EAAc;CAC/D;CAEA,MAAkB,MAA+B;EAC/C,IAAI,EAAM,aAAa,CAAC,CAAC,OAAO,KAAKD,IAAO;EAC5C,IAAM,IAAU,EAAqB,CAAK;EACrC,KACL,KAAKA,GAAM,cACT,IAAI,YAA+B,WAAW;GAC5C,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;EACV,CAAC,CACH;CACF;AACF;AAEA,SAAS,EAAqB,GAAqD;CACjF,QAAQ,EAAM,KAAd;EACE,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,cACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,WACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK;EACL,KAAK;EACL,KAAK,KACH,OAAO;GAAE;GAAO,KAAK,EAAM;GAAK,MAAM;EAAO;EAC/C,SACE;CACJ;AACF"}
1
+ {"version":3,"file":"keynav-spatial.controller.js","names":[],"sources":["../../../src/internal/controllers/keynav-spatial.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\ntype SpatialKeyHost = ReactiveControllerHost & HTMLElement;\n\nexport type SpatialKeyHandling = 'handled' | 'ignored';\n\nexport type SpatialKeyCommand =\n | {\n readonly ctrlKey: boolean;\n readonly event: KeyboardEvent;\n readonly kind: 'direction';\n readonly horizontal: -1 | 0 | 1;\n readonly key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp';\n readonly shiftKey: boolean;\n readonly vertical: -1 | 0 | 1;\n }\n | {\n readonly event: KeyboardEvent;\n readonly kind: 'zoom';\n readonly key: '+' | '-' | '=';\n };\n\n/** Converts direct-host keyboard input into spatial direction and zoom commands. */\nexport class KeyNavigationSpatialController implements ReactiveController {\n readonly #host: SpatialKeyHost;\n\n constructor(host: SpatialKeyHost) {\n this.#host = host;\n host.addController(this);\n }\n\n hostConnected(): void {\n this.#host.addEventListener('keydown', this.#handleKeydown);\n }\n\n hostDisconnected(): void {\n this.#host.removeEventListener('keydown', this.#handleKeydown);\n }\n\n #handleKeydown = (event: KeyboardEvent): void => {\n if (event.composedPath()[0] !== this.#host) return;\n const command = getSpatialKeyCommand(event);\n if (!command) return;\n this.#host.dispatchEvent(\n new CustomEvent<SpatialKeyCommand>('nve-key', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: command\n })\n );\n };\n}\n\nfunction getSpatialKeyCommand(event: KeyboardEvent): SpatialKeyCommand | undefined {\n switch (event.key) {\n case 'ArrowDown':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: -1\n };\n case 'ArrowLeft':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: -1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowRight':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 1,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 0\n };\n case 'ArrowUp':\n return {\n ctrlKey: event.ctrlKey,\n event,\n horizontal: 0,\n key: event.key,\n kind: 'direction',\n shiftKey: event.shiftKey,\n vertical: 1\n };\n case '+':\n case '-':\n case '=':\n return { event, key: event.key, kind: 'zoom' };\n default:\n return undefined;\n }\n}\n"],"mappings":";AA0BA,IAAa,IAAb,MAA0E;CACxE;CAEA,YAAY,GAAsB;EAEhC,AADA,KAAK,KAAQ,GACb,EAAK,cAAc,IAAI;CACzB;CAEA,gBAAsB;EACpB,KAAK,GAAM,iBAAiB,WAAW,KAAK,EAAc;CAC5D;CAEA,mBAAyB;EACvB,KAAK,GAAM,oBAAoB,WAAW,KAAK,EAAc;CAC/D;CAEA,MAAkB,MAA+B;EAC/C,IAAI,EAAM,aAAa,CAAC,CAAC,OAAO,KAAK,IAAO;EAC5C,IAAM,IAAU,EAAqB,CAAK;EACrC,KACL,KAAK,GAAM,cACT,IAAI,YAA+B,WAAW;GAC5C,SAAS;GACT,YAAY;GACZ,UAAU;GACV,QAAQ;EACV,CAAC,CACH;CACF;AACF;AAEA,SAAS,EAAqB,GAAqD;CACjF,QAAQ,EAAM,KAAd;EACE,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,aACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,cACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK,WACH,OAAO;GACL,SAAS,EAAM;GACf;GACA,YAAY;GACZ,KAAK,EAAM;GACX,MAAM;GACN,UAAU,EAAM;GAChB,UAAU;EACZ;EACF,KAAK;EACL,KAAK;EACL,KAAK,KACH,OAAO;GAAE;GAAO,KAAK,EAAM;GAAK,MAAM;EAAO;EAC/C,SACE;CACJ;AACF"}
@@ -15,7 +15,7 @@
15
15
  {
16
16
  "id": "internal-controllers-popover-nested",
17
17
  "name": "Nested",
18
- "template": "<style>\n #root-inner {\n height: 2000px;\n }\n</style>\n<nve-dialog closable modal>\n <h3 nve-text=\"heading\">Dialog</h3>\n <p nve-text=\"body\" style=\"margin-bottom: 48px\">hello there</p>\n <nve-button id=\"dropdown-btn\">search</nve-button>\n <nve-dropdown anchor=\"dropdown-btn\" closable position=\"bottom\" alignment=\"start\">\n <nve-search rounded>\n <label>search dataset</label>\n <nve-icon-button\n id=\"tooltip-btn\"\n icon-name=\"information-circle\"\n container=\"flat\"\n aria-label=\"more details\"\n slot=\"label\"\n ></nve-icon-button>\n <input type=\"search\" placeholder=\"search\" />\n </nve-search>\n <nve-tooltip anchor=\"tooltip-btn\" position=\"top\">hello there</nve-tooltip>\n </nve-dropdown>\n</nve-dialog>\n<nve-notification closable position=\"bottom\" alignment=\"end\">\n <h3 nve-text=\"label\">notification</h3>\n <p nve-text=\"body\">some text content in a notification</p>\n</nve-notification>\n",
18
+ "template": "<style>\n #root-inner {\n height: 2000px;\n }\n</style>\n<nve-dialog closable modal>\n <h3 nve-text=\"heading\">Dialog</h3>\n <p nve-text=\"body\" style=\"margin-bottom: 48px\">hello there</p>\n <nve-button id=\"dropdown-btn\">search</nve-button>\n <nve-dropdown anchor=\"dropdown-btn\" closable position=\"bottom\" alignment=\"start\">\n <nve-search rounded>\n <label>search dataset</label>\n <nve-icon-button id=\"tooltip-btn\" icon-name=\"information-circle\" container=\"flat\" aria-label=\"more details\" slot=\"label\"></nve-icon-button>\n <input type=\"search\" placeholder=\"search\" />\n </nve-search>\n <nve-tooltip anchor=\"tooltip-btn\" position=\"top\">hello there</nve-tooltip>\n </nve-dropdown>\n</nve-dialog>\n<nve-notification closable position=\"bottom\" alignment=\"end\">\n <h3 nve-text=\"label\">notification</h3>\n <p nve-text=\"body\">some text content in a notification</p>\n</nve-notification>\n",
19
19
  "summary": "Nested popovers within dialogs and notifications, with proper layering and stacking order.",
20
20
  "description": "",
21
21
  "composition": true,
@@ -46,7 +46,7 @@
46
46
  {
47
47
  "id": "internal-controllers-popover-legacy-interactive",
48
48
  "name": "LegacyInteractive",
49
- "template": "<div nve-layout=\"row align:center gap:xl\" style=\"height: 300px\">\n <nve-tooltip trigger=\"tooltip-btn\" behavior-trigger position=\"top\" hidden>hello there</nve-tooltip>\n <nve-button id=\"tooltip-btn\">tooltip</nve-button>\n <nve-button id=\"toast-btn\">toast</nve-button>\n <nve-toast trigger=\"toast-btn\" behavior-trigger position=\"top\" close-timeout=\"1500\" hidden>copied!</nve-toast>\n <nve-button id=\"drawer-btn\" size=\"sm\">drawer</nve-button>\n <nve-drawer trigger=\"drawer-btn\" behavior-trigger hidden closable modal>\n <nve-drawer-header>\n <h3 nve-text=\"heading semibold sm\">Title</h3>\n </nve-drawer-header>\n <p nve-text=\"body\">some text content in a drawer</p>\n </nve-drawer>\n <nve-button id=\"dropdown-btn\">dropdown</nve-button>\n <nve-dropdown trigger=\"dropdown-btn\" behavior-trigger closable hidden>\n <h3 nve-text=\"heading\">Title</h3>\n <p nve-text=\"body\">some text content in a dropdown</p>\n </nve-dropdown>\n <nve-button id=\"dialog-btn\">dialog</nve-button>\n <nve-dialog trigger=\"dialog-btn\" behavior-trigger closable modal hidden>\n <h3 nve-text=\"heading\">Title</h3>\n <p nve-text=\"body\">some text content in a closable dialog</p>\n </nve-dialog>\n <nve-button id=\"notification-btn\">notification snackbar</nve-button>\n <nve-notification\n trigger=\"notification-btn\"\n behavior-trigger\n hidden\n closable\n position=\"bottom\"\n alignment=\"end\"\n close-timeout=\"2000\"\n >\n <h3 nve-text=\"label\">notification</h3>\n <p nve-text=\"body\">some text content in a notification</p>\n </nve-notification>\n</div>\n",
49
+ "template": "<div nve-layout=\"row align:center gap:xl\" style=\"height: 300px\">\n <nve-tooltip trigger=\"tooltip-btn\" behavior-trigger position=\"top\" hidden>hello there</nve-tooltip>\n <nve-button id=\"tooltip-btn\">tooltip</nve-button>\n <nve-button id=\"toast-btn\">toast</nve-button>\n <nve-toast trigger=\"toast-btn\" behavior-trigger position=\"top\" close-timeout=\"1500\" hidden>copied!</nve-toast>\n <nve-button id=\"drawer-btn\" size=\"sm\">drawer</nve-button>\n <nve-drawer trigger=\"drawer-btn\" behavior-trigger hidden closable modal>\n <nve-drawer-header>\n <h3 nve-text=\"heading semibold sm\">Title</h3>\n </nve-drawer-header>\n <p nve-text=\"body\">some text content in a drawer</p>\n </nve-drawer>\n <nve-button id=\"dropdown-btn\">dropdown</nve-button>\n <nve-dropdown trigger=\"dropdown-btn\" behavior-trigger closable hidden>\n <h3 nve-text=\"heading\">Title</h3>\n <p nve-text=\"body\">some text content in a dropdown</p>\n </nve-dropdown>\n <nve-button id=\"dialog-btn\">dialog</nve-button>\n <nve-dialog trigger=\"dialog-btn\" behavior-trigger closable modal hidden>\n <h3 nve-text=\"heading\">Title</h3>\n <p nve-text=\"body\">some text content in a closable dialog</p>\n </nve-dialog>\n <nve-button id=\"notification-btn\">notification snackbar</nve-button>\n <nve-notification trigger=\"notification-btn\" behavior-trigger hidden closable position=\"bottom\" alignment=\"end\" close-timeout=\"2000\">\n <h3 nve-text=\"label\">notification</h3>\n <p nve-text=\"body\">some text content in a notification</p>\n </nve-notification>\n</div>\n",
50
50
  "summary": "Legacy implementation showing all popover types using the older trigger/behavior-trigger API for backward compatibility.",
51
51
  "description": "",
52
52
  "deprecated": true,
@@ -1 +1 @@
1
- {"version":3,"file":"state-scroll.controller.js","names":["#target","#offset","#syncTarget","#removeTargetListeners","#activeTarget","#onScrollEnd","#startScroll","#onScroll"],"sources":["../../../src/internal/controllers/state-scroll.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 { attachInternals, endOfScrollBox } from '@nvidia-elements/core/internal';\n\n/**\n * Adds active scroll state detection\n */\nexport function stateScroll<T extends Scroll>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new StateScrollController(instance));\n}\n\nexport interface StateScrollConfig {\n target?: HTMLElement;\n scrollOffset?: number;\n}\n\nexport type Scroll = ReactiveElement & {\n _internals?: ElementInternals;\n stateScrollConfig?: StateScrollConfig;\n};\n\nexport class StateScrollController<T extends Scroll> implements ReactiveController {\n #activeTarget?: HTMLElement;\n\n get #target(): HTMLElement {\n const target = this.host.stateScrollConfig?.target;\n return target ? target : this.host;\n }\n\n get #offset() {\n return this.host.stateScrollConfig?.scrollOffset ?? 0;\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n attachInternals(this.host);\n this.#syncTarget();\n }\n\n hostUpdated() {\n this.#syncTarget();\n }\n\n hostDisconnected() {\n this.#removeTargetListeners();\n }\n\n #syncTarget() {\n const target = this.#target;\n if (this.#activeTarget === target) return;\n\n this.#removeTargetListeners();\n this.#activeTarget = target;\n this.#activeTarget.addEventListener('scrollend', this.#onScrollEnd);\n this.#startScroll();\n }\n\n #onScrollEnd = () => {\n this.host._internals!.states.delete('scrolling');\n\n if (this.#activeTarget && endOfScrollBox(this.#activeTarget, this.#offset)) {\n this.host.dispatchEvent(new CustomEvent('scrollboxend', { bubbles: true, composed: true }));\n }\n\n this.#startScroll();\n };\n\n #onScroll = () => {\n this.host._internals!.states.add('scrolling');\n };\n\n #startScroll() {\n this.#activeTarget?.removeEventListener('scroll', this.#onScroll);\n this.#activeTarget?.addEventListener('scroll', this.#onScroll, { once: true });\n }\n\n #removeTargetListeners() {\n this.#activeTarget?.removeEventListener('scroll', this.#onScroll);\n this.#activeTarget?.removeEventListener('scrollend', this.#onScrollEnd);\n this.#activeTarget = undefined;\n }\n}\n"],"mappings":";;;AAUA,SAAgB,IAAgD;CAC9D,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAAsB,CAAQ,CAAC;AAC/E;AAYA,IAAa,IAAb,MAAmF;CACjF;CAEA,IAAIA,KAAuB;EAEzB,OADe,KAAK,KAAK,mBAAmB,UACnB,KAAK;CAChC;CAEA,IAAIC,KAAU;EACZ,OAAO,KAAK,KAAK,mBAAmB,gBAAgB;CACtD;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,MAAM,gBAAgB;EAGpB,AAFA,MAAM,KAAK,KAAK,gBAChB,EAAgB,KAAK,IAAI,GACzB,KAAKC,GAAY;CACnB;CAEA,cAAc;EACZ,KAAKA,GAAY;CACnB;CAEA,mBAAmB;EACjB,KAAKC,GAAuB;CAC9B;CAEA,KAAc;EACZ,IAAM,IAAS,KAAKH;EAChB,KAAKI,OAAkB,MAE3B,KAAKD,GAAuB,GAC5B,KAAKC,KAAgB,GACrB,KAAKA,GAAc,iBAAiB,aAAa,KAAKC,EAAY,GAClE,KAAKC,GAAa;CACpB;CAEA,WAAqB;EAOnB,AANA,KAAK,KAAK,WAAY,OAAO,OAAO,WAAW,GAE3C,KAAKF,MAAiB,EAAe,KAAKA,IAAe,KAAKH,EAAO,KACvE,KAAK,KAAK,cAAc,IAAI,YAAY,gBAAgB;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC,GAG5F,KAAKK,GAAa;CACpB;CAEA,WAAkB;EAChB,KAAK,KAAK,WAAY,OAAO,IAAI,WAAW;CAC9C;CAEA,KAAe;EAEb,AADA,KAAKF,IAAe,oBAAoB,UAAU,KAAKG,EAAS,GAChE,KAAKH,IAAe,iBAAiB,UAAU,KAAKG,IAAW,EAAE,MAAM,GAAK,CAAC;CAC/E;CAEA,KAAyB;EAGvB,AAFA,KAAKH,IAAe,oBAAoB,UAAU,KAAKG,EAAS,GAChE,KAAKH,IAAe,oBAAoB,aAAa,KAAKC,EAAY,GACtE,KAAKD,KAAgB,KAAA;CACvB;AACF"}
1
+ {"version":3,"file":"state-scroll.controller.js","names":[],"sources":["../../../src/internal/controllers/state-scroll.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 { attachInternals, endOfScrollBox } from '@nvidia-elements/core/internal';\n\n/**\n * Adds active scroll state detection\n */\nexport function stateScroll<T extends Scroll>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new StateScrollController(instance));\n}\n\nexport interface StateScrollConfig {\n target?: HTMLElement;\n scrollOffset?: number;\n}\n\nexport type Scroll = ReactiveElement & {\n _internals?: ElementInternals;\n stateScrollConfig?: StateScrollConfig;\n};\n\nexport class StateScrollController<T extends Scroll> implements ReactiveController {\n #activeTarget?: HTMLElement;\n\n get #target(): HTMLElement {\n const target = this.host.stateScrollConfig?.target;\n return target ? target : this.host;\n }\n\n get #offset() {\n return this.host.stateScrollConfig?.scrollOffset ?? 0;\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n attachInternals(this.host);\n this.#syncTarget();\n }\n\n hostUpdated() {\n this.#syncTarget();\n }\n\n hostDisconnected() {\n this.#removeTargetListeners();\n }\n\n #syncTarget() {\n const target = this.#target;\n if (this.#activeTarget === target) return;\n\n this.#removeTargetListeners();\n this.#activeTarget = target;\n this.#activeTarget.addEventListener('scrollend', this.#onScrollEnd);\n this.#startScroll();\n }\n\n #onScrollEnd = () => {\n this.host._internals!.states.delete('scrolling');\n\n if (this.#activeTarget && endOfScrollBox(this.#activeTarget, this.#offset)) {\n this.host.dispatchEvent(new CustomEvent('scrollboxend', { bubbles: true, composed: true }));\n }\n\n this.#startScroll();\n };\n\n #onScroll = () => {\n this.host._internals!.states.add('scrolling');\n };\n\n #startScroll() {\n this.#activeTarget?.removeEventListener('scroll', this.#onScroll);\n this.#activeTarget?.addEventListener('scroll', this.#onScroll, { once: true });\n }\n\n #removeTargetListeners() {\n this.#activeTarget?.removeEventListener('scroll', this.#onScroll);\n this.#activeTarget?.removeEventListener('scrollend', this.#onScrollEnd);\n this.#activeTarget = undefined;\n }\n}\n"],"mappings":";;;AAUA,SAAgB,IAAgD;CAC9D,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAAsB,CAAQ,CAAC;AAC/E;AAYA,IAAa,IAAb,MAAmF;CACjF;CAEA,IAAI,KAAuB;EAEzB,OADe,KAAK,KAAK,mBAAmB,UACnB,KAAK;CAChC;CAEA,IAAI,KAAU;EACZ,OAAO,KAAK,KAAK,mBAAmB,gBAAgB;CACtD;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,MAAM,gBAAgB;EAGpB,AAFA,MAAM,KAAK,KAAK,gBAChB,EAAgB,KAAK,IAAI,GACzB,KAAK,GAAY;CACnB;CAEA,cAAc;EACZ,KAAK,GAAY;CACnB;CAEA,mBAAmB;EACjB,KAAK,GAAuB;CAC9B;CAEA,KAAc;EACZ,IAAM,IAAS,KAAK;EAChB,KAAK,OAAkB,MAE3B,KAAK,GAAuB,GAC5B,KAAK,KAAgB,GACrB,KAAK,GAAc,iBAAiB,aAAa,KAAK,EAAY,GAClE,KAAK,GAAa;CACpB;CAEA,WAAqB;EAOnB,AANA,KAAK,KAAK,WAAY,OAAO,OAAO,WAAW,GAE3C,KAAK,MAAiB,EAAe,KAAK,IAAe,KAAK,EAAO,KACvE,KAAK,KAAK,cAAc,IAAI,YAAY,gBAAgB;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC,GAG5F,KAAK,GAAa;CACpB;CAEA,WAAkB;EAChB,KAAK,KAAK,WAAY,OAAO,IAAI,WAAW;CAC9C;CAEA,KAAe;EAEb,AADA,KAAK,IAAe,oBAAoB,UAAU,KAAK,EAAS,GAChE,KAAK,IAAe,iBAAiB,UAAU,KAAK,IAAW,EAAE,MAAM,GAAK,CAAC;CAC/E;CAEA,KAAyB;EAGvB,AAFA,KAAK,IAAe,oBAAoB,UAAU,KAAK,EAAS,GAChE,KAAK,IAAe,oBAAoB,aAAa,KAAK,EAAY,GACtE,KAAK,KAAgB,KAAA;CACvB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-anchor.controller.js","names":["#anchor","#slottedAnchor","#parentAnchor","#defaultSlot","#anchorSlot","#updateAnchorSlotAssignment"],"sources":["../../../src/internal/controllers/type-anchor.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { removeEmptyTextNode } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\n\n/**\n * Adds anchor/link support for interactive custom elements.\n */\nexport function typeAnchor<T extends Anchor>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) => target.addInitializer!((instance: T) => new TypeAnchorController(instance));\n}\n\nexport interface Anchor extends ReactiveElement {\n disabled: boolean;\n readOnly: boolean;\n _internals: ElementInternals;\n}\n\nexport class TypeAnchorController<T extends Anchor> implements ReactiveController {\n get #anchor() {\n return this.#slottedAnchor ? this.#slottedAnchor : this.#parentAnchor;\n }\n\n get #slottedAnchor() {\n // return elements that nest in a slot\n return this.host\n .shadowRoot!.querySelector<HTMLSlotElement>('slot, slot[name=anchor]')\n ?.assignedElements()\n ?.find(e => e?.tagName === 'A');\n }\n\n get #parentAnchor() {\n return this.host.parentElement?.tagName === 'A' ? (this.host.parentElement as HTMLAnchorElement) : null;\n }\n\n get #defaultSlot() {\n return this.host.shadowRoot!.querySelector<HTMLSlotElement>('slot:not([name])');\n }\n\n get #anchorSlot() {\n return this.host.shadowRoot!.querySelector<HTMLSlotElement>('slot[name=anchor]');\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n attachInternals(this.host);\n await this.host.updateComplete;\n\n this.#updateAnchorSlotAssignment();\n\n if (this.#anchor) {\n this.host.readOnly = true;\n this.host._internals?.states.add('anchor');\n } else {\n this.host._internals?.states.delete('anchor');\n }\n\n if (this.#parentAnchor) {\n this.#parentAnchor.style.textDecoration = 'none';\n this.host.style.cursor = 'pointer';\n }\n\n this.#anchor?.addEventListener('click', e => {\n if (this.host.disabled) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n });\n }\n\n #updateAnchorSlotAssignment() {\n if (this.#anchor && this.#anchorSlot) {\n this.#anchor.slot = 'an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G,IAAc,cAAc,CAAC,CAAC,SAAQ,MAAQ,EAAoB,CAAI,CAAC;CAEhF;AACF"}
1
+ {"version":3,"file":"type-anchor.controller.js","names":[],"sources":["../../../src/internal/controllers/type-anchor.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { removeEmptyTextNode } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\n\n/**\n * Adds anchor/link support for interactive custom elements.\n */\nexport function typeAnchor<T extends Anchor>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) => target.addInitializer!((instance: T) => new TypeAnchorController(instance));\n}\n\nexport interface Anchor extends ReactiveElement {\n disabled: boolean;\n readOnly: boolean;\n _internals: ElementInternals;\n}\n\nexport class TypeAnchorController<T extends Anchor> implements ReactiveController {\n get #anchor() {\n return this.#slottedAnchor ? this.#slottedAnchor : this.#parentAnchor;\n }\n\n get #slottedAnchor() {\n // return elements that nest in a slot\n return this.host\n .shadowRoot!.querySelector<HTMLSlotElement>('slot, slot[name=anchor]')\n ?.assignedElements()\n ?.find(e => e?.tagName === 'A');\n }\n\n get #parentAnchor() {\n return this.host.parentElement?.tagName === 'A' ? (this.host.parentElement as HTMLAnchorElement) : null;\n }\n\n get #defaultSlot() {\n return this.host.shadowRoot!.querySelector<HTMLSlotElement>('slot:not([name])');\n }\n\n get #anchorSlot() {\n return this.host.shadowRoot!.querySelector<HTMLSlotElement>('slot[name=anchor]');\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n attachInternals(this.host);\n await this.host.updateComplete;\n\n this.#updateAnchorSlotAssignment();\n\n if (this.#anchor) {\n this.host.readOnly = true;\n this.host._internals?.states.add('anchor');\n } else {\n this.host._internals?.states.delete('anchor');\n }\n\n if (this.#parentAnchor) {\n this.#parentAnchor.style.textDecoration = 'none';\n this.host.style.cursor = 'pointer';\n }\n\n this.#anchor?.addEventListener('click', e => {\n if (this.host.disabled) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n });\n }\n\n #updateAnchorSlotAssignment() {\n if (this.#anchor && this.#anchorSlot) {\n this.#anchor.slot = 'anchor';\n this.#defaultSlot?.assignedNodes().forEach(node => removeEmptyTextNode(node));\n }\n }\n}\n"],"mappings":";;;AAWA,SAAgB,IAA+C;CAC7D,QAAQ,MAAkC,EAAO,gBAAiB,MAAgB,IAAI,EAAqB,CAAQ,CAAC;AACtH;AAQA,IAAa,IAAb,MAAkF;CAChF,IAAI,KAAU;EACZ,OAAO,KAAK,KAAiB,KAAK,KAAiB,KAAK;CAC1D;CAEA,IAAI,KAAiB;EAEnB,OAAO,KAAK,KACT,WAAY,cAA+B,yBAAyB,CAAC,EACpE,iBAAiB,CAAC,EAClB,MAAK,MAAK,GAAG,YAAY,GAAG;CAClC;CAEA,IAAI,KAAgB;EAClB,OAAO,KAAK,KAAK,eAAe,YAAY,MAAO,KAAK,KAAK,gBAAsC;CACrG;CAEA,IAAI,KAAe;EACjB,OAAO,KAAK,KAAK,WAAY,cAA+B,kBAAkB;CAChF;CAEA,IAAI,KAAc;EAChB,OAAO,KAAK,KAAK,WAAY,cAA+B,mBAAmB;CACjF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,MAAM,gBAAgB;EAkBpB,AAjBA,EAAgB,KAAK,IAAI,GACzB,MAAM,KAAK,KAAK,gBAEhB,KAAK,GAA4B,GAE7B,KAAK,MACP,KAAK,KAAK,WAAW,IACrB,KAAK,KAAK,YAAY,OAAO,IAAI,QAAQ,KAEzC,KAAK,KAAK,YAAY,OAAO,OAAO,QAAQ,GAG1C,KAAK,OACP,KAAK,GAAc,MAAM,iBAAiB,QAC1C,KAAK,KAAK,MAAM,SAAS,YAG3B,KAAK,IAAS,iBAAiB,UAAS,MAAK;GAC3C,AAAI,KAAK,KAAK,aACZ,EAAE,eAAe,GACjB,EAAE,yBAAyB;EAE/B,CAAC;CACH;CAEA,KAA8B;EAC5B,AAAI,KAAK,MAAW,KAAK,OACvB,KAAK,GAAQ,OAAO,UACpB,KAAK,IAAc,cAAc,CAAC,CAAC,SAAQ,MAAQ,EAAoB,CAAI,CAAC;CAEhF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-closable.controller.js","names":["#dispatchEvent"],"sources":["../../../src/internal/controllers/type-closable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeClosable = ReactiveElement & { closable: boolean };\n\n/**\n * Controller for enabling closable behavior for elements.\n */\nexport class TypeClosableController<T extends TypeClosable> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', () => {\n this.host.hidden = true;\n this.#dispatchEvent();\n });\n }\n\n close() {\n if (this.host.closable) {\n this.#dispatchEvent();\n }\n }\n\n #dispatchEvent() {\n this.host.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));\n }\n}\n"],"mappings":";;AAWA,IAAa,IAAb,MAA0F;CACxF,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,iBAAiB;GAE1C,AADA,KAAK,KAAK,SAAS,IACnB,KAAKA,GAAe;EACtB,CAAC;CACH;CAEA,QAAQ;EACN,AAAI,KAAK,KAAK,YACZ,KAAKA,GAAe;CAExB;CAEA,KAAiB;EACf,KAAK,KAAK,cAAc,IAAI,YAAY,SAAS;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACrF;AACF"}
1
+ {"version":3,"file":"type-closable.controller.js","names":[],"sources":["../../../src/internal/controllers/type-closable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeClosable = ReactiveElement & { closable: boolean };\n\n/**\n * Controller for enabling closable behavior for elements.\n */\nexport class TypeClosableController<T extends TypeClosable> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', () => {\n this.host.hidden = true;\n this.#dispatchEvent();\n });\n }\n\n close() {\n if (this.host.closable) {\n this.#dispatchEvent();\n }\n }\n\n #dispatchEvent() {\n this.host.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));\n }\n}\n"],"mappings":";;AAWA,IAAa,IAAb,MAA0F;CACxF,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,iBAAiB;GAE1C,AADA,KAAK,KAAK,SAAS,IACnB,KAAK,GAAe;EACtB,CAAC;CACH;CAEA,QAAQ;EACN,AAAI,KAAK,KAAK,YACZ,KAAK,GAAe;CAExB;CAEA,KAAiB;EACf,KAAK,KAAK,cAAc,IAAI,YAAY,SAAS;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACrF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-expandable.controller.js","names":["#useHidden","#commandTriggered"],"sources":["../../../src/internal/controllers/type-expandable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeExpandable = ReactiveElement & {\n expanded?: boolean;\n behaviorExpand?: boolean;\n expandable?: boolean;\n _internals?: ElementInternals;\n};\n\n/**\n * Controller for enabling expandable behavior for elements.\n * @event open - Dispatched when the expandable element opens.\n * @event close - Dispatched when the expandable element closes.\n * @property expanded - expanded state\n * @property behaviorExpand - determines if stateful auto behavior should enable\n */\nexport class TypeExpandableController<T extends TypeExpandable> implements ReactiveController {\n #commandTriggered = false;\n #useHidden = false;\n\n constructor(\n private host: T,\n config: { useHidden?: boolean } = {}\n ) {\n this.#useHidden = config.useHidden ?? false;\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', ((e: CommandEvent) => {\n this.#commandTriggered = true;\n if (e.command === '--toggle') {\n this.toggle();\n }\n\n if (e.command === '--open') {\n this.open();\n }\n\n if (e.command === '--close') {\n this.close();\n }\n this.#commandTriggered = false;\n }) as EventListener);\n }\n\n hostUpdated() {\n this.host.expandable\n ? this.host._internals!.states.add('expandable')\n : this.host._internals!.states.delete('expandable');\n }\n\n open() {\n if (this.host.behaviorExpand || this.#commandTriggered) {\n this.host.expanded = true;\n\n if (this.#useHidden) {\n this.host.hidden = false;\n }\n }\n\n this.host.dispatchEvent(new CustomEvent('open', { bubbles: true, composed: true }));\n }\n\n close() {\n if (this.host.behaviorExpand || this.#commandTriggered) {\n this.host.expanded = false;\n\n if (this.#useHidden) {\n this.host.hidden = true;\n }\n }\n\n this.host.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));\n }\n\n toggle() {\n if (this.host.expanded || (this.#useHidden && !this.host.hidden)) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n"],"mappings":";;AAoBA,IAAa,IAAb,MAA8F;CAC5F,KAAoB;CACpB,KAAa;CAEb,YACE,GACA,IAAkC,CAAC,GACnC;EAEA,AAJQ,KAAA,OAAA,GAGR,KAAKA,KAAa,EAAO,aAAa,IACtC,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,aAAa,MAAoB;GAa1D,AAZA,KAAKC,KAAoB,IACrB,EAAE,YAAY,cAChB,KAAK,OAAO,GAGV,EAAE,YAAY,YAChB,KAAK,KAAK,GAGR,EAAE,YAAY,aAChB,KAAK,MAAM,GAEb,KAAKA,KAAoB;EAC3B,EAAmB;CACrB;CAEA,cAAc;EACZ,KAAK,KAAK,aACN,KAAK,KAAK,WAAY,OAAO,IAAI,YAAY,IAC7C,KAAK,KAAK,WAAY,OAAO,OAAO,YAAY;CACtD;CAEA,OAAO;EASL,CARI,KAAK,KAAK,kBAAkB,KAAKA,QACnC,KAAK,KAAK,WAAW,IAEjB,KAAKD,OACP,KAAK,KAAK,SAAS,MAIvB,KAAK,KAAK,cAAc,IAAI,YAAY,QAAQ;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACpF;CAEA,QAAQ;EASN,CARI,KAAK,KAAK,kBAAkB,KAAKC,QACnC,KAAK,KAAK,WAAW,IAEjB,KAAKD,OACP,KAAK,KAAK,SAAS,MAIvB,KAAK,KAAK,cAAc,IAAI,YAAY,SAAS;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACrF;CAEA,SAAS;EACP,AAAI,KAAK,KAAK,YAAa,KAAKA,MAAc,CAAC,KAAK,KAAK,SACvD,KAAK,MAAM,IAEX,KAAK,KAAK;CAEd;AACF"}
1
+ {"version":3,"file":"type-expandable.controller.js","names":[],"sources":["../../../src/internal/controllers/type-expandable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeExpandable = ReactiveElement & {\n expanded?: boolean;\n behaviorExpand?: boolean;\n expandable?: boolean;\n _internals?: ElementInternals;\n};\n\n/**\n * Controller for enabling expandable behavior for elements.\n * @event open - Dispatched when the expandable element opens.\n * @event close - Dispatched when the expandable element closes.\n * @property expanded - expanded state\n * @property behaviorExpand - determines if stateful auto behavior should enable\n */\nexport class TypeExpandableController<T extends TypeExpandable> implements ReactiveController {\n #commandTriggered = false;\n #useHidden = false;\n\n constructor(\n private host: T,\n config: { useHidden?: boolean } = {}\n ) {\n this.#useHidden = config.useHidden ?? false;\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', ((e: CommandEvent) => {\n this.#commandTriggered = true;\n if (e.command === '--toggle') {\n this.toggle();\n }\n\n if (e.command === '--open') {\n this.open();\n }\n\n if (e.command === '--close') {\n this.close();\n }\n this.#commandTriggered = false;\n }) as EventListener);\n }\n\n hostUpdated() {\n this.host.expandable\n ? this.host._internals!.states.add('expandable')\n : this.host._internals!.states.delete('expandable');\n }\n\n open() {\n if (this.host.behaviorExpand || this.#commandTriggered) {\n this.host.expanded = true;\n\n if (this.#useHidden) {\n this.host.hidden = false;\n }\n }\n\n this.host.dispatchEvent(new CustomEvent('open', { bubbles: true, composed: true }));\n }\n\n close() {\n if (this.host.behaviorExpand || this.#commandTriggered) {\n this.host.expanded = false;\n\n if (this.#useHidden) {\n this.host.hidden = true;\n }\n }\n\n this.host.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));\n }\n\n toggle() {\n if (this.host.expanded || (this.#useHidden && !this.host.hidden)) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n"],"mappings":";;AAoBA,IAAa,IAAb,MAA8F;CAC5F,KAAoB;CACpB,KAAa;CAEb,YACE,GACA,IAAkC,CAAC,GACnC;EAEA,AAJQ,KAAA,OAAA,GAGR,KAAK,KAAa,EAAO,aAAa,IACtC,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,aAAa,MAAoB;GAa1D,AAZA,KAAK,KAAoB,IACrB,EAAE,YAAY,cAChB,KAAK,OAAO,GAGV,EAAE,YAAY,YAChB,KAAK,KAAK,GAGR,EAAE,YAAY,aAChB,KAAK,MAAM,GAEb,KAAK,KAAoB;EAC3B,EAAmB;CACrB;CAEA,cAAc;EACZ,KAAK,KAAK,aACN,KAAK,KAAK,WAAY,OAAO,IAAI,YAAY,IAC7C,KAAK,KAAK,WAAY,OAAO,OAAO,YAAY;CACtD;CAEA,OAAO;EASL,CARI,KAAK,KAAK,kBAAkB,KAAK,QACnC,KAAK,KAAK,WAAW,IAEjB,KAAK,OACP,KAAK,KAAK,SAAS,MAIvB,KAAK,KAAK,cAAc,IAAI,YAAY,QAAQ;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACpF;CAEA,QAAQ;EASN,CARI,KAAK,KAAK,kBAAkB,KAAK,QACnC,KAAK,KAAK,WAAW,IAEjB,KAAK,OACP,KAAK,KAAK,SAAS,MAIvB,KAAK,KAAK,cAAc,IAAI,YAAY,SAAS;GAAE,SAAS;GAAM,UAAU;EAAK,CAAC,CAAC;CACrF;CAEA,SAAS;EACP,AAAI,KAAK,KAAK,YAAa,KAAK,MAAc,CAAC,KAAK,KAAK,SACvD,KAAK,MAAM,IAEX,KAAK,KAAK;CAEd;AACF"}
@@ -1 +1 @@
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,KAAK,KAAK,MAAM,EAAU,UAAsB,CAAC;GAC/D;EACF;CACF;CAEA,MAAM,gBAAgB;EACpB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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"}
1
+ {"version":3,"file":"type-native-popover.controller.js","names":[],"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,IAAI,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,K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K,GAAsB,IAGzB,EAAE,YAAY,kBAChB,KAAK,KAAK,YAAY,EAAE,QAAQ,EAAE,OAAsB,CAAC;CAE7D;CAEA,MAAe,MAAqB;EAElC,IADwB,EAAE,QAAQ,UAAU,SAAS,GAAG,GACnC;GACnB,IAAM,IAAqB,KAAK,KAAK,aAAa,KAAK,GAAoB;GAC3E,AAAI,IACF,KAAK,KAAmB,iBAAiB;IACvC,AAAI,KAAK,KAAK,eACZ,KAAK,KAAK,YAAY,EAAE,QAAQ,EAAE,OAAsB,CAAC;GAE7D,GAAG,CAAkB,IAErB,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,KAAK,GAAsB;CAC7B;CAEA,MAAkB,MAAoB;EACpC,AAAI,KAAK,KAAK,SAAS,KAAK,KAAK,QAAQ,eAAe,MACtD,KAAK,KAA0B,EAA0B,GAAG,KAAK,IAAI;CAEzE;CAEA,MAAgB,MAAoB;EAClC,AACE,KAAK,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"}
@@ -10,8 +10,8 @@ function i(r) {
10
10
  if (typeof i == "string" && i?.length) {
11
11
  let a = n(r.parentNode).find((e) => e.id === i);
12
12
  return a || t.warn(e(i)), a ?? globalThis.document.body;
13
- } else if (i && i !== globalThis.document.body) return i;
14
- else return globalThis.document.body;
13
+ }
14
+ return i && i !== globalThis.document.body ? i : globalThis.document.body;
15
15
  }
16
16
  function a(e) {
17
17
  return !!n(e).filter((e) => e.popover && e.matches(":popover-open")).length;
@@ -1 +1 @@
1
- {"version":3,"file":"type-native-popover.utils.js","names":[],"sources":["../../../src/internal/controllers/type-native-popover.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LogService } from '../services/log.service.js';\nimport { getIdMatchNotFoundWarning } from '../utils/audit-logs.js';\nimport { generateId, getFlattenedDOMTree, getAnchorNames, appendAnchorName } from '../utils/dom.js';\n\nexport function associateAnchor(host: HTMLElement, anchor: HTMLElement) {\n const anchorNames = getAnchorNames(anchor);\n let anchorId = anchorNames.find(name => name.startsWith('--_'));\n if (!anchorId) {\n anchorId = `--${anchor.id && !anchor.id.includes(':') ? `_${anchor.id}` : generateId()}`;\n appendAnchorName(anchor, anchorId);\n }\n host.style.positionAnchor = anchorId;\n}\n\nexport function getHostTrigger(element: HTMLElement, trigger: HTMLElement | string) {\n if (typeof trigger === 'string') {\n return (\n (getFlattenedDOMTree(element.parentNode as HTMLElement)\n .filter(el => el?.id !== '')\n .find(el => el.id === trigger) as HTMLButtonElement) ?? globalThis.document.body\n );\n } else {\n return trigger as HTMLButtonElement;\n }\n}\n\nexport function getHostAnchor(host: HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement }) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor?.length) {\n const match = getFlattenedDOMTree(host.parentNode as HTMLElement).find(el => el.id === anchor);\n\n if (!match) {\n LogService.warn(getIdMatchNotFoundWarning(anchor));\n }\n\n return match ?? globalThis.document.body;\n } else if (anchor && anchor !== globalThis.document.body) {\n return anchor as HTMLElement;\n } else {\n return globalThis.document.body;\n }\n}\n\nexport function hasOpenPopover(host: HTMLElement) {\n return !!getFlattenedDOMTree(host).filter(e => e.popover && e.matches(':popover-open')).length;\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAe,GAAsB,GAA+B;CAQhF,OAPE,OAAO,KAAY,WAElB,EAAoB,EAAQ,UAAyB,CAAC,CACpD,QAAO,MAAM,GAAI,OAAO,EAAE,CAAC,CAC3B,MAAK,MAAM,EAAG,OAAO,CAAO,KAA2B,WAAW,SAAS,OAGzE;AAEX;AAEA,SAAgB,EAAc,GAAqF;CACjH,IAAM,IAAS,EAAK,UAAU,EAAK;CAEnC,IAAI,OAAO,KAAW,YAAY,GAAQ,QAAQ;EAChD,IAAM,IAAQ,EAAoB,EAAK,UAAyB,CAAC,CAAC,MAAK,MAAM,EAAG,OAAO,CAAM;EAM7F,OAJK,KACH,EAAW,KAAK,EAA0B,CAAM,CAAC,GAG5C,KAAS,WAAW,SAAS;CACtC,OAAO,IAAI,KAAU,MAAW,WAAW,SAAS,MAClD,OAAO;MAEP,OAAO,WAAW,SAAS;AAE/B;AAEA,SAAgB,EAAe,GAAmB;CAChD,OAAO,CAAC,CAAC,EAAoB,CAAI,CAAC,CAAC,QAAO,MAAK,EAAE,WAAW,EAAE,QAAQ,eAAe,CAAC,CAAC,CAAC;AAC1F"}
1
+ {"version":3,"file":"type-native-popover.utils.js","names":[],"sources":["../../../src/internal/controllers/type-native-popover.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LogService } from '../services/log.service.js';\nimport { getIdMatchNotFoundWarning } from '../utils/audit-logs.js';\nimport { generateId, getFlattenedDOMTree, getAnchorNames, appendAnchorName } from '../utils/dom.js';\n\nexport function associateAnchor(host: HTMLElement, anchor: HTMLElement) {\n const anchorNames = getAnchorNames(anchor);\n let anchorId = anchorNames.find(name => name.startsWith('--_'));\n if (!anchorId) {\n anchorId = `--${anchor.id && !anchor.id.includes(':') ? `_${anchor.id}` : generateId()}`;\n appendAnchorName(anchor, anchorId);\n }\n host.style.positionAnchor = anchorId;\n}\n\nexport function getHostTrigger(element: HTMLElement, trigger: HTMLElement | string) {\n if (typeof trigger === 'string') {\n return (\n (getFlattenedDOMTree(element.parentNode as HTMLElement)\n .filter(el => el?.id !== '')\n .find(el => el.id === trigger) as HTMLButtonElement) ?? globalThis.document.body\n );\n } else {\n return trigger as HTMLButtonElement;\n }\n}\n\nexport function getHostAnchor(host: HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement }) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor?.length) {\n const match = getFlattenedDOMTree(host.parentNode as HTMLElement).find(el => el.id === anchor);\n\n if (!match) {\n LogService.warn(getIdMatchNotFoundWarning(anchor));\n }\n\n return match ?? globalThis.document.body;\n } else if (anchor && anchor !== globalThis.document.body) {\n return anchor as HTMLElement;\n } else {\n return globalThis.document.body;\n }\n}\n\nexport function hasOpenPopover(host: HTMLElement) {\n return !!getFlattenedDOMTree(host).filter(e => e.popover && e.matches(':popover-open')).length;\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAe,GAAsB,GAA+B;CAQhF,OAPE,OAAO,KAAY,WAElB,EAAoB,EAAQ,UAAyB,CAAC,CACpD,QAAO,MAAM,GAAI,OAAO,EAAE,CAAC,CAC3B,MAAK,MAAM,EAAG,OAAO,CAAO,KAA2B,WAAW,SAAS,OAGzE;AAEX;AAEA,SAAgB,EAAc,GAAqF;CACjH,IAAM,IAAS,EAAK,UAAU,EAAK;CAEnC,IAAI,OAAO,KAAW,YAAY,GAAQ,QAAQ;EAChD,IAAM,IAAQ,EAAoB,EAAK,UAAyB,CAAC,CAAC,MAAK,MAAM,EAAG,OAAO,CAAM;EAM7F,OAJK,KACH,EAAW,KAAK,EAA0B,CAAM,CAAC,GAG5C,KAAS,WAAW,SAAS;CACtC;CAGE,OAHS,KAAU,MAAW,WAAW,SAAS,OAC3C,IAEA,WAAW,SAAS;AAE/B;AAEA,SAAgB,EAAe,GAAmB;CAChD,OAAO,CAAC,CAAC,EAAoB,CAAI,CAAC,CAAC,QAAO,MAAK,EAAE,WAAW,EAAE,QAAQ,eAAe,CAAC,CAAC,CAAC;AAC1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-selectable.controller.js","names":["#commandTriggered"],"sources":["../../../src/internal/controllers/type-selectable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeSelectable = ReactiveElement & {\n selected?: boolean;\n behaviorSelect?: boolean;\n selectable?: 'single' | 'multi';\n _internals?: ElementInternals;\n};\n\n/**\n * Controller for enabling selectable behavior for elements.\n * @event select - Dispatched when the selectable element selects.\n * @property selected - selected state\n * @property behaviorSelect - determines if stateful auto behavior should enable\n */\nexport class TypeSelectableController<T extends TypeSelectable> implements ReactiveController {\n #commandTriggered = false;\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', ((e: CommandEvent) => {\n this.#commandTriggered = true;\n if (e.command === '--toggle-select') {\n this.toggle();\n }\n\n if (e.command === '--select') {\n this.select();\n }\n\n if (e.command === '--deselect') {\n this.host.selected = false;\n }\n this.#commandTriggered = false;\n }) as EventListener);\n }\n\n hostUpdated() {\n this.host.selectable === 'single'\n ? this.host._internals!.states.add('selectable-single')\n : this.host._internals!.states.delete('selectable-single');\n this.host.selectable === 'multi'\n ? this.host._internals!.states.add('selectable-multi')\n : this.host._internals!.states.delete('selectable-multi');\n }\n\n select() {\n if (this.host.behaviorSelect || this.#commandTriggered) {\n this.host.selected = true;\n }\n\n this.host.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true, detail: this.host }));\n }\n\n deselect() {\n if (this.host.behaviorSelect || this.#commandTriggered) {\n this.host.selected = false;\n }\n\n this.host.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true, detail: this.host }));\n }\n\n toggle() {\n if (this.host.selected) {\n this.deselect();\n } else {\n this.select();\n }\n }\n}\n"],"mappings":";;AAmBA,IAAa,IAAb,MAA8F;CAC5F,KAAoB;CACpB,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,aAAa,MAAoB;GAa1D,AAZA,KAAKA,KAAoB,IACrB,EAAE,YAAY,qBAChB,KAAK,OAAO,GAGV,EAAE,YAAY,cAChB,KAAK,OAAO,GAGV,EAAE,YAAY,iBAChB,KAAK,KAAK,WAAW,KAEvB,KAAKA,KAAoB;EAC3B,EAAmB;CACrB;CAEA,cAAc;EAIZ,AAHA,KAAK,KAAK,eAAe,WACrB,KAAK,KAAK,WAAY,OAAO,IAAI,mBAAmB,IACpD,KAAK,KAAK,WAAY,OAAO,OAAO,mBAAmB,GAC3D,KAAK,KAAK,eAAe,UACrB,KAAK,KAAK,WAAY,OAAO,IAAI,kBAAkB,IACnD,KAAK,KAAK,WAAY,OAAO,OAAO,kBAAkB;CAC5D;CAEA,SAAS;EAKP,CAJI,KAAK,KAAK,kBAAkB,KAAKA,QACnC,KAAK,KAAK,WAAW,KAGvB,KAAK,KAAK,cAAc,IAAI,YAAY,UAAU;GAAE,SAAS;GAAM,UAAU;GAAM,QAAQ,KAAK;EAAK,CAAC,CAAC;CACzG;CAEA,WAAW;EAKT,CAJI,KAAK,KAAK,kBAAkB,KAAKA,QACnC,KAAK,KAAK,WAAW,KAGvB,KAAK,KAAK,cAAc,IAAI,YAAY,UAAU;GAAE,SAAS;GAAM,UAAU;GAAM,QAAQ,KAAK;EAAK,CAAC,CAAC;CACzG;CAEA,SAAS;EACP,AAAI,KAAK,KAAK,WACZ,KAAK,SAAS,IAEd,KAAK,OAAO;CAEhB;AACF"}
1
+ {"version":3,"file":"type-selectable.controller.js","names":[],"sources":["../../../src/internal/controllers/type-selectable.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 { attachInternals } from '../utils/a11y.js';\n\nexport type TypeSelectable = ReactiveElement & {\n selected?: boolean;\n behaviorSelect?: boolean;\n selectable?: 'single' | 'multi';\n _internals?: ElementInternals;\n};\n\n/**\n * Controller for enabling selectable behavior for elements.\n * @event select - Dispatched when the selectable element selects.\n * @property selected - selected state\n * @property behaviorSelect - determines if stateful auto behavior should enable\n */\nexport class TypeSelectableController<T extends TypeSelectable> implements ReactiveController {\n #commandTriggered = false;\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n\n this.host.addEventListener('command', ((e: CommandEvent) => {\n this.#commandTriggered = true;\n if (e.command === '--toggle-select') {\n this.toggle();\n }\n\n if (e.command === '--select') {\n this.select();\n }\n\n if (e.command === '--deselect') {\n this.host.selected = false;\n }\n this.#commandTriggered = false;\n }) as EventListener);\n }\n\n hostUpdated() {\n this.host.selectable === 'single'\n ? this.host._internals!.states.add('selectable-single')\n : this.host._internals!.states.delete('selectable-single');\n this.host.selectable === 'multi'\n ? this.host._internals!.states.add('selectable-multi')\n : this.host._internals!.states.delete('selectable-multi');\n }\n\n select() {\n if (this.host.behaviorSelect || this.#commandTriggered) {\n this.host.selected = true;\n }\n\n this.host.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true, detail: this.host }));\n }\n\n deselect() {\n if (this.host.behaviorSelect || this.#commandTriggered) {\n this.host.selected = false;\n }\n\n this.host.dispatchEvent(new CustomEvent('select', { bubbles: true, composed: true, detail: this.host }));\n }\n\n toggle() {\n if (this.host.selected) {\n this.deselect();\n } else {\n this.select();\n }\n }\n}\n"],"mappings":";;AAmBA,IAAa,IAAb,MAA8F;CAC5F,KAAoB;CACpB,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAGd,AAFA,EAAgB,KAAK,IAAI,GAEzB,KAAK,KAAK,iBAAiB,aAAa,MAAoB;GAa1D,AAZA,KAAK,KAAoB,IACrB,EAAE,YAAY,qBAChB,KAAK,OAAO,GAGV,EAAE,YAAY,cAChB,KAAK,OAAO,GAGV,EAAE,YAAY,iBAChB,KAAK,KAAK,WAAW,KAEvB,KAAK,KAAoB;EAC3B,EAAmB;CACrB;CAEA,cAAc;EAIZ,AAHA,KAAK,KAAK,eAAe,WACrB,KAAK,KAAK,WAAY,OAAO,IAAI,mBAAmB,IACpD,KAAK,KAAK,WAAY,OAAO,OAAO,mBAAmB,GAC3D,KAAK,KAAK,eAAe,UACrB,KAAK,KAAK,WAAY,OAAO,IAAI,kBAAkB,IACnD,KAAK,KAAK,WAAY,OAAO,OAAO,kBAAkB;CAC5D;CAEA,SAAS;EAKP,CAJI,KAAK,KAAK,kBAAkB,KAAK,QACnC,KAAK,KAAK,WAAW,KAGvB,KAAK,KAAK,cAAc,IAAI,YAAY,UAAU;GAAE,SAAS;GAAM,UAAU;GAAM,QAAQ,KAAK;EAAK,CAAC,CAAC;CACzG;CAEA,WAAW;EAKT,CAJI,KAAK,KAAK,kBAAkB,KAAK,QACnC,KAAK,KAAK,WAAW,KAGvB,KAAK,KAAK,cAAc,IAAI,YAAY,UAAU;GAAE,SAAS;GAAM,UAAU;GAAM,QAAQ,KAAK;EAAK,CAAC,CAAC;CACzG;CAEA,SAAS;EACP,AAAI,KAAK,KAAK,WACZ,KAAK,SAAS,IAEd,KAAK,OAAO;CAEhB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-ssr.controller.js","names":["#firstUpdate"],"sources":["../../../src/internal/controllers/type-ssr.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, RenderOptions, TemplateResult } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { render } from 'lit';\nimport { LogService } from '../services/log.service.js';\nimport { getSSRMismatchWarning } from '../utils/audit-logs.js';\nimport { getEnv } from '../services/global.utils.js';\n\ntype UnprotectedLitElement = ReactiveElement & {\n update: () => void;\n render: () => TemplateResult;\n renderOptions: RenderOptions;\n _internals?: ElementInternals;\n};\n\n/**\n * Catch and manage hydration related fallbacks for SSR\n */\nexport function typeSSR<T extends UnprotectedLitElement>(options: { log?: boolean } = { log: true }): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!(\n (instance: T & { _internals: ElementInternals }) => new TypeSSRController(instance, options)\n );\n}\n\nexport class TypeSSRController<T extends ReactiveElement> implements ReactiveController {\n // https://www.konnorrogers.com/posts/2024/running-lit-ssr-in-web-awesome#hydration-errors\n didSSR = Boolean(this.host.shadowRoot);\n\n constructor(\n private host: T & UnprotectedLitElement,\n private options: { log?: boolean }\n ) {\n this.host.addController(this);\n\n // https://github.com/lit/lit/issues/1434#issuecomment-1598332000\n if (this.didSSR) {\n const controllerOptions = this.options;\n const updateOriginal = host.update;\n Object.defineProperty(host, 'update', {\n value: function () {\n try {\n updateOriginal.call(host);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n const renderRoot = host.renderRoot as HTMLElement;\n renderRoot.innerHTML = renderRoot.innerHTML.split('<!--lit-part ')[0]!;\n render(host.render(), renderRoot, host.renderOptions);\n\n if (getEnv() !== 'production' && controllerOptions.log) {\n LogService.warn(getSSRMismatchWarning(host.localName));\n }\n }\n return updateOriginal;\n }\n });\n }\n }\n\n #firstUpdate = true;\n hostUpdated() {\n // https://github.com/lit/lit/discussions/4697\n // https://github.com/w3c/csswg-drafts/issues/6867#issuecomment-1599444407\n if (this.didSSR && this.#firstUpdate) {\n this.#firstUpdate = false;\n this.host.shadowRoot?.querySelectorAll('slot').forEach(slotElement => {\n slotElement.dispatchEvent(new Event('slotchange', { bubbles: true, composed: false, cancelable: false }));\n });\n\n // if SSR reflect role attribute to host\n if (this.host._internals?.role) {\n this.host.setAttribute('role', this.host._internals.role);\n }\n }\n }\n}\n"],"mappings":";;;;;AAoBA,SAAgB,EAAyC,IAA6B,EAAE,KAAK,GAAK,GAAmB;CACnH,QAAQ,MACN,EAAO,gBACJ,MAAmD,IAAI,EAAkB,GAAU,CAAO,CAC7F;AACJ;AAEA,IAAa,IAAb,MAAwF;CAItF,YACE,GACA,GACA;EAIA,IANQ,KAAA,OAAA,GACA,KAAA,UAAA,iBAJD,EAAQ,KAAK,KAAK,sBAgCZ,IA1Bb,KAAK,KAAK,cAAc,IAAI,GAGxB,KAAK,QAAQ;GACf,IAAM,IAAoB,KAAK,SACzB,IAAiB,EAAK;GAC5B,OAAO,eAAe,GAAM,UAAU,EACpC,OAAO,WAAY;IACjB,IAAI;KACF,EAAe,KAAK,CAAI;IAE1B,QAAY;KACV,IAAM,IAAa,EAAK;KAIxB,AAHA,EAAW,YAAY,EAAW,UAAU,MAAM,eAAe,CAAC,CAAC,IACnE,EAAO,EAAK,OAAO,GAAG,GAAY,EAAK,aAAa,GAEhD,EAAO,MAAM,gBAAgB,EAAkB,OACjD,EAAW,KAAK,EAAsB,EAAK,SAAS,CAAC;IAEzD;IACA,OAAO;GACT,EACF,CAAC;EACH;CACF;CAEA;CACA,cAAc;EAGZ,AAAI,KAAK,UAAU,KAAKA,OACtB,KAAKA,KAAe,IACpB,KAAK,KAAK,YAAY,iBAAiB,MAAM,CAAC,CAAC,SAAQ,MAAe;GACpE,EAAY,cAAc,IAAI,MAAM,cAAc;IAAE,SAAS;IAAM,UAAU;IAAO,YAAY;GAAM,CAAC,CAAC;EAC1G,CAAC,GAGG,KAAK,KAAK,YAAY,QACxB,KAAK,KAAK,aAAa,QAAQ,KAAK,KAAK,WAAW,IAAI;CAG9D;AACF"}
1
+ {"version":3,"file":"type-ssr.controller.js","names":[],"sources":["../../../src/internal/controllers/type-ssr.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, RenderOptions, TemplateResult } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { render } from 'lit';\nimport { LogService } from '../services/log.service.js';\nimport { getSSRMismatchWarning } from '../utils/audit-logs.js';\nimport { getEnv } from '../services/global.utils.js';\n\ntype UnprotectedLitElement = ReactiveElement & {\n update: () => void;\n render: () => TemplateResult;\n renderOptions: RenderOptions;\n _internals?: ElementInternals;\n};\n\n/**\n * Catch and manage hydration related fallbacks for SSR\n */\nexport function typeSSR<T extends UnprotectedLitElement>(options: { log?: boolean } = { log: true }): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!(\n (instance: T & { _internals: ElementInternals }) => new TypeSSRController(instance, options)\n );\n}\n\nexport class TypeSSRController<T extends ReactiveElement> implements ReactiveController {\n // https://www.konnorrogers.com/posts/2024/running-lit-ssr-in-web-awesome#hydration-errors\n didSSR = Boolean(this.host.shadowRoot);\n\n constructor(\n private host: T & UnprotectedLitElement,\n private options: { log?: boolean }\n ) {\n this.host.addController(this);\n\n // https://github.com/lit/lit/issues/1434#issuecomment-1598332000\n if (this.didSSR) {\n const controllerOptions = this.options;\n const updateOriginal = host.update;\n Object.defineProperty(host, 'update', {\n value: function () {\n try {\n updateOriginal.call(host);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n const renderRoot = host.renderRoot as HTMLElement;\n renderRoot.innerHTML = renderRoot.innerHTML.split('<!--lit-part ')[0]!;\n render(host.render(), renderRoot, host.renderOptions);\n\n if (getEnv() !== 'production' && controllerOptions.log) {\n LogService.warn(getSSRMismatchWarning(host.localName));\n }\n }\n return updateOriginal;\n }\n });\n }\n }\n\n #firstUpdate = true;\n hostUpdated() {\n // https://github.com/lit/lit/discussions/4697\n // https://github.com/w3c/csswg-drafts/issues/6867#issuecomment-1599444407\n if (this.didSSR && this.#firstUpdate) {\n this.#firstUpdate = false;\n this.host.shadowRoot?.querySelectorAll('slot').forEach(slotElement => {\n slotElement.dispatchEvent(new Event('slotchange', { bubbles: true, composed: false, cancelable: false }));\n });\n\n // if SSR reflect role attribute to host\n if (this.host._internals?.role) {\n this.host.setAttribute('role', this.host._internals.role);\n }\n }\n }\n}\n"],"mappings":";;;;;AAoBA,SAAgB,EAAyC,IAA6B,EAAE,KAAK,GAAK,GAAmB;CACnH,QAAQ,MACN,EAAO,gBACJ,MAAmD,IAAI,EAAkB,GAAU,CAAO,CAC7F;AACJ;AAEA,IAAa,IAAb,MAAwF;CAItF,YACE,GACA,GACA;EAIA,IANQ,KAAA,OAAA,GACA,KAAA,UAAA,GAJD,KAAA,SAAA,EAAQ,KAAK,KAAK,YAgCZ,KAAA,KAAA,IA1Bb,KAAK,KAAK,cAAc,IAAI,GAGxB,KAAK,QAAQ;GACf,IAAM,IAAoB,KAAK,SACzB,IAAiB,EAAK;GAC5B,OAAO,eAAe,GAAM,UAAU,EACpC,OAAO,WAAY;IACjB,IAAI;KACF,EAAe,KAAK,CAAI;IAE1B,QAAY;KACV,IAAM,IAAa,EAAK;KAIxB,AAHA,EAAW,YAAY,EAAW,UAAU,MAAM,eAAe,CAAC,CAAC,IACnE,EAAO,EAAK,OAAO,GAAG,GAAY,EAAK,aAAa,GAEhD,EAAO,MAAM,gBAAgB,EAAkB,OACjD,EAAW,KAAK,EAAsB,EAAK,SAAS,CAAC;IAEzD;IACA,OAAO;GACT,EACF,CAAC;EACH;CACF;CAEA;CACA,cAAc;EAGZ,AAAI,KAAK,UAAU,KAAK,OACtB,KAAK,KAAe,IACpB,KAAK,KAAK,YAAY,iBAAiB,MAAM,CAAC,CAAC,SAAQ,MAAe;GACpE,EAAY,cAAc,IAAI,MAAM,cAAc;IAAE,SAAS;IAAM,UAAU;IAAO,YAAY;GAAM,CAAC,CAAC;EAC1G,CAAC,GAGG,KAAK,KAAK,YAAY,QACxB,KAAK,KAAK,aAAa,QAAQ,KAAK,KAAK,WAAW,IAAI;CAG9D;AACF"}
@@ -19,7 +19,7 @@ var a = class {
19
19
  i18nRegistry: {},
20
20
  audit: {}
21
21
  }
22
- }, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.7.3"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.7.3"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
22
+ }, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.8.1"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.8.1"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
23
23
  }
24
24
  get state() {
25
25
  return globalThis.NVE_ELEMENTS.state;
@@ -1 +1 @@
1
- {"version":3,"file":"global.utils.js","names":[],"sources":["../../../src/internal/services/global.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\ndeclare global {\n var process: { env?: { NODE_ENV?: string } } | undefined;\n}\n\n/* istanbul ignore next -- @preserve */\nexport function getEnv(): 'development' | 'production' {\n if (\n globalThis.process?.env?.NODE_ENV !== 'production' &&\n (globalThis.location?.hostname === 'localhost' || globalThis.location?.href?.includes('elements-playground'))\n ) {\n return 'development';\n } else {\n return 'production';\n }\n}\n\nexport function getHostDetails(): { moduleHost: string; pageHost: string } {\n const pageHost = globalThis.location?.hostname;\n const moduleHost = new URL(import.meta.url).hostname;\n\n return {\n pageHost,\n moduleHost\n };\n}\n"],"mappings":";;AAQA,SAAgB,IAAuC;CAOnD,OALA,WAAW,SAAS,KAAK,aAAa,iBACrC,WAAW,UAAU,aAAa,eAAe,WAAW,UAAU,MAAM,SAAS,qBAAqB,KAEpG,gBAEA;AAEX;AAEA,SAAgB,IAA2D;CAIzE,OAAO;EACL,UAJe,WAAW,UAAU;EAKpC,YAJiB,IAAI,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;CAK5C;AACF"}
1
+ {"version":3,"file":"global.utils.js","names":[],"sources":["../../../src/internal/services/global.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\ndeclare global {\n var process: { env?: { NODE_ENV?: string } } | undefined;\n}\n\n/* istanbul ignore next -- @preserve */\nexport function getEnv(): 'development' | 'production' {\n if (\n globalThis.process?.env?.NODE_ENV !== 'production' &&\n (globalThis.location?.hostname === 'localhost' || globalThis.location?.href?.includes('elements-playground'))\n ) {\n return 'development';\n } else {\n return 'production';\n }\n}\n\nexport function getHostDetails(): { moduleHost: string; pageHost: string } {\n const pageHost = globalThis.location?.hostname;\n const moduleHost = new URL(import.meta.url).hostname;\n\n return {\n pageHost,\n moduleHost\n };\n}\n"],"mappings":";;AAQA,SAAgB,IAAuC;CAOnD,OALA,WAAW,SAAS,KAAK,aAAa,iBACrC,WAAW,UAAU,aAAa,eAAe,WAAW,UAAU,MAAM,SAAS,qBAAqB,KAEpG,gBAEA;AAEX;AAEA,SAAgB,IAA2D;CAIzE,OAAO;EACL,UAJe,WAAW,UAAU;EAKpC,YAJiB,IAAI,IAAI,YAAY,GAAG,CAAC,CAAC;CAK5C;AACF"}
@@ -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,UAAU,cAAc,IAAI,YAAY,oBAAoB,EAAE,QAAQ;GAAE;GAAM;GAAO;EAAK,EAAE,CAAC,CAAC;CAC3G;AACF"}
1
+ {"version":3,"file":"log.service.js","names":[],"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,KAAK,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,KAAK,GAAU,SAAS,GAAO,GAAG,CAAI;CAE1C;CAEA,OAAO,GAAU,GAAwB,GAAe,GAAG,GAAiB;EAC1E,WAAW,UAAU,cAAc,IAAI,YAAY,oBAAoB,EAAE,QAAQ;GAAE;GAAM;GAAO;EAAK,EAAE,CAAC,CAAC;CAC3G;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"transition.service.js","names":["#hasSpeculationRules","#nveTransition","#observer","#toggleSpeculationRules","#removeSpeculationRules","#appendSpeculationRules"],"sources":["../../../src/internal/services/transition.service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nclass TransitionService_ {\n get #hasSpeculationRules() {\n return globalThis.document.querySelector('[type=speculationrules]');\n }\n\n get #nveTransition() {\n return globalThis.document.documentElement.getAttribute('nve-transition');\n }\n\n #observer: MutationObserver;\n\n enable() {\n if (globalThis.document) {\n this.#observer?.disconnect();\n this.#toggleSpeculationRules();\n this.#observer = new MutationObserver(() => this.#toggleSpeculationRules());\n this.#observer.observe(globalThis.document.documentElement, {\n attributeFilter: ['nve-transition']\n });\n }\n }\n\n disable() {\n this.#removeSpeculationRules();\n this.#observer?.disconnect();\n }\n\n #toggleSpeculationRules() {\n if (globalThis.document && this.#nveTransition === 'auto') {\n if (!this.#hasSpeculationRules) {\n this.#appendSpeculationRules();\n }\n } else {\n this.#removeSpeculationRules();\n }\n }\n\n #appendSpeculationRules() {\n const speculationRules = globalThis.document.createElement('script');\n speculationRules.id = 'nve-speculationrules';\n speculationRules.type = 'speculationrules';\n speculationRules.textContent = JSON.stringify({\n prerender: [\n {\n where: { href_matches: '/*' },\n eagerness: 'moderate'\n }\n ]\n });\n globalThis.document.head.appendChild(speculationRules);\n }\n\n #removeSpeculationRules() {\n globalThis.document?.querySelector('#nve-speculationrules')?.remove();\n }\n}\n\n/**\n * The Transition Service provides setup to enable View Transitions APIs.\n * This includes initializing base speculation rules for smooth transition between navigations.\n *\n * https://developer.chrome.com/docs/web-platform/view-transitions/cross-document\n * https://developer.chrome.com/docs/web-platform/prerender-pages#speculation-rules-api\n */\nexport const TransitionService = new TransitionService_();\n"],"mappings":"AAmEA,IAAa,IAAoB,IAAI,MAhEZ;CACvB,IAAIA,KAAuB;EACzB,OAAO,WAAW,SAAS,cAAc,yBAAyB;CACpE;CAEA,IAAIC,KAAiB;EACnB,OAAO,WAAW,SAAS,gBAAgB,aAAa,gBAAgB;CAC1E;CAEA;CAEA,SAAS;EACP,AAAI,WAAW,aACb,KAAKC,IAAW,WAAW,GAC3B,KAAKC,GAAwB,GAC7B,KAAKD,KAAY,IAAI,uBAAuB,KAAKC,GAAwB,CAAC,GAC1E,KAAKD,GAAU,QAAQ,WAAW,SAAS,iBAAiB,EAC1D,iBAAiB,CAAC,gBAAgB,EACpC,CAAC;CAEL;CAEA,UAAU;EAER,AADA,KAAKE,GAAwB,GAC7B,KAAKF,IAAW,WAAW;CAC7B;CAEA,KAA0B;EACxB,AAAI,WAAW,YAAY,KAAKD,OAAmB,SAC5C,KAAKD,MACR,KAAKK,GAAwB,IAG/B,KAAKD,GAAwB;CAEjC;CAEA,KAA0B;EACxB,IAAM,IAAmB,WAAW,SAAS,cAAc,QAAQ;EAWnE,AAVA,EAAiB,KAAK,wBACtB,EAAiB,OAAO,oBACxB,EAAiB,cAAc,KAAK,UAAU,EAC5C,WAAW,CACT;GACE,OAAO,EAAE,cAAc,KAAK;GAC5B,WAAW;EACb,CACF,EACF,CAAC,GACD,WAAW,SAAS,KAAK,YAAY,CAAgB;CACvD;CAEA,KAA0B;EACxB,WAAW,UAAU,cAAc,uBAAuB,CAAC,EAAE,OAAO;CACtE;AACF,EASwD"}
1
+ {"version":3,"file":"transition.service.js","names":[],"sources":["../../../src/internal/services/transition.service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nclass TransitionService_ {\n get #hasSpeculationRules() {\n return globalThis.document.querySelector('[type=speculationrules]');\n }\n\n get #nveTransition() {\n return globalThis.document.documentElement.getAttribute('nve-transition');\n }\n\n #observer: MutationObserver;\n\n enable() {\n if (globalThis.document) {\n this.#observer?.disconnect();\n this.#toggleSpeculationRules();\n this.#observer = new MutationObserver(() => this.#toggleSpeculationRules());\n this.#observer.observe(globalThis.document.documentElement, {\n attributeFilter: ['nve-transition']\n });\n }\n }\n\n disable() {\n this.#removeSpeculationRules();\n this.#observer?.disconnect();\n }\n\n #toggleSpeculationRules() {\n if (globalThis.document && this.#nveTransition === 'auto') {\n if (!this.#hasSpeculationRules) {\n this.#appendSpeculationRules();\n }\n } else {\n this.#removeSpeculationRules();\n }\n }\n\n #appendSpeculationRules() {\n const speculationRules = globalThis.document.createElement('script');\n speculationRules.id = 'nve-speculationrules';\n speculationRules.type = 'speculationrules';\n speculationRules.textContent = JSON.stringify({\n prerender: [\n {\n where: { href_matches: '/*' },\n eagerness: 'moderate'\n }\n ]\n });\n globalThis.document.head.appendChild(speculationRules);\n }\n\n #removeSpeculationRules() {\n globalThis.document?.querySelector('#nve-speculationrules')?.remove();\n }\n}\n\n/**\n * The Transition Service provides setup to enable View Transitions APIs.\n * This includes initializing base speculation rules for smooth transition between navigations.\n *\n * https://developer.chrome.com/docs/web-platform/view-transitions/cross-document\n * https://developer.chrome.com/docs/web-platform/prerender-pages#speculation-rules-api\n */\nexport const TransitionService = new TransitionService_();\n"],"mappings":"AAmEA,IAAa,IAAoB,IAAI,MAhEZ;CACvB,IAAI,KAAuB;EACzB,OAAO,WAAW,SAAS,cAAc,yBAAyB;CACpE;CAEA,IAAI,KAAiB;EACnB,OAAO,WAAW,SAAS,gBAAgB,aAAa,gBAAgB;CAC1E;CAEA;CAEA,SAAS;EACP,AAAI,WAAW,aACb,KAAK,IAAW,WAAW,GAC3B,KAAK,GAAwB,GAC7B,KAAK,KAAY,IAAI,uBAAuB,KAAK,GAAwB,CAAC,GAC1E,KAAK,GAAU,QAAQ,WAAW,SAAS,iBAAiB,EAC1D,iBAAiB,CAAC,gBAAgB,EACpC,CAAC;CAEL;CAEA,UAAU;EAER,AADA,KAAK,GAAwB,GAC7B,KAAK,IAAW,WAAW;CAC7B;CAEA,KAA0B;EACxB,AAAI,WAAW,YAAY,KAAK,OAAmB,SAC5C,KAAK,MACR,KAAK,GAAwB,IAG/B,KAAK,GAAwB;CAEjC;CAEA,KAA0B;EACxB,IAAM,IAAmB,WAAW,SAAS,cAAc,QAAQ;EAWnE,AAVA,EAAiB,KAAK,wBACtB,EAAiB,OAAO,oBACxB,EAAiB,cAAc,KAAK,UAAU,EAC5C,WAAW,CACT;GACE,OAAO,EAAE,cAAc,KAAK;GAC5B,WAAW;EACb,CACF,EACF,CAAC,GACD,WAAW,SAAS,KAAK,YAAY,CAAgB;CACvD;CAEA,KAA0B;EACxB,WAAW,UAAU,cAAc,uBAAuB,CAAC,EAAE,OAAO;CACtE;AACF,EASwD"}
@@ -8,7 +8,8 @@ function r(e) {
8
8
  if (e instanceof HTMLSlotElement && e.assignedElements) {
9
9
  let t = e.assignedElements();
10
10
  return t.length ? t : Array.from(e.children);
11
- } else return Array.from(e.children);
11
+ }
12
+ return Array.from(e.children);
12
13
  }
13
14
  function i() {
14
15
  return `_${self.crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0].toString(16)}`;