@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
@@ -16,7 +16,14 @@ observedAttributes?:string[];checkValidity:(input:never)=>LyraFileInputObjectVal
16
16
  export declare const DEFAULT_MAX_FILES=100;
17
17
  /** Fallback used by `effectiveMaxTotalSize` for an invalid (negative/`NaN`) `maxTotalSize`
18
18
  * override, mirroring `DEFAULT_MAX_FILE_SIZE_BYTES`'s fail-safe role for `maxFileSize`. */
19
- export declare const DEFAULT_MAX_TOTAL_SIZE_BYTES:number;export interface LyraFileInputRejectedFile{readonly file:File;readonly reason:'type'|'count'|'size'|'directory'|'read'|'limit'|'maxFiles'|'maxTotalSize';}export interface LyraFileInputFilesDetail{readonly files:readonly File[];readonly rejected:readonly LyraFileInputRejectedFile[];}
19
+ export declare const DEFAULT_MAX_TOTAL_SIZE_BYTES:number;export interface LyraFileInputRejectedFile{readonly file:File;readonly reason:'type'|'count'|'size'|'directory'|'read'|'limit'|'maxFiles'|'maxTotalSize';}export interface LyraFileInputFilesDetail{readonly files:readonly File[];readonly rejected:readonly LyraFileInputRejectedFile[];
20
+ /** Remaining allowance under `maxFiles` after this batch, at the control's running count
21
+ * (retained files, unless `nonRetaining`, plus `heldFileCount`) -- `null` while `maxFiles` is
22
+ * unset (no limit), never negative. */
23
+ readonly remainingFiles:number|null;
24
+ /** Remaining allowance under `maxTotalSize` after this batch, in bytes -- `null` while
25
+ * `maxTotalSize` is unset (no limit), never negative. */
26
+ readonly remainingTotalSize:number|null;}
20
27
  /** `lr-files`' event type, narrowing `target`/`currentTarget` to `LyraFileInput` so a listener
21
28
  * reads them without casting. */
22
29
  export interface LyraFileInputFilesEvent extends CustomEvent<LyraFileInputFilesDetail>{readonly target:LyraFileInput;readonly currentTarget:LyraFileInput;}export interface LyraFileInputEventMap{blur:FocusEvent;focus:FocusEvent;input:Event;change:Event;'lr-invalid':CustomEvent<null>;'lr-files':LyraFileInputFilesEvent;}
@@ -34,11 +41,13 @@ export interface LyraFileInputFilesEvent extends CustomEvent<LyraFileInputFilesD
34
41
  * @slot hint - Custom form-control hint content.
35
42
  * @slot error - Custom validation error content. Use `with-error` when this slot is populated in
36
43
  * server-rendered declarative shadow DOM before light-DOM slot assignment is observable.
37
- * @event lr-files - Frozen `detail: { files, rejected }` with detached readonly sequences and
38
- * rejected-file records, fired on drop and manual selection. Immutable `File` items retain
39
- * identity. Typed as {@linkcode LyraFileInputFilesEvent}, so `event.target`/`event.currentTarget` are
40
- * `LyraFileInput` without a cast. Still fires while `nonRetaining` is set, even though `files`
41
- * itself is never written in that mode.
44
+ * @event lr-files - Frozen `detail: { files, rejected, remainingFiles, remainingTotalSize }` with
45
+ * detached readonly sequences and rejected-file records, fired on drop and manual selection.
46
+ * `remainingFiles`/`remainingTotalSize` report the allowance still left under `maxFiles`/
47
+ * `maxTotalSize` after this batch (`null` while that limit is unset). Immutable `File` items
48
+ * retain identity. Typed as {@linkcode LyraFileInputFilesEvent}, so
49
+ * `event.target`/`event.currentTarget` are `LyraFileInput` without a cast. Still fires while
50
+ * `nonRetaining` is set, even though `files` itself is never written in that mode.
42
51
  * @event {Event} input - Native event fired before `change` when user interaction changes `files`;
43
52
  * bubbling, composed, and non-cancelable.
44
53
  * @event {Event} change - Native event fired after `input` when user interaction changes `files`;
@@ -89,7 +98,8 @@ export interface LyraFileInputFilesEvent extends CustomEvent<LyraFileInputFilesD
89
98
  * touched anything. Neither this nor `user-invalid` matches while the control is barred from
90
99
  * constraint validation (disabled, or inside a disabled fieldset).
91
100
  * @cssstate user-valid - `valid`, but only after the user has interacted: choosing or dropping
92
- * files, removing one, a blur, or a `reportValidity()` call (which is what a submit attempt runs).
101
+ * files, removing one, a blur, `reportValidity()`, or a submission attempt. Not after a silent
102
+ * `checkValidity()` alone.
93
103
  * @cssstate user-invalid - `invalid` after that same interaction. Style validation errors with this
94
104
  * rather than `invalid`: a pristine required file input is genuinely invalid, but colouring it red
95
105
  * before the user has done anything is hostile.
