@aceshooting/lyra-ui 16.0.0 → 18.0.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 (358) hide show
  1. package/CHANGELOG.md +758 -0
  2. package/README.md +2 -2
  3. package/custom-elements.json +1 -1
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/agent-tools/browser-frame/browser-frame.class.d.ts +3 -3
  6. package/dist/components/agent-tools/browser-frame/browser-frame.class.js +2 -2
  7. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -2
  8. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +3 -3
  9. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +37 -13
  10. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  11. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  12. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +4 -0
  13. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
  14. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +3 -3
  15. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
  16. package/dist/components/charts/chart/chart.class.d.ts +117 -17
  17. package/dist/components/charts/chart/chart.class.js +3 -3
  18. package/dist/components/charts/chart/histogram-bin.d.ts +5 -1
  19. package/dist/components/charts/chart/histogram-bin.js +1 -1
  20. package/dist/components/charts/chart/lite-chart.class.d.ts +9 -0
  21. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  22. package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
  23. package/dist/components/conversation/model-select/model-select.class.d.ts +13 -4
  24. package/dist/components/conversation/model-select/model-select.class.js +2 -1
  25. package/dist/components/conversation/model-select/model-select.styles.js +1 -1
  26. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +40 -2
  27. package/dist/components/conversation/streaming-text/streaming-text-base.class.js +2 -2
  28. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +27 -3
  29. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +11 -0
  30. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +31 -3
  31. package/dist/components/conversation/streaming-text/streaming-text.class.js +11 -0
  32. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +30 -2
  33. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +4 -3
  34. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
  35. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  36. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  37. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -1
  38. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -0
  39. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +16 -4
  40. package/dist/components/conversation/voice-picker/voice-picker.class.js +2 -1
  41. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  42. package/dist/components/data/context-meter/context-meter.class.d.ts +23 -4
  43. package/dist/components/data/context-meter/context-meter.class.js +10 -7
  44. package/dist/components/data/context-meter/context-meter.styles.js +1 -1
  45. package/dist/components/data/data-grid/data-grid.class.d.ts +5 -2
  46. package/dist/components/data/data-grid/data-grid.class.js +1 -1
  47. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +32 -5
  48. package/dist/components/data/flow-canvas/flow-canvas.class.js +3 -1
  49. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  50. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  51. package/dist/components/data/flow-canvas/flow-types.d.ts +10 -1
  52. package/dist/components/data/gauge/gauge.class.d.ts +15 -2
  53. package/dist/components/data/gauge/gauge.class.js +20 -20
  54. package/dist/components/data/gauge/gauge.styles.js +1 -1
  55. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +14 -5
  56. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +2 -2
  57. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +28 -2
  58. package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -2
  59. package/dist/components/data/sequence-strip/sequence-strip.styles.js +1 -1
  60. package/dist/components/data/table/table.class.d.ts +155 -30
  61. package/dist/components/data/table/table.class.js +6 -4
  62. package/dist/components/data/table/table.styles.js +1 -1
  63. package/dist/components/data/timeline/timeline-item.class.d.ts +9 -1
  64. package/dist/components/data/timeline/timeline-item.class.js +2 -2
  65. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  66. package/dist/components/data/word-cloud/word-cloud.styles.js +1 -1
  67. package/dist/components/forms/button/button.class.d.ts +30 -1
  68. package/dist/components/forms/button/button.class.js +2 -2
  69. package/dist/components/forms/checkbox/checkbox.class.d.ts +8 -6
  70. package/dist/components/forms/checkbox/checkbox.class.js +2 -2
  71. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -5
  72. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  73. package/dist/components/forms/color-picker/color-picker.class.d.ts +16 -2
  74. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  75. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  76. package/dist/components/forms/combobox/combobox.class.d.ts +52 -7
  77. package/dist/components/forms/combobox/combobox.class.js +2 -2
  78. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  79. package/dist/components/forms/date-picker/date-input.class.d.ts +4 -0
  80. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  81. package/dist/components/forms/icon-button/icon-button.class.d.ts +20 -3
  82. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  83. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  84. package/dist/components/forms/input/input.class.d.ts +5 -2
  85. package/dist/components/forms/input/input.class.js +1 -1
  86. package/dist/components/forms/input/time-input.class.d.ts +4 -0
  87. package/dist/components/forms/input/time-input.class.js +1 -1
  88. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -5
  89. package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
  90. package/dist/components/forms/otp-input/otp-input.class.d.ts +7 -2
  91. package/dist/components/forms/otp-input/otp-input.class.js +2 -2
  92. package/dist/components/forms/radio/radio-button.class.d.ts +2 -1
  93. package/dist/components/forms/radio/radio-group.class.d.ts +9 -4
  94. package/dist/components/forms/radio/radio-group.class.js +1 -1
  95. package/dist/components/forms/radio/radio.class.d.ts +13 -7
  96. package/dist/components/forms/radio/radio.class.js +1 -1
  97. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +16 -6
  98. package/dist/components/forms/rubric-form/rubric-form.class.js +2 -2
  99. package/dist/components/forms/select/select.class.d.ts +50 -13
  100. package/dist/components/forms/select/select.class.js +2 -2
  101. package/dist/components/forms/slider/slider.class.d.ts +4 -2
  102. package/dist/components/forms/slider/slider.class.js +1 -1
  103. package/dist/components/forms/switch/switch.class.d.ts +8 -6
  104. package/dist/components/forms/switch/switch.class.js +1 -1
  105. package/dist/components/forms/textarea/textarea.class.d.ts +5 -3
  106. package/dist/components/forms/textarea/textarea.class.js +1 -1
  107. package/dist/components/forms/time-range/time-range.class.d.ts +12 -7
  108. package/dist/components/forms/time-range/time-range.class.js +1 -1
  109. package/dist/components/forms/time-range/time-range.styles.js +1 -1
  110. package/dist/components/forms/token-input/token-input.class.d.ts +6 -4
  111. package/dist/components/forms/token-input/token-input.class.js +1 -1
  112. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +109 -4
  113. package/dist/components/layout/app-rail/app-rail-item.class.js +34 -29
  114. package/dist/components/layout/app-rail/app-rail-item.styles.js +1 -1
  115. package/dist/components/layout/app-rail/app-rail.class.d.ts +25 -3
  116. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  117. package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -2
  118. package/dist/components/layout/app-rail-group/app-rail-group.class.js +2 -2
  119. package/dist/components/layout/carousel/carousel.class.d.ts +1 -1
  120. package/dist/components/layout/carousel/carousel.class.js +1 -1
  121. package/dist/components/layout/details/accordion.class.d.ts +2 -2
  122. package/dist/components/layout/details/accordion.class.js +2 -2
  123. package/dist/components/layout/filter-bar/filter-bar-register.d.ts +1 -0
  124. package/dist/components/layout/filter-bar/filter-bar-register.js +1 -0
  125. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +153 -16
  126. package/dist/components/layout/filter-bar/filter-bar.class.js +8 -5
  127. package/dist/components/layout/menu/menu-item.class.d.ts +3 -3
  128. package/dist/components/layout/menu/menu-item.class.js +3 -3
  129. package/dist/components/layout/menu/menu.class.d.ts +5 -1
  130. package/dist/components/layout/menu/menu.class.js +2 -2
  131. package/dist/components/layout/reorder-list/reorder-item.styles.js +1 -1
  132. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  133. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +107 -2
  134. package/dist/components/layout/virtual-list/virtual-list.class.js +12 -7
  135. package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +1 -1
  136. package/dist/components/media/avatar-group/avatar-group.class.d.ts +12 -1
  137. package/dist/components/media/avatar-group/avatar-group.class.js +2 -2
  138. package/dist/components/media/drop-zone/drop-zone.class.d.ts +32 -11
  139. package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
  140. package/dist/components/media/file-input/file-input.class.d.ts +40 -19
  141. package/dist/components/media/file-input/file-input.class.js +2 -2
  142. package/dist/components/media/map/map.class.d.ts +138 -12
  143. package/dist/components/media/map/map.class.js +25 -20
  144. package/dist/components/media/map/map.styles.js +1 -1
  145. package/dist/components/overlays/callout/callout.styles.js +1 -1
  146. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  147. package/dist/components/overlays/overlay/dropdown.class.d.ts +13 -3
  148. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  149. package/dist/components/overlays/overlay/popover.class.d.ts +12 -3
  150. package/dist/components/overlays/overlay/popover.class.js +2 -2
  151. package/dist/components/overlays/rating/rating.class.d.ts +9 -7
  152. package/dist/components/overlays/rating/rating.class.js +1 -1
  153. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +5 -1
  154. package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
  155. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  156. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +5 -1
  157. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  158. package/dist/components/retrieval/graph-legend/graph-legend.styles.js +1 -1
  159. package/dist/components/retrieval/retrieval-value-format.js +1 -1
  160. package/dist/components/retrieval/source-list/source-list.styles.js +1 -1
  161. package/dist/components/utility/copy-button/copy-button.class.d.ts +23 -11
  162. package/dist/components/utility/copy-button/copy-button.class.js +2 -2
  163. package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
  164. package/dist/components/utility/diff-view/diff-view.styles.js +1 -1
  165. package/dist/components/utility/export-button/export-button.class.d.ts +4 -0
  166. package/dist/components/utility/export-button/export-button.class.js +1 -1
  167. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  168. package/dist/components/utility/known-date/known-date.class.js +1 -1
  169. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +38 -3
  170. package/dist/components/utility/mention-popover/mention-popover.class.js +2 -1
  171. package/dist/components/utility/mention-popover/mention-popover.styles.js +1 -1
  172. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  173. package/dist/components/utility/tour/tour.class.d.ts +4 -0
  174. package/dist/components/utility/tour/tour.class.js +1 -1
  175. package/dist/components/utility/tour/tour.styles.js +1 -1
  176. package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
  177. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +2 -2
  178. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +2 -2
  179. package/dist/components/viewers/highlight-layer/highlight-layer.class.js +2 -2
  180. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  181. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  182. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +2 -2
  183. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
  184. package/dist/custom-elements-jsx.d.ts +2 -2
  185. package/dist/events.d.ts +20 -13
  186. package/dist/internal/aggregate-file-limits.d.ts +33 -0
  187. package/dist/internal/aggregate-file-limits.js +1 -0
  188. package/dist/internal/catalog-picker.d.ts +15 -2
  189. package/dist/internal/catalog-picker.js +1 -1
  190. package/dist/internal/debounce-controller.d.ts +14 -0
  191. package/dist/internal/debounce-controller.js +1 -1
  192. package/dist/internal/default-strings.generated.d.ts +1 -1
  193. package/dist/internal/default-strings.generated.js +2 -2
  194. package/dist/internal/focus-navigation.d.ts +45 -0
  195. package/dist/internal/focus-navigation.js +1 -1
  196. package/dist/internal/form-associated.js +1 -1
  197. package/dist/internal/initial-slot-collection.d.ts +30 -0
  198. package/dist/internal/initial-slot-collection.js +1 -0
  199. package/dist/internal/intl-cache.js +1 -1
  200. package/dist/internal/invalid-event-alias.d.ts +46 -0
  201. package/dist/internal/invalid-event-alias.js +1 -1
  202. package/dist/internal/localization-runtime.d.ts +24 -0
  203. package/dist/internal/localization-runtime.js +1 -1
  204. package/dist/internal/localization-types.d.ts +1 -1
  205. package/dist/internal/localization.js +1 -1
  206. package/dist/internal/package-metadata.d.ts +1 -1
  207. package/dist/internal/package-metadata.js +1 -1
  208. package/dist/internal/positioning-strategy.d.ts +3 -1
  209. package/dist/internal/state-part.d.ts +49 -0
  210. package/dist/internal/state-part.js +1 -0
  211. package/dist/internal/variants.styles.js +1 -1
  212. package/dist/lyra.d.ts +1 -1
  213. package/dist/lyra.js +1 -1
  214. package/dist/svelte.d.ts +2 -2
  215. package/dist/testing/index.d.ts +1 -1
  216. package/dist/testing/index.js +1 -1
  217. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  218. package/dist/testing/lyra-tag-event-map.js +1 -1
  219. package/dist/testing/wait-for-mount.d.ts +46 -0
  220. package/dist/testing/wait-for-mount.js +1 -0
  221. package/dist/theme/theme-bootstrap.js +1 -1
  222. package/dist/theme/theme.d.ts +11 -2
  223. package/dist/theme/theme.js +1 -1
  224. package/dist/translations/ar/layout.js +1 -1
  225. package/dist/translations/ar/retrieval.js +1 -1
  226. package/dist/translations/ar/shared.js +1 -1
  227. package/dist/translations/de/layout.js +1 -1
  228. package/dist/translations/de/retrieval.js +1 -1
  229. package/dist/translations/de/shared.js +1 -1
  230. package/dist/translations/es/layout.js +1 -1
  231. package/dist/translations/es/retrieval.js +1 -1
  232. package/dist/translations/es/shared.js +1 -1
  233. package/dist/translations/fa/layout.js +1 -1
  234. package/dist/translations/fa/retrieval.js +1 -1
  235. package/dist/translations/fa/shared.js +1 -1
  236. package/dist/translations/fr/layout.js +1 -1
  237. package/dist/translations/fr/retrieval.js +1 -1
  238. package/dist/translations/fr/shared.js +1 -1
  239. package/dist/translations/he/layout.js +1 -1
  240. package/dist/translations/he/retrieval.js +1 -1
  241. package/dist/translations/he/shared.js +1 -1
  242. package/dist/translations/it/layout.js +1 -1
  243. package/dist/translations/it/retrieval.js +1 -1
  244. package/dist/translations/it/shared.js +1 -1
  245. package/dist/translations/ja/layout.js +1 -1
  246. package/dist/translations/ja/retrieval.js +1 -1
  247. package/dist/translations/ja/shared.js +1 -1
  248. package/dist/translations/pt-BR/layout.js +1 -1
  249. package/dist/translations/pt-BR/retrieval.js +1 -1
  250. package/dist/translations/pt-BR/shared.js +1 -1
  251. package/dist/translations/ro/agent-tools.d.ts +1 -0
  252. package/dist/translations/ro/agent-tools.js +1 -0
  253. package/dist/translations/ro/charts.d.ts +1 -0
  254. package/dist/translations/ro/charts.js +1 -0
  255. package/dist/translations/ro/conversation.d.ts +1 -0
  256. package/dist/translations/ro/conversation.js +1 -0
  257. package/dist/translations/ro/data.d.ts +1 -0
  258. package/dist/translations/ro/data.js +1 -0
  259. package/dist/translations/ro/forms.d.ts +1 -0
  260. package/dist/translations/ro/forms.js +1 -0
  261. package/dist/translations/ro/layout.d.ts +1 -0
  262. package/dist/translations/ro/layout.js +1 -0
  263. package/dist/translations/ro/media.d.ts +1 -0
  264. package/dist/translations/ro/media.js +1 -0
  265. package/dist/translations/ro/overlays.d.ts +1 -0
  266. package/dist/translations/ro/overlays.js +1 -0
  267. package/dist/translations/ro/retrieval.d.ts +1 -0
  268. package/dist/translations/ro/retrieval.js +1 -0
  269. package/dist/translations/ro/shared.d.ts +1 -0
  270. package/dist/translations/ro/shared.js +1 -0
  271. package/dist/translations/ro/utility.d.ts +1 -0
  272. package/dist/translations/ro/utility.js +1 -0
  273. package/dist/translations/ro/viewers.d.ts +1 -0
  274. package/dist/translations/ro/viewers.js +5 -0
  275. package/dist/translations/ro.d.ts +1 -0
  276. package/dist/translations/ro.js +1 -0
  277. package/dist/translations/ru/layout.js +1 -1
  278. package/dist/translations/ru/retrieval.js +1 -1
  279. package/dist/translations/ru/shared.js +1 -1
  280. package/dist/translations/zh-CN/layout.js +1 -1
  281. package/dist/translations/zh-CN/retrieval.js +1 -1
  282. package/dist/translations/zh-CN/shared.js +1 -1
  283. package/dist/utilities/format.d.ts +17 -0
  284. package/dist/utilities/format.js +1 -1
  285. package/dist/vue.d.ts +2 -2
  286. package/llms/components/lr-app-rail-group.md +87 -10
  287. package/llms/components/lr-app-rail-item.md +88 -11
  288. package/llms/components/lr-app-rail.md +88 -11
  289. package/llms/components/lr-attachment-trigger.md +21 -0
  290. package/llms/components/lr-bar-chart.md +3 -2
  291. package/llms/components/lr-bubble-chart.md +3 -2
  292. package/llms/components/lr-button.md +5 -4
  293. package/llms/components/lr-callout.md +10 -0
  294. package/llms/components/lr-card.md +2 -1
  295. package/llms/components/lr-chart.md +43 -12
  296. package/llms/components/lr-citation-badge.md +7 -1
  297. package/llms/components/lr-code-block.md +21 -0
  298. package/llms/components/lr-color-picker.md +12 -7
  299. package/llms/components/lr-combobox.md +20 -1
  300. package/llms/components/lr-confirm-bar.md +36 -7
  301. package/llms/components/lr-context-meter.md +17 -4
  302. package/llms/components/lr-date-input.md +7 -1
  303. package/llms/components/lr-date-picker.md +6 -0
  304. package/llms/components/lr-dialog.md +21 -0
  305. package/llms/components/lr-doughnut-chart.md +3 -2
  306. package/llms/components/lr-drawer.md +10 -0
  307. package/llms/components/lr-drop-zone.md +16 -7
  308. package/llms/components/lr-dropdown-item.md +7 -0
  309. package/llms/components/lr-entity-chip.md +7 -1
  310. package/llms/components/lr-export-button.md +7 -1
  311. package/llms/components/lr-file-input.md +21 -10
  312. package/llms/components/lr-filter-bar.md +177 -18
  313. package/llms/components/lr-flow-canvas.md +16 -9
  314. package/llms/components/lr-gauge.md +22 -2
  315. package/llms/components/lr-histogram.md +7 -2
  316. package/llms/components/lr-icon-button.md +17 -8
  317. package/llms/components/lr-input.md +3 -1
  318. package/llms/components/lr-line-chart.md +3 -2
  319. package/llms/components/lr-lite-chart.md +13 -0
  320. package/llms/components/lr-locale-picker.md +7 -1
  321. package/llms/components/lr-map.md +63 -6
  322. package/llms/components/lr-mention-popover.md +16 -3
  323. package/llms/components/lr-menu-item.md +7 -0
  324. package/llms/components/lr-menu.md +8 -1
  325. package/llms/components/lr-message-actions.md +10 -0
  326. package/llms/components/lr-model-select.md +8 -3
  327. package/llms/components/lr-native-time-input.md +8 -1
  328. package/llms/components/lr-number-input.md +8 -1
  329. package/llms/components/lr-option.md +19 -0
  330. package/llms/components/lr-otp-input.md +6 -0
  331. package/llms/components/lr-pie-chart.md +3 -2
  332. package/llms/components/lr-polar-area-chart.md +3 -2
  333. package/llms/components/lr-prompt-input.md +2 -2
  334. package/llms/components/lr-radar-chart.md +3 -2
  335. package/llms/components/lr-reorder-item.md +12 -0
  336. package/llms/components/lr-reorder-list.md +12 -0
  337. package/llms/components/lr-scatter-chart.md +3 -2
  338. package/llms/components/lr-select.md +19 -2
  339. package/llms/components/lr-sequence-strip.md +10 -4
  340. package/llms/components/lr-streaming-text-core.md +28 -11
  341. package/llms/components/lr-streaming-text.md +41 -6
  342. package/llms/components/lr-suggestion-chips.md +8 -4
  343. package/llms/components/lr-table.md +47 -10
  344. package/llms/components/lr-textarea.md +1 -1
  345. package/llms/components/lr-time-input.md +7 -1
  346. package/llms/components/lr-tool-call-chip.md +7 -1
  347. package/llms/components/lr-tour.md +7 -1
  348. package/llms/components/lr-usage-badge.md +7 -1
  349. package/llms/components/lr-virtual-list.md +53 -0
  350. package/llms/components/lr-voice-picker.md +7 -3
  351. package/llms/shared.md +175 -19
  352. package/llms/tokens.md +17 -1
  353. package/llms-full.txt +1214 -169
  354. package/package.json +43 -3
  355. package/registrations.json +1 -1
  356. package/vscode-css-data.json +1 -1
  357. package/vscode-html-data.json +1 -1
  358. package/web-types.json +1 -1
