@aceshooting/lyra-ui 29.0.2 → 29.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +19 -26
  3. package/design-tokens.json +1 -1
  4. package/dist/cli/migrate-wa.mjs +2 -0
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +5 -3
  6. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +4 -3
  7. package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +1 -1
  8. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +21 -5
  9. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +14 -11
  10. package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +1 -1
  11. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  12. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +34 -7
  13. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +25 -11
  14. package/dist/components/agent-tools/eval-result/eval-result-source.js +1 -0
  15. package/dist/components/agent-tools/eval-result/eval-result.class.d.ts +31 -11
  16. package/dist/components/agent-tools/eval-result/eval-result.class.js +29 -15
  17. package/dist/components/agent-tools/eval-result/eval-result.styles.js +1 -1
  18. package/dist/components/agent-tools/eval-result/eval-run-result.d.ts +10 -0
  19. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +26 -5
  20. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +16 -6
  21. package/dist/components/agent-tools/span-waterfall/span-waterfall.d.ts +1 -1
  22. package/dist/components/agent-tools/span-waterfall/span-waterfall.js +1 -1
  23. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +1 -1
  24. package/dist/components/agent-tools/task-list/task-list.class.d.ts +29 -6
  25. package/dist/components/agent-tools/task-list/task-list.class.js +13 -7
  26. package/dist/components/agent-tools/task-list/task-list.d.ts +1 -1
  27. package/dist/components/agent-tools/task-list/task-list.js +1 -1
  28. package/dist/components/agent-tools/task-list/task-list.styles.js +1 -1
  29. package/dist/components/agent-tools/terminal/terminal.class.d.ts +9 -5
  30. package/dist/components/agent-tools/terminal/terminal.class.js +8 -8
  31. package/dist/components/agent-tools/test-results/test-results.class.d.ts +16 -4
  32. package/dist/components/agent-tools/test-results/test-results.class.js +15 -6
  33. package/dist/components/agent-tools/test-results/test-results.d.ts +1 -0
  34. package/dist/components/agent-tools/test-results/test-results.js +1 -1
  35. package/dist/components/agent-tools/test-results/test-results.styles.js +1 -1
  36. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +7 -4
  37. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +2 -1
  38. package/dist/components/agent-tools/trace-tree/span-projection.js +1 -0
  39. package/dist/components/agent-tools/trace-tree/span-shared.d.ts +29 -0
  40. package/dist/components/agent-tools/trace-tree/span-shared.js +1 -0
  41. package/dist/components/agent-tools/trace-tree/span.d.ts +5 -35
  42. package/dist/components/agent-tools/trace-tree/span.js +1 -1
  43. package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +27 -5
  44. package/dist/components/agent-tools/trace-tree/trace-tree.class.js +19 -9
  45. package/dist/components/agent-tools/trace-tree/trace-tree.d.ts +1 -1
  46. package/dist/components/agent-tools/trace-tree/trace-tree.js +1 -1
  47. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +1 -1
  48. package/dist/components/charts/chart/bar-chart.class.d.ts +5 -1
  49. package/dist/components/charts/chart/box-plot.class.d.ts +2 -2
  50. package/dist/components/charts/chart/box-plot.class.js +3 -3
  51. package/dist/components/charts/chart/bubble-chart.class.d.ts +5 -1
  52. package/dist/components/charts/chart/chart-prepared-data.d.ts +9 -0
  53. package/dist/components/charts/chart/chart-prepared-data.js +1 -0
  54. package/dist/components/charts/chart/chart-spatial-data.js +2 -0
  55. package/dist/components/charts/chart/chart-sync.js +1 -1
  56. package/dist/components/charts/chart/chart-table-sampling.js +1 -1
  57. package/dist/components/charts/chart/chart.class.d.ts +56 -6
  58. package/dist/components/charts/chart/chart.class.js +18 -8
  59. package/dist/components/charts/chart/chart.styles.js +1 -1
  60. package/dist/components/charts/chart/doughnut-chart.class.d.ts +5 -1
  61. package/dist/components/charts/chart/histogram-buckets.d.ts +1 -1
  62. package/dist/components/charts/chart/histogram-buckets.js +1 -1
  63. package/dist/components/charts/chart/histogram.class.d.ts +19 -4
  64. package/dist/components/charts/chart/histogram.class.js +1 -1
  65. package/dist/components/charts/chart/line-chart.class.d.ts +5 -1
  66. package/dist/components/charts/chart/lite-chart.class.d.ts +51 -11
  67. package/dist/components/charts/chart/lite-chart.class.js +33 -27
  68. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  69. package/dist/components/charts/chart/pie-chart.class.d.ts +5 -1
  70. package/dist/components/charts/chart/polar-area-chart.class.d.ts +5 -1
  71. package/dist/components/charts/chart/radar-chart.class.d.ts +5 -1
  72. package/dist/components/charts/chart/scatter-chart.class.d.ts +5 -1
  73. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +6 -3
  74. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +6 -5
  75. package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +1 -1
  76. package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +8 -0
  77. package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
  78. package/dist/components/conversation/code-block/code-block-base.class.d.ts +5 -3
  79. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  80. package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -1
  81. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  82. package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -4
  83. package/dist/components/conversation/code-block/code-block-shared.js +3 -2
  84. package/dist/components/conversation/code-block/code-block.class.d.ts +11 -4
  85. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  86. package/dist/components/conversation/code-block/code-block.d.ts +1 -1
  87. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  88. package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
  89. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  90. package/dist/components/conversation/markdown/markdown-base.class.d.ts +6 -4
  91. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  92. package/dist/components/conversation/markdown/markdown-code-header.d.ts +2 -2
  93. package/dist/components/conversation/markdown/markdown-code-header.js +1 -1
  94. package/dist/components/conversation/markdown/markdown-core.class.d.ts +8 -3
  95. package/dist/components/conversation/markdown/markdown-progressive.js +2 -2
  96. package/dist/components/conversation/markdown/markdown-shared.d.ts +5 -10
  97. package/dist/components/conversation/markdown/markdown-shared.js +5 -5
  98. package/dist/components/conversation/markdown/markdown-streaming-tail.js +1 -1
  99. package/dist/components/conversation/markdown/markdown.class.d.ts +17 -10
  100. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  101. package/dist/components/conversation/markdown/markdown.styles.js +1 -1
  102. package/dist/components/conversation/model-select/model-select.class.d.ts +4 -3
  103. package/dist/components/conversation/model-select/model-select.class.js +3 -2
  104. package/dist/components/conversation/model-select/model-select.styles.js +1 -1
  105. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.d.ts +2 -1
  106. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +2 -1
  107. package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +1 -1
  108. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -2
  109. package/dist/components/conversation/prompt-input/prompt-input.class.js +2 -1
  110. package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
  111. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +10 -2
  112. package/dist/components/conversation/prompt-queue/prompt-queue.class.js +15 -6
  113. package/dist/components/conversation/prompt-queue/prompt-queue.styles.js +1 -1
  114. package/dist/components/conversation/realtime-session/realtime-session.class.d.ts +3 -1
  115. package/dist/components/conversation/realtime-session/realtime-session.class.js +2 -1
  116. package/dist/components/conversation/realtime-session/realtime-session.styles.js +1 -1
  117. package/dist/components/conversation/streaming-text/markdown-detection.d.ts +2 -0
  118. package/dist/components/conversation/streaming-text/markdown-detection.js +4 -1
  119. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +6 -2
  120. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +3 -3
  121. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -1
  122. package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
  123. package/dist/components/conversation/thread-list/thread-list.class.d.ts +34 -4
  124. package/dist/components/conversation/thread-list/thread-list.class.js +22 -15
  125. package/dist/components/conversation/thread-list/thread-list.d.ts +1 -1
  126. package/dist/components/conversation/thread-list/thread-list.js +1 -1
  127. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  128. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +6 -2
  129. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +3 -2
  130. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +1 -1
  131. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +3 -2
  132. package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -2
  133. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  134. package/dist/components/data/calendar/calendar.class.d.ts +5 -2
  135. package/dist/components/data/calendar/calendar.class.js +1 -1
  136. package/dist/components/data/data-grid/data-grid-processing.js +2 -2
  137. package/dist/components/data/data-grid/data-grid.class.d.ts +22 -8
  138. package/dist/components/data/data-grid/data-grid.class.js +20 -19
  139. package/dist/components/data/data-grid/data-grid.styles.js +1 -1
  140. package/dist/components/data/document-library/document-library.class.d.ts +31 -4
  141. package/dist/components/data/document-library/document-library.class.js +25 -12
  142. package/dist/components/data/document-library/document-library.styles.js +1 -1
  143. package/dist/components/data/file-tree/file-tree.class.d.ts +30 -6
  144. package/dist/components/data/file-tree/file-tree.class.js +4 -3
  145. package/dist/components/data/file-tree/file-tree.d.ts +1 -0
  146. package/dist/components/data/file-tree/file-tree.js +1 -1
  147. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +31 -6
  148. package/dist/components/data/flow-canvas/flow-canvas.class.js +40 -19
  149. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  150. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  151. package/dist/components/data/flow-canvas/flow-source.js +1 -0
  152. package/dist/components/data/flow-canvas/flow-types.d.ts +4 -2
  153. package/dist/components/data/flow-canvas/flow-viewport-index.js +1 -0
  154. package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +9 -3
  155. package/dist/components/data/flow-minimap/flow-minimap.class.js +11 -2
  156. package/dist/components/data/flow-minimap/flow-minimap.styles.js +1 -1
  157. package/dist/components/data/funnel/funnel.class.d.ts +7 -3
  158. package/dist/components/data/funnel/funnel.class.js +2 -2
  159. package/dist/components/data/heatmap/calendar-grid.d.ts +1 -1
  160. package/dist/components/data/heatmap/calendar-grid.js +1 -1
  161. package/dist/components/data/heatmap/heatmap-grid-navigation.js +1 -1
  162. package/dist/components/data/heatmap/heatmap-limits.d.ts +1 -1
  163. package/dist/components/data/heatmap/heatmap-matrix-source-controller.js +1 -0
  164. package/dist/components/data/heatmap/heatmap-matrix-source.d.ts +5 -0
  165. package/dist/components/data/heatmap/heatmap-matrix-source.js +1 -0
  166. package/dist/components/data/heatmap/heatmap-scale.d.ts +0 -16
  167. package/dist/components/data/heatmap/heatmap-scale.js +1 -1
  168. package/dist/components/data/heatmap/heatmap.class.d.ts +40 -11
  169. package/dist/components/data/heatmap/heatmap.class.js +26 -6
  170. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  171. package/dist/components/data/pagination/pagination.class.js +1 -1
  172. package/dist/components/data/sequence-strip/sequence-strip-item.d.ts +17 -0
  173. package/dist/components/data/sequence-strip/sequence-strip-source-controller.js +1 -0
  174. package/dist/components/data/sequence-strip/sequence-strip-source.d.ts +5 -0
  175. package/dist/components/data/sequence-strip/sequence-strip-source.js +1 -0
  176. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +24 -19
  177. package/dist/components/data/sequence-strip/sequence-strip.class.js +23 -4
  178. package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
  179. package/dist/components/data/sparkline/sparkline.class.d.ts +17 -4
  180. package/dist/components/data/sparkline/sparkline.class.js +3 -3
  181. package/dist/components/data/sparkline/sparkline.styles.js +1 -1
  182. package/dist/components/data/table/table.class.d.ts +14 -10
  183. package/dist/components/data/table/table.class.js +17 -16
  184. package/dist/components/data/timeline/timeline.class.d.ts +5 -2
  185. package/dist/components/data/timeline/timeline.class.js +1 -1
  186. package/dist/components/data/tree/tree-item.class.js +1 -1
  187. package/dist/components/data/tree/tree-owner-controller.js +1 -1
  188. package/dist/components/data/tree/tree.class.d.ts +28 -6
  189. package/dist/components/data/tree/tree.class.js +3 -3
  190. package/dist/components/data/tree/tree.d.ts +1 -0
  191. package/dist/components/data/tree/tree.js +1 -1
  192. package/dist/components/data/word-cloud/word-cloud.class.d.ts +17 -7
  193. package/dist/components/data/word-cloud/word-cloud.class.js +6 -4
  194. package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
  195. package/dist/components/forms/catalog-picker-base.d.ts +1 -1
  196. package/dist/components/forms/catalog-picker-base.js +6 -6
  197. package/dist/components/forms/catalog-picker-base.styles.js +1 -1
  198. package/dist/components/forms/combobox/combobox.class.d.ts +7 -3
  199. package/dist/components/forms/combobox/combobox.class.js +1 -1
  200. package/dist/components/forms/combobox/option.class.d.ts +4 -2
  201. package/dist/components/forms/combobox/option.class.js +2 -2
  202. package/dist/components/forms/country-picker/country-picker.class.d.ts +3 -1
  203. package/dist/components/forms/country-picker/country-picker.class.js +1 -1
  204. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +2 -0
  205. package/dist/components/forms/currency-picker/currency-picker.class.js +1 -1
  206. package/dist/components/forms/currency-picker/currency-presentation.js +1 -1
  207. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +6 -2
  208. package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -2
  209. package/dist/components/forms/emoji-picker/emoji-picker.styles.js +1 -1
  210. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +8 -2
  211. package/dist/components/forms/locale-picker/locale-picker.class.js +5 -4
  212. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  213. package/dist/components/forms/select/select.class.d.ts +11 -3
  214. package/dist/components/forms/select/select.class.js +4 -4
  215. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +2 -0
  216. package/dist/components/forms/time-zone-picker/time-zone-picker.class.js +1 -1
  217. package/dist/components/forms/token-input/token-input.class.d.ts +6 -1
  218. package/dist/components/forms/token-input/token-input.class.js +15 -13
  219. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +2 -0
  220. package/dist/components/forms/unit-picker/unit-picker.class.js +1 -1
  221. package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
  222. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  223. package/dist/components/layout/command-palette/command-palette.class.d.ts +5 -2
  224. package/dist/components/layout/command-palette/command-palette.class.js +2 -1
  225. package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
  226. package/dist/components/layout/menu/menu-item.class.d.ts +2 -2
  227. package/dist/components/layout/menu/menu-item.class.js +2 -2
  228. package/dist/components/layout/menu/menu.class.d.ts +1 -1
  229. package/dist/components/layout/menu/menu.class.js +1 -1
  230. package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
  231. package/dist/components/layout/menubar/menubar.class.js +1 -1
  232. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -2
  233. package/dist/components/layout/reorder-list/reorder-item.class.js +2 -2
  234. package/dist/components/layout/reorder-list/reorder-list.class.d.ts +1 -1
  235. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  236. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +13 -9
  237. package/dist/components/layout/virtual-list/virtual-list.class.js +21 -17
  238. package/dist/components/media/av-player/av-cue-index.js +1 -0
  239. package/dist/components/media/av-player/av-cue-source.d.ts +13 -0
  240. package/dist/components/media/av-player/av-cue-source.js +1 -0
  241. package/dist/components/media/av-player/av-metadata.d.ts +2 -2
  242. package/dist/components/media/av-player/av-metadata.js +1 -1
  243. package/dist/components/media/av-player/av-player-cue-source-controller.js +1 -0
  244. package/dist/components/media/av-player/av-player.class.d.ts +34 -12
  245. package/dist/components/media/av-player/av-player.class.js +15 -10
  246. package/dist/components/media/flag/flag.class.js +1 -1
  247. package/dist/components/media/flag/language-map.js +1 -1
  248. package/dist/components/media/lightbox/lightbox-source.js +1 -0
  249. package/dist/components/media/lightbox/lightbox-types.d.ts +15 -0
  250. package/dist/components/media/lightbox/lightbox.class.d.ts +22 -21
  251. package/dist/components/media/lightbox/lightbox.class.js +6 -4
  252. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  253. package/dist/components/media/map/map-geojson-diff.d.ts +6 -6
  254. package/dist/components/media/map/map-geojson-diff.js +1 -1
  255. package/dist/components/media/map/map-loader.d.ts +5 -1
  256. package/dist/components/media/map/map.class.d.ts +24 -6
  257. package/dist/components/media/map/map.class.js +2 -2
  258. package/dist/components/media/map/map.styles.js +1 -1
  259. package/dist/components/media/video-playlist/video-playlist.class.d.ts +2 -1
  260. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  261. package/dist/components/overlays/chip/chip.class.d.ts +1 -1
  262. package/dist/components/overlays/chip/chip.class.js +1 -1
  263. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +30 -8
  264. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +22 -8
  265. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  266. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  267. package/dist/components/retrieval/graph/graph-source-composition.js +1 -0
  268. package/dist/components/retrieval/graph/graph-source-controller.js +1 -0
  269. package/dist/components/retrieval/graph/graph-spatial-controller.js +2 -2
  270. package/dist/components/retrieval/graph/graph-spatial-model.js +1 -0
  271. package/dist/components/retrieval/graph/graph-spatial.js +1 -1
  272. package/dist/components/retrieval/graph/graph.class.d.ts +31 -6
  273. package/dist/components/retrieval/graph/graph.class.js +26 -5
  274. package/dist/components/retrieval/graph/graph.d.ts +1 -1
  275. package/dist/components/retrieval/graph/graph.js +1 -1
  276. package/dist/components/retrieval/graph/graph.styles.js +1 -1
  277. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +33 -4
  278. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +27 -17
  279. package/dist/components/retrieval/ingestion-queue/ingestion-queue.d.ts +1 -1
  280. package/dist/components/retrieval/ingestion-queue/ingestion-queue.js +1 -1
  281. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +1 -1
  282. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +27 -4
  283. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +29 -14
  284. package/dist/components/retrieval/knowledge-base/knowledge-base.styles.js +1 -1
  285. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +17 -3
  286. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js +15 -10
  287. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +1 -1
  288. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +24 -5
  289. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +17 -10
  290. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.d.ts +1 -1
  291. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.js +1 -1
  292. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +1 -1
  293. package/dist/components/retrieval/mind-map/mind-map-layout.js +1 -1
  294. package/dist/components/retrieval/mind-map/mind-map-model.js +1 -0
  295. package/dist/components/retrieval/mind-map/mind-map.class.d.ts +27 -4
  296. package/dist/components/retrieval/mind-map/mind-map.class.js +11 -7
  297. package/dist/components/retrieval/mind-map/mind-map.d.ts +1 -0
  298. package/dist/components/retrieval/mind-map/mind-map.js +1 -1
  299. package/dist/components/retrieval/mind-map/mind-map.styles.js +1 -1
  300. package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +24 -2
  301. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +17 -3
  302. package/dist/components/retrieval/neighbor-list/neighbor-list.d.ts +1 -1
  303. package/dist/components/retrieval/neighbor-list/neighbor-list.js +1 -1
  304. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +1 -1
  305. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +8 -4
  306. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +11 -7
  307. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.styles.js +1 -1
  308. package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.d.ts +12 -6
  309. package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.js +30 -17
  310. package/dist/components/retrieval/retrieval-compare/retrieval-compare.styles.js +1 -1
  311. package/dist/components/retrieval/retrieval-results/retrieval-results-model.js +1 -0
  312. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +46 -5
  313. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +31 -9
  314. package/dist/components/retrieval/retrieval-results/retrieval-results.d.ts +1 -1
  315. package/dist/components/retrieval/retrieval-results/retrieval-results.js +1 -1
  316. package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +1 -1
  317. package/dist/components/utility/diff-view/diff-view.class.d.ts +16 -8
  318. package/dist/components/utility/diff-view/diff-view.class.js +3 -2
  319. package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
  320. package/dist/components/utility/json-viewer/json-viewer.class.d.ts +31 -3
  321. package/dist/components/utility/json-viewer/json-viewer.class.js +13 -4
  322. package/dist/components/utility/json-viewer/json-viewer.d.ts +1 -0
  323. package/dist/components/utility/json-viewer/json-viewer.js +1 -1
  324. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  325. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +6 -4
  326. package/dist/components/utility/mention-popover/mention-popover.class.js +6 -5
  327. package/dist/components/viewers/csv-viewer/csv-viewer.class.d.ts +34 -7
  328. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +9 -7
  329. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +28 -4
  330. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +12 -11
  331. package/dist/components/viewers/geojson-view/geojson-viewer.class.d.ts +3 -1
  332. package/dist/components/viewers/geojson-view/geojson-viewer.class.js +17 -16
  333. package/dist/components/viewers/geojson-view/geojson-viewer.d.ts +1 -1
  334. package/dist/components/viewers/geojson-view/geojson-viewer.js +1 -1
  335. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.d.ts +31 -5
  336. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +11 -8
  337. package/dist/components/viewers/table-viewer-shared.js +19 -3
  338. package/dist/components/viewers/viewer-search-limits.js +1 -1
  339. package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +35 -3
  340. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +20 -5
  341. package/dist/components/viewers/xml-viewer/xml-viewer.d.ts +1 -1
  342. package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
  343. package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +1 -1
  344. package/dist/countries.js +1 -1
  345. package/dist/data-sources.d.ts +34 -0
  346. package/dist/data-sources.js +1 -0
  347. package/dist/events.d.ts +51 -7
  348. package/dist/framework-types.d.ts +1 -1
  349. package/dist/internal/accessibility-visibility.d.ts +4 -2
  350. package/dist/internal/accessibility-visibility.js +1 -1
  351. package/dist/internal/accessible-text-controller.js +1 -1
  352. package/dist/internal/anchor-target.js +2 -2
  353. package/dist/internal/catalog-picker.d.ts +1 -7
  354. package/dist/internal/catalog-picker.js +1 -1
  355. package/dist/internal/collection-snapshot.js +1 -1
  356. package/dist/internal/default-strings/agent-tools.generated.js +1 -1
  357. package/dist/internal/default-strings/charts.generated.js +1 -1
  358. package/dist/internal/default-strings/conversation.generated.js +1 -1
  359. package/dist/internal/default-strings/data.generated.js +1 -1
  360. package/dist/internal/default-strings/forms.generated.js +1 -1
  361. package/dist/internal/default-strings/layout.generated.js +1 -1
  362. package/dist/internal/default-strings/media.generated.js +1 -1
  363. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  364. package/dist/internal/default-strings/shared.generated.js +1 -1
  365. package/dist/internal/default-strings/utility.generated.js +1 -1
  366. package/dist/internal/delimited-data.js +1 -1
  367. package/dist/internal/fixed-containing-block.js +1 -1
  368. package/dist/internal/flow-scene-envelope.js +1 -0
  369. package/dist/internal/graph-scene-controller.js +1 -0
  370. package/dist/internal/hierarchy-source-controller.js +1 -0
  371. package/dist/internal/hierarchy-source-view.js +29 -0
  372. package/dist/internal/hierarchy-source-view.styles.js +1 -0
  373. package/dist/internal/inherited-attribute-hub.d.ts +6 -0
  374. package/dist/internal/inherited-attribute-hub.js +1 -1
  375. package/dist/internal/intl-cache.js +1 -1
  376. package/dist/internal/keyed-index.js +1 -0
  377. package/dist/internal/localization-types.d.ts +1 -1
  378. package/dist/internal/localization.js +2 -2
  379. package/dist/internal/lyra-element.d.ts +2 -2
  380. package/dist/internal/lyra-element.js +3 -2
  381. package/dist/internal/native-modal-context.js +1 -1
  382. package/dist/internal/option-selection.js +1 -1
  383. package/dist/internal/package-metadata.js +1 -1
  384. package/dist/internal/positioner.js +1 -1
  385. package/dist/internal/resource-loader.d.ts +2 -0
  386. package/dist/internal/resource-loader.js +1 -1
  387. package/dist/internal/scoped-definitions.generated.js +1 -1
  388. package/dist/internal/search-haystack.js +1 -0
  389. package/dist/internal/selection-catalog.d.ts +5 -0
  390. package/dist/internal/selection-catalog.js +1 -1
  391. package/dist/internal/shiki-language-sources.js +1 -0
  392. package/dist/internal/source-page-controller.js +1 -0
  393. package/dist/internal/source-page-scope.js +1 -0
  394. package/dist/internal/source-request-controller.js +1 -0
  395. package/dist/internal/source-window-controller.js +1 -0
  396. package/dist/internal/spatial-source-controller.js +1 -0
  397. package/dist/internal/text-quote.d.ts +2 -6
  398. package/dist/internal/text-quote.js +1 -1
  399. package/dist/internal/theme-watcher.js +1 -1
  400. package/dist/internal/virtual-list-composition.js +1 -0
  401. package/dist/lyra.d.ts +1 -1
  402. package/dist/lyra.js +1 -1
  403. package/dist/testing/interaction-drivers.js +1 -1
  404. package/dist/testing/lyra-tag-event-map.js +1 -1
  405. package/dist/units.js +1 -1
  406. package/dist/utilities/data-preparation.d.ts +56 -0
  407. package/dist/utilities/data-preparation.js +1 -0
  408. package/dist/utilities/data-spatial.d.ts +26 -0
  409. package/dist/utilities/data-spatial.js +1 -0
  410. package/dist/utilities/index.d.ts +1 -1
  411. package/dist/utilities/index.js +1 -1
  412. package/llms/components/lr-activity-feed.md +7 -2
  413. package/llms/components/lr-agent-trace.md +49 -9
  414. package/llms/components/lr-agent-workspace.md +15 -8
  415. package/llms/components/lr-av-player.md +180 -10
  416. package/llms/components/lr-bar-chart.md +1 -1
  417. package/llms/components/lr-box-plot.md +8 -0
  418. package/llms/components/lr-bubble-chart.md +1 -1
  419. package/llms/components/lr-calendar.md +26 -3
  420. package/llms/components/lr-chart.md +310 -23
  421. package/llms/components/lr-chat-viewport.md +6 -0
  422. package/llms/components/lr-code-block-core.md +12 -7
  423. package/llms/components/lr-code-block.md +23 -9
  424. package/llms/components/lr-combobox.md +27 -15
  425. package/llms/components/lr-command-palette.md +16 -3
  426. package/llms/components/lr-country-picker.md +23 -6
  427. package/llms/components/lr-csv-viewer.md +95 -12
  428. package/llms/components/lr-currency-picker.md +23 -3
  429. package/llms/components/lr-data-grid.md +24 -6
  430. package/llms/components/lr-dataset-viewer.md +92 -11
  431. package/llms/components/lr-dialog.md +1 -1
  432. package/llms/components/lr-diff-view.md +19 -6
  433. package/llms/components/lr-document-library.md +60 -5
  434. package/llms/components/lr-doughnut-chart.md +1 -1
  435. package/llms/components/lr-embedding-explorer.md +89 -9
  436. package/llms/components/lr-emoji-picker.md +7 -2
  437. package/llms/components/lr-eval-dataset.md +56 -7
  438. package/llms/components/lr-eval-result.md +89 -4
  439. package/llms/components/lr-export-button.md +1 -1
  440. package/llms/components/lr-file-tree.md +60 -6
  441. package/llms/components/lr-flag.md +5 -2
  442. package/llms/components/lr-flow-canvas.md +152 -14
  443. package/llms/components/lr-flow-minimap.md +32 -4
  444. package/llms/components/lr-funnel.md +14 -0
  445. package/llms/components/lr-geojson-viewer.md +27 -10
  446. package/llms/components/lr-graph.md +43 -7
  447. package/llms/components/lr-heatmap.md +161 -5
  448. package/llms/components/lr-histogram.md +55 -9
  449. package/llms/components/lr-ingestion-queue.md +54 -3
  450. package/llms/components/lr-json-viewer.md +87 -7
  451. package/llms/components/lr-knowledge-base-admin.md +60 -4
  452. package/llms/components/lr-knowledge-base.md +121 -9
  453. package/llms/components/lr-knowledge-graph-explorer.md +106 -11
  454. package/llms/components/lr-lightbox.md +42 -6
  455. package/llms/components/lr-line-chart.md +28 -5
  456. package/llms/components/lr-lite-chart.md +96 -31
  457. package/llms/components/lr-locale-picker.md +6 -4
  458. package/llms/components/lr-map.md +67 -8
  459. package/llms/components/lr-markdown-core.md +10 -5
  460. package/llms/components/lr-markdown.md +23 -6
  461. package/llms/components/lr-mention-popover.md +11 -6
  462. package/llms/components/lr-mind-map.md +91 -10
  463. package/llms/components/lr-model-select.md +8 -4
  464. package/llms/components/lr-model-settings-panel.md +10 -2
  465. package/llms/components/lr-navigation-menu.md +1 -1
  466. package/llms/components/lr-neighbor-list.md +69 -2
  467. package/llms/components/lr-pie-chart.md +1 -1
  468. package/llms/components/lr-polar-area-chart.md +1 -1
  469. package/llms/components/lr-prompt-input.md +9 -2
  470. package/llms/components/lr-prompt-queue.md +11 -3
  471. package/llms/components/lr-radar-chart.md +1 -1
  472. package/llms/components/lr-rag-eval-dashboard.md +9 -2
  473. package/llms/components/lr-realtime-session.md +6 -2
  474. package/llms/components/lr-reorder-list.md +4 -0
  475. package/llms/components/lr-retrieval-compare.md +9 -4
  476. package/llms/components/lr-retrieval-results.md +104 -6
  477. package/llms/components/lr-scatter-chart.md +1 -1
  478. package/llms/components/lr-select.md +20 -10
  479. package/llms/components/lr-sequence-strip.md +92 -2
  480. package/llms/components/lr-span-waterfall.md +78 -8
  481. package/llms/components/lr-sparkline.md +42 -11
  482. package/llms/components/lr-spreadsheet-viewer.md +109 -14
  483. package/llms/components/lr-streaming-text-core.md +4 -2
  484. package/llms/components/lr-streaming-text.md +5 -1
  485. package/llms/components/lr-table.md +96 -115
  486. package/llms/components/lr-task-list.md +93 -9
  487. package/llms/components/lr-terminal.md +9 -0
  488. package/llms/components/lr-test-results.md +77 -3
  489. package/llms/components/lr-thread-list.md +86 -1
  490. package/llms/components/lr-time-zone-picker.md +8 -3
  491. package/llms/components/lr-timeline.md +5 -0
  492. package/llms/components/lr-token-input.md +7 -2
  493. package/llms/components/lr-tool-timeline.md +13 -4
  494. package/llms/components/lr-trace-tree.md +96 -10
  495. package/llms/components/lr-transcript-feed.md +9 -2
  496. package/llms/components/lr-tree.md +87 -15
  497. package/llms/components/lr-unit-picker.md +8 -3
  498. package/llms/components/lr-video-playlist.md +2 -0
  499. package/llms/components/lr-virtual-list.md +17 -8
  500. package/llms/components/lr-voice-picker.md +8 -3
  501. package/llms/components/lr-word-cloud.md +128 -12
  502. package/llms/components/lr-xml-viewer.md +106 -9
  503. package/llms/index.md +1 -1
  504. package/llms/peers.md +1 -1
  505. package/llms/shared/events-and-types.md +725 -264
  506. package/llms/shared/forms-and-accessibility.md +3 -17
  507. package/llms/shared/imports-and-registration.md +3 -17
  508. package/llms/shared/localization-and-rtl.md +0 -2
  509. package/llms/shared/styles-and-tokens.md +27 -36
  510. package/llms/shared/testing-and-utilities.md +4 -5
  511. package/llms/shared.md +770 -349
  512. package/llms.txt +1 -2
  513. package/locales.json +139 -139
  514. package/package.json +13 -4
  515. package/registrations.json +1 -1
  516. package/skills/compose-lyra-interfaces/SKILL.md +6 -8
  517. package/skills/lyra-ui/SKILL.md +20 -51
  518. package/skills/lyra-ui/commands/review.md +16 -33
  519. package/skills/lyra-ui/commands/update.md +6 -5
  520. package/skills/lyra-ui/online-api.md +15 -0
  521. package/skills/lyra-ui/reporting.md +2 -1