@@ -159,19 +169,30 @@ get forbiddenMimeTypes():readonly string[];set forbiddenMimeTypes(next:readonly
159
169
  /** Largest accepted file size in bytes. `0` (the default) disables the size check entirely --
160
170
  * see `effectiveMaxFileSize` for how an invalid override is handled. */
161
171
  maxFileSize:number;
162
- /** Largest total number of files accepted, counting retained files plus the current batch. `0`
163
- * (the default) disables the check. Same rejection-UI shape as `maxFileSize`: an excess file in
164
- * the batch is rejected with reason `'maxFiles'` and appears in `[part="rejection"]` alongside
165
- * any other rejection, rather than failing the whole selection. An invalid override (negative,
166
- * `NaN`) falls back to a sane cap rather than silently accepting an unlimited count -- see
167
- * `effectiveMaxFiles`. While `nonRetaining` is set, the count only covers the current batch,
168
- * since the control does not track an externally-held count. */
172
+ /** Largest total number of files accepted, counting retained files (unless `nonRetaining`) plus
173
+ * `heldFileCount` plus the current batch. `0` (the default) disables the check. Same
174
+ * rejection-UI shape as `maxFileSize`: an excess file in the batch is rejected with reason
175
+ * `'maxFiles'` and appears in `[part="rejection"]` alongside any other rejection, rather than
176
+ * failing the whole selection. An invalid override (negative, `NaN`) falls back to a sane cap
177
+ * rather than silently accepting an unlimited count -- see `effectiveMaxFiles`. */
169
178
  maxFiles:number;
170
- /** Largest combined byte size accepted, summing retained files plus the current batch. `0` (the
171
- * default) disables the check. Same rejection-UI shape and invalid-override fallback as
172
- * `maxFileSize` -- see `effectiveMaxTotalSize`. While `nonRetaining` is set, the total only
173
- * covers the current batch. */
179
+ /** Largest combined byte size accepted, summing retained files (unless `nonRetaining`) plus
180
+ * `heldTotalSize` plus the current batch. `0` (the default) disables the check. Same
181
+ * rejection-UI shape and invalid-override fallback as `maxFileSize` -- see
182
+ * `effectiveMaxTotalSize`. */
174
183
  maxTotalSize:number;
184
+ /** Externally held file count added to the running count `maxFiles` evaluates against, in both
185
+ * retaining and `nonRetaining` modes -- the numeric counterpart of `valuePresent`, for a
186
+ * cumulative cap that spans separate picker sessions (e.g. a server-backed upload limit) rather
187
+ * than resetting to what this control alone can see. `0` (the default) means "nothing held" and
188
+ * reproduces prior behavior exactly. A negative, `NaN`, or `Infinity` value is normalized to `0`
189
+ * via `finiteCount` -- an invalid baseline degrades to "nothing held" rather than corrupting
190
+ * every later comparison or permanently blocking every future file. */
191
+ heldFileCount:number;
192
+ /** Externally held byte total added to the running size `maxTotalSize` evaluates against, in
193
+ * both retaining and `nonRetaining` modes. Same contract, default, and invalid-input
194
+ * normalization as `heldFileCount`. */
195
+ heldTotalSize:number;
175
196
  /** Opt-in mode where an accepted selection still fires `lr-files`/`input`/`change` but is never
176
197
  * written to `files` or rendered as a built-in `[part="file"]` row -- for a host that persists
177
198
  * files elsewhere and renders its own list, so assigning `files` (even to reset it) never fights
@@ -283,7 +304,7 @@ private validatorResult;
283
304
  private syncValidatorAttributeObserver;private disconnectValidatorAttributeObserver;private updateValidity;
284
305
  /** Whether the control has a value for `required`/`blank` purposes: real retained files, or --
285
306
  * while `nonRetaining` is set -- the host's own `valuePresent` signal. */
286
- private get hasEffectiveValue();private publishCustomStates;checkValidity():boolean;reportValidity():boolean;setCustomValidity(message:string):void;resetValidity():void;formResetCallback():void;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;private readFormDataFiles;formDisabledCallback(disabled:boolean):void;private syncThumbnailUrls;
307
+ private get hasEffectiveValue();private publishCustomStates;private markInteracted;checkValidity():boolean;reportValidity():boolean;setCustomValidity(message:string):void;resetValidity():void;formResetCallback():void;formStateRestoreCallback(state:string|File|FormData|null,reason:'autocomplete'|'restore'):void;private readFormDataFiles;formDisabledCallback(disabled:boolean):void;private syncThumbnailUrls;
287
308
  /** `maxFileSize` normalized: `0` (explicitly set, or left at the default) or `Infinity`
288
309
  * (explicitly set) both mean "no limit" verbatim -- `null` here signals that. Anything else
289
310
  * that isn't a positive, finite override -- a `NaN` from an invalid `max-file-size` attribute,
@@ -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{getNumberFormat}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{finiteRange}from"../../../internal/numbers.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{syncAriaDescribedByElements}from"../../../internal/aria-controls.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInvalidEventAlias}from"../../../internal/invalid-event-alias.js";import{dispatchNativeEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{DropSessionController}from"../../../internal/drop-session-controller.js";import{sizes}from"../../../internal/sizes.styles.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{closeIcon,fileIcon}from"../../../internal/icons.js";import{styles}from"./file-input.styles.js";import{matchesAccept}from"./accept.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{FILE_SIZE_UNIT_KEYS,formatFileSize}from"../attachment-chip/file-size.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_dropzoneRejectedType,LYRA_DEFAULT_dropzoneReleaseToAdd,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileInputAcceptedMany,LYRA_DEFAULT_fileInputAcceptedOne,LYRA_DEFAULT_fileInputDefaultLabel,LYRA_DEFAULT_fileInputFolderRejected,LYRA_DEFAULT_fileInputRejectedCount,LYRA_DEFAULT_fileInputRejectedLimit,LYRA_DEFAULT_fileInputRejectedMany,LYRA_DEFAULT_fileInputRejectedMaxFiles,LYRA_DEFAULT_fileInputRejectedMaxTotalSize,LYRA_DEFAULT_fileInputRejectedOne,LYRA_DEFAULT_fileInputRejectedRead,LYRA_DEFAULT_fileInputRejectedSize,LYRA_DEFAULT_fileInputRejectedType,LYRA_DEFAULT_fileSizeUnitB,LYRA_DEFAULT_fileSizeUnitGb,LYRA_DEFAULT_fileSizeUnitKb,LYRA_DEFAULT_fileSizeUnitMb,LYRA_DEFAULT_fileSizeUnitTb,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings.generated.js";const VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]);function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}const DEFAULT_MAX_FILE_SIZE_BYTES=25*1024*1024,DEFAULT_MAX_FILES=100,DEFAULT_MAX_TOTAL_SIZE_BYTES=250*1024*1024,MAX_DROPPED_FOLDER_ENTRIES=1e4,MAX_MIME_TYPES=1e4,EMPTY_MIME_TYPES=Object.freeze([]);function snapshotMimeTypes(value){try{if(!Array.isArray(value))return EMPTY_MIME_TYPES;const count=Math.min(value.length,MAX_MIME_TYPES),values=[];for(let index=0;index<count;index++)try{const candidate=value[index];typeof candidate=="string"&&values.push(candidate)}catch{}return values.length?Object.freeze(values):EMPTY_MIME_TYPES}catch{return EMPTY_MIME_TYPES}}const INTERACTIVE_CONTENT_SELECTOR='a[href], area[href], button, input, select, textarea, summary, [contenteditable]:not([contenteditable="false"]), [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])';function isElementTarget(value){const candidate=value;return candidate.nodeType===1&&typeof candidate.matches=="function"}function isFileValue(value){if(value===null||typeof value!="object")return!1;try{const candidate=value;return Object.prototype.toString.call(value)==="[object File]"&&typeof candidate.name=="string"&&typeof candidate.lastModified=="number"&&typeof candidate.size=="number"&&typeof candidate.type=="string"&&typeof candidate.slice=="function"}catch{return!1}}class LyraFileInput extends LyraElement{static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,dropzoneRejectedType:LYRA_DEFAULT_dropzoneRejectedType,dropzoneReleaseToAdd:LYRA_DEFAULT_dropzoneReleaseToAdd,fieldRequired:LYRA_DEFAULT_fieldRequired,fileInputAcceptedMany:LYRA_DEFAULT_fileInputAcceptedMany,fileInputAcceptedOne:LYRA_DEFAULT_fileInputAcceptedOne,fileInputDefaultLabel:LYRA_DEFAULT_fileInputDefaultLabel,fileInputFolderRejected:LYRA_DEFAULT_fileInputFolderRejected,fileInputRejectedCount:LYRA_DEFAULT_fileInputRejectedCount,fileInputRejectedLimit:LYRA_DEFAULT_fileInputRejectedLimit,fileInputRejectedMany:LYRA_DEFAULT_fileInputRejectedMany,fileInputRejectedMaxFiles:LYRA_DEFAULT_fileInputRejectedMaxFiles,fileInputRejectedMaxTotalSize:LYRA_DEFAULT_fileInputRejectedMaxTotalSize,fileInputRejectedOne:LYRA_DEFAULT_fileInputRejectedOne,fileInputRejectedRead:LYRA_DEFAULT_fileInputRejectedRead,fileInputRejectedSize:LYRA_DEFAULT_fileInputRejectedSize,fileInputRejectedType:LYRA_DEFAULT_fileInputRejectedType,fileSizeUnitB:LYRA_DEFAULT_fileSizeUnitB,fileSizeUnitGb:LYRA_DEFAULT_fileSizeUnitGb,fileSizeUnitKb:LYRA_DEFAULT_fileSizeUnitKb,fileSizeUnitMb:LYRA_DEFAULT_fileSizeUnitMb,fileSizeUnitTb:LYRA_DEFAULT_fileSizeUnitTb,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,removeWithContext:LYRA_DEFAULT_removeWithContext,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.immutableEventDetails=Object.freeze(["lr-files"])}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},files:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0}}}get allowedMimeTypes(){return this._allowedMimeTypes}set allowedMimeTypes(next){const old=this._allowedMimeTypes;this._allowedMimeTypes=snapshotMimeTypes(next),this.requestUpdate("allowedMimeTypes",old)}get forbiddenMimeTypes(){return this._forbiddenMimeTypes}set forbiddenMimeTypes(next){const old=this._forbiddenMimeTypes;this._forbiddenMimeTypes=snapshotMimeTypes(next),this.requestUpdate("forbiddenMimeTypes",old)}constructor(){super(),this.multiple=!1,this.compact=!1,this.accept="",this.capture="",this._allowedMimeTypes=EMPTY_MIME_TYPES,this._forbiddenMimeTypes=EMPTY_MIME_TYPES,this.maxFileSize=0,this.maxFiles=0,this.maxTotalSize=0,this.nonRetaining=!1,this.valuePresent=!1,this.directory=!1,this.paste=!0,this.label="",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this.withError=!1,this.size="m",this.validators=[],this.accessibleLabel="",this.dragState="default",this.resultStatus="",this.rejectedFiles=Object.freeze([]),this.touched=!1,this.validityRevision=0,this.slotPresence=new SlotPresenceController(this),this.hasSyncedDescribedByElements=!1,this.announcementsArmed=!1,this._name=null,this._files=[],this._fileCount=0,this._disabled=!1,this._required=!1,this._fieldsetDisabled=!1,this.thumbnailUrls=new Map,this.onDragEnter=e=>this.dropSession.onDragEnter(e),this.onDragOver=e=>this.dropSession.onDragOver(e),this.onDragLeave=e=>this.dropSession.onDragLeave(e),this.onDrop=e=>{const drop=this.dropSession.beginDrop(e);if(!drop)return;const{token,files,folders,overLimit}=drop;if(overLimit&&this.effectiveMultiple){this.emitFiles([],[this.folderFailure(folders[0]?.name??"","limit")]);return}if(folders.length&&this.effectiveMultiple){this.dropSession.readFolders(folders,token).then(result=>{if(!this.dropSession.isCurrent(token)||result.status==="cancelled")return;if(result.status==="error"||result.status==="limit"){this.emitFiles([],[this.folderFailure(result.name,result.status==="limit"?"limit":"read")]);return}const allFiles=[...files,...result.files];allFiles.length&&this.emitFiles(allFiles)});return}const rejectedFolders=folders.map(folder=>this.folderFailure(folder.name,"directory"));(files.length||rejectedFolders.length)&&this.emitFiles(files,rejectedFolders)},this.onPaste=e=>{if(!this.paste||this.liveDisabled)return;const files=[...e.clipboardData?.files??[]];files.length&&(e.preventDefault(),this.emitFiles(files))},this.onInputChange=e=>{e.stopPropagation();const input=e.target,files=[...input.files??[]];input.value="",!this.liveDisabled&&files.length&&this.emitFiles(files)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),this.publishCustomStates(),relayNativeEvent(this,event)},this.onKeyDown=e=>{this.liveDisabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())},this.onDropzoneClick=event=>{const path=event.composedPath();path.includes(this.baseEl)||path.some(node=>isElementTarget(node)&&node.matches(INTERACTIVE_CONTENT_SELECTOR))||this.openPicker()},this.onVisibleLabelClick=event=>{const label=event.currentTarget,path=event.composedPath(),labelIndex=path.indexOf(label);(labelIndex<0?path:path.slice(0,labelIndex)).some(node=>isElementTarget(node)&&node.matches(INTERACTIVE_CONTENT_SELECTOR))||this.openPicker()},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),this.internals.setFormValue(null),this.dropSession=new DropSessionController(this,{isDisabled:()=>this.liveDisabled,previewRejects:items=>this.classify(items,!0).rejected.length>0,onStateChange:()=>{this.dragState=this.dropSession.state,this.publishCustomStates()}})}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}get name(){return this._name}set name(next){const old=this._name;this._name=next==null||next===""?null:String(next),this._name==null?this.removeAttribute("name"):this.setAttribute("name",this._name),this.syncFormValue(),this.requestUpdate("name",old)}get files(){return[...this._files]}set files(next){const old=this._files,valid=Array.isArray(next)?next.filter(isFileValue):[];this._files=[...valid];const oldCount=this._fileCount;this._fileCount=this._files.length,this.syncThumbnailUrls(),this.syncFormValue(),this.updateValidity(),this.requestUpdate("files",old),oldCount!==this._fileCount&&this.requestUpdate("fileCount",oldCount)}get fileCount(){return this._fileCount}get dragging(){return this.dragState!=="default"}get effectiveMultiple(){return this.multiple||this.directory}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.dropSession.reset(),this.updateValidity(),this.requestUpdate("disabled",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 effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get validationTarget(){return this.validationTargetOverride??this.baseEl}set validationTarget(next){this.validationTargetOverride=next??void 0,this.validityController.refreshAnchor()}[VALIDITY_ANCHOR](){return this.validationTarget??null}willUpdate(changed){super.willUpdate(changed),(changed.has("multiple")||changed.has("directory")||changed.has("files"))&&(!this.effectiveMultiple&&this._files.length>1?this.files=this._files.slice(0,1):this.syncFormValue())}connectedCallback(){super.connectedCallback(),this.syncThumbnailUrls(),this.updateValidity(),this.hasUpdated&&this.syncValidatorAttributeObserver(),this.politeSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.assertiveSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.disconnectValidatorAttributeObserver(),this.dropSession.reset();for(const thumbnail of this.thumbnailUrls.values())thumbnail.revoke();this.thumbnailUrls.clear(),this.politeSink?.release(),this.politeSink=void 0,this.assertiveSink?.release(),this.assertiveSink=void 0,this.announcementsArmed=!1,super.disconnectedCallback()}updated(changed){super.updated(changed),changed.has("validators")&&(this.updateValidity(),this.syncValidatorAttributeObserver()),(changed.has("valuePresent")||changed.has("nonRetaining"))&&this.updateValidity();const hostDescribedBy=this.getAttribute("aria-describedby");(hostDescribedBy||this.hasSyncedDescribedByElements)&&(this.hasSyncedDescribedByElements=syncAriaDescribedByElements(this,this.baseEl,hostDescribedBy)),this.announcementsArmed&&(changed.has("dragState")&&this.dragState!=="default"&&this.politeSink?.announce(this.dragStatusText()),changed.has("resultStatus")&&this.resultStatus&&this.politeSink?.announce(this.resultStatus),changed.has("rejectedFiles")&&this.rejectedFiles.length>0&&this.assertiveSink?.announce(this.rejectedFiles.map(rejected=>this.rejectionMessage(rejected)).join(" "))),this.announcementsArmed=!0}syncFormValue(){if(!this.name||this._files.length===0){const state2=this.effectiveMultiple?this.createRestorationFormData():this._files[0]??null;this.internals.setFormValue(null,state2);return}if(this.effectiveMultiple){const submitted=this.createFormData(),state2=this.createRestorationFormData();if(!submitted||!state2){this.internals.setFormValue(null);return}for(const file2 of this._files)submitted.append(this.name,file2);this.internals.setFormValue(submitted,state2);return}const file=this._files[0]??null;this.internals.setFormValue(file,file)}createFormData(){const FormDataCtor=this.ownerDocument?.defaultView?.FormData;return FormDataCtor?new FormDataCtor:null}createRestorationFormData(){const state2=this.createFormData();if(!state2)return null;for(const file of this._files)state2.append("file",file);return state2}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}validatorResult(){let validators;try{validators=Array.isArray(this.validators)?Array.from(this.validators):[]}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}for(const validator of validators){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("valueInvalid")}}if(result=typeof validator=="function"?validator(this.files,this):validator?.validate(this.files,this),result===void 0||result===!0)continue;if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("valueInvalid")};if(result&&typeof result=="object"){const flags={};for(const key of VALIDITY_FLAG_KEYS)Object.prototype.hasOwnProperty.call(result,key)&&result[key]&&(flags[key]=!0);if(Object.values(flags).some(Boolean))return{flags,message:this.localize("valueInvalid")}}}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}}return{}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;let validators;try{validators=Array.isArray(this.validators)?Array.from(this.validators):[]}catch{return}for(const validator of validators)try{if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;const observed=validator.observedAttributes;if(!Array.isArray(observed))continue;for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}catch{continue}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}updateValidity(){if(this.barredFromValidation){this.validityController.setValidity({}),this.publishCustomStates();return}const flags={};let message="";this.required&&!this.hasEffectiveValue&&(flags.valueMissing=!0,message=this.localize("fieldRequired"));const configured=this.validatorResult();configured.flags&&Object.assign(flags,configured.flags),configured.message&&(message=configured.message),this.validityController.setValidity(flags,message),this.publishCustomStates()}get hasEffectiveValue(){return this._files.length>0||this.nonRetaining&&this.valuePresent}publishCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",!this.hasEffectiveValue),setCustomState(this.internals,"dragging",this.dragging),this.toggleAttribute("dragging",this.dragging)}checkValidity(){return this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.touched=!0,this.updateValidity(),this.publishCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.publishCustomStates(),this.requestUpdate()}resetValidity(){this.validityController.setCustomValidity(""),this.updateValidity(),this.requestUpdate()}formResetCallback(){this.touched=!1,this.files=[],this.rejectedFiles=[],this.resultStatus=""}formStateRestoreCallback(state2,reason){if(isFileValue(state2)){this.files=[state2];return}const restored=this.readFormDataFiles(state2);if(restored){this.files=restored;return}this.files=[]}readFormDataFiles(value){if(value===null||typeof value!="object")return;const FormDataCtor=this.ownerDocument.defaultView?.FormData??globalThis.FormData;try{FormDataCtor.prototype.has.call(value,"__lyra_form_state_brand_probe__");const iterator=value.values.call(value),files=[];let entries=0;for(;entries<=MAX_DROPPED_FOLDER_ENTRIES;){const next=iterator.next();if(next.done)return files;if(entries===MAX_DROPPED_FOLDER_ENTRIES)return;entries+=1,isFileValue(next.value)&&files.push(next.value)}return}catch{return}}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.dropSession.reset(),this.updateValidity(),this.requestUpdate()}syncThumbnailUrls(){const urlApi=this.ownerDocument.defaultView?.URL??globalThis.URL,canCreate=typeof urlApi.createObjectURL=="function",canRevoke=typeof urlApi.revokeObjectURL=="function";let changed=!1;for(const[file,thumbnail]of this.thumbnailUrls)(!this._files.includes(file)||thumbnail.owner!==urlApi)&&(thumbnail.revoke(),this.thumbnailUrls.delete(file),changed=!0);if(!this.isConnected){changed&&this.requestUpdate();return}if(canCreate)for(const file of this._files){if(!file.type.startsWith("image/")||this.thumbnailUrls.has(file))continue;const url=urlApi.createObjectURL(file);this.thumbnailUrls.set(file,{url,owner:urlApi,revoke:canRevoke?()=>urlApi.revokeObjectURL(url):()=>{}}),changed=!0}changed&&this.requestUpdate()}get effectiveMaxFileSize(){const maxFileSize=this.maxFileSize;return maxFileSize===0||maxFileSize===1/0?null:finiteRange(maxFileSize>0?maxFileSize:NaN,DEFAULT_MAX_FILE_SIZE_BYTES,1)}get effectiveMaxFiles(){const maxFiles=this.maxFiles;return maxFiles===0||maxFiles===1/0?null:finiteRange(maxFiles>0?maxFiles:NaN,DEFAULT_MAX_FILES,1)}get effectiveMaxTotalSize(){const maxTotalSize=this.maxTotalSize;return maxTotalSize===0||maxTotalSize===1/0?null:finiteRange(maxTotalSize>0?maxTotalSize:NaN,DEFAULT_MAX_TOTAL_SIZE_BYTES,1)}isAllowed(file,isPreview=!1){if(this.forbiddenMimeTypes.includes(file.type)||this.allowedMimeTypes.length>0&&!this.allowedMimeTypes.includes(file.type)||this.accept&&!matchesAccept(file,this.accept,isPreview))return"type";const maxFileSize=this.effectiveMaxFileSize;return maxFileSize!==null&&file.size>maxFileSize?"size":"ok"}totalFileSize(files){let total=0;for(const file of files){const size=file.size;Number.isFinite(size)&&(total+=size)}return total}classify(fileList,isPreview=!1){if(!this.effectiveMultiple&&fileList.length>1)return{files:[],rejected:fileList.map(file=>({file,reason:"count"}))};const files=[],rejected=[],maxFiles=this.effectiveMaxFiles,maxTotalSize=this.effectiveMaxTotalSize;let runningCount=this.nonRetaining?0:this._files.length,runningSize=this.nonRetaining?0:this.totalFileSize(this._files);for(const f of fileList){const reason=this.isAllowed(f,isPreview);if(reason!=="ok"){rejected.push({file:f,reason});continue}if(maxFiles!==null&&runningCount+1>maxFiles){rejected.push({file:f,reason:"maxFiles"});continue}if(maxTotalSize!==null&&runningSize+f.size>maxTotalSize){rejected.push({file:f,reason:"maxTotalSize"});continue}files.push(f),runningCount+=1,runningSize+=Number.isFinite(f.size)?f.size:0}return{files,rejected}}rejectionMessage(rejected){const filename=rejected.file.name;switch(rejected.reason){case"type":return this.localize("fileInputRejectedType",void 0,{filename});case"size":return this.localize("fileInputRejectedSize",void 0,{filename});case"count":return this.localize("fileInputRejectedCount",void 0,{filename});case"directory":return this.localize("fileInputFolderRejected",void 0,{filename});case"read":return this.localize("fileInputRejectedRead",void 0,{filename});case"limit":return this.localize("fileInputRejectedLimit",void 0,{filename});case"maxFiles":return this.localize("fileInputRejectedMaxFiles",void 0,{filename});case"maxTotalSize":return this.localize("fileInputRejectedMaxTotalSize",void 0,{filename})}}outcomeMessage(key,override,count){return override==null?this.localize(key,void 0,{count}):override.replace(/\{count\}/g,count)}emitFiles(fileList,additionalRejected=[]){const{files,rejected}=this.classify(fileList);rejected.push(...additionalRejected);const rejectedSnapshot=Object.freeze(rejected.map(item=>Object.freeze({...item}))),filesSnapshot=Object.freeze([...files]);this.rejectedFiles=rejectedSnapshot;const messages=[],numberFormat=getNumberFormat(this.effectiveLocale);files.length&&messages.push(this.outcomeMessage(files.length===1?"fileInputAcceptedOne":"fileInputAcceptedMany",this.acceptedMessage,numberFormat.format(files.length))),rejected.length&&messages.push(this.outcomeMessage(rejected.length===1?"fileInputRejectedOne":"fileInputRejectedMany",this.rejectedMessage,numberFormat.format(rejected.length))),this.resultStatus=messages.filter(message=>message.length>0).join(" "),(files.length||rejected.length)&&(this.touched=!0,this.updateValidity()),files.length&&(this.nonRetaining||(this.files=this.effectiveMultiple?[...this._files,...files]:files),dispatchNativeEvent(this,"input"),dispatchNativeEvent(this,"change")),this.emit("lr-files",Object.freeze({files:filesSnapshot,rejected:rejectedSnapshot}))}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}openPicker(){this.liveDisabled||this.inputEl?.click()}focus(options){this.liveDisabled||this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.openPicker()}folderFailure(name,reason){const FileCtor=this.ownerDocument.defaultView?.File??globalThis.File;return Object.freeze({file:new FileCtor([],name),reason})}statusText(){return this.dragState==="default"?this.resultStatus:this.dragStatusText()}dragStatusText(){return this.dragState==="accept"?this.localize("dropzoneReleaseToAdd"):this.dragState==="reject"?this.localize("dropzoneRejectedType"):""}get effectiveLabel(){return this.label||this.localize("fileInputDefaultLabel")}removeFile(index){this.liveDisabled||index<0||index>=this._files.length||(this.touched=!0,this.files=this._files.filter((_,candidate)=>candidate!==index),dispatchNativeEvent(this,"input"),dispatchNativeEvent(this,"change"))}fileSize(file){return formatFileSize(file.size,unit=>this.localize(FILE_SIZE_UNIT_KEYS[unit]),(value,fractionDigits)=>getNumberFormat(this.effectiveLocale,{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits}).format(value))}renderFile(file,index){const thumbnail=this.thumbnailUrls.get(file)?.url;return html`<div part="file">
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{getNumberFormat}from"../../../internal/intl-cache.js";import{LyraElement}from"../../../internal/lyra-element.js";import{installFormControlLabelSupport}from"../../../internal/form-control-labels.js";installFormControlLabelSupport();import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{AggregateFileLimitTracker}from"../../../internal/aggregate-file-limits.js";import{AnchoredValidityController,VALIDITY_ANCHOR}from"../../../internal/anchored-validity.js";import{setCustomState,syncValidityStates}from"../../../internal/custom-states.js";import{syncAriaDescribedByElements}from"../../../internal/aria-controls.js";import{attachInternalsSafely,getFormOwner,installCustomErrorProperty,isBarredFromValidation,setFormOwner}from"../../../internal/form-associated.js";import{installInteractionOnInvalid,installInvalidEventAlias,withStaticValidityCheck}from"../../../internal/invalid-event-alias.js";import{dispatchNativeEvent,relayNativeEvent}from"../../../internal/native-event-relay.js";import{DropSessionController}from"../../../internal/drop-session-controller.js";import{sizes}from"../../../internal/sizes.styles.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{closeIcon,fileIcon}from"../../../internal/icons.js";import{styles}from"./file-input.styles.js";import{matchesAccept}from"./accept.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{FILE_SIZE_UNIT_KEYS,formatFileSize}from"../attachment-chip/file-size.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_dropzoneRejectedType,LYRA_DEFAULT_dropzoneReleaseToAdd,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileInputAcceptedMany,LYRA_DEFAULT_fileInputAcceptedOne,LYRA_DEFAULT_fileInputDefaultLabel,LYRA_DEFAULT_fileInputFolderRejected,LYRA_DEFAULT_fileInputRejectedCount,LYRA_DEFAULT_fileInputRejectedLimit,LYRA_DEFAULT_fileInputRejectedMany,LYRA_DEFAULT_fileInputRejectedMaxFiles,LYRA_DEFAULT_fileInputRejectedMaxTotalSize,LYRA_DEFAULT_fileInputRejectedOne,LYRA_DEFAULT_fileInputRejectedRead,LYRA_DEFAULT_fileInputRejectedSize,LYRA_DEFAULT_fileInputRejectedType,LYRA_DEFAULT_fileSizeUnitB,LYRA_DEFAULT_fileSizeUnitGb,LYRA_DEFAULT_fileSizeUnitKb,LYRA_DEFAULT_fileSizeUnitMb,LYRA_DEFAULT_fileSizeUnitTb,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings.generated.js";const VALIDITY_FLAG_KEYS=new Set(["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"]);function isValidityFlagKey(value){return typeof value=="string"&&VALIDITY_FLAG_KEYS.has(value)}const DEFAULT_MAX_FILE_SIZE_BYTES=25*1024*1024,DEFAULT_MAX_FILES=100,DEFAULT_MAX_TOTAL_SIZE_BYTES=250*1024*1024,MAX_DROPPED_FOLDER_ENTRIES=1e4,MAX_MIME_TYPES=1e4,EMPTY_MIME_TYPES=Object.freeze([]);function snapshotMimeTypes(value){try{if(!Array.isArray(value))return EMPTY_MIME_TYPES;const count=Math.min(value.length,MAX_MIME_TYPES),values=[];for(let index=0;index<count;index++)try{const candidate=value[index];typeof candidate=="string"&&values.push(candidate)}catch{}return values.length?Object.freeze(values):EMPTY_MIME_TYPES}catch{return EMPTY_MIME_TYPES}}const INTERACTIVE_CONTENT_SELECTOR='a[href], area[href], button, input, select, textarea, summary, [contenteditable]:not([contenteditable="false"]), [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])';function isElementTarget(value){const candidate=value;return candidate.nodeType===1&&typeof candidate.matches=="function"}function isFileValue(value){if(value===null||typeof value!="object")return!1;try{const candidate=value;return Object.prototype.toString.call(value)==="[object File]"&&typeof candidate.name=="string"&&typeof candidate.lastModified=="number"&&typeof candidate.size=="number"&&typeof candidate.type=="string"&&typeof candidate.slice=="function"}catch{return!1}}class LyraFileInput extends LyraElement{static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,dropzoneRejectedType:LYRA_DEFAULT_dropzoneRejectedType,dropzoneReleaseToAdd:LYRA_DEFAULT_dropzoneReleaseToAdd,fieldRequired:LYRA_DEFAULT_fieldRequired,fileInputAcceptedMany:LYRA_DEFAULT_fileInputAcceptedMany,fileInputAcceptedOne:LYRA_DEFAULT_fileInputAcceptedOne,fileInputDefaultLabel:LYRA_DEFAULT_fileInputDefaultLabel,fileInputFolderRejected:LYRA_DEFAULT_fileInputFolderRejected,fileInputRejectedCount:LYRA_DEFAULT_fileInputRejectedCount,fileInputRejectedLimit:LYRA_DEFAULT_fileInputRejectedLimit,fileInputRejectedMany:LYRA_DEFAULT_fileInputRejectedMany,fileInputRejectedMaxFiles:LYRA_DEFAULT_fileInputRejectedMaxFiles,fileInputRejectedMaxTotalSize:LYRA_DEFAULT_fileInputRejectedMaxTotalSize,fileInputRejectedOne:LYRA_DEFAULT_fileInputRejectedOne,fileInputRejectedRead:LYRA_DEFAULT_fileInputRejectedRead,fileInputRejectedSize:LYRA_DEFAULT_fileInputRejectedSize,fileInputRejectedType:LYRA_DEFAULT_fileInputRejectedType,fileSizeUnitB:LYRA_DEFAULT_fileSizeUnitB,fileSizeUnitGb:LYRA_DEFAULT_fileSizeUnitGb,fileSizeUnitKb:LYRA_DEFAULT_fileSizeUnitKb,fileSizeUnitMb:LYRA_DEFAULT_fileSizeUnitMb,fileSizeUnitTb:LYRA_DEFAULT_fileSizeUnitTb,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,removeWithContext:LYRA_DEFAULT_removeWithContext,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,valueInvalid:LYRA_DEFAULT_valueInvalid}}static{this.immutableEventDetails=Object.freeze(["lr-files"])}static{this.formAssociated=!0}static{this.styles=[LyraElement.styles,sizes,styles,srOnly]}static{this.properties={customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},name:{reflect:!0,noAccessor:!0},files:{attribute:!1,noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0}}}get allowedMimeTypes(){return this._allowedMimeTypes}set allowedMimeTypes(next){const old=this._allowedMimeTypes;this._allowedMimeTypes=snapshotMimeTypes(next),this.requestUpdate("allowedMimeTypes",old)}get forbiddenMimeTypes(){return this._forbiddenMimeTypes}set forbiddenMimeTypes(next){const old=this._forbiddenMimeTypes;this._forbiddenMimeTypes=snapshotMimeTypes(next),this.requestUpdate("forbiddenMimeTypes",old)}constructor(){super(),this.multiple=!1,this.compact=!1,this.accept="",this.capture="",this._allowedMimeTypes=EMPTY_MIME_TYPES,this._forbiddenMimeTypes=EMPTY_MIME_TYPES,this.maxFileSize=0,this.maxFiles=0,this.maxTotalSize=0,this.heldFileCount=0,this.heldTotalSize=0,this.nonRetaining=!1,this.valuePresent=!1,this.directory=!1,this.paste=!0,this.label="",this.hint="",this.errorText="",this.withLabel=!1,this.withHint=!1,this.withError=!1,this.size="m",this.validators=[],this.accessibleLabel="",this.dragState="default",this.resultStatus="",this.rejectedFiles=Object.freeze([]),this.touched=!1,this.validityRevision=0,this.slotPresence=new SlotPresenceController(this),this.hasSyncedDescribedByElements=!1,this.announcementsArmed=!1,this._name=null,this._files=[],this._fileCount=0,this._disabled=!1,this._required=!1,this._fieldsetDisabled=!1,this.thumbnailUrls=new Map,this.markInteracted=()=>{this.touched||(this.touched=!0,this.updateValidity(),this.publishCustomStates())},this.onDragEnter=e=>this.dropSession.onDragEnter(e),this.onDragOver=e=>this.dropSession.onDragOver(e),this.onDragLeave=e=>this.dropSession.onDragLeave(e),this.onDrop=e=>{const drop=this.dropSession.beginDrop(e);if(!drop)return;const{token,files,folders,overLimit}=drop;if(overLimit&&this.effectiveMultiple){this.emitFiles([],[this.folderFailure(folders[0]?.name??"","limit")]);return}if(folders.length&&this.effectiveMultiple){this.dropSession.readFolders(folders,token).then(result=>{if(!this.dropSession.isCurrent(token)||result.status==="cancelled")return;if(result.status==="error"||result.status==="limit"){this.emitFiles([],[this.folderFailure(result.name,result.status==="limit"?"limit":"read")]);return}const allFiles=[...files,...result.files];allFiles.length&&this.emitFiles(allFiles)});return}const rejectedFolders=folders.map(folder=>this.folderFailure(folder.name,"directory"));(files.length||rejectedFolders.length)&&this.emitFiles(files,rejectedFolders)},this.onPaste=e=>{if(!this.paste||this.liveDisabled)return;const files=[...e.clipboardData?.files??[]];files.length&&(e.preventDefault(),this.emitFiles(files))},this.onInputChange=e=>{e.stopPropagation();const input=e.target,files=[...input.files??[]];input.value="",!this.liveDisabled&&files.length&&this.emitFiles(files)},this.onFocus=event=>{if(this.liveDisabled){event.stopPropagation();return}relayNativeEvent(this,event)},this.onBlur=event=>{this.liveDisabled||(this.touched=!0),this.publishCustomStates(),relayNativeEvent(this,event)},this.onKeyDown=e=>{this.liveDisabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())},this.onDropzoneClick=event=>{const path=event.composedPath();path.includes(this.baseEl)||path.some(node=>isElementTarget(node)&&node.matches(INTERACTIVE_CONTENT_SELECTOR))||this.openPicker()},this.onVisibleLabelClick=event=>{const label=event.currentTarget,path=event.composedPath(),labelIndex=path.indexOf(label);(labelIndex<0?path:path.slice(0,labelIndex)).some(node=>isElementTarget(node)&&node.matches(INTERACTIVE_CONTENT_SELECTOR))||this.openPicker()},this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),installCustomErrorProperty(this,()=>this.validityController.customValidityMessage),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init)),installInteractionOnInvalid(this,this.markInteracted),this.internals.setFormValue(null),this.dropSession=new DropSessionController(this,{isDisabled:()=>this.liveDisabled,previewRejects:items=>this.classify(items,!0).rejected.length>0,onStateChange:()=>{this.dragState=this.dropSession.state,this.publishCustomStates()}})}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}get name(){return this._name}set name(next){const old=this._name;this._name=next==null||next===""?null:String(next),this._name==null?this.removeAttribute("name"):this.setAttribute("name",this._name),this.syncFormValue(),this.requestUpdate("name",old)}get files(){return[...this._files]}set files(next){const old=this._files,valid=Array.isArray(next)?next.filter(isFileValue):[];this._files=[...valid];const oldCount=this._fileCount;this._fileCount=this._files.length,this.syncThumbnailUrls(),this.syncFormValue(),this.updateValidity(),this.requestUpdate("files",old),oldCount!==this._fileCount&&this.requestUpdate("fileCount",oldCount)}get fileCount(){return this._fileCount}get dragging(){return this.dragState!=="default"}get effectiveMultiple(){return this.multiple||this.directory}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this._disabled&&this.dropSession.reset(),this.updateValidity(),this.requestUpdate("disabled",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 effectiveDisabled(){return this.disabled||this._fieldsetDisabled}get validationTarget(){return this.validationTargetOverride??this.baseEl}set validationTarget(next){this.validationTargetOverride=next??void 0,this.validityController.refreshAnchor()}[VALIDITY_ANCHOR](){return this.validationTarget??null}willUpdate(changed){super.willUpdate(changed),(changed.has("multiple")||changed.has("directory")||changed.has("files"))&&(!this.effectiveMultiple&&this._files.length>1?this.files=this._files.slice(0,1):this.syncFormValue())}connectedCallback(){super.connectedCallback(),this.syncThumbnailUrls(),this.updateValidity(),this.hasUpdated&&this.syncValidatorAttributeObserver(),this.politeSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}),this.assertiveSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.disconnectValidatorAttributeObserver(),this.dropSession.reset();for(const thumbnail of this.thumbnailUrls.values())thumbnail.revoke();this.thumbnailUrls.clear(),this.politeSink?.release(),this.politeSink=void 0,this.assertiveSink?.release(),this.assertiveSink=void 0,this.announcementsArmed=!1,super.disconnectedCallback()}updated(changed){super.updated(changed),changed.has("validators")&&(this.updateValidity(),this.syncValidatorAttributeObserver()),(changed.has("valuePresent")||changed.has("nonRetaining"))&&this.updateValidity();const hostDescribedBy=this.getAttribute("aria-describedby");(hostDescribedBy||this.hasSyncedDescribedByElements)&&(this.hasSyncedDescribedByElements=syncAriaDescribedByElements(this,this.baseEl,hostDescribedBy)),this.announcementsArmed&&(changed.has("dragState")&&this.dragState!=="default"&&this.politeSink?.announce(this.dragStatusText()),changed.has("resultStatus")&&this.resultStatus&&this.politeSink?.announce(this.resultStatus),changed.has("rejectedFiles")&&this.rejectedFiles.length>0&&this.assertiveSink?.announce(this.rejectedFiles.map(rejected=>this.rejectionMessage(rejected)).join(" "))),this.announcementsArmed=!0}syncFormValue(){if(!this.name||this._files.length===0){const state2=this.effectiveMultiple?this.createRestorationFormData():this._files[0]??null;this.internals.setFormValue(null,state2);return}if(this.effectiveMultiple){const submitted=this.createFormData(),state2=this.createRestorationFormData();if(!submitted||!state2){this.internals.setFormValue(null);return}for(const file2 of this._files)submitted.append(this.name,file2);this.internals.setFormValue(submitted,state2);return}const file=this._files[0]??null;this.internals.setFormValue(file,file)}createFormData(){const FormDataCtor=this.ownerDocument?.defaultView?.FormData;return FormDataCtor?new FormDataCtor:null}createRestorationFormData(){const state2=this.createFormData();if(!state2)return null;for(const file of this._files)state2.append("file",file);return state2}get barredFromValidation(){return isBarredFromValidation(this,this.internals)}validatorResult(){let validators;try{validators=Array.isArray(this.validators)?Array.from(this.validators):[]}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}for(const validator of validators){let result;try{if(typeof validator=="object"&&validator!==null&&"checkValidity"in validator){const checked=validator.checkValidity(this);if(checked?.isValid===!0)continue;const flags={};for(const key of Array.isArray(checked?.invalidKeys)?checked.invalidKeys:[])isValidityFlagKey(key)&&(flags[key]=!0);Object.values(flags).some(Boolean)||(flags.customError=!0);let message=typeof checked?.message=="string"?checked.message:"";return!message&&typeof validator.message=="string"&&(message=validator.message),!message&&typeof validator.message=="function"&&(message=validator.message(this)),{flags,message:message||this.localize("valueInvalid")}}if(result=typeof validator=="function"?validator(this.files,this):validator?.validate(this.files,this),result===void 0||result===!0)continue;if(typeof result=="string")return{flags:{customError:!0},message:result};if(result===!1)return{flags:{customError:!0},message:this.localize("valueInvalid")};if(result&&typeof result=="object"){const flags={};for(const key of VALIDITY_FLAG_KEYS)Object.prototype.hasOwnProperty.call(result,key)&&result[key]&&(flags[key]=!0);if(Object.values(flags).some(Boolean))return{flags,message:this.localize("valueInvalid")}}}catch{return{flags:{customError:!0},message:this.localize("valueInvalid")}}}return{}}syncValidatorAttributeObserver(){this.disconnectValidatorAttributeObserver();const owner=this.ownerDocument.defaultView,MutationObserverCtor=owner?.MutationObserver;if(!this.isConnected||!owner||typeof MutationObserverCtor!="function")return;const attributes=new Set;let validators;try{validators=Array.isArray(this.validators)?Array.from(this.validators):[]}catch{return}for(const validator of validators)try{if(typeof validator!="object"||validator===null||!("checkValidity"in validator))continue;const observed=validator.observedAttributes;if(!Array.isArray(observed))continue;for(const name of observed)typeof name=="string"&&name.length>0&&attributes.add(name)}catch{continue}if(attributes.size===0)return;const binding={},observer=new MutationObserverCtor(()=>{this.validatorAttributeObserver!==binding||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.updateValidity(),this.validityRevision++)});binding.observer=observer,binding.owner=owner;try{observer.observe(this,{attributes:!0,attributeFilter:[...attributes]}),this.validatorAttributeObserver=binding}catch{observer.disconnect()}}disconnectValidatorAttributeObserver(){const binding=this.validatorAttributeObserver;this.validatorAttributeObserver=void 0,binding?.observer.disconnect()}updateValidity(){if(this.barredFromValidation){this.validityController.setValidity({}),this.publishCustomStates();return}const flags={};let message="";this.required&&!this.hasEffectiveValue&&(flags.valueMissing=!0,message=this.localize("fieldRequired"));const configured=this.validatorResult();configured.flags&&Object.assign(flags,configured.flags),configured.message&&(message=configured.message),this.validityController.setValidity(flags,message),this.publishCustomStates()}get hasEffectiveValue(){return this._files.length>0||this.nonRetaining&&this.valuePresent}publishCustomStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this.touched,barred:this.barredFromValidation}),setCustomState(this.internals,"blank",!this.hasEffectiveValue),setCustomState(this.internals,"dragging",this.dragging),this.toggleAttribute("dragging",this.dragging)}checkValidity(){return this.updateValidity(),withStaticValidityCheck(this,()=>this.internals.checkValidity())}reportValidity(){return this.touched=!0,this.updateValidity(),this.publishCustomStates(),this.internals.reportValidity()}setCustomValidity(message){this.validityController.setCustomValidity(message??""),this.publishCustomStates(),this.requestUpdate()}resetValidity(){this.validityController.setCustomValidity(""),this.updateValidity(),this.requestUpdate()}formResetCallback(){this.touched=!1,this.files=[],this.rejectedFiles=[],this.resultStatus=""}formStateRestoreCallback(state2,reason){if(isFileValue(state2)){this.files=[state2];return}const restored=this.readFormDataFiles(state2);if(restored){this.files=restored;return}this.files=[]}readFormDataFiles(value){if(value===null||typeof value!="object")return;const FormDataCtor=this.ownerDocument.defaultView?.FormData??globalThis.FormData;try{FormDataCtor.prototype.has.call(value,"__lyra_form_state_brand_probe__");const iterator=value.values.call(value),files=[];let entries=0;for(;entries<=MAX_DROPPED_FOLDER_ENTRIES;){const next=iterator.next();if(next.done)return files;if(entries===MAX_DROPPED_FOLDER_ENTRIES)return;entries+=1,isFileValue(next.value)&&files.push(next.value)}return}catch{return}}formDisabledCallback(disabled){this._fieldsetDisabled=disabled,disabled&&this.dropSession.reset(),this.updateValidity(),this.requestUpdate()}syncThumbnailUrls(){const urlApi=this.ownerDocument.defaultView?.URL??globalThis.URL,canCreate=typeof urlApi.createObjectURL=="function",canRevoke=typeof urlApi.revokeObjectURL=="function";let changed=!1;for(const[file,thumbnail]of this.thumbnailUrls)(!this._files.includes(file)||thumbnail.owner!==urlApi)&&(thumbnail.revoke(),this.thumbnailUrls.delete(file),changed=!0);if(!this.isConnected){changed&&this.requestUpdate();return}if(canCreate)for(const file of this._files){if(!file.type.startsWith("image/")||this.thumbnailUrls.has(file))continue;const url=urlApi.createObjectURL(file);this.thumbnailUrls.set(file,{url,owner:urlApi,revoke:canRevoke?()=>urlApi.revokeObjectURL(url):()=>{}}),changed=!0}changed&&this.requestUpdate()}get effectiveMaxFileSize(){const maxFileSize=this.maxFileSize;return maxFileSize===0||maxFileSize===1/0?null:finiteRange(maxFileSize>0?maxFileSize:NaN,DEFAULT_MAX_FILE_SIZE_BYTES,1)}get effectiveMaxFiles(){const maxFiles=this.maxFiles;return maxFiles===0||maxFiles===1/0?null:finiteRange(maxFiles>0?maxFiles:NaN,DEFAULT_MAX_FILES,1)}get effectiveMaxTotalSize(){const maxTotalSize=this.maxTotalSize;return maxTotalSize===0||maxTotalSize===1/0?null:finiteRange(maxTotalSize>0?maxTotalSize:NaN,DEFAULT_MAX_TOTAL_SIZE_BYTES,1)}isAllowed(file,isPreview=!1){if(this.forbiddenMimeTypes.includes(file.type)||this.allowedMimeTypes.length>0&&!this.allowedMimeTypes.includes(file.type)||this.accept&&!matchesAccept(file,this.accept,isPreview))return"type";const maxFileSize=this.effectiveMaxFileSize;return maxFileSize!==null&&file.size>maxFileSize?"size":"ok"}totalFileSize(files){let total=0;for(const file of files){const size=file.size;Number.isFinite(size)&&(total+=size)}return total}classify(fileList,isPreview=!1){const limits={maxFiles:this.effectiveMaxFiles,maxTotalSize:this.effectiveMaxTotalSize},tracker=new AggregateFileLimitTracker((this.nonRetaining?0:this._files.length)+finiteCount(this.heldFileCount,0),(this.nonRetaining?0:this.totalFileSize(this._files))+finiteCount(this.heldTotalSize,0));if(!this.effectiveMultiple&&fileList.length>1)return{files:[],rejected:fileList.map(file=>({file,reason:"count"})),...tracker.allowance(limits)};const files=[],rejected=[];for(const f of fileList){const reason=this.isAllowed(f,isPreview);if(reason!=="ok"){rejected.push({file:f,reason});continue}const limitReason=tracker.evaluate(f,limits);if(limitReason){rejected.push({file:f,reason:limitReason});continue}files.push(f)}return{files,rejected,...tracker.allowance(limits)}}rejectionMessage(rejected){const filename=rejected.file.name;switch(rejected.reason){case"type":return this.localize("fileInputRejectedType",void 0,{filename});case"size":return this.localize("fileInputRejectedSize",void 0,{filename});case"count":return this.localize("fileInputRejectedCount",void 0,{filename});case"directory":return this.localize("fileInputFolderRejected",void 0,{filename});case"read":return this.localize("fileInputRejectedRead",void 0,{filename});case"limit":return this.localize("fileInputRejectedLimit",void 0,{filename});case"maxFiles":return this.localize("fileInputRejectedMaxFiles",void 0,{filename});case"maxTotalSize":return this.localize("fileInputRejectedMaxTotalSize",void 0,{filename})}}outcomeMessage(key,override,count){return override==null?this.localize(key,void 0,{count}):override.replace(/\{count\}/g,count)}emitFiles(fileList,additionalRejected=[]){const{files,rejected,remainingFiles,remainingTotalSize}=this.classify(fileList);rejected.push(...additionalRejected);const rejectedSnapshot=Object.freeze(rejected.map(item=>Object.freeze({...item}))),filesSnapshot=Object.freeze([...files]);this.rejectedFiles=rejectedSnapshot;const messages=[],numberFormat=getNumberFormat(this.effectiveLocale);files.length&&messages.push(this.outcomeMessage(files.length===1?"fileInputAcceptedOne":"fileInputAcceptedMany",this.acceptedMessage,numberFormat.format(files.length))),rejected.length&&messages.push(this.outcomeMessage(rejected.length===1?"fileInputRejectedOne":"fileInputRejectedMany",this.rejectedMessage,numberFormat.format(rejected.length))),this.resultStatus=messages.filter(message=>message.length>0).join(" "),(files.length||rejected.length)&&(this.touched=!0,this.updateValidity()),files.length&&(this.nonRetaining||(this.files=this.effectiveMultiple?[...this._files,...files]:files),dispatchNativeEvent(this,"input"),dispatchNativeEvent(this,"change")),this.emit("lr-files",Object.freeze({files:filesSnapshot,rejected:rejectedSnapshot,remainingFiles,remainingTotalSize}))}get liveDisabled(){return this.effectiveDisabled||this.matches(":disabled")}openPicker(){this.liveDisabled||this.inputEl?.click()}focus(options){this.liveDisabled||this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.openPicker()}folderFailure(name,reason){const FileCtor=this.ownerDocument.defaultView?.File??globalThis.File;return Object.freeze({file:new FileCtor([],name),reason})}statusText(){return this.dragState==="default"?this.resultStatus:this.dragStatusText()}dragStatusText(){return this.dragState==="accept"?this.localize("dropzoneReleaseToAdd"):this.dragState==="reject"?this.localize("dropzoneRejectedType"):""}get effectiveLabel(){return this.label||this.localize("fileInputDefaultLabel")}removeFile(index){this.liveDisabled||index<0||index>=this._files.length||(this.touched=!0,this.files=this._files.filter((_,candidate)=>candidate!==index),dispatchNativeEvent(this,"input"),dispatchNativeEvent(this,"change"))}fileSize(file){return formatFileSize(file.size,unit=>this.localize(FILE_SIZE_UNIT_KEYS[unit]),(value,fractionDigits)=>getNumberFormat(this.effectiveLocale,{minimumFractionDigits:fractionDigits,maximumFractionDigits:fractionDigits}).format(value))}renderFile(file,index){const thumbnail=this.thumbnailUrls.get(file)?.url;return html`<div part="file">
2
2
  <span part="file-thumbnail" aria-hidden="true">
3
3
  ${thumbnail?html`<img part="file-image" src=${thumbnail} alt="" />`:html`<span part="file-icon">${fileIcon()}</span>`}
4
4
  </span>
@@ -87,4 +87,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
87
87
  ?disabled=${this.effectiveDisabled}
88
88
  @change=${this.onInputChange}
89
89
  />
90
- `}}__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"multiple",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"compact",void 0),__decorate([property()],LyraFileInput.prototype,"accept",void 0),__decorate([property()],LyraFileInput.prototype,"capture",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"allowedMimeTypes",null),__decorate([property({attribute:!1})],LyraFileInput.prototype,"forbiddenMimeTypes",null),__decorate([property({type:Number,attribute:"max-file-size"})],LyraFileInput.prototype,"maxFileSize",void 0),__decorate([property({type:Number,attribute:"max-files"})],LyraFileInput.prototype,"maxFiles",void 0),__decorate([property({type:Number,attribute:"max-total-size"})],LyraFileInput.prototype,"maxTotalSize",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"non-retaining"})],LyraFileInput.prototype,"nonRetaining",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"value-present"})],LyraFileInput.prototype,"valuePresent",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"directory",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraFileInput.prototype,"paste",void 0),__decorate([property()],LyraFileInput.prototype,"label",void 0),__decorate([property()],LyraFileInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraFileInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraFileInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraFileInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-error"})],LyraFileInput.prototype,"withError",void 0),__decorate([property({reflect:!0})],LyraFileInput.prototype,"size",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"validators",void 0),__decorate([property({attribute:"accessible-label"})],LyraFileInput.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"accepted-message"})],LyraFileInput.prototype,"acceptedMessage",void 0),__decorate([property({attribute:"rejected-message"})],LyraFileInput.prototype,"rejectedMessage",void 0),__decorate([state()],LyraFileInput.prototype,"dragState",void 0),__decorate([state()],LyraFileInput.prototype,"resultStatus",void 0),__decorate([state()],LyraFileInput.prototype,"rejectedFiles",void 0),__decorate([state()],LyraFileInput.prototype,"touched",void 0),__decorate([state()],LyraFileInput.prototype,"validityRevision",void 0),__decorate([query('[part~="base"]')],LyraFileInput.prototype,"baseEl",void 0),__decorate([query('input[type="file"]')],LyraFileInput.prototype,"inputEl",void 0);export{DEFAULT_MAX_FILES,DEFAULT_MAX_FILE_SIZE_BYTES,DEFAULT_MAX_TOTAL_SIZE_BYTES,LyraFileInput};
90
+ `}}__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"multiple",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"compact",void 0),__decorate([property()],LyraFileInput.prototype,"accept",void 0),__decorate([property()],LyraFileInput.prototype,"capture",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"allowedMimeTypes",null),__decorate([property({attribute:!1})],LyraFileInput.prototype,"forbiddenMimeTypes",null),__decorate([property({type:Number,attribute:"max-file-size"})],LyraFileInput.prototype,"maxFileSize",void 0),__decorate([property({type:Number,attribute:"max-files"})],LyraFileInput.prototype,"maxFiles",void 0),__decorate([property({type:Number,attribute:"max-total-size"})],LyraFileInput.prototype,"maxTotalSize",void 0),__decorate([property({type:Number,attribute:"held-file-count"})],LyraFileInput.prototype,"heldFileCount",void 0),__decorate([property({type:Number,attribute:"held-total-size"})],LyraFileInput.prototype,"heldTotalSize",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"non-retaining"})],LyraFileInput.prototype,"nonRetaining",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"value-present"})],LyraFileInput.prototype,"valuePresent",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraFileInput.prototype,"directory",void 0),__decorate([property({type:Boolean,reflect:!0,converter:trueDefaultBooleanConverter})],LyraFileInput.prototype,"paste",void 0),__decorate([property()],LyraFileInput.prototype,"label",void 0),__decorate([property()],LyraFileInput.prototype,"hint",void 0),__decorate([property({attribute:"error-text"})],LyraFileInput.prototype,"errorText",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraFileInput.prototype,"withLabel",void 0),__decorate([property({type:Boolean,attribute:"with-hint"})],LyraFileInput.prototype,"withHint",void 0),__decorate([property({type:Boolean,attribute:"with-error"})],LyraFileInput.prototype,"withError",void 0),__decorate([property({reflect:!0})],LyraFileInput.prototype,"size",void 0),__decorate([property({attribute:!1})],LyraFileInput.prototype,"validators",void 0),__decorate([property({attribute:"accessible-label"})],LyraFileInput.prototype,"accessibleLabel",void 0),__decorate([property({attribute:"accepted-message"})],LyraFileInput.prototype,"acceptedMessage",void 0),__decorate([property({attribute:"rejected-message"})],LyraFileInput.prototype,"rejectedMessage",void 0),__decorate([state()],LyraFileInput.prototype,"dragState",void 0),__decorate([state()],LyraFileInput.prototype,"resultStatus",void 0),__decorate([state()],LyraFileInput.prototype,"rejectedFiles",void 0),__decorate([state()],LyraFileInput.prototype,"touched",void 0),__decorate([state()],LyraFileInput.prototype,"validityRevision",void 0),__decorate([query('[part~="base"]')],LyraFileInput.prototype,"baseEl",void 0),__decorate([query('input[type="file"]')],LyraFileInput.prototype,"inputEl",void 0);export{DEFAULT_MAX_FILES,DEFAULT_MAX_FILE_SIZE_BYTES,DEFAULT_MAX_TOTAL_SIZE_BYTES,LyraFileInput};
@@ -4,15 +4,27 @@ export type LyraMapLegendPattern='solid'|'diagonal'|'dots'|'crosshatch';
4
4
  /** One immutable, bounded map-legend row. Pattern is required so color is never the sole cue. */
5
5
  export interface LyraMapLegendEntry{readonly color:string;readonly label:string;readonly pattern:LyraMapLegendPattern;
6
6
  /**
7
+ * Category key this row stands for -- the same string a `point.colors` / `point.icons` entry
8
+ * matches against `point.field` / `point.iconField`. Trimmed, bounded to 256 characters and
9
+ * retained in the canonical readback, unlike the `value` on the `icon` record below, which is
10
+ * still dropped. A row that carries one becomes a keyboard-operable visibility toggle under
11
+ * `legendInteractive`; a row without one stays inert. An absent, non-string, empty or
12
+ * whitespace-only key leaves no `value` key at all, so a legend that never used categories
13
+ * reads back exactly as it did before this field existed.
14
+ */
15
+ readonly value?:string;
16
+ /**
7
17
  * Optional glyph painted inside `[part="legend-swatch"]`, in the entry's own color, instead of
8
18
  * the solid color block that would otherwise cover it. Deliberately the record `point.icons`
9
19
  * already carries, so a key can reproduce the symbol its point layer draws rather than
10
20
  * describing it in color alone — hand the legend the very icon object the layer renders.
11
21
  *
12
- * The point layer's `value` category key means nothing to a legend row: it is accepted so a
13
- * pass-through needs no reshaping, and left out of the canonical readback. Validation is the
14
- * point icon's own (path data only, at most 8192 characters, positive `viewBox` dimensions);
15
- * an unusable record is dropped and the row keeps rendering its color swatch.
22
+ * The **icon record's own** `value` is accepted so a pass-through needs no reshaping, and is
23
+ * left out of the canonical readback: a row's category key is the row-level `value` above, and
24
+ * is never derived from the glyph's. Deriving it would silently make a row interactive that the
25
+ * author never marked. Validation is the point icon's own (path data only, at most 8192
26
+ * characters, positive `viewBox` dimensions); an unusable record is dropped and the row keeps
27
+ * rendering its color swatch.
16
28
  *
17
29
  * That per-record 8192-character cap is deliberately the whole bound on path data, with no
18
30
  * aggregate budget of the kind `label` carries across the legend. Two reasons. The admission
@@ -325,7 +337,19 @@ export interface LyraMapInstance{getCanvas():HTMLCanvasElement;getCenter():{lng:
325
337
  */
326
338
  setMaxBounds?(bounds?:unknown):unknown;}
327
339
  /** A pan-constraining box, `[[west, south], [east, north]]`, in the order maplibre-gl takes. */
328
- export type LyraMapBounds=readonly[readonly[number,number],readonly[number,number]];export declare function buildGeoJsonPropertyDiff(previous:unknown,next:unknown):MapLibreGeoJsonDiff|null;export interface LyraMapEventMap{'lr-map-load':CustomEvent<null>;'lr-map-marker-activate':CustomEvent<LyraMapMarkerActivationDetail>;'lr-map-click':CustomEvent<{readonly lngLat:readonly[number,number];readonly feature:Feature|undefined;
340
+ export type LyraMapBounds=readonly[readonly[number,number],readonly[number,number]];export declare function buildGeoJsonPropertyDiff(previous:unknown,next:unknown):MapLibreGeoJsonDiff|null;
341
+ /**
342
+ * Complete proposed visibility snapshot for one map legend category, mirroring
343
+ * `LyraChartLegendVisibilityChangeDetail`'s shape so a host that already reconciles a chart legend
344
+ * reconciles this one the same way. Frozen, and detached from the component's own state.
345
+ */
346
+ export interface LyraMapLegendToggleDetail{
347
+ /** The activated row's `value` category key, exactly as it was admitted. */
348
+ readonly value:string;
349
+ /** Proposed visibility of `value` after this toggle. */
350
+ readonly visible:boolean;
351
+ /** Complete canonical proposed hidden-category set, in the order it would be committed. */
352
+ readonly hiddenCategories:readonly string[];}export interface LyraMapEventMap{'lr-map-load':CustomEvent<null>;'lr-map-marker-activate':CustomEvent<LyraMapMarkerActivationDetail>;'lr-map-legend-toggle':CustomEvent<LyraMapLegendToggleDetail>;'lr-map-click':CustomEvent<{readonly lngLat:readonly[number,number];readonly feature:Feature|undefined;
329
353
  /** Which layer `feature` was hit on, so a click is attributable when both a choropleth and
330
354
  * `dataLayers` are painted. `'cluster'` marks a hit on a clustered entry's aggregate circle,
331
355
  * whose `point_count`/`cluster_id` properties describe the group rather than one feature.
@@ -370,6 +394,17 @@ readonly sourceId:string|undefined;}>;}
370
394
  *
371
395
  * @customElement lr-map
372
396
  * @event lr-map-load - Fired once the underlying maplibregl.Map loads.
397
+ * @event lr-map-legend-toggle - **Cancelable.** Fired once when an interactive legend row is
398
+ * activated by pointer or by Enter/Space, carrying the immutable
399
+ * `detail: { value, visible, hiddenCategories }` -- the activated category key, its proposed
400
+ * visibility, and the complete proposed hidden set in the order it would be committed.
401
+ * `preventDefault()` is a real veto: `hiddenCategories` is not written, the row's `aria-pressed`
402
+ * does not change, the MapLibre paint is untouched, and nothing is announced, which is what lets
403
+ * a host own the set and write it itself. There is deliberately no second confirmation event:
404
+ * the committed state is `hiddenCategories`, which the host already observes, so a paired
405
+ * before/after vocabulary would be permanent public surface nobody asked for. A programmatic
406
+ * `hiddenCategories` assignment reconciles without emitting anything -- this event is a
407
+ * DOM-interaction proposal only.
373
408
  * @event lr-map-marker-activate - Fired once when an accepted declarative marker is activated by
374
409
  * pointer/click or by Enter/Space. The immutable detail carries its normalized `id`, validated
375
410
  * `lngLat`, accepted marker snapshot, and activation `source`.
@@ -384,12 +419,20 @@ readonly sourceId:string|undefined;}>;}
384
419
  * @csspart container - The MapLibre container. Its generated canvas is the actual focusable map
385
420
  * region and receives the host-first accessible name and effective locale.
386
421
  * @slot legend - Custom legend content, rendered inside the legend panel's own layout so it stays
387
- * positioned with the map instead of floating beside it.
422
+ * positioned with the map instead of floating beside it. Slotted content is never made
423
+ * interactive by `legendInteractive`, which only reaches rows projected from `legend`.
388
424
  * @csspart legend - The map legend.
389
425
  * @csspart legend-swatch - A legend color swatch, or the entry's glyph when it carries an `icon`
390
426
  * — in which case the swatch drops its color block and pattern overlay, keeps the `pattern`
391
427
  * border framing the glyph as its non-color cue, carries `data-icon="true"`, and paints the
392
- * glyph itself in the entry color.
428
+ * glyph itself in the entry color. It nests inside `legend-toggle` on an interactive row and
429
+ * stays `aria-hidden`/`inert` there, so it never contributes to the button's accessible name.
430
+ * @csspart legend-toggle - The `button` an interactive legend row renders around its swatch and
431
+ * label when `legendInteractive` is set and the row carries a `value`. Absent entirely when
432
+ * either is missing, so an unset map's legend markup is unchanged.
433
+ * @csspart legend-toggle-hidden - Second token carried alongside `legend-toggle` while that row's
434
+ * category is in `hiddenCategories`. State lives in the part name rather than a separate
435
+ * attribute, so `::part(legend-toggle-hidden)` is a reachable styling hook.
393
436
  * @csspart legend-gradient - The continuous ramp bar rendered from `legendGradient`.
394
437
  * @csspart legend-lo - The low endpoint caption of the `legendGradient` bar (mirrors `lr-heatmap`).
395
438
  * @csspart legend-hi - The high endpoint caption of the `legendGradient` bar (mirrors `lr-heatmap`).
@@ -414,6 +457,12 @@ readonly sourceId:string|undefined;}>;}
414
457
  * @cssprop [--lr-map-choropleth-fill-opacity=0.75] - Fill opacity for choropleth and polygon
415
458
  * `dataLayers` fills. Read from the resolved cascade whenever those layers are applied or painted
416
459
  * after a theme change.
460
+ * @cssprop [--lr-map-hidden-category-opacity=0.15] - Opacity a hidden category's points, point
461
+ * strokes and point icons are muted to in the rendered MapLibre paint. Read from the resolved
462
+ * cascade on every paint, because MapLibre draws to a WebGL canvas the CSS cascade never reaches.
463
+ * @cssprop [--lr-map-legend-hidden-swatch-opacity=0.5] - Opacity of a hidden interactive legend
464
+ * row's decorative swatch. Only the `aria-hidden` swatch dims; the label re-colors through the
465
+ * quiet text token instead, so it keeps AA contrast.
417
466
  * @cssprop [--lr-map-popup-close-button-hover-bg=var(--lr-color-brand-quiet)] - Hover background
418
467
  * of `popup-close-button`.
419
468
  * @cssprop [--lr-map-popup-close-button-hover-color=var(--lr-color-brand)] - Hover foreground of
@@ -422,6 +471,18 @@ readonly sourceId:string|undefined;}>;}
422
471
  * @cssprop [--lr-map-popup-close-button-active-color=var(--lr-color-brand)] - Pressed foreground
423
472
  * of `popup-close-button`.
424
473
  *
474
+ * The legend is read-only unless `legendInteractive` is set, which is opt-in for a reason: an
475
+ * unset map renders exactly the key it rendered before, with no button, no extra attribute and no
476
+ * extra MapLibre paint key. Only a row that carries its own `value` becomes a toggle -- the key is
477
+ * never derived from an `icon` record's `value`, which would silently make a row operable the
478
+ * author never marked. Each toggle is a native `button`, so it is one independent tab stop per row
479
+ * (a 100-row legend contributes 100, exactly as a 100-series `lr-chart` legend does) and it grows
480
+ * to the shared `--lr-icon-button-size` hit-area floor. Activation emits the cancelable
481
+ * `lr-map-legend-toggle`; there is deliberately no confirmation event, because the committed state
482
+ * is `hiddenCategories` and the host already observes it. A hidden category mutes its points,
483
+ * point strokes and point icons through `--lr-map-hidden-category-opacity`; a `kind: 'heatmap'`
484
+ * entry is deliberately out of scope, having no per-category field to mute.
485
+ *
425
486
  * No style or tile provider is selected implicitly. Set `mapStyle` explicitly before connection;
426
487
  * this prevents a bare component from making an undeclared third-party request.
427
488
  * @status stable
@@ -500,6 +561,30 @@ legendGradientHiLabel:string|null;
500
561
  /** Counts from the latest bounded legend normalization. `truncated` covers omitted rows or
501
562
  * shortened labels; the returned record is frozen and never aliases caller input. */
502
563
  get legendProjection():LyraMapLegendProjection;
564
+ /**
565
+ * Turns every legend row that carries a `value` into a keyboard-operable visibility toggle;
566
+ * rows without one stay inert. Default `false`, and an unset map renders exactly the read-only
567
+ * key it rendered before this property existed -- no button, no extra attribute, and no extra
568
+ * MapLibre paint key.
569
+ *
570
+ * Each toggle is an independently tabbable native `button`, so Enter and Space are the
571
+ * platform's own activation and no roving tabindex is involved. The consequence is stated
572
+ * rather than hidden: a 100-row interactive legend contributes 100 tab stops, exactly as a
573
+ * 100-series `lr-chart` legend does. Each row also grows to the `--lr-icon-button-size` hit-area
574
+ * floor; the legend panel's own `max-block-size`/`overflow: auto` contains the taller list.
575
+ */
576
+ legendInteractive:boolean;private _hiddenCategories;
577
+ /**
578
+ * Complete controlled set of muted category keys, mirroring `lr-chart`'s `hiddenDatasets`.
579
+ * Clone-owned and frozen; non-string, empty, whitespace-only and duplicate entries are dropped,
580
+ * and at most 100 keys are retained. Honoured on the first render and the first MapLibre paint,
581
+ * not only after a user toggle. An empty array deliberately means every category is visible.
582
+ *
583
+ * Controlled public state, so it deliberately survives a disconnect and reconnect: the
584
+ * "reset transient open-state in `disconnectedCallback()`" rule covers dropdown/preview/tooltip
585
+ * `@state`, not a documented property a host owns and re-reads.
586
+ */
587
+ get hiddenCategories():readonly string[];set hiddenCategories(value:readonly string[]);
503
588
  /** Optional GeoJSON choropleth layer and value-to-color configuration. */
504
589
  choropleth?:Readonly<LyraMapChoroplethLayer>;
505
590
  /** Point markers rendered over the map. Explicit IDs are unique-nonempty first-wins. An idless
@@ -530,7 +615,7 @@ label:string;
530
615
  private loading;
531
616
  /** Classified failure rendered as localized ordinary text and announced through the owner
532
617
  * document's assertive sink. */
533
- private failure?;private errorAnnouncementSink?;private loadLibrary;private visible;private intersectionObserver?;private containerEl?;private _map?;private _styleLoaded;private _appliedChoroplethSourceId?;private _appliedFillLayerId?;private _appliedDataLayerIds;
618
+ private failure?;private errorAnnouncementSink?;private legendAnnouncementSink?;private loadLibrary;private visible;private intersectionObserver?;private containerEl?;private _map?;private _styleLoaded;private _appliedChoroplethSourceId?;private _appliedFillLayerId?;private _appliedDataLayerIds;
534
619
  /**
535
620
  * The rendering shape (`'auto'`, a cluster signature, `'heatmap'`) each applied data layer was
536
621
  * built with, keyed identically to `_appliedDataLayerIds`.
@@ -543,7 +628,12 @@ private failure?;private errorAnnouncementSink?;private loadLibrary;private visi
543
628
  private _appliedDataLayerShapes;
544
629
  /** Last GeoJSON applied per resolved source id, so an update can be diffed against it rather
545
630
  * than replacing the whole source. Holds a reference, not a copy -- it is only ever compared. */
546
- private _appliedGeoJson;private _nextDataLayerId;private nextPointIconId;private appliedPointPaint;private appliedPointIcons;private _maplibreModule?;
631
+ private _appliedGeoJson;private _nextDataLayerId;private nextPointIconId;private appliedPointPaint;
632
+ /** Layer ids whose paint currently carries a muting opacity, so the first paint after the last
633
+ * category is un-hidden can restore it -- and a layer that was never muted keeps its paint
634
+ * object free of the key entirely. Keyed by layer id, not source id, because one source's
635
+ * circle and point-icon layers mute independently on different fields. */
636
+ private appliedPointMuting;private appliedPointIcons;private _maplibreModule?;
547
637
  /** True only after WebGL2 has been proved in the current owner-document realm. */
548
638
  private _webglReady;private _markerInstances;private _markerLabels;private _markerPopupIds;private readonly markerActivationDetails;private _configuredPopups;private _nextPopupId;private peerChromeObserver?;private observedPeerContainer?;private mapResizeObserver?;private observedMapContainer?;private _markerColors;private _connectGeneration;
549
639
  /** The underlying runtime `maplibregl.Map`, declared through Lyra's peer-neutral common-method
@@ -596,7 +686,9 @@ private get safeCenter();connectedCallback():void;disconnectedCallback():void;pr
596
686
  * below without risking a double construction.
597
687
  */
598
688
  private tryConstructMap;protected updated(changed:PropertyValues):void;protected willUpdate(changed:PropertyValues):void;
599
- /** Repaints token-derived MapLibre values without touching sources, layers, or map geometry. */
689
+ /** Repaints token-derived and visibility-derived MapLibre values without touching sources,
690
+ * layers, or map geometry -- which is exactly what a theme change and a `hiddenCategories`
691
+ * change each need. */
600
692
  private refreshThemePaint;private applyChoropleth;private choroplethColorExpression;
601
693
  /**
602
694
  * Keeps the choropleth out of every caller-controlled data-layer namespace. Repeatedly prefixing
@@ -630,7 +722,18 @@ private paintDataLayer;
630
722
  /** The pre-existing geometry split: polygons filled, lines/outlines stroked, points circled. */
631
723
  private applyGeometryLayers;
632
724
  /** Paint-only half of `applyGeometryLayers`. See `paintDataLayer` for why the halves are split. */
633
- private paintGeometryLayers;private lineColor;private paintPoints;private pointIconColor;private removePointIcons;private applyPointIcons;private paintPointIcons;
725
+ private paintGeometryLayers;private lineColor;
726
+ /**
727
+ * A `match` expression over `['get', field]` while any admitted category is hidden; a literal
728
+ * `1` on the first paint after the last category is un-hidden; and `undefined` whenever nothing
729
+ * is or was muted on `layerId` -- which is what leaves a `legendInteractive`-unset map
730
+ * byte-identical: the paint key is never written, so MapLibre keeps its own default and the
731
+ * layer's paint object gains no extra property.
732
+ *
733
+ * The flat `label, output` pair form is deliberately the shape `point.colors` already emits two
734
+ * lines above its own `match`, so this file speaks one expression idiom rather than two.
735
+ */
736
+ private mutedPointOpacity;private paintPoints;private pointIconColor;private removePointIcons;private applyPointIcons;private paintPointIcons;
634
737
  /**
635
738
  * `['step', ['get', 'point_count'], …]` over the authored cluster color breaks, or the layer's
636
739
  * own flat color when none were supplied.
@@ -686,4 +789,27 @@ private syncPeerChromeParts;private observePeerChrome;private syncPopupSemantics
686
789
  * holds fewer than two usable stops. Part names mirror `lr-heatmap`'s
687
790
  * `legend-lo`/`legend-hi` so a consumer styling both components learns one vocabulary.
688
791
  */
689
- private renderLegendGradient;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-map':LyraMap;}}
792
+ /**
793
+ * The swatch-plus-label pair every legend row renders: directly inside the row when the row is
794
+ * inert, and inside the row's toggle button when `legendInteractive` has made it operable. One
795
+ * source of truth, so the two branches can never drift, and an unset map keeps rendering exactly
796
+ * the markup it rendered before the toggle existed.
797
+ */
798
+ private renderLegendRowContent;
799
+ /**
800
+ * Flips one category's visibility from a legend toggle activation.
801
+ *
802
+ * `hiddenCategories` is a key set, so every row carrying the activated key flips together --
803
+ * self-consistent by construction rather than by a per-row visibility flag that two rows
804
+ * describing one category could disagree about.
805
+ */
806
+ private toggleLegendCategory;
807
+ /**
808
+ * The state change belongs in a live region because the thing that changed -- the map, and the
809
+ * legend row's own styling -- is not the focused element, and `aria-pressed` alone only reports
810
+ * the button's new state once focus is already on it.
811
+ */
812
+ private announceLegendVisibility;
813
+ /** Acquired lazily on the first toggle, and re-acquired against a new owner document, so a map
814
+ * that never renders an interactive legend never mounts a live region at all. */
815
+ private syncLegendAnnouncementSink;private releaseLegendAnnouncementSink;private renderLegendGradient;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-map':LyraMap;}}