@@ -1 +1 @@
1
- import{css}from"lit";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";const styles=css` :host { --_lr-dialog-overlay-color: var(--lr-color-overlay); --_lr-dialog-max-width: var(--lr-size-32rem); --_lr-dialog-close-background: var(--lr-icon-button-background, transparent); --_lr-dialog-close-background-hover: var( --lr-icon-button-background-hover, var(--lr-color-brand-quiet) ); --_lr-dialog-close-background-active: var( --lr-icon-button-background-active, color-mix( in oklab, var(--lr-icon-button-background-hover, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); --_lr-dialog-close-color: var(--lr-icon-button-color, var(--lr-color-text-quiet)); --_lr-dialog-close-color-hover: var(--lr-icon-button-color-hover, var(--lr-color-brand)); --_lr-dialog-close-color-active: var( --lr-icon-button-color-active, var(--lr-icon-button-color-hover, var(--lr-color-brand)) ); --_lr-dialog-close-radius: var( --lr-icon-button-radius, var(--lr-overlay-radius, var(--lr-radius)) ); display: none; position: fixed; inset: 0; z-index: var(--lr-overlay-stack-index, var(--lr-layer-modal)); margin: 0; border: none; background: transparent; overflow: visible; inline-size: auto; block-size: auto; align-items: center; justify-content: center; padding-block-start: max(var(--lr-space-l), var(--lr-safe-area-top)); padding-block-end: max(var(--lr-space-l), var(--lr-safe-area-bottom)); padding-inline-start: max( var(--lr-space-l), var(--lr-safe-area-inline-start) ); padding-inline-end: max(var(--lr-space-l), var(--lr-safe-area-inline-end)); } :host([open]) { display: flex; } :host([data-closing]) { display: flex; pointer-events: none; } :host([size='2xs']) { --_lr-dialog-max-width: var(--lr-size-20rem); } :host([size='xs']) { --_lr-dialog-max-width: var(--lr-size-24rem); } :host([size='s']), :host([size='small']) { --_lr-dialog-max-width: var(--lr-size-28rem); } :host([size='l']), :host([size='large']) { --_lr-dialog-max-width: var(--lr-size-38rem); } :host([size='xl']) { --_lr-dialog-max-width: var(--lr-size-48rem); } [part~="base"] { display: contents; } [part~="backdrop"] { position: absolute; inset: 0; background: var(--lr-dialog-overlay-color, var(--_lr-dialog-overlay-color)); backdrop-filter: var( --backdrop-filter, var(--lr-dialog-backdrop-filter, none) ); } [part~="panel"] { position: relative; display: flex; flex-direction: column; min-inline-size: 0; inline-size: var(--width, var(--lr-dialog-width, auto)); max-inline-size: min( var( --lr-dialog-max-width, var(--width, var(--lr-dialog-width, var(--_lr-dialog-max-width))) ), 100% ); block-size: var(--lr-dialog-height, auto); max-block-size: 100%; ${overlaySurface} box-shadow: var(--lr-overlay-shadow-modal, var(--lr-shadow-xl)); overflow: auto; } [part="header"] { display: flex; flex-wrap: wrap; align-items: center; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-space-s); padding: var( --header-spacing, var( --spacing, var(--lr-dialog-spacing-block, var(--lr-space-m)) var(--lr-dialog-spacing, var(--lr-space-l)) ) ); border-block-end: var(--lr-border-width-thin) solid var(--lr-overlay-border, var(--lr-color-border)); } [part~="heading"] { flex: 1 1 auto; min-inline-size: 0; margin: 0; font-weight: var(--lr-font-weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="header-actions"] { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; gap: var(--lr-space-xs); margin-inline-start: auto; } [part="header-actions"] ::slotted(*) { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } [part~="close-button"] { flex: 0 0 auto; margin-inline-start: auto; --lr-icon-button-background: var(--_lr-dialog-close-background); --lr-icon-button-background-hover: var(--_lr-dialog-close-background-hover); --lr-icon-button-background-active: var(--_lr-dialog-close-background-active); --lr-icon-button-color: var(--_lr-dialog-close-color); --lr-icon-button-color-hover: var(--_lr-dialog-close-color-hover); --lr-icon-button-color-active: var(--_lr-dialog-close-color-active); --lr-icon-button-radius: var(--_lr-dialog-close-radius); } [part="header-actions"] + [part~="close-button"] { margin-inline-start: 0; } [part~="close-button"] svg { display: block; } [part="body"] { flex: 1 1 auto; min-inline-size: 0; max-inline-size: 100%; padding: var( --body-spacing, var(--spacing, var(--lr-dialog-spacing, var(--lr-space-l))) ); overflow: auto; overflow-wrap: anywhere; } [part="body"]:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } [part="footer"] { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-space-s); padding: var( --footer-spacing, var( --spacing, var(--lr-dialog-spacing-block, var(--lr-space-m)) var(--lr-dialog-spacing, var(--lr-space-l)) ) ); border-block-start: var(--lr-border-width-thin) solid var(--lr-overlay-border, var(--lr-color-border)); overflow-wrap: anywhere; } [part="footer"] ::slotted(*) { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } [part="footer"][hidden] { display: none; } `;export{styles};
1
+ import{css}from"lit";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";const styles=css` :host { --_lr-dialog-overlay-color: var(--lr-color-overlay); --_lr-dialog-max-width: var(--lr-size-32rem); --_lr-dialog-close-background: transparent; --_lr-dialog-close-background-hover: var(--lr-color-brand-quiet); --_lr-dialog-close-background-active: color-mix( in oklab, var(--lr-icon-button-background-hover, var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); --_lr-dialog-close-color: var(--lr-color-text-quiet); --_lr-dialog-close-color-hover: var(--lr-color-brand); --_lr-dialog-close-color-active: var(--lr-icon-button-color-hover, var(--lr-color-brand)); --_lr-dialog-close-radius: var(--lr-overlay-radius, var(--lr-radius)); display: none; position: fixed; inset: 0; z-index: var(--lr-overlay-stack-index, var(--lr-layer-modal)); margin: 0; border: none; background: transparent; overflow: visible; inline-size: auto; block-size: auto; align-items: center; justify-content: center; padding-block-start: max(var(--lr-space-l), var(--lr-safe-area-top)); padding-block-end: max(var(--lr-space-l), var(--lr-safe-area-bottom)); padding-inline-start: max( var(--lr-space-l), var(--lr-safe-area-inline-start) ); padding-inline-end: max(var(--lr-space-l), var(--lr-safe-area-inline-end)); } :host([open]) { display: flex; } :host([data-closing]) { display: flex; pointer-events: none; } :host([size='2xs']) { --_lr-dialog-max-width: var(--lr-size-20rem); } :host([size='xs']) { --_lr-dialog-max-width: var(--lr-size-24rem); } :host([size='s']), :host([size='small']) { --_lr-dialog-max-width: var(--lr-size-28rem); } :host([size='l']), :host([size='large']) { --_lr-dialog-max-width: var(--lr-size-38rem); } :host([size='xl']) { --_lr-dialog-max-width: var(--lr-size-48rem); } [part~="base"] { display: contents; } [part~="backdrop"] { position: absolute; inset: 0; background: var(--lr-dialog-overlay-color, var(--_lr-dialog-overlay-color)); backdrop-filter: var( --backdrop-filter, var(--lr-dialog-backdrop-filter, none) ); } [part~="panel"] { position: relative; display: flex; flex-direction: column; min-inline-size: 0; inline-size: var(--width, var(--lr-dialog-width, auto)); max-inline-size: min( var( --lr-dialog-max-width, var(--width, var(--lr-dialog-width, var(--_lr-dialog-max-width))) ), 100% ); block-size: var(--lr-dialog-height, auto); max-block-size: 100%; ${overlaySurface} box-shadow: var(--lr-overlay-shadow-modal, var(--lr-shadow-xl)); overflow: auto; } [part="header"] { display: flex; flex-wrap: wrap; align-items: center; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-space-s); padding: var( --header-spacing, var( --spacing, var(--lr-dialog-spacing-block, var(--lr-space-m)) var(--lr-dialog-spacing, var(--lr-space-l)) ) ); border-block-end: var(--lr-border-width-thin) solid var(--lr-overlay-border, var(--lr-color-border)); } [part~="heading"] { flex: 1 1 auto; min-inline-size: 0; margin: 0; font-weight: var(--lr-font-weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } [part="header-actions"] { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; gap: var(--lr-space-xs); margin-inline-start: auto; } [part="header-actions"] ::slotted(*) { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } [part~="close-button"] { flex: 0 0 auto; margin-inline-start: auto; --_lr-icon-button-background-default: var(--_lr-dialog-close-background); --_lr-icon-button-background-hover-default: var(--_lr-dialog-close-background-hover); --_lr-icon-button-background-active-default: var(--_lr-dialog-close-background-active); --_lr-icon-button-color-default: var(--_lr-dialog-close-color); --_lr-icon-button-color-hover-default: var(--_lr-dialog-close-color-hover); --_lr-icon-button-color-active-default: var(--_lr-dialog-close-color-active); --_lr-icon-button-radius-default: var(--_lr-dialog-close-radius); } [part="header-actions"] + [part~="close-button"] { margin-inline-start: 0; } [part~="close-button"] svg { display: block; } [part="body"] { flex: 1 1 auto; min-inline-size: 0; max-inline-size: 100%; padding: var( --body-spacing, var(--spacing, var(--lr-dialog-spacing, var(--lr-space-l))) ); overflow: auto; overflow-wrap: anywhere; } [part="body"]:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-offset)); } [part="footer"] { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-inline-size: 0; max-inline-size: 100%; gap: var(--lr-space-s); padding: var( --footer-spacing, var( --spacing, var(--lr-dialog-spacing-block, var(--lr-space-m)) var(--lr-dialog-spacing, var(--lr-space-l)) ) ); border-block-start: var(--lr-border-width-thin) solid var(--lr-overlay-border, var(--lr-color-border)); overflow-wrap: anywhere; } [part="footer"] ::slotted(*) { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; } [part="footer"][hidden] { display: none; } `;export{styles};
@@ -78,7 +78,7 @@ get hoist():boolean;set hoist(next:boolean);
78
78
  /** Copies the trigger's width, height, or both onto the popup. */
79
79
  sync?:PlaceSync;
80
80
  /** Optional element that counts as inside for light-dismiss handling. Property-only. */
81
- containingElement?:HTMLElement;private consumerMenu?;private consumerMenuSnapshot?;constructor();
81
+ containingElement?:HTMLElement;private consumerMenu?;private consumerMenuSnapshot?;private contentSlot?;constructor();
82
82
  /** Dropdown semantics are invariant: the trigger announces a menu and the contained menu owns
83
83
  * that role/name. The inherited Popover write surface is narrowed to `menu`; any other runtime
84
84
  * or authored value normalizes back to `menu` instead of changing the outer positioning shell.
@@ -92,10 +92,20 @@ protected get defaultPositioningStrategy():PlaceStrategy;
92
92
  * through its own setter. */
93
93
  protected onPositioningStrategyChanged(previous:PlaceStrategy,next:PlaceStrategy):void;protected get positioningSync():PlaceSync|undefined;protected get animationNamespace():string;
94
94
  /** The positioned wrapper is presentation-only; the contained menu owns role and name. */