@@ -12,7 +12,7 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{html as s
12
12
  aria-hidden="true"
13
13
  focusable="false"
14
14
  ><polyline points="5 12.5 10 17.5 19 6.5"></polyline></svg>
15
- `}class LyraMenuItem extends LyraElement{static{this.knownUnobservedAttributes=["submenu-open"]}static{this.styles=[LyraElement.styles,sizes,styles]}get resolvedRel(){return resolveGuardedRel(this.rel,this.target)}get resolvedHref(){return(this.download!==void 0?safeDownloadHref(this.href):safeLinkHref(this.href))??void 0}get isLinkItem(){return this.resolvedHref!==void 0}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}constructor(){super(),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelTextObserver=new AccessibleTextController(this,[],()=>this.syncSlottedLabel(),["data-hidden","label","slot"]),this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownedName={owns:!1,value:null},this.panelName={owns:!1,value:null},this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="icon"||el.getAttribute("slot")==="prefix")},this.onDetailsSlotChange=e=>{this.syncDetailsSlot(e.target)},this.onSuffixSlotChange=()=>{this.hasSuffixSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="suffix")},this.onLabelSlotChange=event=>{this.labelTextObserver.bind(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.labelTextObserver.bind(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open},this.addEventListener("mousedown",event=>{this.interactionDisabled&&event.preventDefault()})}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null,!1);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.applyComputedName(),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]})),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.labelTextObserver.bind(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned,isRadio=this.type==="radio"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":isRadio?"menuitemradio":"menuitem"),isCheckbox||isRadio?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,activeElementIn(this.ownerDocument)===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.proposeChecked(checked)&&(this.checked=checked)}else this.type==="radio"&&!this.checked&&this.proposeChecked(!0)&&(this.checked=!0,this.owningMenu?.uncheckRadioGroup(this,this.group));this.owningMenu?.activate(this)}}proposeChecked(checked){const value=this.value;return!this.emit("lr-menu-item-change-request",{value,checked},{cancelable:!0}).defaultPrevented}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}syncDetailsSlot(slot){const meaningful=node=>node.nodeType===Node.TEXT_NODE?(node.textContent??"").trim()!=="":node.nodeType!==Node.ELEMENT_NODE?!1:node instanceof HTMLSlotElement?node.assignedNodes({flatten:!0}).some(meaningful):!0;this.hasDetailsSlot=slot.assignedNodes({flatten:!0}).some(meaningful)}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot(),requireRendered=!0){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element),requireRendered,ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName()}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.panelName={owns:!1,value:null}),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}firstUpdated(changed){super.firstUpdated(changed);const detailsSlot=this.detailsSlot;queueMicrotask(()=>{this.onIconSlotChange(),this.onSuffixSlotChange(),collectInitialSlotAssignment(detailsSlot,s=>this.syncDetailsSlot(s))})}applyComputedName(){syncOwnedAriaLabel(this,this.slottedLabel,this.ownedName,this.hasAttribute("aria-labelledby"))}applyPanelName(){const panel=this.submenuPanel;panel&&syncOwnedAriaLabel(panel,this.slottedLabel,this.panelName,panel.hasAttribute("label"))}getTextLabel(){return this.slottedLabel}get spinnerParts(){return"spinner spinner__base"}render(){const baseContent=html`
15
+ `}class LyraMenuItem extends LyraElement{static{this.knownUnobservedAttributes=["submenu-open"]}static{this.styles=[LyraElement.styles,sizes,styles]}get resolvedRel(){return resolveGuardedRel(this.rel,this.target)}get resolvedHref(){return(this.download!==void 0?safeDownloadHref(this.href):safeLinkHref(this.href))??void 0}get isLinkItem(){return this.resolvedHref!==void 0}get hasSubmenu(){return this.submenuAssigned}get submenuOpen(){return this.submenuExpanded}[menuItemOwner](owner,expectedOwner){owner===null&&expectedOwner&&this.owningMenu!==expectedOwner||(this.owningMenu=owner)}set submenuOpen(next){!!next!==this.submenuExpanded&&(next?this.openSubmenu("none"):this.closeSubmenu())}get interactionDisabled(){return this.disabled||this.loading}constructor(){super(),this.value="",this.size="m",this.disabled=!1,this.variant="default",this.type="normal",this.checked=!1,this.loading=!1,this.hasIconSlot=!1,this.hasDetailsSlot=!1,this.hasSuffixSlot=!1,this.submenuAssigned=!1,this.submenuExpanded=!1,this.slottedLabel="",this.submenuPanel=null,this.submenuPanelAttached=!1,this.submenuPanelGeneration=0,this.labelTextObserver=new AccessibleTextController(this,[],()=>this.syncSlottedLabel(),["data-hidden","label","slot"]),this.labelObservationGeneration=0,this.announcedNativeState="",this.owningMenu=null,this.ownedName={owns:!1,value:null},this.writingComputedName=!1,this.panelName={owns:!1,value:null},this.onNativeStateMutation=()=>{const signature=this.nativeStateSignature();signature!==this.announcedNativeState&&(this.announcedNativeState=signature,this.emitStateChange())},this.onIconSlotChange=()=>{this.hasIconSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="icon"||el.getAttribute("slot")==="prefix")},this.onDetailsSlotChange=e=>{this.syncDetailsSlot(e.target)},this.onSuffixSlotChange=()=>{this.hasSuffixSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="suffix")},this.onLabelSlotChange=event=>{this.labelTextObserver.bind(),this.syncSlottedLabel(event.target)},this.onForwardedLabelSlotChange=event=>{const slot=event.target;this.labelForwardingSlots().includes(slot)&&(this.labelTextObserver.bind(),this.syncSlottedLabel())},this.onSubmenuSlotChange=e=>{this.syncSubmenuSlot(e.target)},this.onPanelStateChange=open=>{this.submenuExpanded=open},this.addEventListener("mousedown",event=>{this.interactionDisabled&&event.preventDefault()})}connectedCallback(){super.connectedCallback();const initialLabel=this.readSlottedLabel(null,!1);initialLabel!==this.slottedLabel&&(this.slottedLabel=initialLabel),this.applyComputedName(),this.tabIndex!==0&&(this.tabIndex=-1),this.announcedNativeState=this.nativeStateSignature();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.nativeStateObserver=new MutationObserverCtor(this.onNativeStateMutation),this.nativeStateObserver.observe(this,{attributes:!0,attributeFilter:["hidden","inert","aria-hidden"]})),this.addEventListener("slotchange",this.onForwardedLabelSlotChange);const labelGeneration=++this.labelObservationGeneration;this.updateComplete.then(()=>{if(!this.isConnected||labelGeneration!==this.labelObservationGeneration)return;this.labelTextObserver.bind(),this.syncSlottedLabel();const submenuSlot=this.renderRoot.querySelector('slot[name="submenu"]');submenuSlot&&this.syncSubmenuSlot(submenuSlot)})}attributeChangedCallback(name,oldValue,value){name==="aria-label"&&this.writingComputedName||super.attributeChangedCallback(name,oldValue,value)}disconnectedCallback(){super.disconnectedCallback(),this.submenuPanelGeneration+=1,this.submenuExpanded=!1,this.nativeStateObserver?.disconnect(),this.nativeStateObserver=void 0,this.labelObservationGeneration+=1,this.removeEventListener("slotchange",this.onForwardedLabelSlotChange),this.submenuPanel&&this.submenuPanelAttached&&(this.submenuPanel[submenuPanelController].detach(this),this.submenuPanelAttached=!1)}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}nativeStateSignature(){return`${this.hidden}|${this.inert}|${this.getAttribute("aria-hidden")}`}emitStateChange(){this.emit("lr-menu-item-state-change",{disabled:this.interactionDisabled,hidden:!!this.hidden,inert:this.inert})}willUpdate(changed){super.willUpdate(changed);const isCheckbox=this.type==="checkbox"&&!this.submenuAssigned,isRadio=this.type==="radio"&&!this.submenuAssigned;this.setAttribute("role",isCheckbox?"menuitemcheckbox":isRadio?"menuitemradio":"menuitem"),isCheckbox||isRadio?this.setAttribute("aria-checked",this.checked?"true":"false"):this.removeAttribute("aria-checked"),this.submenuAssigned?(this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",this.submenuExpanded?"true":"false")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded")),this.applyComputedName(),this.toggleAttribute("submenu-open",this.submenuExpanded),this.setAttribute("aria-disabled",String(this.interactionDisabled)),this.interactionDisabled&&(changed.has("disabled")||changed.has("loading"))&&(this.tabIndex=-1,activeElementIn(this.ownerDocument)===this&&this.blur()),(changed.has("disabled")||changed.has("loading"))&&this.emitStateChange()}click(){this.interactionDisabled||this.renderRoot.querySelector('[part~="base"]')?.click()}select(){if(!this.interactionDisabled){if(this.submenuPanel){this.openSubmenu("none");return}if(this.type==="checkbox"){const checked=!this.checked;this.proposeChecked(checked)&&(this.checked=checked)}else this.type==="radio"&&!this.checked&&this.proposeChecked(!0)&&(this.checked=!0,this.owningMenu?.uncheckRadioGroup(this,this.group));this.owningMenu?.activate(this)}}proposeChecked(checked){const value=this.value;return!this.emit("lr-menu-item-change-request",{value,checked},{cancelable:!0}).defaultPrevented}async openSubmenu(focus="first"){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||this.interactionDisabled||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],shown=controller.show(focus);this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await shown,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}async closeSubmenu(){const panel=this.submenuPanel,generation=this.submenuPanelGeneration;if(!panel||!this.isCurrentSubmenuPanel(panel,generation))return;const controller=panel[submenuPanelController],hidden=controller.hide();this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await hidden,this.isCurrentSubmenuPanel(panel,generation)&&(panel.updateComplete&&await panel.updateComplete,this.isCurrentSubmenuPanel(panel,generation)&&(this.submenuExpanded=controller.open,await this.updateComplete)))}syncDetailsSlot(slot){const meaningful=node=>node.nodeType===Node.TEXT_NODE?(node.textContent??"").trim()!=="":node.nodeType!==Node.ELEMENT_NODE?!1:node instanceof HTMLSlotElement?node.assignedNodes({flatten:!0}).some(meaningful):!0;this.hasDetailsSlot=slot.assignedNodes({flatten:!0}).some(meaningful)}defaultLabelSlot(){return this.renderRoot?.querySelector("slot:not([name])")??null}isDefaultLabelBranch(node){let top=node;for(;top.parentNode&&top.parentNode!==this;)top=top.parentNode;return top.parentNode!==this?!1:top.nodeType!==1||(top.getAttribute("slot")??"")===""}labelForwardingSlots(){return Array.from(this.querySelectorAll("slot")).filter(slot=>this.isDefaultLabelBranch(slot))}isLabelSubtreeExcluded(element){return!(element.getRootNode()===this.renderRoot&&element.matches('[part~="label"][aria-hidden="true"][inert]:not([hidden])'))&&isAccessibilitySubtreeExcluded(element)}readSlottedLabel(slot=this.defaultLabelSlot(),requireRendered=!0){const nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(this.childNodes).filter(node=>this.isDefaultLabelBranch(node));return composedAccessibilityText(nodes,{ancestorBoundary:this,isSubtreeExcluded:element=>this.isLabelSubtreeExcluded(element),requireRendered,ignoreInheritedVisibility:!0}).replace(/\s+/g," ").trim()}syncSlottedLabel(slot=this.defaultLabelSlot()){const next=this.readSlottedLabel(slot);next!==this.slottedLabel&&(this.slottedLabel=next),this.applyComputedName(),this.applyPanelName()}syncSubmenuSlot(submenuSlot){if(!submenuSlot.isConnected||submenuSlot.getRootNode()!==this.renderRoot)return;const assigned=submenuSlot.assignedElements({flatten:!0}),authoredPanel=assigned.find(element=>element.localName===tag("menu")),hasDirectItems=assigned.some(element=>element.localName===tag("menu-item")||element.localName===tag("dropdown-item")),kind=authoredPanel?"panel":hasDirectItems?"items":void 0;if(this.submenuKind=kind,this.submenuAssigned=kind!==void 0,kind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");generated&&this.connectSubmenuPanel(generated);return}this.connectSubmenuPanel(authoredPanel??null)}connectSubmenuPanel(next){const samePanel=next===this.submenuPanel;if(samePanel&&(next===null||this.submenuPanelAttached))return;const previous=this.submenuPanel;if(++this.submenuPanelGeneration,previous&&this.submenuPanelAttached&&previous[submenuPanelController].detach(this),this.submenuPanelAttached=!1,samePanel||(this.submenuPanel=next,this.panelName={owns:!1,value:null}),!this.submenuPanel){this.submenuExpanded=!1;return}const controller=this.submenuPanel[submenuPanelController];controller.attach(this,this.onPanelStateChange),this.submenuPanelAttached=!0,this.submenuExpanded=controller.open,this.applyPanelName()}isCurrentSubmenuPanel(panel,generation){return this.isConnected&&this.submenuPanel===panel&&this.submenuPanelGeneration===generation}updated(changed){if(super.updated(changed),changed.has("submenuKind")&&this.submenuKind==="items"){const generated=this.renderRoot.querySelector("[data-generated-submenu]");this.connectSubmenuPanel(generated)}}firstUpdated(changed){super.firstUpdated(changed);const detailsSlot=this.detailsSlot;queueMicrotask(()=>{this.onIconSlotChange(),this.onSuffixSlotChange(),collectInitialSlotAssignment(detailsSlot,s=>this.syncDetailsSlot(s))})}applyComputedName(){this.writingComputedName=!0;try{syncOwnedAriaLabel(this,this.slottedLabel,this.ownedName,this.hasAttribute("aria-labelledby"))}finally{this.writingComputedName=!1}}applyPanelName(){const panel=this.submenuPanel;panel&&syncOwnedAriaLabel(panel,this.slottedLabel,this.panelName,panel.hasAttribute("label"))}getTextLabel(){return this.slottedLabel}get spinnerParts(){return"spinner spinner__base"}render(){const baseContent=html`
16
16
  <span part="icon" aria-hidden="true" inert ?hidden=${!this.hasIconSlot}>
17
17
  <slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
18
18
  <span part="prefix"
@@ -69,4 +69,4 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{html as s
69
69
  name="submenu"
70
70
  @slotchange=${this.onSubmenuSlotChange}
71
71
  ></slot>`}
72
- `}}__decorate([property()],LyraMenuItem.prototype,"value",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"disabled",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"variant",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"type",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"checked",void 0),__decorate([property()],LyraMenuItem.prototype,"group",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"loading",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"href",void 0),__decorate([property()],LyraMenuItem.prototype,"target",void 0),__decorate([property()],LyraMenuItem.prototype,"rel",void 0),__decorate([property()],LyraMenuItem.prototype,"download",void 0),__decorate([state()],LyraMenuItem.prototype,"hasIconSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"hasDetailsSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"hasSuffixSlot",void 0),__decorate([query('slot[name="details"]')],LyraMenuItem.prototype,"detailsSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuAssigned",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuExpanded",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuKind",void 0),__decorate([state()],LyraMenuItem.prototype,"slottedLabel",void 0);export{LyraMenuItem};
72
+ `}}__decorate([property()],LyraMenuItem.prototype,"value",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"size",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"disabled",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"variant",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"type",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"checked",void 0),__decorate([property()],LyraMenuItem.prototype,"group",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMenuItem.prototype,"loading",void 0),__decorate([property({reflect:!0})],LyraMenuItem.prototype,"href",void 0),__decorate([property()],LyraMenuItem.prototype,"target",void 0),__decorate([property()],LyraMenuItem.prototype,"rel",void 0),__decorate([property()],LyraMenuItem.prototype,"download",void 0),__decorate([state()],LyraMenuItem.prototype,"hasIconSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"hasDetailsSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"hasSuffixSlot",void 0),__decorate([query('slot[name="details"]')],LyraMenuItem.prototype,"detailsSlot",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuAssigned",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuExpanded",void 0),__decorate([state()],LyraMenuItem.prototype,"submenuKind",void 0);export{LyraMenuItem};
@@ -81,4 +81,4 @@ export declare class LyraMenu extends LyraElement<LyraMenuEventMap>{protected st
81
81
  * matching `lr-select`/`lr-model-select`'s established
82
82
  * `this.getAttribute('aria-label') ?? <computed default>` precedence
83
83
  * (see `effectiveLabel`). */
84
- label?:string;get dropdownOpen():boolean;set dropdownOpen(next:boolean);private items;private activeIndex;private itemsSlot?;private cleanup?;private presentationPositioned;private placedTopLayer?;private itemStateObserver?;private readonly popupController;private menubarAnchored;private pendingFocus;private submenuOpenTimer?;private submenuCloseTimer?;private readonly listId;private readonly owningMenu;private readonly typeBuffer;private createSubmenuController;connectedCallback():void;protected firstUpdated(changed:PropertyValues):void;private get hasStandalonePresentation();private get interactionOpen();private syncPresentationState;private onRegionSlotChange;private syncRegionState;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private reposition;private cancelPresentationHideWatch;private schedulePresentationHide;private focusAfterPlacement;disconnectedCallback():void;private scheduleOwnedTimeout;private clearOwnedTimeout;private openPresentation;private closePresentation;private onDocPointer;private onItemsSlotChange;private syncItemsFromSlot;private observeItems;private acquireItemOwner;private releaseItemOwner;private uncheckRadioGroupSiblings;private isNavigable;private applyDropdownSize;private itemStateChangeReconciliationPending;private onItemStateChangeEvent;private onItemStateChange;private rehomeZeroSurvivorFocus;private onOwnedItemSelect;private dismissAfterSelection;private applyRovingTabIndex;private focusRoving;private setActiveItem;private closeSubmenus;private openSubmenuItem;private clearSubmenuTimers;private ownItemFromEvent;private isForeignEvent;private onListFocusIn;private onListKeyDown;private onPopupPointerOver;private onPopupPointerLeave;private scheduleSubmenuClose;private onNestedSelect;private popupPart;private tabWouldLeavePopup;private onPopupKeyDown;private typeAhead;private resetTypeAhead;private get effectiveLabel();private renderContents;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-menu':LyraMenu;}}
84
+ label?:string;get dropdownOpen():boolean;set dropdownOpen(next:boolean);private items;private activeIndex;private itemsSlot?;private cleanup?;private presentationPositioned;private placedTopLayer?;private itemStateObserver?;private readonly popupController;private menubarAnchored;private pendingFocus;private submenuOpenTimer?;private submenuCloseTimer?;private readonly listId;private readonly owningMenu;private readonly typeBuffer;private readonly typeAheadLabels;private foldedTypeAheadLabel;private createSubmenuController;connectedCallback():void;protected firstUpdated(changed:PropertyValues):void;private get hasStandalonePresentation();private get interactionOpen();private syncPresentationState;private onRegionSlotChange;private syncRegionState;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private reposition;private cancelPresentationHideWatch;private schedulePresentationHide;private focusAfterPlacement;disconnectedCallback():void;private scheduleOwnedTimeout;private clearOwnedTimeout;private openPresentation;private closePresentation;private onDocPointer;private onItemsSlotChange;private syncItemsFromSlot;private observeItems;private acquireItemOwner;private releaseItemOwner;private uncheckRadioGroupSiblings;private isNavigable;private applyDropdownSize;private itemStateChangeReconciliationPending;private onItemStateChangeEvent;private onItemStateChange;private rehomeZeroSurvivorFocus;private onOwnedItemSelect;private dismissAfterSelection;private applyRovingTabIndex;private focusRoving;private setActiveItem;private closeSubmenus;private openSubmenuItem;private clearSubmenuTimers;private ownItemFromEvent;private isForeignEvent;private onListFocusIn;private onListKeyDown;private onPopupPointerOver;private onPopupPointerLeave;private scheduleSubmenuClose;private onNestedSelect;private popupPart;private tabWouldLeavePopup;private onPopupKeyDown;private typeAhead;private resetTypeAhead;private get effectiveLabel();private renderContents;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-menu':LyraMenu;}}
@@ -1,4 +1,4 @@
1
- var _a;import{__decorate}from"tslib";import{maxCssTime}from"../../../internal/css-motion-time.js";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlaceReady as place,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{PopupController}from"../../../internal/popup-controller.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{collectFocusableElements,composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./menu.styles.js";import{menuItemOwner,submenuPanelController}from"./menu-shared.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{activeElementIn,isUsableActiveElement,safeDeepActiveElement}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import"./menu-item.class.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const SUBMENU_PLACEMENT="right-start",SUBMENU_FALLBACK_PLACEMENTS=["right-end","left-start","left-end","bottom-start","top-start"],MENUBAR_PLACEMENT="bottom-start",SUBMENU_OPEN_DELAY=150,SUBMENU_CLOSE_DELAY=300;function isLyraMenuItemElement(value){return isHtmlElement(value)?value.localName===tag("menu-item")||value.localName===tag("dropdown-item"):!1}function isLyraMenuElement(value){return isHtmlElement(value)&&value.localName===tag("menu")}let menuWidthScaleRegistered=!1;function registerMenuWidthScale(){if(!menuWidthScaleRegistered&&(menuWidthScaleRegistered=!0,!(typeof CSS>"u"||typeof CSS.registerProperty!="function")))try{CSS.registerProperty({name:"--_lr-menu-max-inline-size",syntax:"<length-percentage>",inherits:!1,initialValue:"100%"})}catch{}}class LyraMenu extends LyraElement{constructor(){super(...arguments),this.presentationOpen=!1,this.presentationHidden=!0,this.submenuAnchor=null,this.submenuStateChange=null,this.dropdownContained=!1,this.dropdownOwner=null,this._dropdownOpen=!1,this.dropdownRendersMenuRole=!1,this.dropdownStayOpenOnSelect=!1,this.items=[],this.activeIndex=-1,this.presentationPositioned=!1,this.popupController=new PopupController({host:this,onPointer:event=>this.onDocPointer(event)}),this.menubarAnchored=!1,this.pendingFocus="first",this.listId=nextId("menu-list"),this.owningMenu={activate:item=>this.onOwnedItemSelect(item),uncheckRadioGroup:(item,group)=>this.uncheckRadioGroupSiblings(item,group)},this.typeBuffer=new TypeAheadBuffer(this),this[_a]=this.createSubmenuController(),this.onRegionSlotChange=()=>{this.syncRegionState()},this.onDocPointer=e=>{const path=e.composedPath();path.includes(this)||this.submenuAnchor&&path.includes(this.submenuAnchor)||this.closePresentation()},this.onItemsSlotChange=e=>{this.syncItemsFromSlot(e.target)},this.itemStateChangeReconciliationPending=!1,this.onItemStateChangeEvent=event=>{event.stopPropagation(),!this.itemStateChangeReconciliationPending&&(this.itemStateChangeReconciliationPending=!0,queueMicrotask(()=>{this.itemStateChangeReconciliationPending=!1,this.onItemStateChange()}))},this.onItemStateChange=()=>{const navigable=[];if(this.items.forEach((item,index)=>{this.isNavigable(item)&&navigable.push({item,index})}),this.activeIndex>=0&&!this.isNavigable(this.items[this.activeIndex])){const current=this.activeIndex,displaced=this.items[current],focused=safeDeepActiveElement(this.ownerDocument),displacedHadFocus=focused===null||focused===this.ownerDocument.body||focused===displaced||composedContains(displaced,focused),next=navigable.find(({index})=>index>current)?.item??navigable.find(({index})=>index<current)?.item;next?this.setActiveItem(next,displacedHadFocus):(this.activeIndex=-1,this.applyRovingTabIndex(),displacedHadFocus&&this.rehomeZeroSurvivorFocus());return}this.applyRovingTabIndex()},this.onListFocusIn=e=>{const target=e.target;if(!isLyraMenuItemElement(target))return;const index=this.items.indexOf(target);index===-1||index===this.activeIndex||!this.isNavigable(target)||(this.activeIndex=index,this.applyRovingTabIndex(),this.closeSubmenus(target))},this.onListKeyDown=e=>{if(this.isForeignEvent(e)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing||e.keyCode===229)return;const isItemTarget=isLyraMenuItemElement(e.target);if(e.key==="Escape"&&isItemTarget&&!this.hasStandalonePresentation){e.preventDefault(),this.closePresentation({focusTrigger:!0});return}if(!isItemTarget)return;const navigable=this.items.filter(i=>this.isNavigable(i)),current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentNavIndex=current?navigable.indexOf(current):-1,intoSubmenuKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight";switch(e.key){case"ArrowRight":case"ArrowLeft":e.key===intoSubmenuKey?current?.hasSubmenu&&this.isNavigable(current)&&(e.preventDefault(),this.closeSubmenus(current),current.openSubmenu("first")):this.submenuAnchor&&!this.menubarAnchored&&(e.preventDefault(),this.closePresentation({focusTrigger:!0}));break;case"ArrowDown":case"ArrowUp":case"Home":case"End":{e.preventDefault();const nextIndex=resolveListMove(e,{count:navigable.length,current:currentNavIndex,orientation:"vertical"});nextIndex!==null&&this.setActiveItem(navigable[nextIndex]);break}case"Enter":case" ":e.preventDefault(),current?.hasSubmenu?(this.closeSubmenus(current),current.openSubmenu("first")):current?.isLinkItem?current.click():current?.select();break;default:this.typeBuffer.accepts(e)&&this.typeAhead(e.key);return}},this.onPopupPointerOver=e=>{if(!this.interactionOpen)return;const hovered=this.ownItemFromEvent(e);this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&opened===hovered?(this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuCloseTimer=void 0):opened&&this.scheduleSubmenuClose(opened),!(!hovered||hovered===opened||!hovered.hasSubmenu||!this.isNavigable(hovered))&&(this.submenuOpenTimer=this.scheduleOwnedTimeout(()=>{this.submenuOpenTimer=void 0,!(!this.interactionOpen||!this.items.includes(hovered))&&(this.closeSubmenus(hovered),hovered.openSubmenu("none"))},SUBMENU_OPEN_DELAY))},this.onPopupPointerLeave=()=>{this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&this.scheduleSubmenuClose(opened)},this.onNestedSelect=e=>{if(e.target===this)return;const event=e;this.dropdownStayOpenOnSelect&&event.preventDefault(),queueMicrotask(()=>{event.defaultPrevented||this.dismissAfterSelection(!0)})},this.onPopupKeyDown=e=>{const listEl=this.popupPart("list");if(e.key==="Escape"){if(listEl&&e.composedPath().includes(listEl)||this.hasStandalonePresentation)return;e.preventDefault(),this.closePresentation({focusTrigger:!0});return}e.key==="Tab"&&this.tabWouldLeavePopup(e)&&this.closePresentation()}}static{_a=submenuPanelController}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-select"])}static{this.identityEventDetailProperties=Object.freeze({"lr-select":Object.freeze(["item"])})}static{this.styles=[LyraElement.styles,styles]}get dropdownOpen(){return this._dropdownOpen}set dropdownOpen(next){const normalized=!!next;if(normalized===this._dropdownOpen)return;const old=this._dropdownOpen;this._dropdownOpen=normalized,this.presentationOpen=normalized,this.requestUpdate("dropdownOpen",old)}createSubmenuController(){const menu=this;return{get open(){return menu.submenuAnchor!==null&&menu.presentationOpen},attach(anchor,onStateChange,options){menu.submenuAnchor&&menu.submenuAnchor!==anchor&&menu.closePresentation(),menu.menubarAnchored=options?.menubar===!0,menu.submenuAnchor=anchor,menu.submenuStateChange=onStateChange,menu.syncPresentationState(),menu.requestUpdate()},detach(anchor){menu.submenuAnchor===anchor&&(menu.closePresentation(),menu.submenuAnchor=null,menu.menubarAnchored=!1,menu.submenuStateChange=null,menu.cleanup?.(),menu.cleanup=void 0,menu.syncPresentationState(),menu.requestUpdate())},async show(focus="first"){menu.submenuAnchor&&(menu.openPresentation(focus),await menu.updateComplete,await menu.focusAfterPlacement(focus))},async hide(options){menu.closePresentation(options),await menu.updateComplete}}}connectedCallback(){if(super.connectedCallback(),registerMenuWidthScale(),this.hasUpdated){const slot=this.renderRoot.querySelector("slot:not([name])");slot&&this.syncItemsFromSlot(slot,!0)}}firstUpdated(changed){super.firstUpdated(changed),this.syncRegionState(),this.syncPresentationState();const slot=this.itemsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.syncItemsFromSlot(s))})}get hasStandalonePresentation(){return!this.dropdownContained&&!this.submenuAnchor}get interactionOpen(){return this.hasStandalonePresentation||this.presentationOpen}syncPresentationState(){const standalone=this.hasStandalonePresentation;if(this.toggleAttribute("data-inline",standalone),this.toggleAttribute("data-submenu",this.submenuAnchor!==null),this.toggleAttribute("data-contained",this.dropdownContained),standalone){const active=this.activeIndex>=0?this.items[this.activeIndex]:void 0;if(!active||!this.isNavigable(active)){const first=this.items.find(item=>this.isNavigable(item));this.activeIndex=first?this.items.indexOf(first):-1}}else this.presentationOpen||(this.activeIndex=-1);this.applyRovingTabIndex()}syncRegionState(){const assigned=selector=>this.renderRoot.querySelector(selector)?.assignedElements({flatten:!0}).length??0;this.toggleAttribute("data-has-header",assigned('slot[name="header"]')>0),this.toggleAttribute("data-has-footer",assigned('slot[name="footer"]')>0),this.toggleAttribute("data-list-empty",assigned("slot:not([name])")===0)}willUpdate(changed){super.willUpdate(changed),this.presentationOpen&&this.submenuAnchor&&(this.cancelPresentationHideWatch(),this.presentationHidden=!1)}updated(changed){super.updated(changed);const list=this.renderRoot.querySelector('[part~="list"]')??void 0;syncAriaDescribedByElements(this,list,this.getAttribute("aria-describedby")),(changed.has("presentationOpen")||changed.has("dropdownOpen")||changed.has("dropdownContained"))&&(this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.presentationOpen?this.submenuAnchor?(this.popupController.bindPointer(),this.reposition()):(this.popupController.unbindPointer(),this.presentationPositioned=!0,this.focusRoving(this.pendingFocus)):(this.popupController.unbindPointer(),this.resetTypeAhead(),this.activeIndex=-1,this.applyRovingTabIndex(),this.clearSubmenuTimers(),this.closeSubmenus(),this.submenuAnchor&&this.schedulePresentationHide())),changed.has("dropdownContained")&&this.syncPresentationState(),changed.has("dropdownSize")&&this.applyDropdownSize()}reposition(){this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1;const popup=this.renderRoot.querySelector(".submenu-surface");if(this.submenuAnchor&&popup){const placement=this.menubarAnchored?MENUBAR_PLACEMENT:rtlAwarePlacement(SUBMENU_PLACEMENT,this),topLayer=this.submenuAnchor.closest(tag("menubar"))?.topLayer===!0;this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,topLayer),this.cleanup=place(this.submenuAnchor,popup,{placement,flipFallbackPlacements:this.menubarAnchored?void 0:SUBMENU_FALLBACK_PLACEMENTS.map(candidate=>rtlAwarePlacement(candidate,this)),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed"))})}}cancelPresentationHideWatch(){this.presentationHideWatcher?.(),this.presentationHideWatcher=void 0}schedulePresentationHide(){this.cancelPresentationHideWatch();const surface=this.renderRoot.querySelector(".submenu-surface"),view=this.ownerDocument.defaultView,transitionMs=surface&&view?maxCssTime(view.getComputedStyle(surface).transitionDuration)+maxCssTime(view.getComputedStyle(surface).transitionDelay):0,waitForEvent=!!(surface&&view&&transitionMs>0&&!prefersReducedMotion(this));let settled=!1,timeout;const finish=()=>{settled||(settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd),this.presentationHideWatcher===cancel&&(this.presentationHideWatcher=void 0),this.presentationHidden=!0)},onEnd=event=>{event.target===surface&&finish()},cancel=()=>{settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd)};this.presentationHideWatcher=cancel,waitForEvent&&surface&&view?(surface.addEventListener("transitionend",onEnd),timeout=view.setTimeout(finish,transitionMs+50)):queueMicrotask(finish)}async focusAfterPlacement(focus){if(!this.presentationOpen||!this.submenuAnchor)return;const positioned=this.cleanup!==void 0&&(this.presentationPositioned||await waitForDeferredPlacement(()=>this.cleanup));if(!(!this.presentationOpen||!this.submenuAnchor)){if(!positioned){this.closePresentation(),await this.updateComplete;return}this.presentationPositioned=!0,this.focusRoving(focus)}}disconnectedCallback(){super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.resetTypeAhead(),this.clearSubmenuTimers(),this.itemStateObserver?.disconnect(),this.itemStateObserver=void 0,this.popupController.unbindPointer();for(const item of this.items)this.releaseItemOwner(item);this._dropdownOpen=!1,this.presentationOpen=!1,this.cancelPresentationHideWatch(),this.presentationHidden=!0,this.submenuStateChange?.(!1)}scheduleOwnedTimeout(callback,delay){const owner=this.ownerDocument.defaultView;if(owner)return{owner,handle:owner.setTimeout(callback,delay)}}clearOwnedTimeout(timer){timer&&timer.owner.clearTimeout(timer.handle)}focusContained(focus="first"){if(this.dropdownContained&&this.dropdownOwner)if(this.dropdownOwner.open)this.pendingFocus=focus,this.focusRoving(focus);else{const transition=this.dropdownOwner.show();this.dropdownOwner.open&&(this.pendingFocus=focus)}}openPresentation(focus="first"){if(this.dropdownContained&&this.dropdownOwner){this.focusContained(focus);return}this.pendingFocus=focus,this.presentationOpen?(!this.submenuAnchor||this.presentationPositioned)&&this.focusRoving(focus):(this.presentationOpen=!0,this.submenuStateChange?.(!0))}closePresentation(options){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide(options);return}this.presentationOpen&&(this.presentationOpen=!1,this.submenuStateChange?.(!1),options?.focusTrigger&&this.submenuAnchor&&resolveAccessibleTrigger(this.submenuAnchor).focus())}syncItemsFromSlot(slot,reconnect=!1){if(!this.isConnected)return;const assigned=slot.assignedElements({flatten:!0}).filter(isLyraMenuItemElement);if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index])){reconnect&&(this.observeItems(),this.syncPresentationState());return}this.itemStateObserver?.disconnect();const previousItems=this.items,previouslyActive=this.activeIndex>=0?this.items[this.activeIndex]:void 0,focusedBefore=safeDeepActiveElement(this.ownerDocument),activeItemLostFocus=!!previouslyActive&&(focusedBefore===null||focusedBefore===this.ownerDocument.body||focusedBefore===previouslyActive||composedContains(previouslyActive,focusedBefore));this.items=assigned;const assignedItems=new Set(assigned);for(const item of previousItems)assignedItems.has(item)||this.releaseItemOwner(item);if(this.observeItems(),this.activeIndex=previouslyActive?this.items.indexOf(previouslyActive):-1,this.syncPresentationState(),this.syncRegionState(),this.interactionOpen)if(this.activeIndex===-1){const successor=this.items.find(item=>this.isNavigable(item));previouslyActive&&successor?this.setActiveItem(successor,activeItemLostFocus):this.focusRoving(this.pendingFocus),activeItemLostFocus&&!this.items.some(item=>this.isNavigable(item))&&this.rehomeZeroSurvivorFocus()}else{const active=activeElementIn(this.ownerDocument);!(isUsableActiveElement(active)&&this.contains(active))&&activeItemLostFocus&&this.items[this.activeIndex].focus()}}observeItems(){for(const item of this.items)this.acquireItemOwner(item);this.applyDropdownSize();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;if(MutationObserverCtor){const owner=this.ownerDocument;let observer;observer=new MutationObserverCtor(()=>{this.itemStateObserver!==observer||this.ownerDocument!==owner||this.onItemStateChange()}),this.itemStateObserver=observer;for(const item of this.items)this.itemStateObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}}acquireItemOwner(item){item[menuItemOwner]?.(this.owningMenu)}releaseItemOwner(item){item[menuItemOwner]?.(null,this.owningMenu)}uncheckRadioGroupSiblings(item,group){for(const sibling of this.items)sibling!==item&&sibling.type==="radio"&&sibling.group===group&&sibling.checked&&(sibling.checked=!1)}isNavigable(item){return!item.interactionDisabled&&isRovingTargetAvailable(item)}applyDropdownSize(){if(this.dropdownSize)for(const item of this.items)item.size=this.dropdownSize}rehomeZeroSurvivorFocus(){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide({focusTrigger:!0});return}if(this.submenuAnchor){this.closePresentation({focusTrigger:!0});return}const list=this.renderRoot.querySelector('[part~="list"]');list&&(list.tabIndex=-1,list.focus({preventScroll:!0}))}onOwnedItemSelect(item){if(!isLyraMenuItemElement(item)||!this.items.includes(item))return;!this.emit("lr-select",{item},{cancelable:!0}).defaultPrevented&&!this.dropdownStayOpenOnSelect&&this.dismissAfterSelection(!0)}dismissAfterSelection(focusTrigger){this.closeSubmenus(),this.dropdownContained?this.dropdownOwner&&this.dropdownOwner.hide({focusTrigger}):this.submenuAnchor&&this.closePresentation({focusTrigger})}applyRovingTabIndex(){this.items.forEach((item,i)=>{item.tabIndex=i===this.activeIndex?0:-1})}focusRoving(which){if(which==="none")return;const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const item=which==="first"?navigable[0]:navigable[navigable.length-1];item&&this.setActiveItem(item)}setActiveItem(item,moveFocus=!0){this.activeIndex=this.items.indexOf(item),this.applyRovingTabIndex(),this.closeSubmenus(item),moveFocus&&item.focus()}closeSubmenus(keep){for(const item of this.items)item!==keep&&item.submenuOpen&&item.closeSubmenu()}openSubmenuItem(){return this.items.find(item=>item.submenuOpen)}clearSubmenuTimers(){this.clearOwnedTimeout(this.submenuOpenTimer),this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuOpenTimer=void 0,this.submenuCloseTimer=void 0}ownItemFromEvent(e){let owner;for(const node of e.composedPath()){if(node===this)break;isLyraMenuItemElement(node)&&(owner=node)}return owner}isForeignEvent(e){for(const node of e.composedPath()){if(node===this)return!1;if(isLyraMenuElement(node))return!0}return!1}scheduleSubmenuClose(item){this.submenuCloseTimer||(this.submenuCloseTimer=this.scheduleOwnedTimeout(()=>{this.submenuCloseTimer=void 0,item.submenuOpen&&(composedContains(item,safeDeepActiveElement(this.ownerDocument))||item.closeSubmenu())},SUBMENU_CLOSE_DELAY))}popupPart(name){return this.renderRoot.querySelector(`[part="${name}"]`)}tabWouldLeavePopup(e){const header=this.popupPart("header"),footer=this.popupPart("footer"),listEl=this.popupPart("list"),backwards=e.shiftKey,active=safeDeepActiveElement(this.ownerDocument),headerStops=header?collectFocusableElements(header):[],footerStops=footer?collectFocusableElements(footer):[],listStops=listEl?collectFocusableElements(listEl):[],hasNeighbor=stops=>{const index=active?stops.indexOf(active):-1;return index===-1?!1:backwards?index>0:index<stops.length-1},path=e.composedPath();return footer&&path.includes(footer)?hasNeighbor(footerStops)?!1:backwards?listStops.length===0&&headerStops.length===0:!0:header&&path.includes(header)?hasNeighbor(headerStops)?!1:backwards?!0:listStops.length===0&&footerStops.length===0:!isLyraMenuItemElement(e.target)&&hasNeighbor(listStops)?!1:backwards?headerStops.length===0:footerStops.length===0}typeAhead(char){this.typeBuffer.add(char,this.effectiveLocale);const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentIndex=current?navigable.indexOf(current):-1,match=this.typeBuffer.match(navigable,currentIndex,item=>item.getTextLabel(),this.effectiveLocale);match!==null&&this.setActiveItem(navigable[match])}resetTypeAhead(){this.typeBuffer.clear()}get effectiveLabel(){const hostLabel=this.getAttribute("aria-label");return hostLabel!==null?hostLabel:this.label!==void 0?this.label:this.dropdownLabel!==void 0?this.dropdownLabel:this.localize("menuLabel")}renderContents(bindPointerOver=!0){return html`
1
+ var _a;import{__decorate}from"tslib";import{resolveIntlLocale}from"../../../internal/intl-cache.js";import{maxCssTime}from"../../../internal/css-motion-time.js";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlaceReady as place,syncTopLayerRelease,topLayerPlacement,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{PopupController}from"../../../internal/popup-controller.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{collectFocusableElements,composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./menu.styles.js";import{menuItemOwner,submenuPanelController}from"./menu-shared.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{tag}from"../../../internal/prefix.js";import{activeElementIn,isUsableActiveElement,safeDeepActiveElement}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import"./menu-item.class.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const SUBMENU_PLACEMENT="right-start",SUBMENU_FALLBACK_PLACEMENTS=["right-end","left-start","left-end","bottom-start","top-start"],MENUBAR_PLACEMENT="bottom-start",SUBMENU_OPEN_DELAY=150,SUBMENU_CLOSE_DELAY=300;function isLyraMenuItemElement(value){return isHtmlElement(value)?value.localName===tag("menu-item")||value.localName===tag("dropdown-item"):!1}function isLyraMenuElement(value){return isHtmlElement(value)&&value.localName===tag("menu")}let menuWidthScaleRegistered=!1;function registerMenuWidthScale(){if(!menuWidthScaleRegistered&&(menuWidthScaleRegistered=!0,!(typeof CSS>"u"||typeof CSS.registerProperty!="function")))try{CSS.registerProperty({name:"--_lr-menu-max-inline-size",syntax:"<length-percentage>",inherits:!1,initialValue:"100%"})}catch{}}class LyraMenu extends LyraElement{constructor(){super(...arguments),this.presentationOpen=!1,this.presentationHidden=!0,this.submenuAnchor=null,this.submenuStateChange=null,this.dropdownContained=!1,this.dropdownOwner=null,this._dropdownOpen=!1,this.dropdownRendersMenuRole=!1,this.dropdownStayOpenOnSelect=!1,this.items=[],this.activeIndex=-1,this.presentationPositioned=!1,this.popupController=new PopupController({host:this,onPointer:event=>this.onDocPointer(event)}),this.menubarAnchored=!1,this.pendingFocus="first",this.listId=nextId("menu-list"),this.owningMenu={activate:item=>this.onOwnedItemSelect(item),uncheckRadioGroup:(item,group)=>this.uncheckRadioGroupSiblings(item,group)},this.typeBuffer=new TypeAheadBuffer(this),this.typeAheadLabels=new WeakMap,this[_a]=this.createSubmenuController(),this.onRegionSlotChange=()=>{this.syncRegionState()},this.onDocPointer=e=>{const path=e.composedPath();path.includes(this)||this.submenuAnchor&&path.includes(this.submenuAnchor)||this.closePresentation()},this.onItemsSlotChange=e=>{this.syncItemsFromSlot(e.target)},this.itemStateChangeReconciliationPending=!1,this.onItemStateChangeEvent=event=>{event.stopPropagation(),!this.itemStateChangeReconciliationPending&&(this.itemStateChangeReconciliationPending=!0,queueMicrotask(()=>{this.itemStateChangeReconciliationPending=!1,this.onItemStateChange()}))},this.onItemStateChange=()=>{const navigable=[];if(this.items.forEach((item,index)=>{this.isNavigable(item)&&navigable.push({item,index})}),this.activeIndex>=0&&!this.isNavigable(this.items[this.activeIndex])){const current=this.activeIndex,displaced=this.items[current],focused=safeDeepActiveElement(this.ownerDocument),displacedHadFocus=focused===null||focused===this.ownerDocument.body||focused===displaced||composedContains(displaced,focused),next=navigable.find(({index})=>index>current)?.item??navigable.find(({index})=>index<current)?.item;next?this.setActiveItem(next,displacedHadFocus):(this.activeIndex=-1,this.applyRovingTabIndex(),displacedHadFocus&&this.rehomeZeroSurvivorFocus());return}this.applyRovingTabIndex()},this.onListFocusIn=e=>{const target=e.target;if(!isLyraMenuItemElement(target))return;const index=this.items.indexOf(target);index===-1||index===this.activeIndex||!this.isNavigable(target)||(this.activeIndex=index,this.applyRovingTabIndex(),this.closeSubmenus(target))},this.onListKeyDown=e=>{if(this.isForeignEvent(e)||e.altKey||e.ctrlKey||e.metaKey||e.isComposing||e.keyCode===229)return;const isItemTarget=isLyraMenuItemElement(e.target);if(e.key==="Escape"&&isItemTarget&&!this.hasStandalonePresentation){e.preventDefault(),this.closePresentation({focusTrigger:!0});return}if(!isItemTarget)return;const navigable=this.items.filter(i=>this.isNavigable(i)),current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentNavIndex=current?navigable.indexOf(current):-1,intoSubmenuKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight";switch(e.key){case"ArrowRight":case"ArrowLeft":e.key===intoSubmenuKey?current?.hasSubmenu&&this.isNavigable(current)&&(e.preventDefault(),this.closeSubmenus(current),current.openSubmenu("first")):this.submenuAnchor&&!this.menubarAnchored&&(e.preventDefault(),this.closePresentation({focusTrigger:!0}));break;case"ArrowDown":case"ArrowUp":case"Home":case"End":{e.preventDefault();const nextIndex=resolveListMove(e,{count:navigable.length,current:currentNavIndex,orientation:"vertical"});nextIndex!==null&&this.setActiveItem(navigable[nextIndex]);break}case"Enter":case" ":e.preventDefault(),current?.hasSubmenu?(this.closeSubmenus(current),current.openSubmenu("first")):current?.isLinkItem?current.click():current?.select();break;default:this.typeBuffer.accepts(e)&&this.typeAhead(e.key);return}},this.onPopupPointerOver=e=>{if(!this.interactionOpen)return;const hovered=this.ownItemFromEvent(e);this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&opened===hovered?(this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuCloseTimer=void 0):opened&&this.scheduleSubmenuClose(opened),!(!hovered||hovered===opened||!hovered.hasSubmenu||!this.isNavigable(hovered))&&(this.submenuOpenTimer=this.scheduleOwnedTimeout(()=>{this.submenuOpenTimer=void 0,!(!this.interactionOpen||!this.items.includes(hovered))&&(this.closeSubmenus(hovered),hovered.openSubmenu("none"))},SUBMENU_OPEN_DELAY))},this.onPopupPointerLeave=()=>{this.clearOwnedTimeout(this.submenuOpenTimer),this.submenuOpenTimer=void 0;const opened=this.openSubmenuItem();opened&&this.scheduleSubmenuClose(opened)},this.onNestedSelect=e=>{if(e.target===this)return;const event=e;this.dropdownStayOpenOnSelect&&event.preventDefault(),queueMicrotask(()=>{event.defaultPrevented||this.dismissAfterSelection(!0)})},this.onPopupKeyDown=e=>{const listEl=this.popupPart("list");if(e.key==="Escape"){if(listEl&&e.composedPath().includes(listEl)||this.hasStandalonePresentation)return;e.preventDefault(),this.closePresentation({focusTrigger:!0});return}e.key==="Tab"&&this.tabWouldLeavePopup(e)&&this.closePresentation()}}static{_a=submenuPanelController}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-select"])}static{this.identityEventDetailProperties=Object.freeze({"lr-select":Object.freeze(["item"])})}static{this.styles=[LyraElement.styles,styles]}get dropdownOpen(){return this._dropdownOpen}set dropdownOpen(next){const normalized=!!next;if(normalized===this._dropdownOpen)return;const old=this._dropdownOpen;this._dropdownOpen=normalized,this.presentationOpen=normalized,this.requestUpdate("dropdownOpen",old)}foldedTypeAheadLabel(item,locale){const label=item.getTextLabel(),previous=this.typeAheadLabels.get(item);if(previous?.label===label&&previous.locale===locale)return previous.folded;const folded=label.toLocaleLowerCase(resolveIntlLocale(locale));return this.typeAheadLabels.set(item,{label,locale,folded}),folded}createSubmenuController(){const menu=this;return{get open(){return menu.submenuAnchor!==null&&menu.presentationOpen},attach(anchor,onStateChange,options){menu.submenuAnchor&&menu.submenuAnchor!==anchor&&menu.closePresentation(),menu.menubarAnchored=options?.menubar===!0,menu.submenuAnchor=anchor,menu.submenuStateChange=onStateChange,menu.syncPresentationState(),menu.requestUpdate()},detach(anchor){menu.submenuAnchor===anchor&&(menu.closePresentation(),menu.submenuAnchor=null,menu.menubarAnchored=!1,menu.submenuStateChange=null,menu.cleanup?.(),menu.cleanup=void 0,menu.syncPresentationState(),menu.requestUpdate())},async show(focus="first"){menu.submenuAnchor&&(menu.openPresentation(focus),await menu.updateComplete,await menu.focusAfterPlacement(focus))},async hide(options){menu.closePresentation(options),await menu.updateComplete}}}connectedCallback(){if(super.connectedCallback(),registerMenuWidthScale(),this.hasUpdated){const slot=this.renderRoot.querySelector("slot:not([name])");slot&&this.syncItemsFromSlot(slot,!0)}}firstUpdated(changed){super.firstUpdated(changed),this.syncRegionState(),this.syncPresentationState();const slot=this.itemsSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.syncItemsFromSlot(s))})}get hasStandalonePresentation(){return!this.dropdownContained&&!this.submenuAnchor}get interactionOpen(){return this.hasStandalonePresentation||this.presentationOpen}syncPresentationState(){const standalone=this.hasStandalonePresentation;if(this.toggleAttribute("data-inline",standalone),this.toggleAttribute("data-submenu",this.submenuAnchor!==null),this.toggleAttribute("data-contained",this.dropdownContained),standalone){const active=this.activeIndex>=0?this.items[this.activeIndex]:void 0;if(!active||!this.isNavigable(active)){const first=this.items.find(item=>this.isNavigable(item));this.activeIndex=first?this.items.indexOf(first):-1}}else this.presentationOpen||(this.activeIndex=-1);this.applyRovingTabIndex()}syncRegionState(){const assigned=selector=>this.renderRoot.querySelector(selector)?.assignedElements({flatten:!0}).length??0;this.toggleAttribute("data-has-header",assigned('slot[name="header"]')>0),this.toggleAttribute("data-has-footer",assigned('slot[name="footer"]')>0),this.toggleAttribute("data-list-empty",assigned("slot:not([name])")===0)}willUpdate(changed){super.willUpdate(changed),this.presentationOpen&&this.submenuAnchor&&(this.cancelPresentationHideWatch(),this.presentationHidden=!1)}updated(changed){super.updated(changed);const list=this.renderRoot.querySelector('[part~="list"]')??void 0;syncAriaDescribedByElements(this,list,this.getAttribute("aria-describedby")),(changed.has("presentationOpen")||changed.has("dropdownOpen")||changed.has("dropdownContained"))&&(this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.presentationOpen?this.submenuAnchor?(this.popupController.bindPointer(),this.reposition()):(this.popupController.unbindPointer(),this.presentationPositioned=!0,this.focusRoving(this.pendingFocus)):(this.popupController.unbindPointer(),this.resetTypeAhead(),this.activeIndex=-1,this.applyRovingTabIndex(),this.clearSubmenuTimers(),this.closeSubmenus(),this.submenuAnchor&&this.schedulePresentationHide())),changed.has("dropdownContained")&&this.syncPresentationState(),changed.has("dropdownSize")&&this.applyDropdownSize()}reposition(){this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1;const popup=this.renderRoot.querySelector(".submenu-surface");if(this.submenuAnchor&&popup){const placement=this.menubarAnchored?MENUBAR_PLACEMENT:rtlAwarePlacement(SUBMENU_PLACEMENT,this),topLayer=this.submenuAnchor.closest(tag("menubar"))?.topLayer===!0;this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,topLayer),this.cleanup=place(this.submenuAnchor,popup,{placement,flipFallbackPlacements:this.menubarAnchored?void 0:SUBMENU_FALLBACK_PLACEMENTS.map(candidate=>rtlAwarePlacement(candidate,this)),...topLayerPlacement(topLayer,resolveEffectivePositioningStrategy(this,void 0,"fixed"))})}}cancelPresentationHideWatch(){this.presentationHideWatcher?.(),this.presentationHideWatcher=void 0}schedulePresentationHide(){this.cancelPresentationHideWatch();const surface=this.renderRoot.querySelector(".submenu-surface"),view=this.ownerDocument.defaultView,transitionMs=surface&&view?maxCssTime(view.getComputedStyle(surface).transitionDuration)+maxCssTime(view.getComputedStyle(surface).transitionDelay):0,waitForEvent=!!(surface&&view&&transitionMs>0&&!prefersReducedMotion(this));let settled=!1,timeout;const finish=()=>{settled||(settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd),this.presentationHideWatcher===cancel&&(this.presentationHideWatcher=void 0),this.presentationHidden=!0)},onEnd=event=>{event.target===surface&&finish()},cancel=()=>{settled=!0,timeout!==void 0&&view?.clearTimeout(timeout),surface?.removeEventListener("transitionend",onEnd)};this.presentationHideWatcher=cancel,waitForEvent&&surface&&view?(surface.addEventListener("transitionend",onEnd),timeout=view.setTimeout(finish,transitionMs+50)):queueMicrotask(finish)}async focusAfterPlacement(focus){if(!this.presentationOpen||!this.submenuAnchor)return;const positioned=this.cleanup!==void 0&&(this.presentationPositioned||await waitForDeferredPlacement(()=>this.cleanup));if(!(!this.presentationOpen||!this.submenuAnchor)){if(!positioned){this.closePresentation(),await this.updateComplete;return}this.presentationPositioned=!0,this.focusRoving(focus)}}disconnectedCallback(){super.disconnectedCallback(),this.cleanup?.(),this.cleanup=void 0,this.presentationPositioned=!1,this.resetTypeAhead(),this.clearSubmenuTimers(),this.itemStateObserver?.disconnect(),this.itemStateObserver=void 0,this.popupController.unbindPointer();for(const item of this.items)this.releaseItemOwner(item);this._dropdownOpen=!1,this.presentationOpen=!1,this.cancelPresentationHideWatch(),this.presentationHidden=!0,this.submenuStateChange?.(!1)}scheduleOwnedTimeout(callback,delay){const owner=this.ownerDocument.defaultView;if(owner)return{owner,handle:owner.setTimeout(callback,delay)}}clearOwnedTimeout(timer){timer&&timer.owner.clearTimeout(timer.handle)}focusContained(focus="first"){if(this.dropdownContained&&this.dropdownOwner)if(this.dropdownOwner.open)this.pendingFocus=focus,this.focusRoving(focus);else{const transition=this.dropdownOwner.show();this.dropdownOwner.open&&(this.pendingFocus=focus)}}openPresentation(focus="first"){if(this.dropdownContained&&this.dropdownOwner){this.focusContained(focus);return}this.pendingFocus=focus,this.presentationOpen?(!this.submenuAnchor||this.presentationPositioned)&&this.focusRoving(focus):(this.presentationOpen=!0,this.submenuStateChange?.(!0))}closePresentation(options){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide(options);return}this.presentationOpen&&(this.presentationOpen=!1,this.submenuStateChange?.(!1),options?.focusTrigger&&this.submenuAnchor&&resolveAccessibleTrigger(this.submenuAnchor).focus())}syncItemsFromSlot(slot,reconnect=!1){if(!this.isConnected)return;const assigned=slot.assignedElements({flatten:!0}).filter(isLyraMenuItemElement);if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index])){reconnect&&(this.observeItems(),this.syncPresentationState());return}this.itemStateObserver?.disconnect();const previousItems=this.items,previouslyActive=this.activeIndex>=0?this.items[this.activeIndex]:void 0,focusedBefore=safeDeepActiveElement(this.ownerDocument),activeItemLostFocus=!!previouslyActive&&(focusedBefore===null||focusedBefore===this.ownerDocument.body||focusedBefore===previouslyActive||composedContains(previouslyActive,focusedBefore));this.items=assigned;const assignedItems=new Set(assigned);for(const item of previousItems)assignedItems.has(item)||this.releaseItemOwner(item);if(this.observeItems(),this.activeIndex=previouslyActive?this.items.indexOf(previouslyActive):-1,this.syncPresentationState(),this.syncRegionState(),this.interactionOpen)if(this.activeIndex===-1){const successor=this.items.find(item=>this.isNavigable(item));previouslyActive&&successor?this.setActiveItem(successor,activeItemLostFocus):this.focusRoving(this.pendingFocus),activeItemLostFocus&&!this.items.some(item=>this.isNavigable(item))&&this.rehomeZeroSurvivorFocus()}else{const active=activeElementIn(this.ownerDocument);!(isUsableActiveElement(active)&&this.contains(active))&&activeItemLostFocus&&this.items[this.activeIndex].focus()}}observeItems(){for(const item of this.items)this.acquireItemOwner(item);this.applyDropdownSize();const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;if(MutationObserverCtor){const owner=this.ownerDocument;let observer;observer=new MutationObserverCtor(()=>{this.itemStateObserver!==observer||this.ownerDocument!==owner||this.onItemStateChange()}),this.itemStateObserver=observer;for(const item of this.items)this.itemStateObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}}acquireItemOwner(item){item[menuItemOwner]?.(this.owningMenu)}releaseItemOwner(item){item[menuItemOwner]?.(null,this.owningMenu)}uncheckRadioGroupSiblings(item,group){for(const sibling of this.items)sibling!==item&&sibling.type==="radio"&&sibling.group===group&&sibling.checked&&(sibling.checked=!1)}isNavigable(item){return!item.interactionDisabled&&isRovingTargetAvailable(item)}applyDropdownSize(){if(this.dropdownSize)for(const item of this.items)item.size=this.dropdownSize}rehomeZeroSurvivorFocus(){if(this.dropdownContained&&this.dropdownOwner){this.dropdownOwner.hide({focusTrigger:!0});return}if(this.submenuAnchor){this.closePresentation({focusTrigger:!0});return}const list=this.renderRoot.querySelector('[part~="list"]');list&&(list.tabIndex=-1,list.focus({preventScroll:!0}))}onOwnedItemSelect(item){if(!isLyraMenuItemElement(item)||!this.items.includes(item))return;!this.emit("lr-select",{item},{cancelable:!0}).defaultPrevented&&!this.dropdownStayOpenOnSelect&&this.dismissAfterSelection(!0)}dismissAfterSelection(focusTrigger){this.closeSubmenus(),this.dropdownContained?this.dropdownOwner&&this.dropdownOwner.hide({focusTrigger}):this.submenuAnchor&&this.closePresentation({focusTrigger})}applyRovingTabIndex(){this.items.forEach((item,i)=>{item.tabIndex=i===this.activeIndex?0:-1})}focusRoving(which){if(which==="none")return;const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const item=which==="first"?navigable[0]:navigable[navigable.length-1];item&&this.setActiveItem(item)}setActiveItem(item,moveFocus=!0){this.activeIndex=this.items.indexOf(item),this.applyRovingTabIndex(),this.closeSubmenus(item),moveFocus&&item.focus()}closeSubmenus(keep){for(const item of this.items)item!==keep&&item.submenuOpen&&item.closeSubmenu()}openSubmenuItem(){return this.items.find(item=>item.submenuOpen)}clearSubmenuTimers(){this.clearOwnedTimeout(this.submenuOpenTimer),this.clearOwnedTimeout(this.submenuCloseTimer),this.submenuOpenTimer=void 0,this.submenuCloseTimer=void 0}ownItemFromEvent(e){let owner;for(const node of e.composedPath()){if(node===this)break;isLyraMenuItemElement(node)&&(owner=node)}return owner}isForeignEvent(e){for(const node of e.composedPath()){if(node===this)return!1;if(isLyraMenuElement(node))return!0}return!1}scheduleSubmenuClose(item){this.submenuCloseTimer||(this.submenuCloseTimer=this.scheduleOwnedTimeout(()=>{this.submenuCloseTimer=void 0,item.submenuOpen&&(composedContains(item,safeDeepActiveElement(this.ownerDocument))||item.closeSubmenu())},SUBMENU_CLOSE_DELAY))}popupPart(name){return this.renderRoot.querySelector(`[part="${name}"]`)}tabWouldLeavePopup(e){const header=this.popupPart("header"),footer=this.popupPart("footer"),listEl=this.popupPart("list"),backwards=e.shiftKey,active=safeDeepActiveElement(this.ownerDocument),headerStops=header?collectFocusableElements(header):[],footerStops=footer?collectFocusableElements(footer):[],listStops=listEl?collectFocusableElements(listEl):[],hasNeighbor=stops=>{const index=active?stops.indexOf(active):-1;return index===-1?!1:backwards?index>0:index<stops.length-1},path=e.composedPath();return footer&&path.includes(footer)?hasNeighbor(footerStops)?!1:backwards?listStops.length===0&&headerStops.length===0:!0:header&&path.includes(header)?hasNeighbor(headerStops)?!1:backwards?!0:listStops.length===0&&footerStops.length===0:!isLyraMenuItemElement(e.target)&&hasNeighbor(listStops)?!1:backwards?headerStops.length===0:footerStops.length===0}typeAhead(char){this.typeBuffer.add(char,this.effectiveLocale);const navigable=this.items.filter(i=>this.isNavigable(i));if(!navigable.length)return;const current=this.activeIndex>=0?this.items[this.activeIndex]:void 0,currentIndex=current?navigable.indexOf(current):-1,locale=resolveIntlLocale(this.effectiveLocale);let match=null;for(let step=1;step<=navigable.length;step++){const candidate=((currentIndex+step)%navigable.length+navigable.length)%navigable.length;if(this.foldedTypeAheadLabel(navigable[candidate],locale).startsWith(this.typeBuffer.text)){match=candidate;break}}match!==null&&this.setActiveItem(navigable[match])}resetTypeAhead(){this.typeBuffer.clear()}get effectiveLabel(){const hostLabel=this.getAttribute("aria-label");return hostLabel!==null?hostLabel:this.label!==void 0?this.label:this.dropdownLabel!==void 0?this.dropdownLabel:this.localize("menuLabel")}renderContents(bindPointerOver=!0){return html`
2
2
  <div part="header">
3
3
  <slot name="header" @slotchange=${this.onRegionSlotChange}></slot>
4
4
  </div>
@@ -30,4 +30,4 @@ topLayer:boolean;
30
30
  /** Shared control size inherited by every title. */
31
31
  size:LyraSize;
32
32
  /** Card chrome or a transparent frame with identical geometry. */
33
- frame:LyraFrame;private items;private activeIndex;private expandedItem;private overlayHandle?;private itemObserver?;private readonly typeBuffer;private focusedItem;private readonly owner;constructor();connectedCallback():void;disconnectedCallback():void;protected firstUpdated(changed:PropertyValues):void;private isNavigable;private observeItems;private syncItems;private rehome;private syncItemState;private setActive;private registerOverlay;private open;private carry;private collapse;private menuStateChanged;private onDocumentFocus;private eventItem;private onClick;private onPointerOver;private move;private onKeyDown;render():TemplateResult;}
33
+ frame:LyraFrame;private items;private activeIndex;private expandedItem;private overlayHandle?;private itemObserver?;private readonly typeBuffer;private readonly typeAheadLabels;private foldedTypeAheadLabel;private focusedItem;private readonly owner;constructor();connectedCallback():void;disconnectedCallback():void;protected firstUpdated(changed:PropertyValues):void;private isNavigable;private observeItems;private syncItems;private rehome;private syncItemState;private setActive;private registerOverlay;private open;private carry;private collapse;private menuStateChanged;private onDocumentFocus;private eventItem;private onClick;private onPointerOver;private move;private onKeyDown;render():TemplateResult;}
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{keyEventOwnedByInnerControl}from"../../../internal/hotkey.js";import{sizes}from"../../../internal/sizes.styles.js";import{tag}from"../../../internal/prefix.js";import{menubarItemOwner}from"./menubar-shared.js";import{styles}from"./menubar.styles.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";class LyraMenubar extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.styles=[LyraElement.styles,sizes,styles]}constructor(){super(),this.topLayer=!1,this.size="m",this.frame="card",this.items=[],this.activeIndex=-1,this.expandedItem=null,this.typeBuffer=new TypeAheadBuffer(this),this.focusedItem=null,this.owner={menuStateChanged:(item,open)=>this.menuStateChanged(item,open),itemStateChanged:()=>this.syncItemState()},this.syncItems=()=>{const assigned=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})??[]).filter(element=>element.localName===tag("menubar-item"));if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index]))return;const previous=this.items[this.activeIndex],oldIndex=this.activeIndex,active=deepActiveElement(this.ownerDocument),heldFocus=!!previous&&(active===previous||!!active&&composedContains(previous,active)||this.focusedItem===previous&&(!active||active===this.ownerDocument.body)),assignedItems=new Set(assigned);for(const item of this.items)assignedItems.has(item)||item[menubarItemOwner](null,this.owner);this.items=assigned;for(const item of this.items)item[menubarItemOwner](this.owner);this.observeItems(),previous&&assignedItems.has(previous)&&this.isNavigable(previous)?this.setActive(previous):this.rehome(oldIndex,heldFocus),this.expandedItem&&!assignedItems.has(this.expandedItem)&&this.collapse()},this.onDocumentFocus=()=>{const active=deepActiveElement(this.ownerDocument);(!active||!composedContains(this,active))&&(this.focusedItem=null,this.collapse())},this.onClick=event=>{const found=this.eventItem(event);if(!found||found.inMenu)return;const{item}=found;if(this.setActive(item,!0),!item.hasMenu){this.expandedItem&&this.collapse();return}this.expandedItem===item?this.collapse():this.expandedItem?this.carry(item):this.open(item,"none")},this.onPointerOver=event=>{if(!this.expandedItem||event.pointerType==="touch")return;const found=this.eventItem(event);found&&!found.inMenu&&found.item.hasMenu&&found.item!==this.expandedItem&&this.carry(found.item)},this.onKeyDown=event=>{if(event.defaultPrevented||event.isComposing||event.keyCode===229||event.altKey||event.ctrlKey||event.metaKey)return;const found=this.eventItem(event);if(!found)return;const{item,inMenu}=found;if(inMenu){if(!isHtmlElement(event.target)||![tag("menu-item"),tag("dropdown-item")].includes(event.target.localName)||keyEventOwnedByInnerControl(event,{container:event.target})||event.key!=="ArrowLeft"&&event.key!=="ArrowRight")return}else if(event.target!==item||keyEventOwnedByInnerControl(event,{container:item}))return;const navigable=this.items.filter(candidate=>this.isNavigable(candidate));if(!navigable.length)return;const index=navigable.indexOf(item);let next;const nextIndex=resolveListMove(event,{count:navigable.length,current:index,orientation:"horizontal",direction:this.effectiveDirection});if(nextIndex!==null)next=navigable[nextIndex];else if(["ArrowDown","ArrowUp","Enter"," "].includes(event.key)){item.hasMenu?(event.preventDefault(),this.open(item,event.key==="ArrowUp"?"last":"first")):(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),item.click());return}else if(this.typeBuffer.accepts(event)){this.typeBuffer.add(event.key,this.effectiveLocale);const match=this.typeBuffer.match(navigable,index,item2=>item2.textLabel,this.effectiveLocale);match!==null&&(next=navigable[match])}next&&(event.preventDefault(),this.move(next))},this.addEventListener("keydown",this.onKeyDown),this.addEventListener("click",this.onClick),this.addEventListener("pointerover",this.onPointerOver),this.addEventListener("focusin",event=>{const item=this.items.find(candidate=>candidate===event.target);item&&this.isNavigable(item)&&(this.focusedItem=item,this.setActive(item))})}connectedCallback(){if(super.connectedCallback(),this.hasUpdated){for(const item of this.items)item[menubarItemOwner](this.owner);this.observeItems(),queueMicrotask(()=>{this.isConnected&&(this.syncItems(),this.syncItemState())})}}disconnectedCallback(){this.collapse(),this.typeBuffer.clear(),this.itemObserver?.disconnect(),this.itemObserver=void 0,this.ownerDocument.removeEventListener("focusin",this.onDocumentFocus,!0);for(const item of this.items)item[menubarItemOwner](null,this.owner);this.focusedItem=null,super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),queueMicrotask(()=>{this.isConnected&&collectInitialSlotAssignment(this.renderRoot.querySelector("slot"),this.syncItems)})}isNavigable(item){return isRovingTargetAvailable(item)}observeItems(){this.itemObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;if(Observer){this.itemObserver=new Observer(()=>this.syncItemState());for(const item of this.items)this.itemObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}}rehome(index,focus){const successor=this.items.find((item,current)=>current>=Math.max(0,index)&&this.isNavigable(item))??this.items.slice(0,Math.max(0,index)).reverse().find(item=>this.isNavigable(item));if(successor)this.setActive(successor,focus);else{this.activeIndex=-1;for(const item of this.items)item.tabIndex=-1}}syncItemState(){const active=this.items[this.activeIndex];if(!active||!this.isNavigable(active)){const focused=deepActiveElement(this.ownerDocument);this.rehome(this.activeIndex,!!active&&(focused===active||!!focused&&composedContains(active,focused)))}this.expandedItem&&(!this.isNavigable(this.expandedItem)||!this.expandedItem.hasMenu)&&this.collapse()}setActive(item,focus=!1){if(this.isNavigable(item)){this.activeIndex=this.items.indexOf(item);for(const candidate of this.items)candidate.tabIndex=candidate===item?0:-1;focus&&(this.focusedItem=item,item.focus({preventScroll:!0}))}}registerOverlay(){this.overlayHandle||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this,preferredInitialFocus:()=>this.expandedItem,onEscape:()=>this.collapse(),onTab:()=>this.collapse(),restoreFocusTo:()=>{const active=deepActiveElement(this.ownerDocument);return isHtmlElement(active)&&active!==this.ownerDocument.body&&active!==this.ownerDocument.documentElement?active:null}}),this.ownerDocument.addEventListener("focusin",this.onDocumentFocus,!0))}open(item,focus){const previous=this.expandedItem;this.expandedItem=item,previous&&previous!==item&&previous.closeMenu(),this.registerOverlay(),item.openMenu(focus)}carry(item){const previous=this.expandedItem;this.setActive(item,!0),item.hasMenu&&this.isNavigable(item)?(this.expandedItem=item,previous&&previous!==item&&previous.closeMenu(),item.openMenu("none")):this.collapse()}collapse(){const item=this.expandedItem;this.expandedItem=null,this.ownerDocument.removeEventListener("focusin",this.onDocumentFocus,!0);const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate(),item&&item.closeMenu()}menuStateChanged(item,open){if(this.items.includes(item))if(open&&item!==this.expandedItem){const previous=this.expandedItem;this.expandedItem=item,previous&&previous.closeMenu(),this.registerOverlay()}else!open&&item===this.expandedItem&&this.collapse()}eventItem(event){const path=event.composedPath(),item=path.find(target=>this.items.includes(target));if(!item||!this.isNavigable(item))return;const preceding=path.slice(0,path.indexOf(item));return{item,path:preceding,inMenu:preceding.some(node=>isHtmlElement(node)&&node.localName===tag("menu"))}}move(item){this.expandedItem?this.carry(item):this.setActive(item,!0)}render(){return html`<div part="base" role="menubar" aria-label=${this.getAttribute("aria-label")??this.label??this.localize("menuLabel")}><slot @slotchange=${this.syncItems}></slot></div>`}}__decorate([property()],LyraMenubar.prototype,"label",void 0),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraMenubar.prototype,"topLayer",void 0),__decorate([property({reflect:!0})],LyraMenubar.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraMenubar.prototype,"frame",void 0);export{LyraMenubar};
1
+ import{__decorate}from"tslib";import{resolveIntlLocale}from"../../../internal/intl-cache.js";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{TypeAheadBuffer}from"../../../internal/type-ahead-buffer.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{activateNonmodalOverlay,composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{keyEventOwnedByInnerControl}from"../../../internal/hotkey.js";import{sizes}from"../../../internal/sizes.styles.js";import{tag}from"../../../internal/prefix.js";import{menubarItemOwner}from"./menubar-shared.js";import{styles}from"./menubar.styles.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";class LyraMenubar extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.styles=[LyraElement.styles,sizes,styles]}foldedTypeAheadLabel(item,locale){const label=item.textLabel,previous=this.typeAheadLabels.get(item);if(previous?.label===label&&previous.locale===locale)return previous.folded;const folded=label.toLocaleLowerCase(resolveIntlLocale(locale));return this.typeAheadLabels.set(item,{label,locale,folded}),folded}constructor(){super(),this.topLayer=!1,this.size="m",this.frame="card",this.items=[],this.activeIndex=-1,this.expandedItem=null,this.typeBuffer=new TypeAheadBuffer(this),this.typeAheadLabels=new WeakMap,this.focusedItem=null,this.owner={menuStateChanged:(item,open)=>this.menuStateChanged(item,open),itemStateChanged:()=>this.syncItemState()},this.syncItems=()=>{const assigned=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})??[]).filter(element=>element.localName===tag("menubar-item"));if(assigned.length===this.items.length&&assigned.every((item,index)=>item===this.items[index]))return;const previous=this.items[this.activeIndex],oldIndex=this.activeIndex,active=deepActiveElement(this.ownerDocument),heldFocus=!!previous&&(active===previous||!!active&&composedContains(previous,active)||this.focusedItem===previous&&(!active||active===this.ownerDocument.body)),assignedItems=new Set(assigned);for(const item of this.items)assignedItems.has(item)||item[menubarItemOwner](null,this.owner);this.items=assigned;for(const item of this.items)item[menubarItemOwner](this.owner);this.observeItems(),previous&&assignedItems.has(previous)&&this.isNavigable(previous)?this.setActive(previous):this.rehome(oldIndex,heldFocus),this.expandedItem&&!assignedItems.has(this.expandedItem)&&this.collapse()},this.onDocumentFocus=()=>{const active=deepActiveElement(this.ownerDocument);(!active||!composedContains(this,active))&&(this.focusedItem=null,this.collapse())},this.onClick=event=>{const found=this.eventItem(event);if(!found||found.inMenu)return;const{item}=found;if(this.setActive(item,!0),!item.hasMenu){this.expandedItem&&this.collapse();return}this.expandedItem===item?this.collapse():this.expandedItem?this.carry(item):this.open(item,"none")},this.onPointerOver=event=>{if(!this.expandedItem||event.pointerType==="touch")return;const found=this.eventItem(event);found&&!found.inMenu&&found.item.hasMenu&&found.item!==this.expandedItem&&this.carry(found.item)},this.onKeyDown=event=>{if(event.defaultPrevented||event.isComposing||event.keyCode===229||event.altKey||event.ctrlKey||event.metaKey)return;const found=this.eventItem(event);if(!found)return;const{item,inMenu}=found;if(inMenu){if(!isHtmlElement(event.target)||![tag("menu-item"),tag("dropdown-item")].includes(event.target.localName)||keyEventOwnedByInnerControl(event,{container:event.target})||event.key!=="ArrowLeft"&&event.key!=="ArrowRight")return}else if(event.target!==item||keyEventOwnedByInnerControl(event,{container:item}))return;const navigable=this.items.filter(candidate=>this.isNavigable(candidate));if(!navigable.length)return;const index=navigable.indexOf(item);let next;const nextIndex=resolveListMove(event,{count:navigable.length,current:index,orientation:"horizontal",direction:this.effectiveDirection});if(nextIndex!==null)next=navigable[nextIndex];else if(["ArrowDown","ArrowUp","Enter"," "].includes(event.key)){item.hasMenu?(event.preventDefault(),this.open(item,event.key==="ArrowUp"?"last":"first")):(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),item.click());return}else if(this.typeBuffer.accepts(event)){this.typeBuffer.add(event.key,this.effectiveLocale);const locale=resolveIntlLocale(this.effectiveLocale);let match=null;for(let step=1;step<=navigable.length;step++){const candidate=((index+step)%navigable.length+navigable.length)%navigable.length;if(this.foldedTypeAheadLabel(navigable[candidate],locale).startsWith(this.typeBuffer.text)){match=candidate;break}}match!==null&&(next=navigable[match])}next&&(event.preventDefault(),this.move(next))},this.addEventListener("keydown",this.onKeyDown),this.addEventListener("click",this.onClick),this.addEventListener("pointerover",this.onPointerOver),this.addEventListener("focusin",event=>{const item=this.items.find(candidate=>candidate===event.target);item&&this.isNavigable(item)&&(this.focusedItem=item,this.setActive(item))})}connectedCallback(){if(super.connectedCallback(),this.hasUpdated){for(const item of this.items)item[menubarItemOwner](this.owner);this.observeItems(),queueMicrotask(()=>{this.isConnected&&(this.syncItems(),this.syncItemState())})}}disconnectedCallback(){this.collapse(),this.typeBuffer.clear(),this.itemObserver?.disconnect(),this.itemObserver=void 0,this.ownerDocument.removeEventListener("focusin",this.onDocumentFocus,!0);for(const item of this.items)item[menubarItemOwner](null,this.owner);this.focusedItem=null,super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),queueMicrotask(()=>{this.isConnected&&collectInitialSlotAssignment(this.renderRoot.querySelector("slot"),this.syncItems)})}isNavigable(item){return isRovingTargetAvailable(item)}observeItems(){this.itemObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;if(Observer){this.itemObserver=new Observer(()=>this.syncItemState());for(const item of this.items)this.itemObserver.observe(item,{attributes:!0,attributeFilter:["disabled","hidden","aria-hidden","inert"]})}}rehome(index,focus){const successor=this.items.find((item,current)=>current>=Math.max(0,index)&&this.isNavigable(item))??this.items.slice(0,Math.max(0,index)).reverse().find(item=>this.isNavigable(item));if(successor)this.setActive(successor,focus);else{this.activeIndex=-1;for(const item of this.items)item.tabIndex=-1}}syncItemState(){const active=this.items[this.activeIndex];if(!active||!this.isNavigable(active)){const focused=deepActiveElement(this.ownerDocument);this.rehome(this.activeIndex,!!active&&(focused===active||!!focused&&composedContains(active,focused)))}this.expandedItem&&(!this.isNavigable(this.expandedItem)||!this.expandedItem.hasMenu)&&this.collapse()}setActive(item,focus=!1){if(this.isNavigable(item)){this.activeIndex=this.items.indexOf(item);for(const candidate of this.items)candidate.tabIndex=candidate===item?0:-1;focus&&(this.focusedItem=item,item.focus({preventScroll:!0}))}}registerOverlay(){this.overlayHandle||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this,preferredInitialFocus:()=>this.expandedItem,onEscape:()=>this.collapse(),onTab:()=>this.collapse(),restoreFocusTo:()=>{const active=deepActiveElement(this.ownerDocument);return isHtmlElement(active)&&active!==this.ownerDocument.body&&active!==this.ownerDocument.documentElement?active:null}}),this.ownerDocument.addEventListener("focusin",this.onDocumentFocus,!0))}open(item,focus){const previous=this.expandedItem;this.expandedItem=item,previous&&previous!==item&&previous.closeMenu(),this.registerOverlay(),item.openMenu(focus)}carry(item){const previous=this.expandedItem;this.setActive(item,!0),item.hasMenu&&this.isNavigable(item)?(this.expandedItem=item,previous&&previous!==item&&previous.closeMenu(),item.openMenu("none")):this.collapse()}collapse(){const item=this.expandedItem;this.expandedItem=null,this.ownerDocument.removeEventListener("focusin",this.onDocumentFocus,!0);const handle=this.overlayHandle;this.overlayHandle=void 0,handle?.deactivate(),item&&item.closeMenu()}menuStateChanged(item,open){if(this.items.includes(item))if(open&&item!==this.expandedItem){const previous=this.expandedItem;this.expandedItem=item,previous&&previous.closeMenu(),this.registerOverlay()}else!open&&item===this.expandedItem&&this.collapse()}eventItem(event){const path=event.composedPath(),item=path.find(target=>this.items.includes(target));if(!item||!this.isNavigable(item))return;const preceding=path.slice(0,path.indexOf(item));return{item,path:preceding,inMenu:preceding.some(node=>isHtmlElement(node)&&node.localName===tag("menu"))}}move(item){this.expandedItem?this.carry(item):this.setActive(item,!0)}render(){return html`<div part="base" role="menubar" aria-label=${this.getAttribute("aria-label")??this.label??this.localize("menuLabel")}><slot @slotchange=${this.syncItems}></slot></div>`}}__decorate([property()],LyraMenubar.prototype,"label",void 0),__decorate([property({type:Boolean,attribute:"top-layer",reflect:!0})],LyraMenubar.prototype,"topLayer",void 0),__decorate([property({reflect:!0})],LyraMenubar.prototype,"size",void 0),__decorate([property({reflect:!0})],LyraMenubar.prototype,"frame",void 0);export{LyraMenubar};
@@ -42,7 +42,7 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
42
42
  * @status stable
43
43
  * @since 6.0.0
44
44
  */
45
- export declare class LyraReorderItem extends LyraElement<LyraReorderItemEventMap>{static styles:import("lit").CSSResultGroup[];private readonly reorderInternals;private readonly moveUpLabelId;private readonly moveDownLabelId;private readonly itemLabelId;private owner;private ownerState;private contentObserver?;
45
+ export declare class LyraReorderItem extends LyraElement<LyraReorderItemEventMap>{static styles:import("lit").CSSResultGroup[];private readonly reorderInternals;private readonly moveUpLabelId;private readonly moveDownLabelId;private readonly itemLabelId;private owner;private ownerState;private contentObserver?;private contentLabel?;
46
46
  /** Required unique, nonempty stable identifier included in the parent list's emitted
47
47
  * `lr-reorder-request` order array. An owning list excludes an item with a missing,
48
48
  * whitespace-only, or duplicate value from movement until its identity becomes valid. Direct
@@ -69,4 +69,4 @@ get pending():boolean;private setOwnerState;private get moveUpDisabled();private
69
69
  * requested direction already being this item's boundary. Returns whether focus moved. The
70
70
  * move controls are composed `<lr-icon-button>`s, which expose `disabled` and `focus()` but are
71
71
  * not `HTMLButtonElement`s; read both structurally. */
72
- focusMoveButton(direction:'up'|'down'):boolean;private get resolvedItemLabel();private refreshContentObserver;connectedCallback():void;disconnectedCallback():void;private onMoveUpClick;private onMoveDownClick;protected willUpdate(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-reorder-item':LyraReorderItem;}}
72
+ focusMoveButton(direction:'up'|'down'):boolean;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private get resolvedItemLabel();private refreshContentObserver;private onContentSlotChange;connectedCallback():void;disconnectedCallback():void;private onMoveUpClick;private onMoveDownClick;protected willUpdate(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-reorder-item':LyraReorderItem;}}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityTextResult}from"../../../internal/accessibility-visibility.js";import{chevronIcon}from"../../../internal/icons.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{styles}from"./reorder-item.styles.js";import{reorderIdentityChange,reorderOwnerUpdate}from"./reorder-owner.js";import{LYRA_DEFAULT_moveDown,LYRA_DEFAULT_moveUp}from"../../../internal/default-strings/shared.generated.js";function isReorderOwnerState(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return typeof candidate.atStart=="boolean"&&typeof candidate.atEnd=="boolean"&&typeof candidate.listDisabled=="boolean"&&typeof candidate.pending=="boolean"&&typeof candidate.busy=="boolean"&&typeof candidate.validIdentity=="boolean"}class LyraReorderItem extends LyraElement{constructor(){super(...arguments),this.reorderInternals=attachInternalsSafely(this),this.moveUpLabelId=nextId("reorder-move-up"),this.moveDownLabelId=nextId("reorder-move-down"),this.itemLabelId=nextId("reorder-item-label"),this.owner=null,this.ownerState={atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1},this.value="",this.hostAccessibleLabel=null,this.disabled=!1,this.onMoveUpClick=()=>{this.moveUpDisabled||this.emit("lr-move-request",{direction:"up"})},this.onMoveDownClick=()=>{this.moveDownDisabled||this.emit("lr-move-request",{direction:"down"})}}static{this.defaultStrings={...super.defaultStrings,moveDown:LYRA_DEFAULT_moveDown,moveUp:LYRA_DEFAULT_moveUp}}static{this.styles=[LyraElement.styles,styles]}get atStart(){return this.ownerState.atStart}get atEnd(){return this.ownerState.atEnd}get listDisabled(){return this.ownerState.listDisabled}get pending(){return this.ownerState.pending}[reorderOwnerUpdate](owner,state){if(!isReorderOwnerState(state)){this.owner===owner&&(this.owner=null,this.setOwnerState({atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1}));return}this.owner=owner,this.setOwnerState(state)}setOwnerState(state){const previous=this.ownerState;previous.atStart===state.atStart&&previous.atEnd===state.atEnd&&previous.listDisabled===state.listDisabled&&previous.pending===state.pending&&previous.busy===state.busy&&previous.validIdentity===state.validIdentity||(this.ownerState=state,setCustomState(this.reorderInternals,"at-start",state.atStart),setCustomState(this.reorderInternals,"at-end",state.atEnd),setCustomState(this.reorderInternals,"list-disabled",state.listDisabled),setCustomState(this.reorderInternals,"pending",state.pending),setCustomState(this.reorderInternals,"busy",state.busy),setCustomState(this.reorderInternals,"invalid-identity",!state.validIdentity),this.requestUpdate())}get moveUpDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atStart}get moveDownDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atEnd}focusMoveButton(direction){if(direction==="up"?this.moveUpDisabled:this.moveDownDisabled)return!1;const part=direction==="up"?"move-up-button":"move-down-button",button=this.shadowRoot?.querySelector(`[part='${part}']`);return!button||button.disabled?!1:(button.focus(),!0)}get resolvedItemLabel(){return this.hostAccessibleLabel!==null?this.hostAccessibleLabel:composedAccessibilityTextResult(this.childNodes,{ancestorBoundary:this,maxCharacters:256,maxDepth:16,maxNodes:128,requireRendered:!1,skipRootAncestorValidation:!0}).text}refreshContentObserver(){this.contentObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;!Observer||!this.isConnected||(this.contentObserver=new Observer(()=>this.requestUpdate()),this.contentObserver.observe(this,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:["alt","aria-label","aria-labelledby","hidden","inert","title"]}))}connectedCallback(){super.connectedCallback(),this.refreshContentObserver()}disconnectedCallback(){this.contentObserver?.disconnect(),this.contentObserver=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("value")&&this.owner?.[reorderIdentityChange]?.(this),this.getAttribute("role")!=="listitem"&&this.setAttribute("role","listitem")}render(){const itemLabel=this.resolvedItemLabel;return html`
1
+ import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityTextResult}from"../../../internal/accessibility-visibility.js";import{chevronIcon}from"../../../internal/icons.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{styles}from"./reorder-item.styles.js";import{reorderIdentityChange,reorderOwnerUpdate}from"./reorder-owner.js";import{LYRA_DEFAULT_moveDown,LYRA_DEFAULT_moveUp}from"../../../internal/default-strings/shared.generated.js";function isReorderOwnerState(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return typeof candidate.atStart=="boolean"&&typeof candidate.atEnd=="boolean"&&typeof candidate.listDisabled=="boolean"&&typeof candidate.pending=="boolean"&&typeof candidate.busy=="boolean"&&typeof candidate.validIdentity=="boolean"}class LyraReorderItem extends LyraElement{constructor(){super(...arguments),this.reorderInternals=attachInternalsSafely(this),this.moveUpLabelId=nextId("reorder-move-up"),this.moveDownLabelId=nextId("reorder-move-down"),this.itemLabelId=nextId("reorder-item-label"),this.owner=null,this.ownerState={atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1},this.value="",this.hostAccessibleLabel=null,this.disabled=!1,this.onContentSlotChange=()=>{this.refreshContentObserver(),this.requestUpdate()},this.onMoveUpClick=()=>{this.moveUpDisabled||this.emit("lr-move-request",{direction:"up"})},this.onMoveDownClick=()=>{this.moveDownDisabled||this.emit("lr-move-request",{direction:"down"})}}static{this.defaultStrings={...super.defaultStrings,moveDown:LYRA_DEFAULT_moveDown,moveUp:LYRA_DEFAULT_moveUp}}static{this.styles=[LyraElement.styles,styles]}get atStart(){return this.ownerState.atStart}get atEnd(){return this.ownerState.atEnd}get listDisabled(){return this.ownerState.listDisabled}get pending(){return this.ownerState.pending}[reorderOwnerUpdate](owner,state){if(!isReorderOwnerState(state)){this.owner===owner&&(this.owner=null,this.setOwnerState({atStart:!1,atEnd:!1,listDisabled:!1,pending:!1,busy:!1,validIdentity:!1}));return}this.owner=owner,this.setOwnerState(state)}setOwnerState(state){const previous=this.ownerState;previous.atStart===state.atStart&&previous.atEnd===state.atEnd&&previous.listDisabled===state.listDisabled&&previous.pending===state.pending&&previous.busy===state.busy&&previous.validIdentity===state.validIdentity||(this.ownerState=state,setCustomState(this.reorderInternals,"at-start",state.atStart),setCustomState(this.reorderInternals,"at-end",state.atEnd),setCustomState(this.reorderInternals,"list-disabled",state.listDisabled),setCustomState(this.reorderInternals,"pending",state.pending),setCustomState(this.reorderInternals,"busy",state.busy),setCustomState(this.reorderInternals,"invalid-identity",!state.validIdentity),this.requestUpdate("ownerState",previous))}get moveUpDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atStart}get moveDownDisabled(){const hasValidIdentity=this.owner===null?(this.value??"").trim().length>0:this.ownerState.validIdentity;return this.disabled||this.listDisabled||this.ownerState.busy||!hasValidIdentity||this.atEnd}focusMoveButton(direction){if(direction==="up"?this.moveUpDisabled:this.moveDownDisabled)return!1;const part=direction==="up"?"move-up-button":"move-down-button",button=this.shadowRoot?.querySelector(`[part='${part}']`);return!button||button.disabled?!1:(button.focus(),!0)}requestUpdate(...args){args[0]===void 0&&(this.contentLabel=void 0),super.requestUpdate(...args)}get resolvedItemLabel(){return this.hostAccessibleLabel!==null?this.hostAccessibleLabel:this.contentLabel??=composedAccessibilityTextResult(this.childNodes,{ancestorBoundary:this,maxCharacters:256,maxDepth:16,maxNodes:128,requireRendered:!1,skipRootAncestorValidation:!0}).text}refreshContentObserver(){if(this.contentLabel=void 0,this.contentObserver?.disconnect(),this.contentObserver=void 0,this.hostAccessibleLabel!==null||!this.isConnected)return;const Observer=this.ownerDocument?.defaultView?.MutationObserver;Observer&&(this.contentObserver=new Observer(()=>{this.contentLabel=void 0,this.requestUpdate()}),this.contentObserver.observe(this,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:["alt","aria-label","aria-labelledby","hidden","inert","title"]}))}connectedCallback(){super.connectedCallback(),this.refreshContentObserver()}disconnectedCallback(){this.contentObserver?.disconnect(),this.contentObserver=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("hostAccessibleLabel")&&this.refreshContentObserver(),changed.has("value")&&this.owner?.[reorderIdentityChange]?.(this),this.getAttribute("role")!=="listitem"&&this.setAttribute("role","listitem")}render(){const itemLabel=this.resolvedItemLabel;return html`
2
2
  <div part="base">