95
- protected get popupSurfaceRole():undefined;protected animationDurationProperties(showing:boolean):readonly string[];protected get popupPartNames():string;protected isInsideLightDismissBoundary(path:EventTarget[]):boolean;protected onPopupPositioned():void;private get menuEngine();private configureMenu;connectedCallback():void;private releaseConsumerMenu;private onContentSlotChange;protected onTriggerKeyDown(event:KeyboardEvent):void;
95
+ protected get popupSurfaceRole():undefined;protected animationDurationProperties(showing:boolean):readonly string[];protected get popupPartNames():string;protected isInsideLightDismissBoundary(path:EventTarget[]):boolean;protected onPopupPositioned():void;private get menuEngine();private configureMenu;connectedCallback():void;private releaseConsumerMenu;private onContentSlotChange;
96
+ /**
97
+ * Reads the default slot's currently assigned elements and adopts a consumer-supplied
98
+ * `<lr-menu>` among them (rather than wrapping mapped rows in a second, generated one) --
99
+ * wired as the `slotchange` handler (via `onContentSlotChange`) for every later mutation, and
100
+ * called once more from `firstUpdated()` (see `collectInitialSlotAssignment`) to cover an
101
+ * environment, or a real-browser timing race, where the slot's initial assignment never fires
102
+ * `slotchange`. Idempotent: a second call finding the same (or still-absent) menu falls through
103
+ * the `next !== this.consumerMenu` guard and only re-runs the harmless `configureMenu()` resync.
104
+ */
105
+ private collectConsumerMenuFromSlot;protected onTriggerKeyDown(event:KeyboardEvent):void;
96
106
  /** Re-run positioning after an imperative anchor/layout change. */
97
107
  reposition():void;
98
108
  /** Focus the assigned trigger, when one is present. */
99
109
  focusOnTrigger(options?:FocusOptions):void;
100
110
  /** Return the active generated or consumer-supplied menu engine. */
101
- getMenu():LyraMenu|null;protected updated(changed:PropertyValues):void;disconnectedCallback():void;protected renderPopupContent():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-dropdown':LyraDropdown;}}
111
+ getMenu():LyraMenu|null;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;disconnectedCallback():void;protected renderPopupContent():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-dropdown':LyraDropdown;}}
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html}from"lit";import{property,state}from"lit/decorators.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{tag}from"../../../internal/prefix.js";import{LyraPopover}from"./popover.class.js";import{styles}from"./dropdown.styles.js";const menuTag=unsafeStatic(tag("menu"));class LyraDropdown extends LyraPopover{static{this.styles=[LyraPopover.styles,styles]}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}constructor(){super(),this.distance=0,this.placement="bottom-start",this.arrow=!1,this.size="m",this.stayOpenOnSelect=!1,this.onContentSlotChange=event=>{const next=event.target.assignedElements({flatten:!0}).find(element=>element.localName===tag("menu"));next!==this.consumerMenu&&(this.releaseConsumerMenu(this.consumerMenu),this.consumerMenu=next),this.configureMenu(next??this.menuEngine)},this.popupRole="menu"}get popupRole(){return"menu"}set popupRole(_next){super.popupRole!=="menu"&&(super.popupRole="menu")}attributeChangedCallback(name,oldValue,newValue){if(name==="popup-role"&&newValue!==null&&newValue!=="menu"){this.setAttribute("popup-role","menu");return}super.attributeChangedCallback(name,oldValue,newValue)}get defaultDistance(){return 0}get defaultPositioningStrategy(){return"absolute"}onPositioningStrategyChanged(previous,next){const wasHoisted=previous==="fixed";wasHoisted!==(next==="fixed")&&this.requestUpdate("hoist",wasHoisted)}get positioningSync(){return this.sync}get animationNamespace(){return"dropdown"}get popupSurfaceRole(){}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-transition-fast"]}get popupPartNames(){return["popup","dialog","popup__popup","base","base__popup","panel"].join(" ")}isInsideLightDismissBoundary(path){return super.isInsideLightDismissBoundary(path)||!!(this.containingElement&&path.includes(this.containingElement))}onPopupPositioned(){if(super.onPopupPositioned(),this.openedByInteraction)return;const menu=this.menuEngine;if(!menu?.dropdownOpen)return;menu.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).find(element=>element.tabIndex===0)?.focus()}get menuEngine(){return this.consumerMenu??this.renderRoot.querySelector('[part~="menu"]')??void 0}configureMenu(menu){menu&&(menu===this.consumerMenu&&!this.consumerMenuSnapshot&&(this.consumerMenuSnapshot={dropdownOwner:menu.dropdownOwner,dropdownContained:menu.dropdownContained,dropdownRendersMenuRole:menu.dropdownRendersMenuRole,dropdownStayOpenOnSelect:menu.dropdownStayOpenOnSelect,dropdownSize:menu.dropdownSize,dropdownLabel:menu.dropdownLabel,dropdownOpen:menu.dropdownOpen}),menu.dropdownOwner=this,menu.dropdownContained=!0,menu.dropdownRendersMenuRole=!0,menu.dropdownStayOpenOnSelect=this.stayOpenOnSelect,menu.dropdownSize=this.size,menu.dropdownLabel=this.effectivePopupLabel,menu.dropdownOpen=this.open)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.isConnected&&this.configureMenu(this.menuEngine)})}releaseConsumerMenu(menu){if(!menu)return;const snapshot=menu===this.consumerMenu?this.consumerMenuSnapshot:void 0;menu.dropdownOpen=!1,menu.dropdownOwner=snapshot?.dropdownOwner??null,menu.dropdownContained=snapshot?.dropdownContained??!1,menu.dropdownRendersMenuRole=snapshot?.dropdownRendersMenuRole??!1,menu.dropdownStayOpenOnSelect=snapshot?.dropdownStayOpenOnSelect??!1,menu.dropdownSize=snapshot?.dropdownSize,menu.dropdownLabel=snapshot?.dropdownLabel,snapshot&&(menu.dropdownOpen=snapshot.dropdownOpen),menu===this.consumerMenu&&(this.consumerMenuSnapshot=void 0)}onTriggerKeyDown(event){if(this.disabled||this.open)return;let focus;if(event.key==="ArrowDown"?focus="first":event.key==="ArrowUp"&&(focus="last"),!focus)return;event.preventDefault();const menu=this.menuEngine;this.configureMenu(menu),menu?menu.focusContained(focus):this.show()}reposition(){this.positionPopup()}focusOnTrigger(options){this.renderRoot.querySelector('slot[name="trigger"]')?.assignedElements({flatten:!0})[0]?.focus(options)}getMenu(){return this.menuEngine??null}updated(changed){super.updated(changed),this.configureMenu(this.menuEngine),this.open&&changed.has("sync")&&this.reposition()}disconnectedCallback(){this.releaseConsumerMenu(this.consumerMenu),super.disconnectedCallback()}renderPopupContent(){return this.consumerMenu?html`<slot @slotchange=${this.onContentSlotChange}></slot>`:staticHtml`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html}from"lit";import{property,query,state}from"lit/decorators.js";import{html as staticHtml,unsafeStatic}from"lit/static-html.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{tag}from"../../../internal/prefix.js";import{LyraPopover}from"./popover.class.js";import{styles}from"./dropdown.styles.js";const menuTag=unsafeStatic(tag("menu"));class LyraDropdown extends LyraPopover{static{this.styles=[LyraPopover.styles,styles]}get hoist(){return this.positioningStrategy==="fixed"}set hoist(next){this.positioningStrategy=next?"fixed":"absolute"}constructor(){super(),this.distance=0,this.placement="bottom-start",this.arrow=!1,this.size="m",this.stayOpenOnSelect=!1,this.onContentSlotChange=event=>{this.collectConsumerMenuFromSlot(event.target)},this.popupRole="menu"}get popupRole(){return"menu"}set popupRole(_next){super.popupRole!=="menu"&&(super.popupRole="menu")}attributeChangedCallback(name,oldValue,newValue){if(name==="popup-role"&&newValue!==null&&newValue!=="menu"){this.setAttribute("popup-role","menu");return}super.attributeChangedCallback(name,oldValue,newValue)}get defaultDistance(){return 0}get defaultPositioningStrategy(){return"absolute"}onPositioningStrategyChanged(previous,next){const wasHoisted=previous==="fixed";wasHoisted!==(next==="fixed")&&this.requestUpdate("hoist",wasHoisted)}get positioningSync(){return this.sync}get animationNamespace(){return"dropdown"}get popupSurfaceRole(){}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-transition-fast"]}get popupPartNames(){return["popup","dialog","popup__popup","base","base__popup","panel"].join(" ")}isInsideLightDismissBoundary(path){return super.isInsideLightDismissBoundary(path)||!!(this.containingElement&&path.includes(this.containingElement))}onPopupPositioned(){if(super.onPopupPositioned(),this.openedByInteraction)return;const menu=this.menuEngine;if(!menu?.dropdownOpen)return;menu.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).find(element=>element.tabIndex===0)?.focus()}get menuEngine(){return this.consumerMenu??this.renderRoot.querySelector('[part~="menu"]')??void 0}configureMenu(menu){menu&&(menu===this.consumerMenu&&!this.consumerMenuSnapshot&&(this.consumerMenuSnapshot={dropdownOwner:menu.dropdownOwner,dropdownContained:menu.dropdownContained,dropdownRendersMenuRole:menu.dropdownRendersMenuRole,dropdownStayOpenOnSelect:menu.dropdownStayOpenOnSelect,dropdownSize:menu.dropdownSize,dropdownLabel:menu.dropdownLabel,dropdownOpen:menu.dropdownOpen}),menu.dropdownOwner=this,menu.dropdownContained=!0,menu.dropdownRendersMenuRole=!0,menu.dropdownStayOpenOnSelect=this.stayOpenOnSelect,menu.dropdownSize=this.size,menu.dropdownLabel=this.effectivePopupLabel,menu.dropdownOpen=this.open)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.isConnected&&this.configureMenu(this.menuEngine)})}releaseConsumerMenu(menu){if(!menu)return;const snapshot=menu===this.consumerMenu?this.consumerMenuSnapshot:void 0;menu.dropdownOpen=!1,menu.dropdownOwner=snapshot?.dropdownOwner??null,menu.dropdownContained=snapshot?.dropdownContained??!1,menu.dropdownRendersMenuRole=snapshot?.dropdownRendersMenuRole??!1,menu.dropdownStayOpenOnSelect=snapshot?.dropdownStayOpenOnSelect??!1,menu.dropdownSize=snapshot?.dropdownSize,menu.dropdownLabel=snapshot?.dropdownLabel,snapshot&&(menu.dropdownOpen=snapshot.dropdownOpen),menu===this.consumerMenu&&(this.consumerMenuSnapshot=void 0)}collectConsumerMenuFromSlot(slot){const next=slot.assignedElements({flatten:!0}).find(element=>element.localName===tag("menu"));next!==this.consumerMenu&&(this.releaseConsumerMenu(this.consumerMenu),this.consumerMenu=next),this.configureMenu(next??this.menuEngine)}onTriggerKeyDown(event){if(this.disabled||this.open)return;let focus;if(event.key==="ArrowDown"?focus="first":event.key==="ArrowUp"&&(focus="last"),!focus)return;event.preventDefault();const menu=this.menuEngine;this.configureMenu(menu),menu?menu.focusContained(focus):this.show()}reposition(){this.positionPopup()}focusOnTrigger(options){this.renderRoot.querySelector('slot[name="trigger"]')?.assignedElements({flatten:!0})[0]?.focus(options)}getMenu(){return this.menuEngine??null}updated(changed){super.updated(changed),this.configureMenu(this.menuEngine),this.open&&changed.has("sync")&&this.reposition()}firstUpdated(changed){super.firstUpdated(changed);const slot=this.contentSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectConsumerMenuFromSlot(s))})}disconnectedCallback(){this.releaseConsumerMenu(this.consumerMenu),super.disconnectedCallback()}renderPopupContent(){return this.consumerMenu?html`<slot @slotchange=${this.onContentSlotChange}></slot>`:staticHtml`
2
2
  <${menuTag}
3
3
  part="menu"
4
4
  .dropdownOwner=${this}
@@ -11,4 +11,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
11
11
  >
12
12
  <slot @slotchange=${this.onContentSlotChange}></slot>
13
13
  </${menuTag}>
14
- `}}__decorate([property({reflect:!0})],LyraDropdown.prototype,"size",void 0),__decorate([property({type:Boolean,attribute:"stay-open-on-select",reflect:!0})],LyraDropdown.prototype,"stayOpenOnSelect",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDropdown.prototype,"hoist",null),__decorate([property({reflect:!0})],LyraDropdown.prototype,"sync",void 0),__decorate([property({attribute:!1})],LyraDropdown.prototype,"containingElement",void 0),__decorate([state()],LyraDropdown.prototype,"consumerMenu",void 0),__decorate([property({attribute:"popup-role"})],LyraDropdown.prototype,"popupRole",null);export{LyraDropdown};
14
+ `}}__decorate([property({reflect:!0})],LyraDropdown.prototype,"size",void 0),__decorate([property({type:Boolean,attribute:"stay-open-on-select",reflect:!0})],LyraDropdown.prototype,"stayOpenOnSelect",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDropdown.prototype,"hoist",null),__decorate([property({reflect:!0})],LyraDropdown.prototype,"sync",void 0),__decorate([property({attribute:!1})],LyraDropdown.prototype,"containingElement",void 0),__decorate([state()],LyraDropdown.prototype,"consumerMenu",void 0),__decorate([query("slot:not([name])")],LyraDropdown.prototype,"contentSlot",void 0),__decorate([property({attribute:"popup-role"})],LyraDropdown.prototype,"popupRole",null);export{LyraDropdown};
@@ -212,7 +212,7 @@ get popupRole():LyraPopupRole;set popupRole(next:LyraPopupRole);private _disable
212
212
  * `disabled` plus `open` markup/property state normalizes closed in either order. Mirrors
213
213
  * `<lr-tooltip>`'s and `<lr-dropdown>`'s own `disabled`.
214
214
  * @default false */
215
- get disabled():boolean;set disabled(next:boolean);private triggerElement?;private slottedTrigger?;
215
+ get disabled():boolean;set disabled(next:boolean);private triggerElement?;private slottedTrigger?;private triggerSlotElement?;
216
216
  /**
217
217
  * True while the surface was opened by a transient `hover`/`focus` interaction rather than a
218
218
  * click or a programmatic call. It gates two things: the surface closes again when the
@@ -284,7 +284,7 @@ protected isInsideLightDismissBoundary(path:EventTarget[]):boolean;
284
284
  /** Runs once when a newly opened/re-anchored popup has completed its first placement and is no
285
285
  * longer visibility-hidden. Focus cannot reliably enter a visibility-hidden subtree in Firefox
286
286
  * or WebKit, so autofocus and mapped menu focus wait for this readiness boundary. */
287
- protected onPopupPositioned():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private syncAnchorIdentityObservation;private resolveForTrigger;private syncInteractionTrigger;
287
+ protected onPopupPositioned():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;protected firstUpdated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private syncAnchorIdentityObservation;private resolveForTrigger;private syncInteractionTrigger;
288
288
  /** Registers every open popover with the shared, topmost-stack-aware overlay manager. Popovers
289
289
  * remain nonmodal and non-focus-trapping; the manager owns Escape and restoration to the
290
290
  * trigger (or a virtual anchor's explicit `returnFocusTo`). */
@@ -318,7 +318,16 @@ showAt(rect:OverlayVirtualRect,options?:{returnFocusTo?:HTMLElement;}):void;
318
318
  /** Resolves what the popup is positioned against: an explicit virtual anchor first, then the
319
319
  * direct `anchor`, then the `for` idref, then the slotted trigger. Shared with `<lr-tooltip>`,
320
320
  * which resolves the identical chain. */
321
- private resolveAnchor;protected positionPopup():void;private invalidatePositioning;private resolveCurrentPositioning;private startPositioning;private syncTriggerA11y;private get accessibleTrigger();private releaseTriggerA11y;private onTriggerSlotChange;private onTriggerClick;private onTriggerPointerEnter;private onTriggerPointerLeave;private onPopupPointerEnter;private onPopupPointerLeave;private onSurfaceFocusIn;private onSurfaceFocusOut;
321
+ private resolveAnchor;protected positionPopup():void;private invalidatePositioning;private resolveCurrentPositioning;private startPositioning;private syncTriggerA11y;private get accessibleTrigger();private releaseTriggerA11y;private onTriggerSlotChange;
322
+ /**
323
+ * Reads the named `trigger` slot's currently assigned element and applies it -- wired as the
324
+ * `slotchange` handler (via `onTriggerSlotChange`) for every later mutation, and called once
325
+ * more from `firstUpdated()` (see `collectInitialSlotAssignment`) to cover an environment, or a
326
+ * real-browser timing race, where the slot's initial assignment never fires `slotchange`.
327
+ * Idempotent: a second call that reads back the same assigned element is a no-op past the
328
+ * `next === this.slottedTrigger` guard.
329
+ */
330
+ private collectTriggerFromSlot;private onTriggerClick;private onTriggerPointerEnter;private onTriggerPointerLeave;private onPopupPointerEnter;private onPopupPointerLeave;private onSurfaceFocusIn;private onSurfaceFocusOut;
322
331
  /** The shared "the interaction that was holding this open has ended" path. Retention beats
323
332
  * closing: a pinned surface, a pointer/focus target still inside the trigger or the popup, and
324
333
  * focus resting anywhere within the surface each keep it open. */
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{loadAnchoredOverlayRuntime}from"../../../internal/anchored-overlay-runtime.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{activeElementIn}from"../../../internal/active-element.js";import{literalSetConverter,omittedEmptyStringConverter,optionalLiteralSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{normalizeVirtualRect,observeOverlayAnchorIdentity,OverlayTransitionGate,resolveOverlayAnchor}from"./overlay-shared.js";import{styles}from"./overlay.styles.js";import{LYRA_DEFAULT_menuLabel,LYRA_DEFAULT_popover}from"../../../internal/default-strings.generated.js";const DEFAULT_DISTANCE=8;let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").trim().toLowerCase().split(/\s+/)){const keyword=POPOVER_TRIGGER_KEYWORDS.find(candidate=>candidate===token);keyword&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0,POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]);class LyraPopover extends LyraElement{constructor(){super(...arguments),this._open=!1,this.placement="top",this.distance=8,this.skidding=0,this._for="",this.anchor=null,this.arrow=!0,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.resolvedSide="bottom",this.anchorPositioned=!1,this.directionChanged=!1,this.observedDirectAnchorWasConnected=!1,this.positioningGeneration=0,this.positioningReady=Promise.resolve(!1),this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.hostIdObserverGeneration=0,this.transitionToken=0,this.transitionGate=new OverlayTransitionGate,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{const next=event.target.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger())},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.opensOn("click")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.pinned=!0,this.openedByInteraction=!1,this.open||this.show()}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=()=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=path.slice(0,hostIndex).find(target=>target.nodeType===1&&target.getAttribute("data-popover")==="close");if(!closeAction)return;event.stopPropagation();const state2=closeAction;state2.effectiveDisabled===!0||state2.disabled===!0||closeAction.hasAttribute("disabled")||closeAction.getAttribute("aria-disabled")?.trim().toLowerCase()==="true"||closeAction.hasAttribute("inert")||closeAction.closest("[inert]")||this.hide()},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())}}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this._positioningStrategy??this.defaultPositioningStrategy}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??this.defaultPositioningStrategy,old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&(this.requestUpdate("positioningStrategy",old),this.onPositioningStrategyChanged(old,normalized))}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return new Set(this._trigger.split(" "))}get isManualTrigger(){return this.triggerKeywords.has("manual")}opensOn(keyword){return!this.isManualTrigger&&this.triggerKeywords.has(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??(this.accessibleLabel||this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover"))}get rendersArrow(){return this.arrow&&!this.withoutArrow}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction,changed.has("anchor")&&changed.get("anchor")===this.observedDirectAnchor&&this.observedDirectAnchorWasConnected&&this.anchor?.isConnected!==!0&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),(changed.has("anchor")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")&&this.syncInteractionTrigger(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("anchor")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}connectedCallback(){if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.positionPopup()}}disconnectedCallback(){this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0,this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.pinned=!1,this.openedByInteraction=!1,this.transitionToken++,this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0,this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0;const directAnchor=this.open?this.anchor??void 0:void 0;if(this.observedDirectAnchor=directAnchor,this.observedDirectAnchorWasConnected=directAnchor?.isConnected===!0,!this.isConnected||!this.for&&!directAnchor)return;const onIdentityChange=()=>{const directAnchorRemoved=this.anchor===this.observedDirectAnchor&&this.observedDirectAnchorWasConnected&&this.observedDirectAnchor?.isConnected===!1;if(this.observedDirectAnchorWasConnected=this.observedDirectAnchor?.isConnected===!0,this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()},observedRoots=new Set([this]);directAnchor&&directAnchor.getRootNode()!==this.getRootNode()&&observedRoots.add(directAnchor.isConnected?directAnchor:directAnchor.ownerDocument);const cleanups=[...observedRoots].map(root=>observeOverlayAnchorIdentity(root,onIdentityChange));this.stopAnchorIdentityObservation=()=>{for(const cleanup of cleanups)cleanup()}}resolveForTrigger(){if(!this.for)return;const target=this.getRootNode().getElementById?.(this.for)??null,HTMLElementCtor=target?.ownerDocument.defaultView?.HTMLElement;return target&&HTMLElementCtor&&target instanceof HTMLElementCtor?target:void 0}syncInteractionTrigger(){const next=this.virtualAnchor?void 0:this.slottedTrigger??this.resolveForTrigger();if(next===this.triggerElement){this.syncTriggerA11y();return}if(this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.triggerElement=next,this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:this.anchor,for:this.for,trigger:this.triggerElement})}positionPopup(){this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;this.positioningReady=new Promise(resolve=>{this.resolvePositioningReady=resolve}),this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0,this.resolvePositioningReady?.(!1),this.resolvePositioningReady=void 0}resolveCurrentPositioning(positioned){const resolve=this.resolvePositioningReady;this.resolvePositioningReady=void 0,resolve?.(positioned)}async startPositioning(generation,anchor,popup,arrowElement,bridgeElement){try{const{place}=await loadAnchoredOverlayRuntime();if(generation!==this.positioningGeneration||!this.open||!this.isConnected||this.resolveAnchor()!==anchor||this.renderRoot.querySelector('[part~="popup"]')!==popup)return;const cleanup=place(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:resolveEffectivePositioningStrategy(this,this._positioningStrategy,this.defaultPositioningStrategy),offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||(this.resolveCurrentPositioning(!0),becamePositioned&&this.onPopupPositioned())})}});generation!==this.positioningGeneration?cleanup():this.cleanup=cleanup}catch{if(generation!==this.positioningGeneration)return;this.resolveCurrentPositioning(!1),this.forceClose({focusTrigger:!1})}}syncTriggerA11y(){const trigger=this.triggerElement??null,popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution);const accessibleTrigger=this.accessibleTrigger,distinctAccessibleTrigger=accessibleTrigger!==trigger?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(distinctAccessibleTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(distinctAccessibleTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){return this.triggerElement?resolveAccessibleTrigger(this.triggerElement):null}releaseTriggerA11y(){this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0,this.triggerAria?.release(),this.triggerAria=void 0}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=activeElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.pendingDirection=next?"show":"hide",this.delayTimerView=view;const timer=view.setTimeout(()=>{this.delayTimerView!==view||this.delayTimer!==timer||(this.delayTimer=void 0,this.delayTimerView=void 0,this.pendingDirection=void 0,commit())},delay);this.delayTimer=timer}cancelPendingTransition(){this.delayTimer!==void 0&&this.delayTimerView?.clearTimeout(this.delayTimer),this.delayTimer=void 0,this.delayTimerView=void 0,this.pendingDirection=void 0}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){const nextDocument=this.ownerDocument;this.lightDismissDocument!==nextDocument&&(this.stopLightDismiss(),nextDocument.addEventListener("pointerdown",this.onDocumentPointer),this.lightDismissDocument=nextDocument)}stopLightDismiss(){this.lightDismissDocument?.removeEventListener("pointerdown",this.onDocumentPointer),this.lightDismissDocument=void 0}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this._open||!this.canOpen?Promise.resolve():this.transitionGate.request(!0,()=>{if(this.emitCancelableLifecycle("lr-show").defaultPrevented){this.syncOpenAttribute();return}if(!this.closePopoverPeers()){this.syncOpenAttribute();return}return this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),this.setOpen(!0),this.settleTransition("lr-after-show")})}hide(options){return this._open?this.transitionGate.request(!1,()=>{if(this.emitCancelableLifecycle("lr-hide").defaultPrevented){this.syncOpenAttribute();return}return this.forceClose(options)}):Promise.resolve()}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const peers=[...this.getRootNode().querySelectorAll(tag("popover"))].filter(peer=>peer.isConnected&&peer._open&&!peer.virtualAnchor&&peer.connectionSequence>0);if(peers.reduce((latest,peer)=>!latest||peer.connectionSequence>latest.connectionSequence?peer:latest,void 0)!==this){this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.transitionToken++,this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this._open?(options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.cancelTransitionAnimation(),this.isConnected&&this.setAttribute("data-closing",""),this.setOpen(!1),this.settleTransition("lr-after-hide")):Promise.resolve()}cancelTransitionAnimation(){this.transitionAnimation?.cancel(),this.transitionAnimation=void 0}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(event==="lr-after-show"){for(;this.open&&!this.anchorPositioned;){const readiness=this.positioningReady,positioned=await readiness;if(this.transitionToken!==token)return;if(positioned)break;if(readiness===this.positioningReady)return}if(await this.updateComplete,this.transitionToken!==token)return}if(this.isConnected){const popup=this.renderRoot.querySelector('[part~="popup"]'),showing=event==="lr-after-show",offset="translateY(var(--lr-size-neg-0-25rem))",animation=popup?animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]}):void 0;if(this.transitionAnimation=animation,await animation?.finished.catch(()=>{}),this.transitionToken!==token)return;this.cancelTransitionAnimation()}event==="lr-after-hide"&&this.removeAttribute("data-closing"),this.emitSettledLifecycle(event)}}render(){const popupRole=this.popupSurfaceRole;return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId,resolveAccessibleTrigger}from"../../../internal/a11y.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{loadAnchoredOverlayRuntime}from"../../../internal/anchored-overlay-runtime.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{activeElementIn}from"../../../internal/active-element.js";import{literalSetConverter,omittedEmptyStringConverter,optionalLiteralSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{normalizeVirtualRect,observeOverlayAnchorIdentity,OverlayTransitionGate,resolveOverlayAnchor}from"./overlay-shared.js";import{styles}from"./overlay.styles.js";import{LYRA_DEFAULT_menuLabel,LYRA_DEFAULT_popover}from"../../../internal/default-strings.generated.js";const DEFAULT_DISTANCE=8;let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").trim().toLowerCase().split(/\s+/)){const keyword=POPOVER_TRIGGER_KEYWORDS.find(candidate=>candidate===token);keyword&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0,POSITIONING_STRATEGY=optionalLiteralSetConverter(["absolute","fixed"]);class LyraPopover extends LyraElement{constructor(){super(...arguments),this._open=!1,this.placement="top",this.distance=8,this.skidding=0,this._for="",this.anchor=null,this.arrow=!0,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.resolvedSide="bottom",this.anchorPositioned=!1,this.directionChanged=!1,this.observedDirectAnchorWasConnected=!1,this.positioningGeneration=0,this.positioningReady=Promise.resolve(!1),this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.hostIdObserverGeneration=0,this.transitionToken=0,this.transitionGate=new OverlayTransitionGate,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{this.collectTriggerFromSlot(event.target)},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.opensOn("click")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.pinned=!0,this.openedByInteraction=!1,this.open||this.show()}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=()=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=path.slice(0,hostIndex).find(target=>target.nodeType===1&&target.getAttribute("data-popover")==="close");if(!closeAction)return;event.stopPropagation();const state2=closeAction;state2.effectiveDisabled===!0||state2.disabled===!0||closeAction.hasAttribute("disabled")||closeAction.getAttribute("aria-disabled")?.trim().toLowerCase()==="true"||closeAction.hasAttribute("inert")||closeAction.closest("[inert]")||this.hide()},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())}}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}static{this.styles=[LyraElement.styles,styles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this._positioningStrategy??this.defaultPositioningStrategy}set positioningStrategy(next){const normalized=POSITIONING_STRATEGY.normalize(next)??this.defaultPositioningStrategy,old=this.positioningStrategy;this._positioningStrategy=normalized,normalized!==old&&(this.requestUpdate("positioningStrategy",old),this.onPositioningStrategyChanged(old,normalized))}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return new Set(this._trigger.split(" "))}get isManualTrigger(){return this.triggerKeywords.has("manual")}opensOn(keyword){return!this.isManualTrigger&&this.triggerKeywords.has(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??(this.accessibleLabel||this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover"))}get rendersArrow(){return this.arrow&&!this.withoutArrow}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction,changed.has("anchor")&&changed.get("anchor")===this.observedDirectAnchor&&this.observedDirectAnchorWasConnected&&this.anchor?.isConnected!==!0&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),(changed.has("anchor")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")&&this.syncInteractionTrigger(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("anchor")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.triggerSlotElement;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectTriggerFromSlot(s))})}connectedCallback(){if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.positionPopup()}}disconnectedCallback(){this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0,this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.pinned=!1,this.openedByInteraction=!1,this.transitionToken++,this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0,this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.stopAnchorIdentityObservation?.(),this.stopAnchorIdentityObservation=void 0;const directAnchor=this.open?this.anchor??void 0:void 0;if(this.observedDirectAnchor=directAnchor,this.observedDirectAnchorWasConnected=directAnchor?.isConnected===!0,!this.isConnected||!this.for&&!directAnchor)return;const onIdentityChange=()=>{const directAnchorRemoved=this.anchor===this.observedDirectAnchor&&this.observedDirectAnchorWasConnected&&this.observedDirectAnchor?.isConnected===!1;if(this.observedDirectAnchorWasConnected=this.observedDirectAnchor?.isConnected===!0,this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()},observedRoots=new Set([this]);directAnchor&&directAnchor.getRootNode()!==this.getRootNode()&&observedRoots.add(directAnchor.isConnected?directAnchor:directAnchor.ownerDocument);const cleanups=[...observedRoots].map(root=>observeOverlayAnchorIdentity(root,onIdentityChange));this.stopAnchorIdentityObservation=()=>{for(const cleanup of cleanups)cleanup()}}resolveForTrigger(){if(!this.for)return;const target=this.getRootNode().getElementById?.(this.for)??null,HTMLElementCtor=target?.ownerDocument.defaultView?.HTMLElement;return target&&HTMLElementCtor&&target instanceof HTMLElementCtor?target:void 0}syncInteractionTrigger(){const next=this.virtualAnchor?void 0:this.slottedTrigger??this.resolveForTrigger();if(next===this.triggerElement){this.syncTriggerA11y();return}if(this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.triggerElement=next,this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:this.anchor,for:this.for,trigger:this.triggerElement})}positionPopup(){this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;this.positioningReady=new Promise(resolve=>{this.resolvePositioningReady=resolve}),this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0,this.resolvePositioningReady?.(!1),this.resolvePositioningReady=void 0}resolveCurrentPositioning(positioned){const resolve=this.resolvePositioningReady;this.resolvePositioningReady=void 0,resolve?.(positioned)}async startPositioning(generation,anchor,popup,arrowElement,bridgeElement){try{const{place}=await loadAnchoredOverlayRuntime();if(generation!==this.positioningGeneration||!this.open||!this.isConnected||this.resolveAnchor()!==anchor||this.renderRoot.querySelector('[part~="popup"]')!==popup)return;const cleanup=place(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:resolveEffectivePositioningStrategy(this,this._positioningStrategy,this.defaultPositioningStrategy),offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||(this.resolveCurrentPositioning(!0),becamePositioned&&this.onPopupPositioned())})}});generation!==this.positioningGeneration?cleanup():this.cleanup=cleanup}catch{if(generation!==this.positioningGeneration)return;this.resolveCurrentPositioning(!1),this.forceClose({focusTrigger:!1})}}syncTriggerA11y(){const trigger=this.triggerElement??null,popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]};this.triggerAria?this.triggerAria.update(trigger,contribution):this.triggerAria=acquireAriaOwnership(trigger,contribution);const accessibleTrigger=this.accessibleTrigger,distinctAccessibleTrigger=accessibleTrigger!==trigger?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(distinctAccessibleTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(distinctAccessibleTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){return this.triggerElement?resolveAccessibleTrigger(this.triggerElement):null}releaseTriggerA11y(){this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0,this.triggerAria?.release(),this.triggerAria=void 0}collectTriggerFromSlot(slot){const next=slot.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger())}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=activeElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.pendingDirection=next?"show":"hide",this.delayTimerView=view;const timer=view.setTimeout(()=>{this.delayTimerView!==view||this.delayTimer!==timer||(this.delayTimer=void 0,this.delayTimerView=void 0,this.pendingDirection=void 0,commit())},delay);this.delayTimer=timer}cancelPendingTransition(){this.delayTimer!==void 0&&this.delayTimerView?.clearTimeout(this.delayTimer),this.delayTimer=void 0,this.delayTimerView=void 0,this.pendingDirection=void 0}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){const nextDocument=this.ownerDocument;this.lightDismissDocument!==nextDocument&&(this.stopLightDismiss(),nextDocument.addEventListener("pointerdown",this.onDocumentPointer),this.lightDismissDocument=nextDocument)}stopLightDismiss(){this.lightDismissDocument?.removeEventListener("pointerdown",this.onDocumentPointer),this.lightDismissDocument=void 0}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this._open||!this.canOpen?Promise.resolve():this.transitionGate.request(!0,()=>{if(this.emitCancelableLifecycle("lr-show").defaultPrevented){this.syncOpenAttribute();return}if(!this.closePopoverPeers()){this.syncOpenAttribute();return}return this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),this.setOpen(!0),this.settleTransition("lr-after-show")})}hide(options){return this._open?this.transitionGate.request(!1,()=>{if(this.emitCancelableLifecycle("lr-hide").defaultPrevented){this.syncOpenAttribute();return}return this.forceClose(options)}):Promise.resolve()}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const peers=[...this.getRootNode().querySelectorAll(tag("popover"))].filter(peer=>peer.isConnected&&peer._open&&!peer.virtualAnchor&&peer.connectionSequence>0);if(peers.reduce((latest,peer)=>!latest||peer.connectionSequence>latest.connectionSequence?peer:latest,void 0)!==this){this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.transitionToken++,this.cancelTransitionAnimation(),this.removeAttribute("data-closing"),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this._open?(options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.cancelTransitionAnimation(),this.isConnected&&this.setAttribute("data-closing",""),this.setOpen(!1),this.settleTransition("lr-after-hide")):Promise.resolve()}cancelTransitionAnimation(){this.transitionAnimation?.cancel(),this.transitionAnimation=void 0}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(event==="lr-after-show"){for(;this.open&&!this.anchorPositioned;){const readiness=this.positioningReady,positioned=await readiness;if(this.transitionToken!==token)return;if(positioned)break;if(readiness===this.positioningReady)return}if(await this.updateComplete,this.transitionToken!==token)return}if(this.isConnected){const popup=this.renderRoot.querySelector('[part~="popup"]'),showing=event==="lr-after-show",offset="translateY(var(--lr-size-neg-0-25rem))",animation=popup?animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]}):void 0;if(this.transitionAnimation=animation,await animation?.finished.catch(()=>{}),this.transitionToken!==token)return;this.cancelTransitionAnimation()}event==="lr-after-hide"&&this.removeAttribute("data-closing"),this.emitSettledLifecycle(event)}}render(){const popupRole=this.popupSurfaceRole;return html`
2
2
  <span part="trigger" @click=${this.onTriggerClick} @keydown=${this.onTriggerKeyDown}>
3
3
  <slot name="trigger" @slotchange=${this.onTriggerSlotChange}></slot>
4
4
  </span>
@@ -11,4 +11,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
11
11
  <div part=${this.contentPartNames}>${this.renderPopupContent()}</div>
12
12
  ${this.rendersArrow?html`<span part="arrow popup__arrow arrow-${this.resolvedSide}"></span>`:nothing}
13
13
  </div>
14
- `}}__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"open",null),__decorate([property({reflect:!0})],LyraPopover.prototype,"placement",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],LyraPopover.prototype,"positioningStrategy",null),__decorate([property({type:Number})],LyraPopover.prototype,"distance",void 0),__decorate([property({type:Number})],LyraPopover.prototype,"skidding",void 0),__decorate([property({reflect:!0,converter:omittedEmptyStringConverter})],LyraPopover.prototype,"for",null),__decorate([property({attribute:!1})],LyraPopover.prototype,"anchor",void 0),__decorate([property({type:Boolean,converter:trueDefaultBooleanConverter,reflect:!0})],LyraPopover.prototype,"arrow",void 0),__decorate([property({type:Boolean,attribute:"without-arrow",reflect:!0})],LyraPopover.prototype,"withoutArrow",void 0),__decorate([property({attribute:"arrow-placement"})],LyraPopover.prototype,"arrowPlacement",void 0),__decorate([property({type:Number,attribute:"arrow-padding"})],LyraPopover.prototype,"arrowPadding",void 0),__decorate([property()],LyraPopover.prototype,"trigger",null),__decorate([property({type:Number,attribute:"show-delay"})],LyraPopover.prototype,"showDelay",void 0),__decorate([property({type:Number,attribute:"hide-delay"})],LyraPopover.prototype,"hideDelay",void 0),__decorate([property({type:Boolean,attribute:"hover-bridge",reflect:!0})],LyraPopover.prototype,"hoverBridge",void 0),__decorate([property({attribute:"aria-label"})],LyraPopover.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"popup-role",converter:POPUP_ROLE})],LyraPopover.prototype,"popupRole",null),__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"disabled",null),__decorate([state()],LyraPopover.prototype,"resolvedSide",void 0),__decorate([state()],LyraPopover.prototype,"anchorPositioned",void 0);export{LyraPopover};
14
+ `}}__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"open",null),__decorate([property({reflect:!0})],LyraPopover.prototype,"placement",void 0),__decorate([property({attribute:"positioning-strategy",reflect:!0,converter:POSITIONING_STRATEGY})],LyraPopover.prototype,"positioningStrategy",null),__decorate([property({type:Number})],LyraPopover.prototype,"distance",void 0),__decorate([property({type:Number})],LyraPopover.prototype,"skidding",void 0),__decorate([property({reflect:!0,converter:omittedEmptyStringConverter})],LyraPopover.prototype,"for",null),__decorate([property({attribute:!1})],LyraPopover.prototype,"anchor",void 0),__decorate([property({type:Boolean,converter:trueDefaultBooleanConverter,reflect:!0})],LyraPopover.prototype,"arrow",void 0),__decorate([property({type:Boolean,attribute:"without-arrow",reflect:!0})],LyraPopover.prototype,"withoutArrow",void 0),__decorate([property({attribute:"arrow-placement"})],LyraPopover.prototype,"arrowPlacement",void 0),__decorate([property({type:Number,attribute:"arrow-padding"})],LyraPopover.prototype,"arrowPadding",void 0),__decorate([property()],LyraPopover.prototype,"trigger",null),__decorate([property({type:Number,attribute:"show-delay"})],LyraPopover.prototype,"showDelay",void 0),__decorate([property({type:Number,attribute:"hide-delay"})],LyraPopover.prototype,"hideDelay",void 0),__decorate([property({type:Boolean,attribute:"hover-bridge",reflect:!0})],LyraPopover.prototype,"hoverBridge",void 0),__decorate([property({attribute:"aria-label"})],LyraPopover.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"popup-role",converter:POPUP_ROLE})],LyraPopover.prototype,"popupRole",null),__decorate([property({type:Boolean,reflect:!0})],LyraPopover.prototype,"disabled",null),__decorate([query('slot[name="trigger"]')],LyraPopover.prototype,"triggerSlotElement",void 0),__decorate([state()],LyraPopover.prototype,"resolvedSide",void 0),__decorate([state()],LyraPopover.prototype,"anchorPositioned",void 0);export{LyraPopover};
@@ -96,8 +96,8 @@ export type LyraRatingSymbolRenderer=(value:number,selected:boolean)=>unknown;ex
96
96
  * @cssstate invalid - The control currently fails its constraints — true for a pristine