3
3
  <span id=${this.moveUpLabelId} hidden>${this.localize("moveUp")}</span>
4
4
  <span id=${this.moveDownLabelId} hidden
@@ -26,7 +26,7 @@ import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/dec
26
26
  ${chevronIcon()}
27
27
  </lr-icon-button>
28
28
  <span part="content"
29
- ><slot @slotchange=${this.refreshContentObserver}></slot
29
+ ><slot @slotchange=${this.onContentSlotChange}></slot
30
30
  ></span>
31
31
  </div>
32
32
  `}}__decorate([property()],LyraReorderItem.prototype,"value",void 0),__decorate([property({attribute:"aria-label"})],LyraReorderItem.prototype,"hostAccessibleLabel",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraReorderItem.prototype,"disabled",void 0);export{LyraReorderItem};
@@ -65,7 +65,7 @@ disabled:boolean;
65
65
  * never reaches that exact order leaves the move pending indefinitely; one that drops the
66
66
  * moved `value` entirely (removes or renames that row) cancels it silently, with no
67
67
  * announcement -- the host already knows, since it made that edit itself. */
68
- controlled:boolean;private liveRegion?;private pendingFocusTarget;private focusRestoreGeneration;private itemObserver?;private stateItems;private moveToken;private pendingMove;private pendingReconciliation;private get directItemElements();private get itemElements();private syncBoundaryState;private onSlotChange;private tryCompleteControlledReconciliation;private identityChangeReconciliationPending;private refreshItemObserver;private pendingMembershipIsCurrent;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;disconnectedCallback():void;private orderValues;private scheduleFocusRestore;private restoreFocusAfterItemUpdate;private applyMove;private finishMove;private commitMove;private moveItem;
68
+ controlled:boolean;private liveRegion?;private pendingFocusTarget;private focusRestoreGeneration;private boundarySnapshot;private stateItems;private moveToken;private pendingMove;private pendingReconciliation;private get directItemElements();private get itemElements();private syncBoundaryState;private onSlotChange;private tryCompleteControlledReconciliation;private identityChangeReconciliationPending;private pendingMembershipIsCurrent;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;disconnectedCallback():void;private orderValues;private scheduleFocusRestore;private restoreFocusAfterItemUpdate;private applyMove;private finishMove;private commitMove;private moveItem;
69
69
  /** Applies a move an `lr-reorder-request` listener held via `preventDefault()`, once the host's
70
70
  * own async work (e.g. persisting the new order) has succeeded. While `controlled`, this starts
71
71
  * waiting for the host's own matching re-render rather than moving anything itself -- see that
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{tag}from"../../../internal/prefix.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{composedContains}from"../../../internal/overlay-stack.js";import{releaseReorderOwnerState,reorderIdentityChange,updateReorderOwnerState}from"./reorder-owner.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./reorder-list.styles.js";import{LYRA_DEFAULT_reorderMoveCancelled,LYRA_DEFAULT_reorderMovePending}from"../../../internal/default-strings/layout.generated.js";import{LYRA_DEFAULT_reorderItemMoved}from"../../../internal/default-strings/shared.generated.js";function isRowOwnChrome(node,item){let root=node.getRootNode();for(;root instanceof ShadowRoot;){if(root===item.shadowRoot)return!0;root=root.host.getRootNode()}return!1}class LyraReorderList extends LyraElement{constructor(){super(...arguments),this.label="",this.disabled=!1,this.controlled=!1,this.pendingFocusTarget=null,this.focusRestoreGeneration=0,this.stateItems=new Set,this.moveToken=0,this.pendingMove=null,this.pendingReconciliation=null,this.onSlotChange=()=>{this.pendingMove&&this.pendingMove.phase==="held"&&!this.pendingMembershipIsCurrent()&&this.revertPendingMove(),this.pendingReconciliation&&this.tryCompleteControlledReconciliation(),this.syncBoundaryState()},this.identityChangeReconciliationPending=!1,this.onMoveRequest=e=>{const item=e.target?.closest?.(tag("reorder-item"));if(!item||item.parentElement!==this)return;const{direction}=e.detail;e.stopPropagation(),this.moveItem(item,direction)},this.onKeyDown=e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey||e.shiftKey||e.key!=="ArrowUp"&&e.key!=="ArrowDown")return;const path=e.composedPath(),item=path.find(target=>target instanceof Element&&target.localName===tag("reorder-item")&&target.parentElement===this);if(!item)return;const itemIndex=path.indexOf(item);if(path.slice(0,itemIndex).some(target=>{if(!(target instanceof Element)||isRowOwnChrome(target,item))return!1;const name=target.localName;return name==="a"||name==="button"||name==="input"||name==="select"||name==="textarea"||target.hasAttribute("contenteditable")||name.includes("-")&&target!==item}))return;const items=this.itemElements,fromIndex=items.indexOf(item),toIndex=e.key==="ArrowDown"?fromIndex+1:fromIndex-1;this.disabled||this.pendingMove||this.pendingReconciliation||item.disabled||fromIndex<0||toIndex<0||toIndex>=items.length||(e.preventDefault(),this.moveItem(item,e.key==="ArrowDown"?"down":"up"))}}static{this.defaultStrings={...super.defaultStrings,reorderItemMoved:LYRA_DEFAULT_reorderItemMoved,reorderMoveCancelled:LYRA_DEFAULT_reorderMoveCancelled,reorderMovePending:LYRA_DEFAULT_reorderMovePending}}static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-reorder-request"])}get directItemElements(){const itemTag=tag("reorder-item");return[...this.children].filter(element=>element.localName===itemTag)}get itemElements(){const seen=new Set;return this.directItemElements.filter(item=>{const value=item.value;return typeof value!="string"||value.trim()===""||seen.has(value)?!1:(seen.add(value),!0)})}syncBoundaryState(){const directItems=this.directItemElements,items=this.itemElements,indexOf=new Map(items.map((item,index)=>[item,index])),heldMove=this.pendingMove?.phase==="held",reconciliation=this.pendingReconciliation,busy=heldMove||reconciliation!==null,nextStateItems=new Set(directItems);for(const item of this.stateItems)nextStateItems.has(item)||releaseReorderOwnerState(item,this);directItems.forEach(item=>{const i=indexOf.get(item)??-1;updateReorderOwnerState(item,this,{atStart:i===0,atEnd:i>=0&&i===items.length-1,listDisabled:this.disabled,pending:heldMove&&this.pendingMove?.item===item||reconciliation!==null&&item.value===reconciliation.value,busy,validIdentity:indexOf.has(item)})}),this.stateItems=nextStateItems,this.requestUpdate()}tryCompleteControlledReconciliation(){const reconciliation=this.pendingReconciliation;if(!reconciliation)return;const items=this.itemElements,currentValues=items.map(entry=>entry.value);if(!(currentValues.length===reconciliation.expectedValues.length&&currentValues.every((value,index)=>value===reconciliation.expectedValues[index]))){currentValues.includes(reconciliation.value)||(this.pendingReconciliation=null);return}const movedItem=items[reconciliation.toIndex];this.pendingReconciliation=null,movedItem&&this.finishMove(movedItem,reconciliation.direction,reconciliation.toIndex)}[reorderIdentityChange](item){item.parentElement===this&&(this.identityChangeReconciliationPending||(this.identityChangeReconciliationPending=!0,queueMicrotask(()=>{this.identityChangeReconciliationPending=!1,this.onSlotChange()})))}refreshItemObserver(){this.itemObserver?.disconnect();const Observer=this.ownerDocument.defaultView?.MutationObserver;!Observer||!this.isConnected||(this.itemObserver=new Observer(()=>this.onSlotChange()),this.itemObserver.observe(this,{childList:!0}))}pendingMembershipIsCurrent(){if(!this.pendingMove)return!1;const current=this.itemElements;return!this.disabled&&!this.pendingMove.item.disabled&&!this.pendingMove.target.disabled&&current.length===this.pendingMove.members.length&&current.every((item,index)=>item===this.pendingMove.members[index]&&item.value===this.pendingMove.values[index])&&current[this.pendingMove.toIndex]===this.pendingMove.target}connectedCallback(){super.connectedCallback(),this.refreshItemObserver(),this.syncBoundaryState()}willUpdate(changed){super.willUpdate(changed),changed.has("disabled")&&this.syncBoundaryState(),changed.has("controlled")&&this.pendingReconciliation&&(this.pendingReconciliation=null,this.syncBoundaryState())}disconnectedCallback(){this.itemObserver?.disconnect(),this.itemObserver=void 0,this.pendingFocusTarget=null,this.focusRestoreGeneration+=1,this.pendingMove=null,this.pendingReconciliation=null,this.moveToken+=1;for(const item of this.stateItems)releaseReorderOwnerState(item,this);this.stateItems.clear(),super.disconnectedCallback()}orderValues(items){return Object.freeze(items.map(item=>item.value))}scheduleFocusRestore(){this.scheduleAfterUpdate(()=>{const focusTarget=this.pendingFocusTarget;focusTarget&&this.restoreFocusAfterItemUpdate(focusTarget,this.focusRestoreGeneration)},"reorder-focus")}async restoreFocusAfterItemUpdate(focusTarget,generation){if(await focusTarget.item.updateComplete,!this.isConnected||generation!==this.focusRestoreGeneration||this.pendingFocusTarget!==focusTarget)return;this.pendingFocusTarget=null;const captured=focusTarget.preScheduleFocus;captured!=null&&captured!==this.ownerDocument.body&&captured.isConnected&&!composedContains(this,captured)||focusTarget.item.focusMoveButton(focusTarget.direction)}applyMove(item,direction,_fromIndex,toIndex){const target=this.itemElements[toIndex];direction==="up"?this.insertBefore(item,target):this.insertBefore(item,target.nextElementSibling),this.finishMove(item,direction,toIndex)}finishMove(item,direction,toIndex){this.syncBoundaryState();const focusDirection=(direction==="up"?item.atStart:item.atEnd)?direction==="up"?"down":"up":direction;this.pendingFocusTarget={item,direction:focusDirection,preScheduleFocus:deepActiveElementIn(this.ownerDocument)},this.focusRestoreGeneration+=1,this.scheduleFocusRestore();const newItems=this.itemElements,number=getNumberFormat(this.effectiveLocale);this.liveRegion?.announce(this.localize("reorderItemMoved",void 0,{index:number.format(toIndex+1),total:number.format(newItems.length)}),{force:!0})}commitMove(item,direction,fromIndex,toIndex,expectedValues){this.controlled?(this.pendingReconciliation={value:item.value,direction,toIndex,expectedValues},this.syncBoundaryState()):this.applyMove(item,direction,fromIndex,toIndex)}moveItem(item,direction){if(this.disabled||item.disabled||this.pendingMove||this.pendingReconciliation)return;const items=this.itemElements,fromIndex=items.indexOf(item);if(fromIndex<0)return;const toIndex=direction==="up"?fromIndex-1:fromIndex+1;if(toIndex<0||toIndex>=items.length)return;const reordered=items.slice();reordered.splice(fromIndex,1),reordered.splice(toIndex,0,item);const expectedValues=this.orderValues(reordered),transaction={token:++this.moveToken,phase:"dispatching",resolution:null,item,target:items[toIndex],direction,fromIndex,toIndex,members:[...items],values:items.map(member=>member.value),expectedValues};this.pendingMove=transaction;const request=this.emit("lr-reorder-request",Object.freeze({order:expectedValues,fromIndex,toIndex}),{cancelable:!0});if(!(this.pendingMove!==transaction||transaction.token!==this.moveToken)){if(!this.pendingMembershipIsCurrent()){this.pendingMove=null,this.syncBoundaryState();return}if(request.defaultPrevented){if(transaction.resolution==="revert"){this.pendingMove=null,this.syncBoundaryState();return}if(transaction.resolution==="finalize"){this.pendingMove=null,this.syncBoundaryState(),this.commitMove(item,direction,fromIndex,toIndex,expectedValues);return}this.pendingMove={...transaction,phase:"held"},this.syncBoundaryState(),this.liveRegion?.announce(this.localize("reorderMovePending"),{force:!0});return}this.pendingMove=null,this.syncBoundaryState(),this.commitMove(item,direction,fromIndex,toIndex,expectedValues)}}finalizePendingMove(){if(!this.pendingMove)return;if(this.pendingMove.phase==="dispatching"){this.pendingMove.resolution="finalize";return}if(!this.pendingMembershipIsCurrent()){this.revertPendingMove();return}const{item,direction,fromIndex,toIndex,expectedValues}=this.pendingMove;this.pendingMove=null,this.syncBoundaryState(),this.commitMove(item,direction,fromIndex,toIndex,expectedValues)}revertPendingMove(options){if(!this.pendingMove)return;if(this.pendingMove.phase==="dispatching"){this.pendingMove.resolution="revert";return}const wasHeld=this.pendingMove.phase==="held";this.pendingMove=null,this.syncBoundaryState(),wasHeld&&!(options?.silent??!1)&&this.liveRegion?.announce(this.localize("reorderMoveCancelled"),{force:!0})}render(){return html`
1
+ import{__decorate}from"tslib";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{tag}from"../../../internal/prefix.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{composedContains}from"../../../internal/overlay-stack.js";import{releaseReorderOwnerState,reorderIdentityChange,updateReorderOwnerState}from"./reorder-owner.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./reorder-list.styles.js";import{LYRA_DEFAULT_reorderMoveCancelled,LYRA_DEFAULT_reorderMovePending}from"../../../internal/default-strings/layout.generated.js";import{LYRA_DEFAULT_reorderItemMoved}from"../../../internal/default-strings/shared.generated.js";function isRowOwnChrome(node,item){let root=node.getRootNode();for(;root instanceof ShadowRoot;){if(root===item.shadowRoot)return!0;root=root.host.getRootNode()}return!1}class LyraReorderList extends LyraElement{constructor(){super(...arguments),this.label="",this.disabled=!1,this.controlled=!1,this.pendingFocusTarget=null,this.focusRestoreGeneration=0,this.boundarySnapshot=[],this.stateItems=new Set,this.moveToken=0,this.pendingMove=null,this.pendingReconciliation=null,this.onSlotChange=()=>{this.pendingMove&&this.pendingMove.phase==="held"&&!this.pendingMembershipIsCurrent()&&this.revertPendingMove(),this.pendingReconciliation&&this.tryCompleteControlledReconciliation();const current=this.directItemElements;(current.length!==this.boundarySnapshot.length||current.some((item,index)=>item!==this.boundarySnapshot[index]?.[0]||item.value!==this.boundarySnapshot[index]?.[1]))&&this.syncBoundaryState()},this.identityChangeReconciliationPending=!1,this.onMoveRequest=e=>{const item=e.target?.closest?.(tag("reorder-item"));if(!item||item.parentElement!==this)return;const{direction}=e.detail;e.stopPropagation(),this.moveItem(item,direction)},this.onKeyDown=e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey||e.shiftKey||e.key!=="ArrowUp"&&e.key!=="ArrowDown")return;const path=e.composedPath(),item=path.find(target=>target instanceof Element&&target.localName===tag("reorder-item")&&target.parentElement===this);if(!item)return;const itemIndex=path.indexOf(item);if(path.slice(0,itemIndex).some(target=>{if(!(target instanceof Element)||isRowOwnChrome(target,item))return!1;const name=target.localName;return name==="a"||name==="button"||name==="input"||name==="select"||name==="textarea"||target.hasAttribute("contenteditable")||name.includes("-")&&target!==item}))return;const items=this.itemElements,fromIndex=items.indexOf(item),toIndex=e.key==="ArrowDown"?fromIndex+1:fromIndex-1;this.disabled||this.pendingMove||this.pendingReconciliation||item.disabled||fromIndex<0||toIndex<0||toIndex>=items.length||(e.preventDefault(),this.moveItem(item,e.key==="ArrowDown"?"down":"up"))}}static{this.defaultStrings={...super.defaultStrings,reorderItemMoved:LYRA_DEFAULT_reorderItemMoved,reorderMoveCancelled:LYRA_DEFAULT_reorderMoveCancelled,reorderMovePending:LYRA_DEFAULT_reorderMovePending}}static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-reorder-request"])}get directItemElements(){const itemTag=tag("reorder-item");return[...this.children].filter(element=>element.localName===itemTag)}get itemElements(){const seen=new Set;return this.directItemElements.filter(item=>{const value=item.value;return typeof value!="string"||value.trim()===""||seen.has(value)?!1:(seen.add(value),!0)})}syncBoundaryState(){const directItems=this.directItemElements,items=this.itemElements,indexOf=new Map(items.map((item,index)=>[item,index])),heldMove=this.pendingMove?.phase==="held",reconciliation=this.pendingReconciliation,busy=heldMove||reconciliation!==null,nextStateItems=new Set(directItems);for(const item of this.stateItems)nextStateItems.has(item)||releaseReorderOwnerState(item,this);directItems.forEach(item=>{const i=indexOf.get(item)??-1;updateReorderOwnerState(item,this,{atStart:i===0,atEnd:i>=0&&i===items.length-1,listDisabled:this.disabled,pending:heldMove&&this.pendingMove?.item===item||reconciliation!==null&&item.value===reconciliation.value,busy,validIdentity:indexOf.has(item)})}),this.stateItems=nextStateItems,this.boundarySnapshot=directItems.map(item=>[item,item.value]),this.requestUpdate()}tryCompleteControlledReconciliation(){const reconciliation=this.pendingReconciliation;if(!reconciliation)return;const items=this.itemElements,currentValues=items.map(entry=>entry.value);if(!(currentValues.length===reconciliation.expectedValues.length&&currentValues.every((value,index)=>value===reconciliation.expectedValues[index]))){currentValues.includes(reconciliation.value)||(this.pendingReconciliation=null);return}const movedItem=items[reconciliation.toIndex];this.pendingReconciliation=null,movedItem&&this.finishMove(movedItem,reconciliation.direction,reconciliation.toIndex)}[reorderIdentityChange](item){item.parentElement===this&&(this.identityChangeReconciliationPending||(this.identityChangeReconciliationPending=!0,queueMicrotask(()=>{this.identityChangeReconciliationPending=!1,this.onSlotChange()})))}pendingMembershipIsCurrent(){if(!this.pendingMove)return!1;const current=this.itemElements;return!this.disabled&&!this.pendingMove.item.disabled&&!this.pendingMove.target.disabled&&current.length===this.pendingMove.members.length&&current.every((item,index)=>item===this.pendingMove.members[index]&&item.value===this.pendingMove.values[index])&&current[this.pendingMove.toIndex]===this.pendingMove.target}connectedCallback(){super.connectedCallback(),this.syncBoundaryState()}willUpdate(changed){super.willUpdate(changed),changed.has("disabled")&&this.syncBoundaryState(),changed.has("controlled")&&this.pendingReconciliation&&(this.pendingReconciliation=null,this.syncBoundaryState())}disconnectedCallback(){this.boundarySnapshot=[],this.pendingFocusTarget=null,this.focusRestoreGeneration+=1,this.pendingMove=null,this.pendingReconciliation=null,this.moveToken+=1;for(const item of this.stateItems)releaseReorderOwnerState(item,this);this.stateItems.clear(),super.disconnectedCallback()}orderValues(items){return Object.freeze(items.map(item=>item.value))}scheduleFocusRestore(){this.scheduleAfterUpdate(()=>{const focusTarget=this.pendingFocusTarget;focusTarget&&this.restoreFocusAfterItemUpdate(focusTarget,this.focusRestoreGeneration)},"reorder-focus")}async restoreFocusAfterItemUpdate(focusTarget,generation){if(await focusTarget.item.updateComplete,!this.isConnected||generation!==this.focusRestoreGeneration||this.pendingFocusTarget!==focusTarget)return;this.pendingFocusTarget=null;const captured=focusTarget.preScheduleFocus;captured!=null&&captured!==this.ownerDocument.body&&captured.isConnected&&!composedContains(this,captured)||focusTarget.item.focusMoveButton(focusTarget.direction)}applyMove(item,direction,_fromIndex,toIndex){const target=this.itemElements[toIndex];direction==="up"?this.insertBefore(item,target):this.insertBefore(item,target.nextElementSibling),this.finishMove(item,direction,toIndex)}finishMove(item,direction,toIndex){this.syncBoundaryState();const focusDirection=(direction==="up"?item.atStart:item.atEnd)?direction==="up"?"down":"up":direction;this.pendingFocusTarget={item,direction:focusDirection,preScheduleFocus:deepActiveElementIn(this.ownerDocument)},this.focusRestoreGeneration+=1,this.scheduleFocusRestore();const newItems=this.itemElements,number=getNumberFormat(this.effectiveLocale);this.liveRegion?.announce(this.localize("reorderItemMoved",void 0,{index:number.format(toIndex+1),total:number.format(newItems.length)}),{force:!0})}commitMove(item,direction,fromIndex,toIndex,expectedValues){this.controlled?(this.pendingReconciliation={value:item.value,direction,toIndex,expectedValues},this.syncBoundaryState()):this.applyMove(item,direction,fromIndex,toIndex)}moveItem(item,direction){if(this.disabled||item.disabled||this.pendingMove||this.pendingReconciliation)return;const items=this.itemElements,fromIndex=items.indexOf(item);if(fromIndex<0)return;const toIndex=direction==="up"?fromIndex-1:fromIndex+1;if(toIndex<0||toIndex>=items.length)return;const reordered=items.slice();reordered.splice(fromIndex,1),reordered.splice(toIndex,0,item);const expectedValues=this.orderValues(reordered),transaction={token:++this.moveToken,phase:"dispatching",resolution:null,item,target:items[toIndex],direction,fromIndex,toIndex,members:[...items],values:items.map(member=>member.value),expectedValues};this.pendingMove=transaction;const request=this.emit("lr-reorder-request",Object.freeze({order:expectedValues,fromIndex,toIndex}),{cancelable:!0});if(!(this.pendingMove!==transaction||transaction.token!==this.moveToken)){if(!this.pendingMembershipIsCurrent()){this.pendingMove=null,this.syncBoundaryState();return}if(request.defaultPrevented){if(transaction.resolution==="revert"){this.pendingMove=null,this.syncBoundaryState();return}if(transaction.resolution==="finalize"){this.pendingMove=null,this.syncBoundaryState(),this.commitMove(item,direction,fromIndex,toIndex,expectedValues);return}this.pendingMove={...transaction,phase:"held"},this.syncBoundaryState(),this.liveRegion?.announce(this.localize("reorderMovePending"),{force:!0});return}this.pendingMove=null,this.commitMove(item,direction,fromIndex,toIndex,expectedValues)}}finalizePendingMove(){if(!this.pendingMove)return;if(this.pendingMove.phase==="dispatching"){this.pendingMove.resolution="finalize";return}if(!this.pendingMembershipIsCurrent()){this.revertPendingMove();return}const{item,direction,fromIndex,toIndex,expectedValues}=this.pendingMove;this.pendingMove=null,this.syncBoundaryState(),this.commitMove(item,direction,fromIndex,toIndex,expectedValues)}revertPendingMove(options){if(!this.pendingMove)return;if(this.pendingMove.phase==="dispatching"){this.pendingMove.resolution="revert";return}const wasHeld=this.pendingMove.phase==="held";this.pendingMove=null,this.syncBoundaryState(),wasHeld&&!(options?.silent??!1)&&this.liveRegion?.announce(this.localize("reorderMoveCancelled"),{force:!0})}render(){return html`
2
2
  <div
3
3
  part="base"
4
4
  role="list"
@@ -149,8 +149,10 @@ export interface LyraVirtualListScroll{scrollTop:number;viewportHeight:number;}e
149
149
  * anchors, with `label: ''` so no duplicate `[part="group"]` marker renders.
150
150
  *
151
151
  * **Position queries.** `offsetForIndex(index)` and `indexAtOffset(px)` expose the windowing math
152
- * itself: they translate between an item index and the pixel offset that row renders at, in the same
153
- * coordinate space as the scroll container's `scrollTop`. A host doing its own scroll-linked layout
152
+ * itself: they translate between an item index and its logical pixel offset. Above 8,000,000 pixels,
153
+ * scrollbar travel is scaled below browser layout limits, while visible row heights stay unchanged.
154
+ * Position queries and scroll events retain logical pixels; native scrollTop uses scaled pixels.
155
+ * Scaling emits a one-time development warning. A host doing its own scroll-linked layout
154
156
  * (a pinned group header, a scrollbar minimap, a "jump to here" affordance) needs those numbers and
155
157
  * would otherwise have to duplicate the offsets array.
156
158
  *
@@ -266,7 +268,9 @@ items:readonly unknown[];
266
268
  * and frozen while retaining each generic row's identity; reassign a new array after sequence
267
269
  * changes. Indexed-source objects pass through by identity. When set, this takes precedence over
268
270
  * `items`; an indexed source lets synthetic or remote models expose a large row count without
269
- * allocating an `Array(0…count)` merely to feed the virtualizer.
271
+ * allocating an `Array(0…count)` merely to feed the virtualizer. After mutating an indexed
272
+ * source's count or callback closures, call `requestUpdate()` to refresh identities, active-key
273
+ * lookup and measured geometry; this remains effective when a property update is pending.
270
274
  */
271
275
  source?:LyraVirtualListSource;
272
276
  /** Renders one row's content — typically a `lit-html` `TemplateResult` — inside this component's
@@ -406,12 +410,12 @@ get renderedRows():HTMLElement[];
406
410
  * returned elements as read-only: their lifetime belongs to the windowing math, and any of them
407
411
  * can be recycled or removed on the next update.
408
412
  */
409
- get projectedRows():HTMLElement[];private get externalScroller();private get spacerElement();private readScrollMetrics;private visualBlockScale;private relativeBlockScale;private applyScrollPosition;private syncExternalScrollMetrics;private get safeRowIndexOffset();private computedAriaRowIndex;private containerScrollTop;private viewportHeight;private renderUnmeasuredWindow;private offsets;private rowIdentities;private fixedRowHeight;private readonly measuredHeights;private readonly measuredIndices;private indexedMeasurementIndices;private indexedMeasurementDeltaPrefix;private indexedMeasurementIndexDirty;private offsetsDirty;private identitiesDirty;private itemsChangedPendingPrune;private renderStart;private renderEnd;private pinnedRow;private renderedWindow;private projectionAnchor?;private projectionPart?;private projectionDeferred;private readonly releaseRowProjection;private visibleStart;private visibleEnd;private lastEmittedStart;private lastEmittedEnd;private loadMoreArmed;private pendingScrollCorrection?;private measurementGeneration;private isFirstUpdate;private stickyHeight;private noTopLayer;private rowResizeObserver?;private groupResizeObserver?;private containerResizeObserver?;private stickyResizeObserver?;private observedSticky?;private readonly observedRows;private readonly observedRowKeys;private readonly observedRowIndices;private readonly observedGroups;private readonly observedGroupIndices;private scrollRafId?;private scrollRafOwner?;private scrollRafDocument?;private scrollListenerTarget?;private viewportResizeTarget?;private externalMetricsPending;private ownerRealmGeneration;private inResizeDelivery;private readonly pendingRowMeasurements;private readonly pendingGroupMeasurements;private readonly deferredRowObservations;private readonly deferredGroupObservations;private rowObserveRafId?;private rowObserveRafOwner?;private rowObserveRafDocument?;private activeIndexFor?;private activeIndexForLength;private activeIndexForId;private activeIndexForKeyFn?;private activeIndexCache;private get activeIndex();private pendingScrollTop;private normalizedGroups;private readonly normalizedGroupByIndex;private readonly measuredGroupHeights;private groupHeightPrefix;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private isCurrentOwnerWork;private resetOwnerRealmWork;firstUpdated(changed:PropertyValues):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private parseRowHeight;private get effectiveSource();private get itemCount();private itemAt;private keyOf;private rowIdentity;private identityAt;private groupHeightAt;private rowHeightAt;private groupContributionThrough;private groupCountThrough;private recomputeGroupHeightPrefix;private indexedOffsetForIndex;private rebuildIndexedMeasurementIndex;private pruneIndexedMeasurements;private offsetAt;private recomputeOffsets;private groupTopAt;private rowBottomAt;private entryTopAt;private findIndexAtOrAfter;private findIndexAtOrBefore;
413
+ get projectedRows():HTMLElement[];private get externalScroller();private get spacerElement();private externalGeometry?;private externalStyleObserver?;private invalidateExternalGeometry;private scrollRoundingAnchor?;private scrollScale;private logicalScroll;private physicalScroll;private physicalRowOffset;private captureScrollRounding;private readScrollMetrics;private readPhysicalScrollMetrics;private visualBlockScale;private relativeBlockScale;private applyScrollPosition;private scrollMetricsRefreshPending;private scheduleScrollMetricsRefresh;private syncExternalScrollMetrics;private get safeRowIndexOffset();private computedAriaRowIndex;private containerScrollTop;private viewportHeight;private renderUnmeasuredWindow;private offsets;private offsetDirtyStart;private appendIdentityStart;private identityIndices;private keyIndices;private keyOccurrences;private groupPrefixDirty;private rowKeys;private rowIdentities;private fixedRowHeight;private readonly measuredHeights;private readonly measuredIndices;private indexedMeasurementIndices;private indexedMeasurementDeltaPrefix;private indexedMeasurementIndexDirty;private offsetsDirty;private identitiesDirty;private itemsChangedPendingPrune;private compositionVersion;private compositionScrollTarget?;private readonly composition;private renderStart;private renderEnd;private pinnedRow;private renderedWindow;private rowElements;private groupElements;private stickyElement?;private projectionAnchor?;private projectionPart?;private projectionDeferred;private readonly releaseRowProjection;private visibleStart;private visibleEnd;private lastEmittedStart;private lastEmittedEnd;private loadMoreArmed;private pendingScrollCorrection?;private measurementGeneration;private isFirstUpdate;private stickyHeight;private noTopLayer;private rowResizeObserver?;private groupResizeObserver?;private containerResizeObserver?;private stickyResizeObserver?;private observedSticky?;private readonly observedRows;private readonly observedRowKeys;private readonly observedRowIndices;private readonly observedGroups;private readonly observedGroupIndices;private scrollRafId?;private scrollRafOwner?;private scrollRafDocument?;private scrollListenerTarget?;private viewportResizeTarget?;private externalMetricsPending;private ownerRealmGeneration;private inResizeDelivery;private readonly pendingRowMeasurements;private readonly pendingGroupMeasurements;private readonly deferredRowObservations;private readonly deferredGroupObservations;private rowObserveRafId?;private rowObserveRafOwner?;private rowObserveRafDocument?;private activeIndexFor?;private activeIndexForLength;private activeIndexForId;private activeIndexForKeyFn?;private activeIndexCache;private get activeIndex();private pendingScrollTop;private normalizedGroups;private readonly normalizedGroupByIndex;private readonly measuredGroupHeights;private groupHeightPrefix;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private isCurrentOwnerWork;private resetOwnerRealmWork;firstUpdated(changed:PropertyValues):void;private contentRefreshPending;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private parseRowHeight;private get effectiveSource();private get itemCount();private itemAt;private keyOf;private rowIdentity;private identityAt;private groupHeightAt;private rowHeightAt;private groupContributionThrough;private groupCountThrough;private recomputeGroupHeightPrefix;private indexedOffsetForIndex;private rebuildIndexedMeasurementIndex;private pruneIndexedMeasurements;private offsetAt;private recomputeOffsets;private groupTopAt;private rowBottomAt;private entryTopAt;private findIndexAtOrAfter;private findIndexAtOrBefore;
410
414
  /**
411
- * Row `index`'s pixel top in this list's own scroll-coordinate space — the exact value the row is
412
- * positioned at (`transform: translateY(...)`), and therefore directly comparable with
413
- * `scrollContainer.scrollTop`. `index` is clamped to `0…count`, so
414
- * `offsetForIndex(count)` is the total content height (`[part="spacer"]`'s height) and an
415
+ * Row `index`'s logical pixel top in this list's own scroll-coordinate space.
416
+ * Above 8,000,000 pixels, native scrollbar travel and row transforms use a scaled extent;
417
+ * this method and scroll events keep logical pixels. `index` is clamped to `0…count`, so
418
+ * `offsetForIndex(count)` is the logical total content height and an
415
419
  * empty list always answers `0`.
416
420
  *
417
421
  * In `row-height="auto"` mode an unmeasured row contributes a fixed estimate. A real group marker
@@ -429,7 +433,7 @@ offsetForIndex(index:number):number;
429
433
  * Returns `-1` when the effective source is empty. Same `row-height="auto"` estimate caveat as
430
434
  * `offsetForIndex()`.
431
435
  */
432
- indexAtOffset(px:number):number;private computeRange;private attachContainerListeners;private detachContainerListeners;private onExternalViewportResize;private onUserScrollIntent;private onScroll;private onRowsResized;private applyPendingRowMeasurements;private onGroupsResized;private applyPendingGroupMeasurements;private get defersMeasurementApplication();private beginResizeDelivery;private syncRowObservers;private syncGroupObservers;private get stickyInset();private scrollActiveIntoView;
436
+ indexAtOffset(px:number):number;private computeRange;private limitCompositionWindow;private setCompositionScrollTarget;private attachContainerListeners;private detachContainerListeners;private onExternalViewportResize;private onUserScrollIntent;private onScroll;private onRowsResized;private applyPendingRowMeasurements;private onGroupsResized;private applyPendingGroupMeasurements;private get defersMeasurementApplication();private beginResizeDelivery;private syncRowObservers;private syncGroupObservers;private get stickyInset();private scrollActiveIntoView;
433
437
  /**
434
438
  * Scrolls row `index` into view. `align` (default `'auto'`) chooses `'start'` (row's top edge
435
439
  * flush with the viewport top), `'end'` (row's bottom edge flush with the viewport bottom), or