97
97
  * `required` rating that has never been set, which is why validation styling should key off
98
98
  * `user-invalid` instead.
99
- * @cssstate user-valid - Valid, and the user has interacted: rated it, blurred it, or triggered
100
- * validation (a submit attempt runs `reportValidity()`).
99
+ * @cssstate user-valid - Valid, and the user has interacted: rated it, blurred it,
100
+ * `reportValidity()`, or a submission attempt. Not after a silent `checkValidity()` alone.
101
101
  * @cssstate user-invalid - Invalid, and the user has interacted. This is the state to paint red;
102
102
  * a form reset returns the control to pristine and drops it again.
103
103
  * @status stable
@@ -124,11 +124,13 @@ getSymbol?:LyraRatingSymbolRenderer;set defaultValueAlias(next:number|null);
124
124
  private hoverValue;private hovering;private internals;private validityController;
125
125
  /** Consumer-supplied validation message reflected through `custom-error`. */
126
126
  customError:string|null;private _value;private _max;private _name;private _required;private _disabled;private _fieldsetDisabled;private _defaultValue;private _valueDirty;private settingDefaultValue;private reflectingDefaultValue;
127
- /** Whether the user has driven this control yet — rated it, blurred it, or triggered validation.
128
- * Gates the `user-valid`/`user-invalid` custom states: a pristine `required` rating IS invalid,
129
- * but painting it red before anyone has touched it is hostile. Mirrors the `FormAssociated`
130
- * mixin's own flag; this control drives `ElementInternals` directly (its value is a number, not
131
- * the string that mixin assumes) so it has to track the flag itself. */
127
+ /** Whether the user has driven this control yet — rated it, blurred it, or triggered interactive
128
+ * validation (`reportValidity()` or a submission attempt, via `installInteractionOnInvalid()`).
129
+ * A silent `checkValidity()` alone never counts. Gates the `user-valid`/`user-invalid` custom
130
+ * states: a pristine `required` rating IS invalid, but painting it red before anyone has touched
131
+ * it is hostile. Mirrors the `FormAssociated` mixin's own flag; this control drives
132
+ * `ElementInternals` directly (its value is a number, not the string that mixin assumes) so it
133
+ * has to track the flag itself. */
132
134
  private _hasInteracted;private authorAriaLabel;private syncingHostSemantics;private externalLabelNameActive;
133
135
  /** Live presentational symbol row, or `null` before the render root is populated. */
134
136
  get rating():HTMLElement|null;constructor();attributeChangedCallback(name:string,oldValue:string|null,value:string|null):void;
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,svg}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{normalizeSize}from"../../../internal/variants.js";import{styles}from"./rating.styles.js";import{dispatchNativeEvent}from"../../../internal/native-event-relay.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{EXTERNAL_LABEL_HOST_SEMANTICS,installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{currentValidityValidator}from"../../forms/form-validator.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_rating}from"../../../internal/default-strings.generated.js";const DEFAULT_MAX=5,MAX_STARS=100,DEFAULT_PRECISION=1,MANAGED_ARIA_LABEL_ATTRIBUTE="data-lr-rating-managed-label",MIN_PRECISION=.01,STAR_POINTS="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2";function starOutline(){return svg`<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true" focusable="false"><polygon points=${STAR_POINTS}></polygon></svg>`}function starSolid(){return svg`<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false"><polygon points=${STAR_POINTS}></polygon></svg>`}class LyraRating extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,rating:LYRA_DEFAULT_rating}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","max")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static get observedAttributes(){return[...new Set([...super.observedAttributes,"role"])]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},value:{attribute:"value",type:Number,noAccessor:!0},defaultValue:{attribute:!1,noAccessor:!0},max:{type:Number,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get effectiveSize(){const value=this.size;return["2xs","xs","s","m","l","xl","small","medium","large"].includes(value)?normalizeSize(value):"m"}get defaultValueAlias(){return this.defaultValue}set defaultValueAlias(next){this.defaultValue=finiteNumber(next??0,0)}get rating(){return this.renderRoot.querySelector('[part~="rating"]')}constructor(){super(),this.precision=1,this.readonly=!1,this.accessibleLabel="",this.label="",this.size="m",this.hoverValue=0,this.hovering=!1,this._value=0,this._max=DEFAULT_MAX,this._name="",this._required=!1,this._disabled=!1,this._fieldsetDisabled=!1,this._defaultValue=0,this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._hasInteracted=!1,this.authorAriaLabel=null,this.syncingHostSemantics=!1,this.externalLabelNameActive=!1,this.markInteracted=()=>{this._hasInteracted||(this._hasInteracted=!0,this.syncValidityStates())},this.onClick=event=>{const next=this.pointerValue(event);next!==null&&this.setValue(next)},this.onPointerEnter=event=>{this.interactive&&(this.hovering=!0,this.hoverValue=this.pointerValue(event)??this.hoverValue,this.emit("lr-hover",{phase:"start",value:this.hoverValue}))},this.onPointerMove=event=>{if(!this.interactive)return;const next=this.pointerValue(event);if(next!==null){if(!this.hovering){this.hovering=!0,this.hoverValue=next,this.emit("lr-hover",{phase:"start",value:next});return}next!==this.hoverValue&&(this.hoverValue=next,this.emit("lr-hover",{phase:"move",value:next}))}},this.onPointerEnd=()=>{this.hovering&&(this.hovering=!1,this.emit("lr-hover",{phase:"end",value:this.hoverValue}))},this.onKeyDown=event=>{const forwardKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight",backwardKey=this.effectiveDirection==="rtl"?"ArrowRight":"ArrowLeft";(event.key===forwardKey||event.key==="ArrowUp")&&(event.preventDefault(),this.setValue(this.safeValue+this.safePrecision)),(event.key===backwardKey||event.key==="ArrowDown")&&(event.preventDefault(),this.setValue(this.safeValue-this.safePrecision)),event.key==="Home"&&(event.preventDefault(),this.setValue(0)),event.key==="End"&&(event.preventDefault(),this.setValue(this.safeMax))},this.onHostKeyDown=event=>{event.composedPath()[0]===this&&this.onKeyDown(event)},this.onBlur=event=>{event.target===this&&this.markInteracted()},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),this.internals.setFormValue("0"),this.addEventListener("focusout",this.markInteracted),this.addEventListener("keydown",this.onHostKeyDown),this.addEventListener("blur",this.onBlur),this.syncValidityStates()}attributeChangedCallback(name,oldValue,value){if(!(this.syncingHostSemantics&&(name==="aria-label"||name==="role"))){if(super.attributeChangedCallback(name,oldValue,value),name==="aria-label"){const managed=this.getAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE),rehydratedManagedName=oldValue===null&&managed!==null&&managed===value;if(this.authorAriaLabel=rehydratedManagedName?null:value,!rehydratedManagedName){this.syncingHostSemantics=!0;try{this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE)}finally{this.syncingHostSemantics=!1}}}if(name==="role"&&value!=="slider"){this.syncingHostSemantics=!0;try{this.setAttribute("role","slider")}finally{this.syncingHostSemantics=!1}}}}[EXTERNAL_LABEL_HOST_SEMANTICS](operation){if(operation.type==="has-authored-name")return this.authorAriaLabel!==null;if(operation.type==="apply"){this.externalLabelNameActive=!0,this.syncingHostSemantics=!0;try{this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,operation.name),this.getAttribute("aria-label")!==operation.name&&this.setAttribute("aria-label",operation.name)}finally{this.syncingHostSemantics=!1}return}this.externalLabelNameActive=!1,this.syncingHostSemantics=!0;try{if(this.getAttribute("aria-label")===operation.appliedName)if(operation.hadPrevious){const previous=operation.previous??"";this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,previous),this.setAttribute("aria-label",previous)}else this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE),this.removeAttribute("aria-label")}finally{this.syncingHostSemantics=!1}this.authorAriaLabel===null&&this.syncHostSemantics()}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=typeof next=="number"?next:Number(next),this.syncFormValue(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next==null?0:typeof next=="number"?next:Number(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("default-value"):this.setAttribute("default-value",String(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get max(){return this._max}set max(next){const old=this._max;this._max=typeof next=="number"?next:Number(next),this.syncFormValue(),this.requestUpdate("max",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.resetHover(),this.updateValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.updateValidity(),this.markInteracted(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityStates(),this.syncHostSemantics()}resetValidity(){this.setCustomValidity("")}formResetCallback(){this.resetHover(),this.restoreLiveValueFromDefault(),this._hasInteracted=!1,this.syncValidityStates()}formStateRestoreCallback(state2,reason){this.value=typeof state2=="string"?finiteNumber(Number(state2),0):0}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formDisabledCallback(fieldsetDisabled){this._fieldsetDisabled=fieldsetDisabled,fieldsetDisabled&&this.resetHover(),this.updateValidity(),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.syncHostSemantics()}disconnectedCallback(){super.disconnectedCallback(),this.resetHover()}get safeMax(){return finiteCount(this.max,DEFAULT_MAX,MAX_STARS)}get safeValue(){return finiteRange(this.value,0,0,this.safeMax)}get safePrecision(){const precision=finiteRange(this.precision,DEFAULT_PRECISION,MIN_PRECISION,this.safeMax);return precision>0?precision:DEFAULT_PRECISION}get interactive(){return!this.effectiveDisabled&&!this.readonly}syncFormValue(){this.internals&&(this.internals.setFormValue(String(this.safeValue)),this.updateValidity())}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.validityController&&(this.barredFromValidation?this.validityController.setValidity({}):this.required&&this.safeValue<=0?this.validityController.setValidity({valueMissing:!0},this.localize("fieldRequired")):this.validityController.setValidity({}),this.syncValidityStates())}syncValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this._hasInteracted,barred:this.barredFromValidation})}setValue(next){if(!this.interactive)return;this.markInteracted();const precision=this.safePrecision,clamped=Math.max(0,Math.min(this.safeMax,Math.round(next/precision)*precision));clamped!==this.value&&(this.value=clamped,dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:this.value})),this.emit("lr-activate",{value:clamped})}pointerValue(event){const target=event.target?.closest?.("[data-value]");if(!target)return null;const star=Number(target.dataset.value);if(!Number.isFinite(star))return null;const rect=target.getBoundingClientRect(),precision=this.safePrecision;if(rect.width<=0)return Math.max(0,Math.min(this.safeMax,star));const physicalFraction=Math.max(0,Math.min(1,(event.clientX-rect.left)/rect.width)),logicalFraction=this.effectiveDirection==="rtl"?1-physicalFraction:physicalFraction,rawValue=star-1+logicalFraction;return Math.max(precision,Math.min(this.safeMax,Math.ceil(rawValue/precision)*precision))}resetHover(){this.hovering=!1,this.hoverValue=0}focus(options){this.effectiveDisabled||super.focus(options)}blur(){super.blur()}click(){this.effectiveDisabled||super.click()}captureHostNameProvenance(){if(this.externalLabelNameActive||this.authorAriaLabel!==null)return;const current=this.getAttribute("aria-label");if(current===null)return;const managed=this.getAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE);if(managed!==current&&(this.authorAriaLabel=current,managed!==null)){this.syncingHostSemantics=!0;try{this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE)}finally{this.syncingHostSemantics=!1}}}syncHostSemantics(){this.captureHostNameProvenance();const safeMax=this.safeMax,safeValue=this.safeValue,label=typeof this.label=="string"&&this.label.trim()===""?"":this.label,generatedLabel=this.accessibleLabel||label||this.localize("rating");this.syncingHostSemantics=!0;try{this.setAttribute("role","slider"),this.setAttribute("tabindex",this.effectiveDisabled?"-1":"0"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(safeMax)),this.setAttribute("aria-valuenow",String(safeValue)),this.setAttribute("aria-valuetext",getNumberFormat(this.effectiveLocale).format(safeValue)),this.setAttribute("aria-disabled",this.effectiveDisabled?"true":"false"),this.setAttribute("aria-readonly",this.readonly?"true":"false"),this.setAttribute("aria-required",this.required?"true":"false"),this.setAttribute("aria-invalid",this.internals.validity.valid?"false":"true"),this.setAttribute("data-effective-size",this.effectiveSize),!this.externalLabelNameActive&&this.authorAriaLabel===null&&this.getAttribute("aria-label")!==generatedLabel?(this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,generatedLabel),this.setAttribute("aria-label",generatedLabel)):!this.externalLabelNameActive&&this.authorAriaLabel===null&&this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,generatedLabel)}finally{this.syncingHostSemantics=!1}}willUpdate(changed){super.willUpdate(changed),changed.has("readonly")&&!this.interactive&&this.resetHover(),this.syncHostSemantics()}updated(changed){super.updated(changed),changed.has("readonly")&&(this.updateValidity(),this.syncHostSemantics())}symbol(star,selected){return this.getSymbol?this.getSymbol(star,selected):selected?starSolid():starOutline()}renderSymbol(star,selected){return html`<span aria-hidden="true" inert style="pointer-events: none"
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,svg}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{syncValidityStates}from"../../../internal/custom-states.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{normalizeSize}from"../../../internal/variants.js";import{styles}from"./rating.styles.js";import{dispatchNativeEvent}from"../../../internal/native-event-relay.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{omittedEmptyStringConverter}from"../../../internal/converters.js";import{EXTERNAL_LABEL_HOST_SEMANTICS,installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{currentValidityValidator}from"../../forms/form-validator.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_rating}from"../../../internal/default-strings.generated.js";const DEFAULT_MAX=5,MAX_STARS=100,DEFAULT_PRECISION=1,MANAGED_ARIA_LABEL_ATTRIBUTE="data-lr-rating-managed-label",MIN_PRECISION=.01,STAR_POINTS="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2";function starOutline(){return svg`<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true" focusable="false"><polygon points=${STAR_POINTS}></polygon></svg>`}function starSolid(){return svg`<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false"><polygon points=${STAR_POINTS}></polygon></svg>`}class LyraRating extends LyraElement{static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,rating:LYRA_DEFAULT_rating}}static get validators(){return[currentValidityValidator("required","disabled","readonly","value","max")]}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,styles]}static get observedAttributes(){return[...new Set([...super.observedAttributes,"role"])]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},value:{attribute:"value",type:Number,noAccessor:!0},defaultValue:{attribute:!1,noAccessor:!0},max:{type:Number,noAccessor:!0},name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},required:{type:Boolean,reflect:!0,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get effectiveSize(){const value=this.size;return["2xs","xs","s","m","l","xl","small","medium","large"].includes(value)?normalizeSize(value):"m"}get defaultValueAlias(){return this.defaultValue}set defaultValueAlias(next){this.defaultValue=finiteNumber(next??0,0)}get rating(){return this.renderRoot.querySelector('[part~="rating"]')}constructor(){super(),this.precision=1,this.readonly=!1,this.accessibleLabel="",this.label="",this.size="m",this.hoverValue=0,this.hovering=!1,this._value=0,this._max=DEFAULT_MAX,this._name="",this._required=!1,this._disabled=!1,this._fieldsetDisabled=!1,this._defaultValue=0,this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this._hasInteracted=!1,this.authorAriaLabel=null,this.syncingHostSemantics=!1,this.externalLabelNameActive=!1,this.markInteracted=()=>{this._hasInteracted||(this._hasInteracted=!0,this.syncValidityStates())},this.onClick=event=>{const next=this.pointerValue(event);next!==null&&this.setValue(next)},this.onPointerEnter=event=>{this.interactive&&(this.hovering=!0,this.hoverValue=this.pointerValue(event)??this.hoverValue,this.emit("lr-hover",{phase:"start",value:this.hoverValue}))},this.onPointerMove=event=>{if(!this.interactive)return;const next=this.pointerValue(event);if(next!==null){if(!this.hovering){this.hovering=!0,this.hoverValue=next,this.emit("lr-hover",{phase:"start",value:next});return}next!==this.hoverValue&&(this.hoverValue=next,this.emit("lr-hover",{phase:"move",value:next}))}},this.onPointerEnd=()=>{this.hovering&&(this.hovering=!1,this.emit("lr-hover",{phase:"end",value:this.hoverValue}))},this.onKeyDown=event=>{const forwardKey=this.effectiveDirection==="rtl"?"ArrowLeft":"ArrowRight",backwardKey=this.effectiveDirection==="rtl"?"ArrowRight":"ArrowLeft";(event.key===forwardKey||event.key==="ArrowUp")&&(event.preventDefault(),this.setValue(this.safeValue+this.safePrecision)),(event.key===backwardKey||event.key==="ArrowDown")&&(event.preventDefault(),this.setValue(this.safeValue-this.safePrecision)),event.key==="Home"&&(event.preventDefault(),this.setValue(0)),event.key==="End"&&(event.preventDefault(),this.setValue(this.safeMax))},this.onHostKeyDown=event=>{event.composedPath()[0]===this&&this.onKeyDown(event)},this.onBlur=event=>{event.target===this&&this.markInteracted()},installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted),this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),this.internals.setFormValue("0"),this.addEventListener("focusout",this.markInteracted),this.addEventListener("keydown",this.onHostKeyDown),this.addEventListener("blur",this.onBlur),this.syncValidityStates()}attributeChangedCallback(name,oldValue,value){if(!(this.syncingHostSemantics&&(name==="aria-label"||name==="role"))){if(super.attributeChangedCallback(name,oldValue,value),name==="aria-label"){const managed=this.getAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE),rehydratedManagedName=oldValue===null&&managed!==null&&managed===value;if(this.authorAriaLabel=rehydratedManagedName?null:value,!rehydratedManagedName){this.syncingHostSemantics=!0;try{this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE)}finally{this.syncingHostSemantics=!1}}}if(name==="role"&&value!=="slider"){this.syncingHostSemantics=!0;try{this.setAttribute("role","slider")}finally{this.syncingHostSemantics=!1}}}}[EXTERNAL_LABEL_HOST_SEMANTICS](operation){if(operation.type==="has-authored-name")return this.authorAriaLabel!==null;if(operation.type==="apply"){this.externalLabelNameActive=!0,this.syncingHostSemantics=!0;try{this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,operation.name),this.getAttribute("aria-label")!==operation.name&&this.setAttribute("aria-label",operation.name)}finally{this.syncingHostSemantics=!1}return}this.externalLabelNameActive=!1,this.syncingHostSemantics=!0;try{if(this.getAttribute("aria-label")===operation.appliedName)if(operation.hadPrevious){const previous=operation.previous??"";this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,previous),this.setAttribute("aria-label",previous)}else this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE),this.removeAttribute("aria-label")}finally{this.syncingHostSemantics=!1}this.authorAriaLabel===null&&this.syncHostSemantics()}get value(){return this._value}set value(next){const old=this._value;this.settingDefaultValue||(this._valueDirty=!0),this._value=typeof next=="number"?next:Number(next),this.syncFormValue(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next==null?0:typeof next=="number"?next:Number(next),this.reflectingDefaultValue=!0;try{next==null?this.removeAttribute("default-value"):this.setAttribute("default-value",String(this._defaultValue))}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get max(){return this._max}set max(next){const old=this._max;this._max=typeof next=="number"?next:Number(next),this.syncFormValue(),this.requestUpdate("max",old)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}get required(){return this._required}set required(next){const old=this._required;this._required=!!next,this.toggleAttribute("required",this._required),this.updateValidity(),this.requestUpdate("required",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.resetHover(),this.updateValidity(),this.requestUpdate("disabled",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get form(){return getFormOwner(this.internals)}set form(owner){setFormOwner(this,owner)}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector('[part~="base"]')??null}checkValidity(){return this.updateValidity(),withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){return this.updateValidity(),this.markInteracted(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.syncValidityStates(),this.syncHostSemantics()}resetValidity(){this.setCustomValidity("")}formResetCallback(){this.resetHover(),this.restoreLiveValueFromDefault(),this._hasInteracted=!1,this.syncValidityStates()}formStateRestoreCallback(state2,reason){this.value=typeof state2=="string"?finiteNumber(Number(state2),0):0}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formDisabledCallback(fieldsetDisabled){this._fieldsetDisabled=fieldsetDisabled,fieldsetDisabled&&this.resetHover(),this.updateValidity(),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.syncHostSemantics()}disconnectedCallback(){super.disconnectedCallback(),this.resetHover()}get safeMax(){return finiteCount(this.max,DEFAULT_MAX,MAX_STARS)}get safeValue(){return finiteRange(this.value,0,0,this.safeMax)}get safePrecision(){const precision=finiteRange(this.precision,DEFAULT_PRECISION,MIN_PRECISION,this.safeMax);return precision>0?precision:DEFAULT_PRECISION}get interactive(){return!this.effectiveDisabled&&!this.readonly}syncFormValue(){this.internals&&(this.internals.setFormValue(String(this.safeValue)),this.updateValidity())}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}updateValidity(){this.validityController&&(this.barredFromValidation?this.validityController.setValidity({}):this.required&&this.safeValue<=0?this.validityController.setValidity({valueMissing:!0},this.localize("fieldRequired")):this.validityController.setValidity({}),this.syncValidityStates())}syncValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this._hasInteracted,barred:this.barredFromValidation})}setValue(next){if(!this.interactive)return;this.markInteracted();const precision=this.safePrecision,clamped=Math.max(0,Math.min(this.safeMax,Math.round(next/precision)*precision));clamped!==this.value&&(this.value=clamped,dispatchNativeEvent(this,"change"),this.emit("lr-change",{value:this.value})),this.emit("lr-activate",{value:clamped})}pointerValue(event){const target=event.target?.closest?.("[data-value]");if(!target)return null;const star=Number(target.dataset.value);if(!Number.isFinite(star))return null;const rect=target.getBoundingClientRect(),precision=this.safePrecision;if(rect.width<=0)return Math.max(0,Math.min(this.safeMax,star));const physicalFraction=Math.max(0,Math.min(1,(event.clientX-rect.left)/rect.width)),logicalFraction=this.effectiveDirection==="rtl"?1-physicalFraction:physicalFraction,rawValue=star-1+logicalFraction;return Math.max(precision,Math.min(this.safeMax,Math.ceil(rawValue/precision)*precision))}resetHover(){this.hovering=!1,this.hoverValue=0}focus(options){this.effectiveDisabled||super.focus(options)}blur(){super.blur()}click(){this.effectiveDisabled||super.click()}captureHostNameProvenance(){if(this.externalLabelNameActive||this.authorAriaLabel!==null)return;const current=this.getAttribute("aria-label");if(current===null)return;const managed=this.getAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE);if(managed!==current&&(this.authorAriaLabel=current,managed!==null)){this.syncingHostSemantics=!0;try{this.removeAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE)}finally{this.syncingHostSemantics=!1}}}syncHostSemantics(){this.captureHostNameProvenance();const safeMax=this.safeMax,safeValue=this.safeValue,label=typeof this.label=="string"&&this.label.trim()===""?"":this.label,generatedLabel=this.accessibleLabel||label||this.localize("rating");this.syncingHostSemantics=!0;try{this.setAttribute("role","slider"),this.setAttribute("tabindex",this.effectiveDisabled?"-1":"0"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(safeMax)),this.setAttribute("aria-valuenow",String(safeValue)),this.setAttribute("aria-valuetext",getNumberFormat(this.effectiveLocale).format(safeValue)),this.setAttribute("aria-disabled",this.effectiveDisabled?"true":"false"),this.setAttribute("aria-readonly",this.readonly?"true":"false"),this.setAttribute("aria-required",this.required?"true":"false"),this.setAttribute("aria-invalid",this.internals.validity.valid?"false":"true"),this.setAttribute("data-effective-size",this.effectiveSize),!this.externalLabelNameActive&&this.authorAriaLabel===null&&this.getAttribute("aria-label")!==generatedLabel?(this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,generatedLabel),this.setAttribute("aria-label",generatedLabel)):!this.externalLabelNameActive&&this.authorAriaLabel===null&&this.setAttribute(MANAGED_ARIA_LABEL_ATTRIBUTE,generatedLabel)}finally{this.syncingHostSemantics=!1}}willUpdate(changed){super.willUpdate(changed),changed.has("readonly")&&!this.interactive&&this.resetHover(),this.syncHostSemantics()}updated(changed){super.updated(changed),changed.has("readonly")&&(this.updateValidity(),this.syncHostSemantics())}symbol(star,selected){return this.getSymbol?this.getSymbol(star,selected):selected?starSolid():starOutline()}renderSymbol(star,selected){return html`<span aria-hidden="true" inert style="pointer-events: none"
2
2
  >${this.symbol(star,selected)}</span
3
3
  >`}render(){const safeMax=this.safeMax,safeValue=this.safeValue,displayValue=this.hovering&&this.interactive?Math.min(this.hoverValue,safeMax):safeValue,count=Math.round(safeMax);return html`<div
4
4
  part="base rating"
@@ -73,6 +73,10 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
73
73
  * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius, on the
74
74
  * anchored source-preview popover.
75
75
  * @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of the anchored surface.
76
+ * @cssprop --lr-positioning-strategy - Cascading `absolute`/`fixed` override for the preview
77
+ * popover's `fixed` default, read from computed style when it is (re)positioned. Set it once on
78
+ * `:root`, a theme, or one clipping ancestor to change every unset citation badge beneath it; an
79
+ * unrecognized value falls back to `fixed`.
76
80
  * @status stable
77
81
  * @since 4.0.0
78
82
  */
@@ -93,4 +97,4 @@ sourceId:string;
93
97
  href:string;
94
98
  /** Adds source context to the accessible name while retaining the visible citation index
95
99
  * (`"Citation {index}, {label}"`). */
96
- label:string;private popoverOpen;private buttonEl?;private popoverEl?;private readonly popoverId;private readonly slotPresence;private cleanupPositioner?;private hideTimer?;private hovering;private focused;private get hasPreviewSlot();protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private get accessibleLabel();private showPreview;private scheduleHidePreview;private hidePreviewNow;private onPointerEnter;private onPointerLeave;private onFocusIn;private onFocusOut;private onKeyDown;private onClick;private onDblClick;private emitOpen;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-citation-badge':LyraCitationBadge;}}
100
+ label:string;private popoverOpen;private buttonEl?;private popoverEl?;private readonly popoverId;private readonly slotPresence;private cleanupPositioner?;private hideTimer?;private hideTimerOwner?;private hovering;private focused;private get hasPreviewSlot();protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private get accessibleLabel();private showPreview;private clearHideTimer;private scheduleHidePreview;private hidePreviewNow;private onPointerEnter;private onPointerLeave;private onFocusIn;private onFocusOut;private onKeyDown;private onClick;private onDblClick;private emitOpen;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-citation-badge':LyraCitationBadge;}}
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{nextId}from"../../../internal/a11y.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{finiteInteger}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./citation-badge.styles.js";import{LYRA_DEFAULT_citation,LYRA_DEFAULT_citationHighConfidence,LYRA_DEFAULT_citationLowConfidence,LYRA_DEFAULT_citationMediumConfidence,LYRA_DEFAULT_citationUnverified,LYRA_DEFAULT_citationVerified,LYRA_DEFAULT_citationWithCustomLabel,LYRA_DEFAULT_citationWithStatus,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const STATUS_MESSAGE_KEY={default:null,high:"citationHighConfidence",medium:"citationMediumConfidence",low:"citationLowConfidence",verified:"citationVerified",unverified:"citationUnverified"},HIDE_DELAY_MS=200;class LyraCitationBadge extends LyraElement{constructor(){super(...arguments),this._index=1,this.status="default",this.sourceId="",this.href="",this.label="",this.popoverOpen=!1,this.popoverId=nextId("citation-badge-popover"),this.slotPresence=new SlotPresenceController(this),this.hovering=!1,this.focused=!1,this.onPointerEnter=()=>{this.hovering=!0,this.showPreview()},this.onPointerLeave=()=>{this.hovering=!1,this.scheduleHidePreview()},this.onFocusIn=()=>{this.focused=!0,this.showPreview()},this.onFocusOut=()=>{this.focused=!1,!this.hovering&&this.hidePreviewNow()},this.onKeyDown=e=>{if(e.key==="Escape"&&this.popoverOpen){e.stopPropagation(),this.hidePreviewNow();return}e.key===" "&&!e.repeat&&e.target===this.buttonEl&&(e.preventDefault(),this.emitOpen())},this.onClick=()=>{this.emit("lr-citation-activate",{sourceId:this.sourceId,index:this.index})},this.onDblClick=()=>{this.emitOpen()}}static{this.defaultStrings={...super.defaultStrings,citation:LYRA_DEFAULT_citation,citationHighConfidence:LYRA_DEFAULT_citationHighConfidence,citationLowConfidence:LYRA_DEFAULT_citationLowConfidence,citationMediumConfidence:LYRA_DEFAULT_citationMediumConfidence,citationUnverified:LYRA_DEFAULT_citationUnverified,citationVerified:LYRA_DEFAULT_citationVerified,citationWithCustomLabel:LYRA_DEFAULT_citationWithCustomLabel,citationWithStatus:LYRA_DEFAULT_citationWithStatus,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get index(){return this._index}set index(value){const old=this._index;this._index=finiteInteger(value,1,1),this.requestUpdate("index",old)}get hasPreviewSlot(){return this.slotPresence.has()}willUpdate(changed){super.willUpdate(changed),this.popoverOpen&&!this.hasPreviewSlot&&this.hidePreviewNow()}updated(changed){super.updated(changed),changed.has("popoverOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.popoverOpen&&this.buttonEl&&this.popoverEl&&(this.cleanupPositioner=place(this.buttonEl,this.popoverEl,{placement:"top-start"})))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,clearTimeout(this.hideTimer),this.hideTimer=void 0,this.popoverOpen=!1,this.hovering=!1,this.focused=!1}get accessibleLabel(){const index=getNumberFormat(this.effectiveLocale).format(this.index);if(this.label)return this.localize("citationWithCustomLabel",void 0,{index,label:this.label});const key=STATUS_MESSAGE_KEY[this.status],statusText=key?this.localize(key):"",citationLabel=this.localize("citation",void 0,{index});return statusText?this.localize("citationWithStatus",void 0,{index,status:statusText}):citationLabel}showPreview(){this.hasPreviewSlot&&(clearTimeout(this.hideTimer),this.hideTimer=void 0,!this.popoverOpen&&(this.popoverOpen=!0))}scheduleHidePreview(){!this.popoverOpen||this.hovering||this.focused||(clearTimeout(this.hideTimer),this.hideTimer=setTimeout(()=>{this.hideTimer=void 0,this.popoverOpen=!1},HIDE_DELAY_MS))}hidePreviewNow(){clearTimeout(this.hideTimer),this.hideTimer=void 0,this.popoverOpen&&(this.popoverOpen=!1)}emitOpen(){this.emit("lr-citation-open",{sourceId:this.sourceId,index:this.index,href:this.href||void 0})}render(){const formattedIndex=getNumberFormat(this.effectiveLocale).format(this.index);return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{nextId}from"../../../internal/a11y.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{finiteInteger}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./citation-badge.styles.js";import{LYRA_DEFAULT_citation,LYRA_DEFAULT_citationHighConfidence,LYRA_DEFAULT_citationLowConfidence,LYRA_DEFAULT_citationMediumConfidence,LYRA_DEFAULT_citationUnverified,LYRA_DEFAULT_citationVerified,LYRA_DEFAULT_citationWithCustomLabel,LYRA_DEFAULT_citationWithStatus,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const STATUS_MESSAGE_KEY={default:null,high:"citationHighConfidence",medium:"citationMediumConfidence",low:"citationLowConfidence",verified:"citationVerified",unverified:"citationUnverified"},HIDE_DELAY_MS=200;class LyraCitationBadge extends LyraElement{constructor(){super(...arguments),this._index=1,this.status="default",this.sourceId="",this.href="",this.label="",this.popoverOpen=!1,this.popoverId=nextId("citation-badge-popover"),this.slotPresence=new SlotPresenceController(this),this.hovering=!1,this.focused=!1,this.onPointerEnter=()=>{this.hovering=!0,this.showPreview()},this.onPointerLeave=()=>{this.hovering=!1,this.scheduleHidePreview()},this.onFocusIn=()=>{this.focused=!0,this.showPreview()},this.onFocusOut=()=>{this.focused=!1,!this.hovering&&this.hidePreviewNow()},this.onKeyDown=e=>{if(e.key==="Escape"&&this.popoverOpen){e.stopPropagation(),this.hidePreviewNow();return}e.key===" "&&!e.repeat&&e.target===this.buttonEl&&(e.preventDefault(),this.emitOpen())},this.onClick=()=>{this.emit("lr-citation-activate",{sourceId:this.sourceId,index:this.index})},this.onDblClick=()=>{this.emitOpen()}}static{this.defaultStrings={...super.defaultStrings,citation:LYRA_DEFAULT_citation,citationHighConfidence:LYRA_DEFAULT_citationHighConfidence,citationLowConfidence:LYRA_DEFAULT_citationLowConfidence,citationMediumConfidence:LYRA_DEFAULT_citationMediumConfidence,citationUnverified:LYRA_DEFAULT_citationUnverified,citationVerified:LYRA_DEFAULT_citationVerified,citationWithCustomLabel:LYRA_DEFAULT_citationWithCustomLabel,citationWithStatus:LYRA_DEFAULT_citationWithStatus,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get index(){return this._index}set index(value){const old=this._index;this._index=finiteInteger(value,1,1),this.requestUpdate("index",old)}get hasPreviewSlot(){return this.slotPresence.has()}willUpdate(changed){super.willUpdate(changed),this.popoverOpen&&!this.hasPreviewSlot&&this.hidePreviewNow()}updated(changed){super.updated(changed),changed.has("popoverOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.popoverOpen&&this.buttonEl&&this.popoverEl&&(this.cleanupPositioner=place(this.buttonEl,this.popoverEl,{placement:"top-start",strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")})))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.clearHideTimer(),this.popoverOpen=!1,this.hovering=!1,this.focused=!1}get accessibleLabel(){const index=getNumberFormat(this.effectiveLocale).format(this.index);if(this.label)return this.localize("citationWithCustomLabel",void 0,{index,label:this.label});const key=STATUS_MESSAGE_KEY[this.status],statusText=key?this.localize(key):"",citationLabel=this.localize("citation",void 0,{index});return statusText?this.localize("citationWithStatus",void 0,{index,status:statusText}):citationLabel}showPreview(){this.hasPreviewSlot&&(this.clearHideTimer(),!this.popoverOpen&&(this.popoverOpen=!0))}clearHideTimer(){this.hideTimer!==void 0&&this.hideTimerOwner?.clearTimeout(this.hideTimer),this.hideTimer=void 0,this.hideTimerOwner=void 0}scheduleHidePreview(){if(!this.popoverOpen||this.hovering||this.focused)return;this.clearHideTimer();const ownerWindow=this.ownerDocument.defaultView;if(!ownerWindow)return;const handle=ownerWindow.setTimeout(()=>{this.hideTimer===handle&&(this.hideTimer=void 0,this.hideTimerOwner=void 0,this.popoverOpen=!1)},HIDE_DELAY_MS);this.hideTimer=handle,this.hideTimerOwner=ownerWindow}hidePreviewNow(){this.clearHideTimer(),this.popoverOpen&&(this.popoverOpen=!1)}emitOpen(){this.emit("lr-citation-open",{sourceId:this.sourceId,index:this.index,href:this.href||void 0})}render(){const formattedIndex=getNumberFormat(this.effectiveLocale).format(this.index);return html`
2
2
  <span
3
3
  class="wrapper"
4
4
  @pointerenter=${this.onPointerEnter}
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);display:block;container-type:inline-size}[part=base]{gap:var(--lr-space-xs);flex-direction:column;display:flex}[part=plot]{inline-size:100%;block-size:var(--lr-embedding-explorer-height,auto);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);display:block;overflow:visible}[part=point]{cursor:pointer;outline:none}.point-hit{fill:none;stroke:#0000;stroke-width:var(--lr-size-24px);stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:stroke}[part=point]:hover,[part=point]:focus-visible{outline:none}[part=point]:hover .point-marker,[part=point]:focus-visible .point-marker{stroke:var(--lr-color-text);stroke-width:var(--lr-border-width-medium)}[part=point]:active .point-marker{stroke:var(--lr-color-text);stroke-width:var(--lr-border-width-thick)}[part=point][data-selected=true] .point-marker{stroke:var(--lr-embedding-explorer-selected-stroke,var(--lr-color-brand));stroke-width:var(--lr-border-width-medium)}[part=point][data-selected=true]:hover .point-marker,[part=point][data-selected=true]:focus-visible .point-marker{stroke-width:var(--lr-border-width-thick)}[part=point][data-selected=true]:active .point-marker{stroke-width:calc(var(--lr-border-width-thick) + var(--lr-border-width-thin))}[part=legend]{gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);flex-wrap:wrap;align-items:center;display:flex}[part=legend-item]{align-items:center;gap:var(--lr-space-2xs);min-inline-size:0;max-inline-size:100%;display:inline-flex}[part=legend-swatch]{inline-size:var(--lr-size-0-75rem);block-size:var(--lr-size-0-75rem);border-radius:var(--lr-radius-xs);flex:none}[part=legend-label]{overflow-wrap:anywhere;min-inline-size:0}[part=empty]{color:var(--lr-color-text-quiet);margin:0}@container (inline-size<=319.98px){[part=plot]{min-block-size:var(--lr-size-12rem)}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);display:block;container-type:inline-size}[part=base]{gap:var(--lr-space-xs);flex-direction:column;display:flex}[part=plot]{inline-size:100%;block-size:var(--lr-embedding-explorer-height,auto);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);background:var(--lr-color-surface);display:block;overflow:visible}[part=point]{cursor:pointer;transition:stroke var(--lr-transition-fast), stroke-width var(--lr-transition-fast);outline:none}.point-hit{fill:none;stroke:#0000;stroke-width:var(--lr-size-24px);stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:stroke}[part=point]:hover,[part=point]:focus-visible{outline:none}[part=point]:hover .point-marker,[part=point]:focus-visible .point-marker{stroke:var(--lr-color-text);stroke-width:var(--lr-border-width-medium)}[part=point]:active .point-marker{stroke:var(--lr-color-text);stroke-width:var(--lr-border-width-thick)}[part=point][data-selected=true] .point-marker{stroke:var(--lr-embedding-explorer-selected-stroke,var(--lr-color-brand));stroke-width:var(--lr-border-width-medium)}[part=point][data-selected=true]:hover .point-marker,[part=point][data-selected=true]:focus-visible .point-marker{stroke-width:var(--lr-border-width-thick)}[part=point][data-selected=true]:active .point-marker{stroke-width:calc(var(--lr-border-width-thick) + var(--lr-border-width-thin))}[part=legend]{gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);flex-wrap:wrap;align-items:center;display:flex}[part=legend-item]{align-items:center;gap:var(--lr-space-2xs);min-inline-size:0;max-inline-size:100%;display:inline-flex}[part=legend-swatch]{inline-size:var(--lr-size-0-75rem);block-size:var(--lr-size-0-75rem);border-radius:var(--lr-radius-xs);flex:none}[part=legend-label]{overflow-wrap:anywhere;min-inline-size:0}[part=empty]{color:var(--lr-color-text-quiet);margin:0}@container (inline-size<=319.98px){[part=plot]{min-block-size:var(--lr-size-12rem)}}`;export{styles};
@@ -30,6 +30,10 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
30
30
  * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius, on the
31
31
  * anchored detail popover.
32
32
  * @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of the anchored surface.
33
+ * @cssprop --lr-positioning-strategy - Cascading `absolute`/`fixed` override for the preview
34
+ * popover's `fixed` default, read from computed style when it is (re)positioned. Set it once on
35
+ * `:root`, a theme, or one clipping ancestor to change every unset entity chip beneath it; an
36
+ * unrecognized value falls back to `fixed`.
33
37
  * @status stable
34
38
  * @since 4.0.0
35
39
  */
@@ -50,4 +54,4 @@ typeLabel?:string;private popoverOpen;private buttonEl?;private popoverEl?;priva
50
54
  * regardless of assignment, so `:empty` never matches either. The shared controller answers the
51
55
  * same "does this slot carry real consumer content" question every other presence-driven
52
56
  * component asks, seeded before the first render and kept live afterwards. */
53
- private readonly slotPresence;private cleanupPositioner?;private hideTimer?;private hovering;private focused;private get hasPreviewSlot();protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private get accessibleLabel();private showPreview;private scheduleHidePreview;private hidePreviewNow;private onPointerEnter;private onPointerLeave;private onFocusIn;private onFocusOut;private onKeyDown;private onClick;private onDblClick;private emitOpen;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-entity-chip':LyraEntityChip;}}
57
+ private readonly slotPresence;private cleanupPositioner?;private hideTimer?;private hideTimerOwner?;private hovering;private focused;private get hasPreviewSlot();protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;disconnectedCallback():void;private get accessibleLabel();private showPreview;private clearHideTimer;private scheduleHidePreview;private hidePreviewNow;private onPointerEnter;private onPointerLeave;private onFocusIn;private onFocusOut;private onKeyDown;private onClick;private onDblClick;private emitOpen;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-entity-chip':LyraEntityChip;}}
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isNonBlankIdentity}from"../retrieval-identity.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{nextId}from"../../../internal/a11y.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{styles}from"./entity-chip.styles.js";import{LYRA_DEFAULT_entityChipWithType,LYRA_DEFAULT_untitledEntity}from"../../../internal/default-strings.generated.js";const HIDE_DELAY_MS=200;class LyraEntityChip extends LyraElement{constructor(){super(...arguments),this.entityId="",this.text="",this.type="",this.popoverOpen=!1,this.popoverId=nextId("entity-chip-popover"),this.slotPresence=new SlotPresenceController(this),this.hovering=!1,this.focused=!1,this.onPointerEnter=()=>{this.hovering=!0,this.showPreview()},this.onPointerLeave=()=>{this.hovering=!1,this.scheduleHidePreview()},this.onFocusIn=()=>{this.focused=!0,this.showPreview()},this.onFocusOut=()=>{this.focused=!1,!this.hovering&&this.hidePreviewNow()},this.onKeyDown=e=>{if(e.key==="Escape"&&this.popoverOpen){e.stopPropagation(),this.hidePreviewNow();return}e.key===" "&&!e.repeat&&e.target===this.buttonEl&&(e.preventDefault(),this.emitOpen())},this.onClick=()=>{isNonBlankIdentity(this.entityId)&&this.emit("lr-entity-select",{entityId:this.entityId})},this.onDblClick=()=>{this.emitOpen()}}static{this.defaultStrings={...super.defaultStrings,entityChipWithType:LYRA_DEFAULT_entityChipWithType,untitledEntity:LYRA_DEFAULT_untitledEntity}}static{this.styles=[LyraElement.styles,styles]}get hasPreviewSlot(){return this.slotPresence.has()}willUpdate(changed){super.willUpdate(changed),this.popoverOpen&&!this.hasPreviewSlot&&this.hidePreviewNow()}updated(changed){super.updated(changed),changed.has("popoverOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.popoverOpen&&this.buttonEl&&this.popoverEl&&(this.cleanupPositioner=place(this.buttonEl,this.popoverEl,{placement:"top-start"})))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,clearTimeout(this.hideTimer),this.hideTimer=void 0,this.popoverOpen=!1,this.hovering=!1,this.focused=!1}get accessibleLabel(){const label=(this.text??"").trim()===""?this.localize("untitledEntity"):this.text,typeText=this.typeLabel?.trim()||(this.type??"").trim();return typeText?this.localize("entityChipWithType",void 0,{label,type:typeText}):label}showPreview(){this.hasPreviewSlot&&(clearTimeout(this.hideTimer),this.hideTimer=void 0,!this.popoverOpen&&(this.popoverOpen=!0))}scheduleHidePreview(){!this.popoverOpen||this.hovering||this.focused||(clearTimeout(this.hideTimer),this.hideTimer=setTimeout(()=>{this.hideTimer=void 0,this.popoverOpen=!1},HIDE_DELAY_MS))}hidePreviewNow(){clearTimeout(this.hideTimer),this.hideTimer=void 0,this.popoverOpen&&(this.popoverOpen=!1)}emitOpen(){isNonBlankIdentity(this.entityId)&&this.emit("lr-entity-open",{entityId:this.entityId})}render(){return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isNonBlankIdentity}from"../retrieval-identity.js";import{deferredPlace as place}from"../../../internal/anchored-overlay-runtime.js";import{resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{nextId}from"../../../internal/a11y.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{styles}from"./entity-chip.styles.js";import{LYRA_DEFAULT_entityChipWithType,LYRA_DEFAULT_untitledEntity}from"../../../internal/default-strings.generated.js";const HIDE_DELAY_MS=200;class LyraEntityChip extends LyraElement{constructor(){super(...arguments),this.entityId="",this.text="",this.type="",this.popoverOpen=!1,this.popoverId=nextId("entity-chip-popover"),this.slotPresence=new SlotPresenceController(this),this.hovering=!1,this.focused=!1,this.onPointerEnter=()=>{this.hovering=!0,this.showPreview()},this.onPointerLeave=()=>{this.hovering=!1,this.scheduleHidePreview()},this.onFocusIn=()=>{this.focused=!0,this.showPreview()},this.onFocusOut=()=>{this.focused=!1,!this.hovering&&this.hidePreviewNow()},this.onKeyDown=e=>{if(e.key==="Escape"&&this.popoverOpen){e.stopPropagation(),this.hidePreviewNow();return}e.key===" "&&!e.repeat&&e.target===this.buttonEl&&(e.preventDefault(),this.emitOpen())},this.onClick=()=>{isNonBlankIdentity(this.entityId)&&this.emit("lr-entity-select",{entityId:this.entityId})},this.onDblClick=()=>{this.emitOpen()}}static{this.defaultStrings={...super.defaultStrings,entityChipWithType:LYRA_DEFAULT_entityChipWithType,untitledEntity:LYRA_DEFAULT_untitledEntity}}static{this.styles=[LyraElement.styles,styles]}get hasPreviewSlot(){return this.slotPresence.has()}willUpdate(changed){super.willUpdate(changed),this.popoverOpen&&!this.hasPreviewSlot&&this.hidePreviewNow()}updated(changed){super.updated(changed),changed.has("popoverOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.popoverOpen&&this.buttonEl&&this.popoverEl&&(this.cleanupPositioner=place(this.buttonEl,this.popoverEl,{placement:"top-start",strategy:resolveEffectivePositioningStrategy(this,void 0,"fixed")})))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.clearHideTimer(),this.popoverOpen=!1,this.hovering=!1,this.focused=!1}get accessibleLabel(){const label=(this.text??"").trim()===""?this.localize("untitledEntity"):this.text,typeText=this.typeLabel?.trim()||(this.type??"").trim();return typeText?this.localize("entityChipWithType",void 0,{label,type:typeText}):label}showPreview(){this.hasPreviewSlot&&(this.clearHideTimer(),!this.popoverOpen&&(this.popoverOpen=!0))}clearHideTimer(){this.hideTimer!==void 0&&this.hideTimerOwner?.clearTimeout(this.hideTimer),this.hideTimer=void 0,this.hideTimerOwner=void 0}scheduleHidePreview(){if(!this.popoverOpen||this.hovering||this.focused)return;this.clearHideTimer();const ownerWindow=this.ownerDocument.defaultView;if(!ownerWindow)return;const handle=ownerWindow.setTimeout(()=>{this.hideTimer===handle&&(this.hideTimer=void 0,this.hideTimerOwner=void 0,this.popoverOpen=!1)},HIDE_DELAY_MS);this.hideTimer=handle,this.hideTimerOwner=ownerWindow}hidePreviewNow(){this.clearHideTimer(),this.popoverOpen&&(this.popoverOpen=!1)}emitOpen(){isNonBlankIdentity(this.entityId)&&this.emit("lr-entity-open",{entityId:this.entityId})}render(){return html`
2
2
  <span
3
3
  class="wrapper"
4
4
  @pointerenter=${this.onPointerEnter}
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{gap:var(--lr-space-s);flex-wrap:wrap;min-inline-size:0;max-inline-size:100%;display:flex}[part~=item]{align-items:center;gap:var(--lr-space-xs);box-sizing:border-box;min-inline-size:0;max-inline-size:100%;padding:var(--lr-size-2px) var(--lr-space-xs);border-radius:var(--lr-radius-xs);color:var(--lr-color-text);font:inherit;font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-snug);background:0 0;border:none;display:inline-flex}button[part~=item]{box-sizing:border-box;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:opacity var(--lr-transition-fast)}button[part~=item]:hover{background:color-mix(in srgb, var(--lr-color-text) 8%, transparent)}button[part~=item]:active{background:color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active))}button[part~=item]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part~=item][data-hidden] [part=swatch]{opacity:var(--lr-graph-legend-hidden-swatch-opacity,.5)}[part~=item][data-hidden] [part=label],[part~=item][data-hidden] [part=count]{color:var(--lr-graph-legend-hidden-color,var(--lr-color-text-quiet))}[part=swatch]{color:var(--lr-color-text);flex:none;display:block}[part=label]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}[part=count]{color:var(--lr-color-text-quiet);font-variant-numeric:tabular-nums}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{gap:var(--lr-space-s);flex-wrap:wrap;min-inline-size:0;max-inline-size:100%;display:flex}[part~=item]{align-items:center;gap:var(--lr-space-xs);box-sizing:border-box;min-inline-size:0;max-inline-size:100%;padding:var(--lr-size-2px) var(--lr-space-xs);border-radius:var(--lr-radius-xs);color:var(--lr-color-text);font:inherit;font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-snug);background:0 0;border:none;display:inline-flex}button[part~=item]{box-sizing:border-box;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:var(--lr-transition-interactive)}button[part~=item]:hover{background:color-mix(in srgb, var(--lr-color-text) 8%, transparent)}button[part~=item]:active{background:color-mix(in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-active))}button[part~=item]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part~=item][data-hidden] [part=swatch]{opacity:var(--lr-graph-legend-hidden-swatch-opacity,.5)}[part~=item][data-hidden] [part=label],[part~=item][data-hidden] [part=count]{color:var(--lr-graph-legend-hidden-color,var(--lr-color-text-quiet))}[part=swatch]{color:var(--lr-color-text);flex:none;display:block}[part=label]{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}[part=count]{color:var(--lr-color-text-quiet);font-variant-numeric:tabular-nums}`;export{styles};
@@ -1 +1 @@
1
- import{getListFormat,getNumberFormat}from"../../internal/intl-cache.js";import{finiteNumber}from"../../internal/numbers.js";function formatBoundedRetrievalValue(value,options){const maxDepth=options.maxDepth??6,maxEntries=options.maxEntries??32,maxValues=options.maxValues??128,maxStringLength=options.maxStringLength??256,seen=new WeakSet;let remaining=maxValues;const boundedText=value2=>value2.length>maxStringLength?`${value2.slice(0,maxStringLength)}${options.truncated}`:value2,format=(current,depth)=>{if(remaining--<=0||depth>maxDepth)return options.truncated;if(typeof current=="string")return boundedText(current);if(typeof current=="number")return getNumberFormat(options.locale).format(finiteNumber(current,0));if(typeof current=="boolean"||typeof current=="bigint")return String(current);if(current==null)return"";if(typeof current!="object"||seen.has(current))return options.invalid;seen.add(current);try{if(Array.isArray(current)){const length=current.length;if(!Number.isSafeInteger(length)||length<0)return options.invalid;const count=Math.min(length,maxEntries),items=[];for(let index=0;index<count;index++)items.push(format(current[index],depth+1));return length>count&&items.push(options.truncated),getListFormat(options.locale,{type:"conjunction"}).format(items)}const entries=[];let truncated=!1;for(const key in current)if(Object.prototype.hasOwnProperty.call(current,key)){if(entries.length>=maxEntries){truncated=!0;break}entries.push([boundedText(key),current[key]])}const parts=entries.map(([key,item])=>`${key}: ${format(item,depth+1)}`);return truncated&&parts.push(options.truncated),`{${parts.join(", ")}}`}catch{return options.invalid}finally{seen.delete(current)}};return format(value,0)}export{formatBoundedRetrievalValue};
1
+ import{getListFormat,getNumberFormat}from"../../internal/intl-cache.js";import{finiteNumber}from"../../internal/numbers.js";function formatBoundedRetrievalValue(value,options){const maxDepth=options.maxDepth??6,maxEntries=options.maxEntries??32,maxValues=options.maxValues??128,maxStringLength=options.maxStringLength??256,numberFormat=getNumberFormat(options.locale),listFormat=getListFormat(options.locale,{type:"conjunction"}),seen=new WeakSet;let remaining=maxValues;const boundedText=value2=>value2.length>maxStringLength?`${value2.slice(0,maxStringLength)}${options.truncated}`:value2,format=(current,depth)=>{if(remaining--<=0||depth>maxDepth)return options.truncated;if(typeof current=="string")return boundedText(current);if(typeof current=="number")return numberFormat.format(finiteNumber(current,0));if(typeof current=="boolean"||typeof current=="bigint")return String(current);if(current==null)return"";if(typeof current!="object"||seen.has(current))return options.invalid;seen.add(current);try{if(Array.isArray(current)){const length=current.length;if(!Number.isSafeInteger(length)||length<0)return options.invalid;const count=Math.min(length,maxEntries),items=[];for(let index=0;index<count;index++)items.push(format(current[index],depth+1));return length>count&&items.push(options.truncated),listFormat.format(items)}const entries=[];let truncated=!1;for(const key in current)if(Object.prototype.hasOwnProperty.call(current,key)){if(entries.length>=maxEntries){truncated=!0;break}entries.push([boundedText(key),current[key]])}const parts=entries.map(([key,item])=>`${key}: ${format(item,depth+1)}`);return truncated&&parts.push(options.truncated),`{${parts.join(", ")}}`}catch{return options.invalid}finally{seen.delete(current)}};return format(value,0)}export{formatBoundedRetrievalValue};
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{min-inline-size:0;display:block}[part=base]{border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);overflow:hidden}[part=header]{align-items:center;gap:var(--lr-space-xs);box-sizing:border-box;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);inline-size:100%;padding:var(--lr-space-s) var(--lr-space-m);color:var(--lr-color-text);font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-md-sm);text-align:start;cursor:pointer;background:0 0;border:none;display:flex}[part=header]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=header]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active));color:var(--lr-color-brand)}[part=header]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=toggle]{transition:transform var(--lr-transition-fast);flex:none;display:inline-flex}:host([expanded]) [part=toggle]{transform:rotate(90deg)}:host(:not([expanded]):dir(rtl)) [part=toggle]{transform:scaleX(-1)}[part=list]{gap:var(--lr-space-s);padding:0 var(--lr-space-m) var(--lr-space-m);border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);overflow-wrap:anywhere;flex-direction:column;min-inline-size:0;padding-block-start:var(--lr-space-m);display:flex}[part=list][hidden]{display:none}@media (prefers-reduced-motion:reduce){[part=toggle]{transition:none!important}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{min-inline-size:0;display:block}[part=base]{border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);overflow:hidden}[part=header]{align-items:center;gap:var(--lr-space-xs);box-sizing:border-box;min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);inline-size:100%;padding:var(--lr-space-s) var(--lr-space-m);color:var(--lr-color-text);font:inherit;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-md-sm);text-align:start;cursor:pointer;transition:var(--lr-transition-interactive);background:0 0;border:none;display:flex}[part=header]:hover{background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=header]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active));color:var(--lr-color-brand)}[part=header]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-offset))}[part=toggle]{transition:transform var(--lr-transition-fast);flex:none;display:inline-flex}:host([expanded]) [part=toggle]{transform:rotate(90deg)}:host(:not([expanded]):dir(rtl)) [part=toggle]{transform:scaleX(-1)}[part=list]{gap:var(--lr-space-s);padding:0 var(--lr-space-m) var(--lr-space-m);border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border);overflow-wrap:anywhere;flex-direction:column;min-inline-size:0;padding-block-start:var(--lr-space-m);display:flex}[part=list][hidden]{display:none}@media (prefers-reduced-motion:reduce){[part=toggle]{transition:none!important}}`;export{styles};