@aceshooting/lyra-ui 9.1.1 → 11.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 (585) hide show
  1. package/CHANGELOG.md +785 -0
  2. package/custom-elements.json +1 -1
  3. package/design-tokens.json +13 -0
  4. package/dist/cli/migrate-wa.mjs +216 -1
  5. package/dist/cli/migration-contract.json +1 -1
  6. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
  7. package/dist/components/agent-tools/activity-feed/activity-feed.styles.js +0 -16
  8. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
  9. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.styles.js +7 -5
  10. package/dist/components/agent-tools/agent-run/agent-run.class.js +2 -2
  11. package/dist/components/agent-tools/agent-run/agent-run.styles.js +0 -13
  12. package/dist/components/agent-tools/agent-trace/agent-trace.styles.js +7 -4
  13. package/dist/components/agent-tools/approval-queue/approval-queue.styles.js +7 -5
  14. package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +0 -3
  15. package/dist/components/agent-tools/browser-frame/browser-frame.styles.js +3 -5
  16. package/dist/components/agent-tools/commit-card/commit-card.styles.js +0 -10
  17. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +11 -6
  18. package/dist/components/agent-tools/confirm-bar/confirm-bar.styles.js +0 -46
  19. package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +0 -7
  20. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +2 -2
  21. package/dist/components/agent-tools/prompt-studio/prompt-studio.styles.js +0 -15
  22. package/dist/components/agent-tools/result-card/result-card.styles.js +0 -7
  23. package/dist/components/agent-tools/result-card/result-field.styles.js +0 -5
  24. package/dist/components/agent-tools/schema-viewer/schema-viewer.styles.js +0 -3
  25. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +0 -15
  26. package/dist/components/agent-tools/stack-trace/stack-trace.styles.js +0 -20
  27. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
  28. package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +0 -3
  29. package/dist/components/agent-tools/task-list/task-list.styles.js +0 -15
  30. package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -6
  31. package/dist/components/agent-tools/terminal/terminal.class.js +4 -4
  32. package/dist/components/agent-tools/terminal/terminal.styles.js +0 -46
  33. package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
  34. package/dist/components/agent-tools/test-results/test-results.styles.js +0 -5
  35. package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +0 -41
  36. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.styles.js +0 -41
  37. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.styles.js +0 -30
  38. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +6 -6
  39. package/dist/components/agent-tools/tool-param-form/tool-param-form.styles.js +0 -5
  40. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +0 -20
  41. package/dist/components/agent-tools/tool-result-view/tool-result-view.styles.js +0 -4
  42. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.styles.js +0 -21
  43. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +7 -31
  44. package/dist/components/charts/chart/box-plot.class.d.ts +27 -0
  45. package/dist/components/charts/chart/box-plot.class.js +14 -4
  46. package/dist/components/charts/chart/box-plot.styles.js +28 -20
  47. package/dist/components/charts/chart/chart-colors.d.ts +1 -1
  48. package/dist/components/charts/chart/chart-colors.js +1 -1
  49. package/dist/components/charts/chart/chart-core-loader.d.ts +1 -0
  50. package/dist/components/charts/chart/chart-core-loader.js +1 -1
  51. package/dist/components/charts/chart/chart-feature-loader.d.ts +35 -0
  52. package/dist/components/charts/chart/chart-feature-loader.js +1 -1
  53. package/dist/components/charts/chart/chart.class.d.ts +120 -0
  54. package/dist/components/charts/chart/chart.class.js +16 -6
  55. package/dist/components/charts/chart/chart.styles.js +28 -27
  56. package/dist/components/charts/chart/lite-chart.class.d.ts +20 -1
  57. package/dist/components/charts/chart/lite-chart.class.js +4 -4
  58. package/dist/components/charts/chart/lite-chart.styles.js +0 -27
  59. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +20 -0
  60. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +3 -1
  61. package/dist/components/conversation/agent-workspace/agent-workspace.styles.js +3 -0
  62. package/dist/components/conversation/audio-visualizer/audio-visualizer.styles.js +0 -7
  63. package/dist/components/conversation/branch-picker/branch-picker.styles.js +0 -3
  64. package/dist/components/conversation/chat-composer/chat-composer.styles.js +0 -51
  65. package/dist/components/conversation/chat-message/chat-message.styles.js +7 -35
  66. package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
  67. package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +0 -33
  68. package/dist/components/conversation/checkpoint/checkpoint.class.js +1 -1
  69. package/dist/components/conversation/checkpoint/checkpoint.styles.js +0 -3
  70. package/dist/components/conversation/code-block/code-block-shared.d.ts +5 -2
  71. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  72. package/dist/components/conversation/code-block/code-block.styles.js +4 -95
  73. package/dist/components/conversation/code-block/code-loader.d.ts +11 -0
  74. package/dist/components/conversation/code-block/code-loader.js +1 -1
  75. package/dist/components/conversation/code-block/shiki-types.d.ts +12 -0
  76. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  77. package/dist/components/conversation/conversation-item/conversation-item.styles.js +8 -54
  78. package/dist/components/conversation/generation-metrics/generation-metrics.class.js +2 -2
  79. package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +0 -17
  80. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  81. package/dist/components/conversation/markdown/markdown.styles.js +0 -41
  82. package/dist/components/conversation/message-actions/message-actions.styles.js +0 -3
  83. package/dist/components/conversation/message-feedback/message-feedback.styles.js +0 -35
  84. package/dist/components/conversation/message-parts/message-parts.class.d.ts +1 -1
  85. package/dist/components/conversation/message-parts/message-parts.styles.js +0 -5
  86. package/dist/components/conversation/model-select/model-select.class.js +3 -3
  87. package/dist/components/conversation/model-select/model-select.styles.js +12 -47
  88. package/dist/components/conversation/model-settings-panel/model-settings-panel.styles.js +0 -6
  89. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +3 -0
  90. package/dist/components/conversation/prompt-input/prompt-input.styles.js +0 -10
  91. package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +0 -8
  92. package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -11
  93. package/dist/components/conversation/stream-status/stream-status.styles.js +0 -16
  94. package/dist/components/conversation/streaming-text/streaming-text.styles.js +0 -15
  95. package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +0 -5
  96. package/dist/components/conversation/thread-list/thread-list.styles.js +0 -23
  97. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +16 -4
  98. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  99. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +0 -1
  100. package/dist/components/conversation/typing-indicator/typing-indicator.styles.js +0 -23
  101. package/dist/components/conversation/usage-badge/usage-badge.styles.js +0 -3
  102. package/dist/components/conversation/voice-picker/voice-picker.class.js +3 -3
  103. package/dist/components/conversation/voice-picker/voice-picker.styles.js +9 -29
  104. package/dist/components/conversation/widget-renderer/resolve.d.ts +2 -0
  105. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  106. package/dist/components/data/calendar/calendar.class.d.ts +15 -2
  107. package/dist/components/data/calendar/calendar.class.js +2 -2
  108. package/dist/components/data/calendar/calendar.styles.js +2 -28
  109. package/dist/components/data/condition-builder/condition-builder.class.d.ts +10 -6
  110. package/dist/components/data/condition-builder/condition-builder.class.js +2 -2
  111. package/dist/components/data/condition-builder/condition-builder.styles.js +0 -6
  112. package/dist/components/data/context-meter/context-meter.styles.js +0 -24
  113. package/dist/components/data/data-grid/data-grid.class.js +3 -3
  114. package/dist/components/data/data-grid/data-grid.styles.js +0 -22
  115. package/dist/components/data/document-library/document-library.class.js +2 -2
  116. package/dist/components/data/document-library/document-library.styles.js +0 -4
  117. package/dist/components/data/env-list/env-list.class.js +1 -1
  118. package/dist/components/data/env-list/env-list.styles.js +7 -4
  119. package/dist/components/data/file-tree/file-tree.class.d.ts +12 -0
  120. package/dist/components/data/flow-canvas/flow-canvas.styles.js +12 -19
  121. package/dist/components/data/flow-controls/flow-controls.class.js +2 -2
  122. package/dist/components/data/flow-controls/flow-controls.styles.js +3 -36
  123. package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
  124. package/dist/components/data/flow-minimap/flow-minimap.styles.js +0 -9
  125. package/dist/components/data/flow-node/flow-node.styles.js +0 -23
  126. package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
  127. package/dist/components/data/flow-run-status/flow-run-status.styles.js +0 -7
  128. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +0 -7
  129. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
  130. package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +0 -10
  131. package/dist/components/data/heatmap/heatmap-scale.d.ts +20 -0
  132. package/dist/components/data/heatmap/heatmap-scale.js +1 -1
  133. package/dist/components/data/heatmap/heatmap.class.d.ts +117 -1
  134. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  135. package/dist/components/data/heatmap/heatmap.styles.js +0 -54
  136. package/dist/components/data/pagination/pagination.styles.js +23 -46
  137. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +34 -1
  138. package/dist/components/data/sequence-strip/sequence-strip.class.js +5 -2
  139. package/dist/components/data/sequence-strip/sequence-strip.styles.js +14 -20
  140. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  141. package/dist/components/data/stat/stat.styles.js +0 -67
  142. package/dist/components/data/table/table.class.d.ts +42 -3
  143. package/dist/components/data/table/table.class.js +4 -4
  144. package/dist/components/data/table/table.styles.js +20 -91
  145. package/dist/components/data/timeline/timeline-item.styles.js +0 -30
  146. package/dist/components/data/timeline/timeline.class.d.ts +89 -1
  147. package/dist/components/data/timeline/timeline.class.js +2 -2
  148. package/dist/components/data/timeline/timeline.styles.js +111 -31
  149. package/dist/components/data/tree/tree-item.styles.js +1 -28
  150. package/dist/components/data/tree/tree.class.js +2 -2
  151. package/dist/components/data/tree/tree.styles.js +0 -6
  152. package/dist/components/data/word-cloud/word-cloud.styles.js +0 -5
  153. package/dist/components/forms/button/button.class.js +1 -1
  154. package/dist/components/forms/button/button.styles.js +0 -105
  155. package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
  156. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  157. package/dist/components/forms/checkbox/checkbox.styles.js +0 -39
  158. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +21 -2
  159. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  160. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +0 -18
  161. package/dist/components/forms/code-editor/code-editor.styles.js +0 -30
  162. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  163. package/dist/components/forms/color-picker/color-picker.styles.js +0 -69
  164. package/dist/components/forms/combobox/combobox.class.d.ts +71 -3
  165. package/dist/components/forms/combobox/combobox.class.js +5 -3
  166. package/dist/components/forms/combobox/combobox.styles.js +31 -111
  167. package/dist/components/forms/combobox/option.styles.js +7 -1
  168. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  169. package/dist/components/forms/date-picker/date-input.styles.js +12 -67
  170. package/dist/components/forms/date-picker/date-picker.class.d.ts +47 -0
  171. package/dist/components/forms/date-picker/date-picker.class.js +36 -22
  172. package/dist/components/forms/date-picker/date-picker.styles.js +82 -29
  173. package/dist/components/forms/emoji-picker/emoji-data-loader.d.ts +6 -3
  174. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  175. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +8 -1
  176. package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
  177. package/dist/components/forms/emoji-picker/emoji-picker.styles.js +3 -41
  178. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  179. package/dist/components/forms/icon-button/icon-button.styles.js +0 -16
  180. package/dist/components/forms/input/input.styles.js +0 -54
  181. package/dist/components/forms/input/number-input.styles.d.ts +4 -5
  182. package/dist/components/forms/input/number-input.styles.js +0 -11
  183. package/dist/components/forms/input/time-input-shared.d.ts +11 -0
  184. package/dist/components/forms/input/time-input-shared.js +1 -1
  185. package/dist/components/forms/input/time-input.class.d.ts +11 -2
  186. package/dist/components/forms/input/time-input.class.js +1 -1
  187. package/dist/components/forms/input/time-input.styles.js +0 -6
  188. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  189. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -26
  190. package/dist/components/forms/otp-input/otp-input.class.js +3 -3
  191. package/dist/components/forms/otp-input/otp-input.styles.js +0 -16
  192. package/dist/components/forms/phone-input/phone-input.class.d.ts +9 -1
  193. package/dist/components/forms/phone-input/phone-input.class.js +2 -2
  194. package/dist/components/forms/phone-input/phone-input.styles.js +0 -37
  195. package/dist/components/forms/radio/radio-button.styles.js +1 -30
  196. package/dist/components/forms/radio/radio-group.styles.js +0 -4
  197. package/dist/components/forms/radio/radio.styles.js +0 -44
  198. package/dist/components/forms/rubric-form/rubric-form.styles.js +0 -5
  199. package/dist/components/forms/select/select.class.js +1 -1
  200. package/dist/components/forms/select/select.styles.js +14 -114
  201. package/dist/components/forms/slider/slider.styles.js +0 -55
  202. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +0 -11
  203. package/dist/components/forms/swatch-picker/swatch-picker.class.js +2 -2
  204. package/dist/components/forms/swatch-picker/swatch-picker.styles.js +0 -77
  205. package/dist/components/forms/switch/switch.class.d.ts +3 -0
  206. package/dist/components/forms/switch/switch.class.js +1 -1
  207. package/dist/components/forms/switch/switch.styles.js +0 -37
  208. package/dist/components/forms/textarea/textarea.styles.js +0 -28
  209. package/dist/components/forms/time-range/time-range.styles.js +12 -84
  210. package/dist/components/forms/token-input/token-input.class.d.ts +23 -9
  211. package/dist/components/forms/token-input/token-input.class.js +1 -1
  212. package/dist/components/forms/token-input/token-input.styles.js +1 -54
  213. package/dist/components/layout/app-rail/app-rail-item.class.js +2 -2
  214. package/dist/components/layout/app-rail/app-rail-item.styles.js +0 -13
  215. package/dist/components/layout/app-rail/app-rail.class.d.ts +5 -0
  216. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  217. package/dist/components/layout/app-rail/app-rail.styles.js +0 -46
  218. package/dist/components/layout/button-group/button-group.styles.js +0 -6
  219. package/dist/components/layout/card/card.class.d.ts +12 -0
  220. package/dist/components/layout/card/card.styles.js +3 -11
  221. package/dist/components/layout/carousel/carousel.styles.js +0 -1
  222. package/dist/components/layout/command-palette/command-palette.class.d.ts +8 -0
  223. package/dist/components/layout/command-palette/command-palette.class.js +3 -1
  224. package/dist/components/layout/command-palette/command-palette.styles.js +1 -13
  225. package/dist/components/layout/control-group/control-group.styles.js +0 -7
  226. package/dist/components/layout/dashboard-grid/dashboard-grid.styles.js +6 -25
  227. package/dist/components/layout/details/accordion.class.d.ts +13 -0
  228. package/dist/components/layout/details/accordion.class.js +1 -1
  229. package/dist/components/layout/details/details.class.js +1 -1
  230. package/dist/components/layout/details/details.styles.js +0 -12
  231. package/dist/components/layout/dock-panel/dock-panel.styles.js +0 -45
  232. package/dist/components/layout/drilldown-panel/drilldown-panel.class.d.ts +2 -0
  233. package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +2 -2
  234. package/dist/components/layout/drilldown-panel/drilldown-panel.styles.js +0 -4
  235. package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
  236. package/dist/components/layout/filter-bar/filter-bar.styles.js +0 -9
  237. package/dist/components/layout/menu/menu-item.class.d.ts +5 -0
  238. package/dist/components/layout/menu/menu-item.class.js +1 -1
  239. package/dist/components/layout/menu/menu-item.styles.js +0 -49
  240. package/dist/components/layout/menu/menu-label.styles.js +0 -2
  241. package/dist/components/layout/menu/menu.styles.js +0 -18
  242. package/dist/components/layout/multi-split/multi-split.styles.js +0 -63
  243. package/dist/components/layout/page/page.class.d.ts +4 -0
  244. package/dist/components/layout/page/page.class.js +1 -1
  245. package/dist/components/layout/reorder-list/reorder-item.styles.js +0 -4
  246. package/dist/components/layout/responsive-panel/responsive-panel.styles.js +0 -27
  247. package/dist/components/layout/scroller/scroller.styles.js +0 -20
  248. package/dist/components/layout/segmented/segmented.class.d.ts +7 -1
  249. package/dist/components/layout/segmented/segmented.class.js +1 -1
  250. package/dist/components/layout/segmented/segmented.styles.js +69 -37
  251. package/dist/components/layout/split-panel/split-panel.styles.js +1 -7
  252. package/dist/components/layout/stepper/stepper.class.d.ts +8 -1
  253. package/dist/components/layout/stepper/stepper.class.js +1 -1
  254. package/dist/components/layout/stepper/stepper.styles.js +140 -41
  255. package/dist/components/layout/tab-group/tab-group.class.d.ts +4 -1
  256. package/dist/components/layout/tab-group/tab-group.styles.js +9 -75
  257. package/dist/components/layout/tab-group/tab.styles.js +0 -2
  258. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +4 -4
  259. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  260. package/dist/components/layout/virtual-list/virtual-list.styles.js +0 -68
  261. package/dist/components/layout/widget/widget.class.d.ts +5 -1
  262. package/dist/components/layout/widget/widget.class.js +1 -1
  263. package/dist/components/layout/widget/widget.styles.js +97 -40
  264. package/dist/components/media/animated-image/animated-image.class.d.ts +3 -0
  265. package/dist/components/media/animated-image/animated-image.class.js +1 -1
  266. package/dist/components/media/animated-image/animated-image.styles.js +0 -28
  267. package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +1 -1
  268. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  269. package/dist/components/media/attachment-chip/attachment-chip.styles.js +0 -31
  270. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
  271. package/dist/components/media/attachment-trigger/attachment-trigger.styles.js +0 -40
  272. package/dist/components/media/av-player/av-player.class.d.ts +5 -6
  273. package/dist/components/media/av-player/av-player.class.js +1 -1
  274. package/dist/components/media/av-player/av-player.styles.js +0 -45
  275. package/dist/components/media/avatar/avatar.styles.js +3 -16
  276. package/dist/components/media/file-icon/file-icon.class.d.ts +1 -2
  277. package/dist/components/media/file-icon/file-icon.class.js +1 -1
  278. package/dist/components/media/file-input/file-input.class.d.ts +12 -0
  279. package/dist/components/media/file-input/file-input.styles.js +3 -24
  280. package/dist/components/media/flag/flag.class.d.ts +23 -1
  281. package/dist/components/media/flag/flag.class.js +4 -2
  282. package/dist/components/media/flag/flag.styles.js +7 -1
  283. package/dist/components/media/flag/language-map.d.ts +10 -0
  284. package/dist/components/media/flag/language-map.js +1 -1
  285. package/dist/components/media/image-comparer/image-comparer.styles.js +4 -33
  286. package/dist/components/media/image-viewer/image-viewer.class.js +0 -2
  287. package/dist/components/media/image-viewer/image-viewer.styles.js +7 -27
  288. package/dist/components/media/lightbox/lightbox.class.js +0 -2
  289. package/dist/components/media/lightbox/lightbox.styles.js +0 -21
  290. package/dist/components/media/map/map-loader.d.ts +19 -1
  291. package/dist/components/media/map/map-loader.js +1 -1
  292. package/dist/components/media/map/map.class.d.ts +178 -1
  293. package/dist/components/media/map/map.class.js +15 -3
  294. package/dist/components/media/map/map.styles.js +20 -17
  295. package/dist/components/media/media-card/media-card.class.d.ts +14 -3
  296. package/dist/components/media/media-card/media-card.class.js +1 -1
  297. package/dist/components/media/media-card/media-card.styles.js +2 -28
  298. package/dist/components/media/pan-zoom/pan-zoom.styles.js +0 -3
  299. package/dist/components/media/qr-code/qr-code.class.d.ts +3 -2
  300. package/dist/components/media/qr-code/qr-code.class.js +2 -2
  301. package/dist/components/media/qr-code/qr-code.styles.js +0 -3
  302. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +2 -0
  303. package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -1
  304. package/dist/components/media/sequence-playback/sequence-playback.styles.js +0 -19
  305. package/dist/components/media/video/video.class.d.ts +23 -2
  306. package/dist/components/media/video/video.class.js +3 -3
  307. package/dist/components/media/video/video.styles.js +4 -2
  308. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
  309. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  310. package/dist/components/media/zoomable-frame/zoomable-frame.styles.js +0 -5
  311. package/dist/components/overlays/alert/alert.styles.js +4 -2
  312. package/dist/components/overlays/badge/badge.styles.js +4 -48
  313. package/dist/components/overlays/badge/tag.styles.js +0 -14
  314. package/dist/components/overlays/callout/callout.styles.js +0 -11
  315. package/dist/components/overlays/chip/chip-group.styles.js +0 -18
  316. package/dist/components/overlays/chip/chip.styles.js +6 -69
  317. package/dist/components/overlays/dialog/confirm.d.ts +1 -4
  318. package/dist/components/overlays/dialog/confirm.js +1 -1
  319. package/dist/components/overlays/dialog/dialog.class.d.ts +32 -9
  320. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  321. package/dist/components/overlays/dialog/dialog.styles.js +0 -43
  322. package/dist/components/overlays/drawer/drawer.class.d.ts +2 -2
  323. package/dist/components/overlays/drawer/drawer.styles.js +0 -9
  324. package/dist/components/overlays/empty/empty.styles.js +0 -12
  325. package/dist/components/overlays/kbd/kbd.styles.js +0 -8
  326. package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -6
  327. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  328. package/dist/components/overlays/overlay/overlay.styles.js +0 -28
  329. package/dist/components/overlays/overlay/popover.class.d.ts +28 -4
  330. package/dist/components/overlays/overlay/popover.class.js +2 -2
  331. package/dist/components/overlays/overlay/tooltip.class.d.ts +10 -0
  332. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  333. package/dist/components/overlays/popup/popup.class.d.ts +1 -0
  334. package/dist/components/overlays/popup/popup.class.js +1 -1
  335. package/dist/components/overlays/popup/popup.styles.js +0 -15
  336. package/dist/components/overlays/progress/progress-ring.class.d.ts +9 -1
  337. package/dist/components/overlays/progress/progress-ring.class.js +3 -3
  338. package/dist/components/overlays/progress/progress.styles.js +0 -21
  339. package/dist/components/overlays/rating/rating.styles.js +0 -25
  340. package/dist/components/overlays/skeleton/skeleton.styles.js +0 -4
  341. package/dist/components/overlays/spinner/spinner.styles.js +0 -3
  342. package/dist/components/overlays/toast/toast-item.styles.js +3 -45
  343. package/dist/components/retrieval/chunk-inspector/chunk-inspector.styles.js +0 -35
  344. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +2 -2
  345. package/dist/components/retrieval/citation-badge/citation-badge.class.js +3 -3
  346. package/dist/components/retrieval/citation-badge/citation-badge.styles.js +0 -20
  347. package/dist/components/retrieval/claim-evidence/claim-evidence.styles.js +0 -8
  348. package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -0
  349. package/dist/components/retrieval/community-card/community-card.styles.js +0 -6
  350. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +8 -12
  351. package/dist/components/retrieval/entity-card/entity-card.class.d.ts +4 -3
  352. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  353. package/dist/components/retrieval/entity-card/entity-card.styles.js +0 -12
  354. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +10 -4
  355. package/dist/components/retrieval/entity-chip/entity-chip.class.js +3 -3
  356. package/dist/components/retrieval/entity-chip/entity-chip.styles.js +6 -9
  357. package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +19 -5
  358. package/dist/components/retrieval/graph/graph.class.d.ts +5 -0
  359. package/dist/components/retrieval/graph/graph.class.js +1 -1
  360. package/dist/components/retrieval/graph/graph.styles.js +0 -30
  361. package/dist/components/retrieval/graph-legend/graph-legend.styles.js +0 -3
  362. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +0 -25
  363. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.d.ts +2 -0
  364. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.styles.js +0 -7
  365. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +20 -6
  366. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +2 -2
  367. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +0 -16
  368. package/dist/components/retrieval/mind-map/mind-map.class.d.ts +5 -3
  369. package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
  370. package/dist/components/retrieval/mind-map/mind-map.styles.js +0 -2
  371. package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +3 -2
  372. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
  373. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +0 -30
  374. package/dist/components/retrieval/node-palette/node-palette.styles.js +0 -11
  375. package/dist/components/retrieval/path-strip/path-strip.styles.js +0 -10
  376. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +12 -3
  377. package/dist/components/retrieval/provenance-panel/provenance-panel.styles.js +0 -2
  378. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +3 -2
  379. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +2 -2
  380. package/dist/components/retrieval/retrieval-results/retrieval-results.styles.js +0 -28
  381. package/dist/components/retrieval/retrieval-search/retrieval-search.styles.js +0 -4
  382. package/dist/components/retrieval/retrieval-trace/retrieval-trace.styles.js +0 -2
  383. package/dist/components/retrieval/source-card/source-card.styles.js +0 -13
  384. package/dist/components/retrieval/source-list/source-list.styles.js +0 -7
  385. package/dist/components/retrieval/source-picker/source-picker.styles.js +0 -7
  386. package/dist/components/utility/copy-button/copy-button.styles.js +0 -10
  387. package/dist/components/utility/diff-view/diff-view.styles.js +0 -14
  388. package/dist/components/utility/export-button/export-button.styles.js +0 -22
  389. package/dist/components/utility/icon/icon.styles.js +0 -6
  390. package/dist/components/utility/json-viewer/json-viewer.styles.js +2 -48
  391. package/dist/components/utility/known-date/known-date.class.d.ts +7 -3
  392. package/dist/components/utility/known-date/known-date.styles.js +10 -51
  393. package/dist/components/utility/live-region/live-region.styles.js +0 -4
  394. package/dist/components/utility/mention-popover/mention-popover.styles.js +0 -25
  395. package/dist/components/utility/poll-status/poll-status.styles.js +0 -4
  396. package/dist/components/utility/random-content/random-content.class.d.ts +22 -0
  397. package/dist/components/utility/random-content/random-content.class.js +3 -2
  398. package/dist/components/utility/random-content/random-content.styles.js +6 -13
  399. package/dist/components/utility/tour/tour.class.d.ts +4 -2
  400. package/dist/components/utility/tour/tour.class.js +3 -3
  401. package/dist/components/utility/tour/tour.styles.js +0 -13
  402. package/dist/components/utility/visually-hidden/visually-hidden.styles.js +0 -5
  403. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  404. package/dist/components/viewers/archive-viewer/archive-viewer.styles.d.ts +2 -2
  405. package/dist/components/viewers/archive-viewer/archive-viewer.styles.js +0 -10
  406. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
  407. package/dist/components/viewers/csv-viewer/csv-viewer.styles.js +0 -19
  408. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
  409. package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +0 -15
  410. package/dist/components/viewers/document-compare/document-compare.styles.js +0 -3
  411. package/dist/components/viewers/document-preview/document-preview.styles.js +0 -25
  412. package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +2 -1
  413. package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
  414. package/dist/components/viewers/document-viewer/document-viewer.styles.js +0 -5
  415. package/dist/components/viewers/docx-viewer/docx-viewer.styles.js +0 -17
  416. package/dist/components/viewers/ebook-viewer/ebook-viewer.styles.js +0 -4
  417. package/dist/components/viewers/email-viewer/email-viewer.styles.js +0 -7
  418. package/dist/components/viewers/geojson-view/geojson-view.styles.js +0 -5
  419. package/dist/components/viewers/highlight-layer/highlight-layer.styles.js +0 -3
  420. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
  421. package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +0 -38
  422. package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
  423. package/dist/components/viewers/page-rail/page-rail.styles.js +0 -13
  424. package/dist/components/viewers/pdf-viewer/pdf-loader.d.ts +13 -2
  425. package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
  426. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +32 -2
  427. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
  428. package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -27
  429. package/dist/components/viewers/pptx-viewer/pptx-viewer.styles.js +0 -3
  430. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
  431. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.styles.js +0 -14
  432. package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +0 -7
  433. package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +2 -24
  434. package/dist/custom-elements-jsx.d.ts +72 -40
  435. package/dist/events.d.ts +43 -33
  436. package/dist/internal/agent-status-variants.d.ts +18 -0
  437. package/dist/internal/agent-status-variants.js +1 -0
  438. package/dist/internal/announcer.d.ts +8 -3
  439. package/dist/internal/announcer.js +1 -1
  440. package/dist/internal/autoloader-manifest.js +1 -1
  441. package/dist/internal/canvas-color.d.ts +16 -0
  442. package/dist/internal/canvas-color.js +1 -1
  443. package/dist/internal/catalog-picker.d.ts +0 -1
  444. package/dist/internal/catalog-picker.js +1 -1
  445. package/dist/internal/default-strings.generated.d.ts +1 -0
  446. package/dist/internal/default-strings.generated.js +1 -1
  447. package/dist/internal/dev-mode-attribute-warning.d.ts +27 -4
  448. package/dist/internal/dev-mode-attribute-warning.js +1 -1
  449. package/dist/internal/localization-runtime.js +1 -1
  450. package/dist/internal/localization-types.d.ts +1 -1
  451. package/dist/internal/localization.js +1 -1
  452. package/dist/internal/lyra-element.d.ts +13 -0
  453. package/dist/internal/lyra-element.js +1 -1
  454. package/dist/internal/media-controller.js +1 -1
  455. package/dist/internal/package-metadata.d.ts +1 -1
  456. package/dist/internal/package-metadata.js +1 -1
  457. package/dist/internal/scroll-overflow.d.ts +35 -13
  458. package/dist/internal/scroll-overflow.js +1 -1
  459. package/dist/internal/sizes.styles.js +0 -2
  460. package/dist/internal/specialist-tokens.styles.js +6 -11
  461. package/dist/internal/text-highlights.d.ts +4 -1
  462. package/dist/internal/text-highlights.js +1 -1
  463. package/dist/internal/tokens/palette.styles.js +0 -15
  464. package/dist/internal/tokens.styles.js +20 -113
  465. package/dist/lyra.d.ts +9 -6
  466. package/dist/styles/reservations.css +82 -0
  467. package/dist/svelte.d.ts +72 -40
  468. package/dist/translations/ar.js +1 -1
  469. package/dist/translations/de.js +1 -1
  470. package/dist/translations/es.js +1 -1
  471. package/dist/translations/fa.js +1 -1
  472. package/dist/translations/fr.js +1 -1
  473. package/dist/translations/he.js +1 -1
  474. package/dist/translations/ja.js +1 -1
  475. package/dist/translations/pt-BR.js +1 -1
  476. package/dist/translations/ru.js +1 -1
  477. package/dist/translations/zh-CN.js +1 -1
  478. package/dist/vue.d.ts +72 -40
  479. package/llms/components/lr-accordion-item.md +12 -3
  480. package/llms/components/lr-accordion.md +11 -2
  481. package/llms/components/lr-agent-eval-dashboard.md +1 -1
  482. package/llms/components/lr-agent-trace.md +3 -1
  483. package/llms/components/lr-agent-workspace.md +20 -0
  484. package/llms/components/lr-artifact-panel.md +10 -4
  485. package/llms/components/lr-attachment-chip.md +7 -4
  486. package/llms/components/lr-attachment-trigger.md +7 -4
  487. package/llms/components/lr-av-player.md +3 -1
  488. package/llms/components/lr-avatar.md +6 -6
  489. package/llms/components/lr-bar-chart.md +8 -6
  490. package/llms/components/lr-box-plot.md +15 -4
  491. package/llms/components/lr-browser-frame.md +7 -3
  492. package/llms/components/lr-bubble-chart.md +8 -6
  493. package/llms/components/lr-calendar.md +9 -2
  494. package/llms/components/lr-card.md +24 -0
  495. package/llms/components/lr-chart.md +45 -11
  496. package/llms/components/lr-chat-viewport.md +7 -2
  497. package/llms/components/lr-checkbox-group.md +13 -5
  498. package/llms/components/lr-checkbox.md +5 -2
  499. package/llms/components/lr-checkpoint.md +6 -2
  500. package/llms/components/lr-combobox.md +47 -8
  501. package/llms/components/lr-command-palette.md +4 -1
  502. package/llms/components/lr-confirm-bar.md +7 -3
  503. package/llms/components/lr-context-meter.md +12 -11
  504. package/llms/components/lr-conversation-item.md +7 -4
  505. package/llms/components/lr-date-input.md +22 -2
  506. package/llms/components/lr-date-picker.md +23 -3
  507. package/llms/components/lr-details.md +11 -2
  508. package/llms/components/lr-dialog.md +16 -10
  509. package/llms/components/lr-dock-panel.md +7 -10
  510. package/llms/components/lr-document-preview.md +6 -1
  511. package/llms/components/lr-document-viewer.md +3 -2
  512. package/llms/components/lr-doughnut-chart.md +8 -6
  513. package/llms/components/lr-drawer.md +3 -3
  514. package/llms/components/lr-entity-card.md +3 -3
  515. package/llms/components/lr-entity-chip.md +1 -1
  516. package/llms/components/lr-entity-dossier.md +4 -1
  517. package/llms/components/lr-file-input.md +2 -2
  518. package/llms/components/lr-flag.md +30 -8
  519. package/llms/components/lr-heatmap.md +46 -0
  520. package/llms/components/lr-histogram.md +7 -4
  521. package/llms/components/lr-icon.md +1 -1
  522. package/llms/components/lr-json-schema-viewer.md +2 -1
  523. package/llms/components/lr-knowledge-graph-explorer.md +8 -3
  524. package/llms/components/lr-known-date.md +4 -2
  525. package/llms/components/lr-line-chart.md +8 -6
  526. package/llms/components/lr-lite-chart.md +16 -6
  527. package/llms/components/lr-map.md +91 -10
  528. package/llms/components/lr-markdown-core.md +3 -2
  529. package/llms/components/lr-media-card.md +28 -12
  530. package/llms/components/lr-message-parts.md +2 -1
  531. package/llms/components/lr-model-select.md +9 -10
  532. package/llms/components/lr-model-settings-panel.md +9 -9
  533. package/llms/components/lr-neighbor-list.md +1 -1
  534. package/llms/components/lr-notebook-viewer.md +6 -3
  535. package/llms/components/lr-option.md +46 -7
  536. package/llms/components/lr-pdf-viewer.md +62 -2
  537. package/llms/components/lr-pie-chart.md +8 -6
  538. package/llms/components/lr-polar-area-chart.md +8 -6
  539. package/llms/components/lr-popover.md +25 -1
  540. package/llms/components/lr-progress-ring.md +8 -1
  541. package/llms/components/lr-prompt-studio.md +1 -1
  542. package/llms/components/lr-provenance-panel.md +4 -2
  543. package/llms/components/lr-qr-code.md +1 -1
  544. package/llms/components/lr-radar-chart.md +8 -6
  545. package/llms/components/lr-rag-eval-dashboard.md +2 -2
  546. package/llms/components/lr-random-content.md +13 -0
  547. package/llms/components/lr-reorder-item.md +6 -1
  548. package/llms/components/lr-reorder-list.md +6 -1
  549. package/llms/components/lr-responsive-panel.md +11 -7
  550. package/llms/components/lr-scatter-chart.md +8 -6
  551. package/llms/components/lr-sequence-strip.md +16 -2
  552. package/llms/components/lr-slider.md +12 -5
  553. package/llms/components/lr-sparkline.md +1 -1
  554. package/llms/components/lr-suggestion-chips.md +7 -2
  555. package/llms/components/lr-swatch-picker.md +5 -5
  556. package/llms/components/lr-switch.md +5 -2
  557. package/llms/components/lr-table.md +30 -4
  558. package/llms/components/lr-terminal.md +3 -1
  559. package/llms/components/lr-thread-list.md +8 -8
  560. package/llms/components/lr-time-input.md +6 -1
  561. package/llms/components/lr-timeline-item.md +24 -0
  562. package/llms/components/lr-timeline.md +25 -1
  563. package/llms/components/lr-token-input.md +7 -2
  564. package/llms/components/lr-tool-approval-dialog.md +7 -8
  565. package/llms/components/lr-tool-call-chip.md +5 -1
  566. package/llms/components/lr-tool-param-form.md +14 -12
  567. package/llms/components/lr-tool-result-dialog.md +11 -9
  568. package/llms/components/lr-tool-result-view.md +7 -6
  569. package/llms/components/lr-tool-select-dialog.md +18 -16
  570. package/llms/components/lr-trace-tree.md +3 -1
  571. package/llms/components/lr-usage-badge.md +4 -1
  572. package/llms/components/lr-video-playlist.md +1 -1
  573. package/llms/components/lr-virtual-list.md +22 -14
  574. package/llms/components/lr-voice-picker.md +8 -5
  575. package/llms/components/lr-widget-renderer.md +3 -3
  576. package/llms/components/lr-widget.md +1 -1
  577. package/llms/components/lr-word-cloud.md +6 -2
  578. package/llms/peers.md +12 -2
  579. package/llms/shared.md +70 -2
  580. package/llms/tokens.md +15 -1
  581. package/llms-full.txt +1335 -306
  582. package/package.json +17 -5
  583. package/vscode-css-data.json +93 -2
  584. package/vscode-html-data.json +513 -59
  585. package/web-types.json +457 -72
@@ -1,6 +1,7 @@
1
1
  import { type TemplateResult, type PropertyValues } from 'lit';
2
2
  import type { Feature, FeatureCollection } from 'geojson';
3
3
  import { LyraElement } from '../../../internal/lyra-element.js';
4
+ import { type MapLibreGeoJsonDiff } from './map-loader.js';
4
5
  import '../../overlays/skeleton/skeleton.class.js';
5
6
  /** Non-color encoding retained when a legend entry's authored color is unavailable. */
6
7
  export type LyraMapLegendPattern = 'solid' | 'diagonal' | 'dots' | 'crosshatch';
@@ -10,6 +11,12 @@ export interface LyraMapLegendEntry {
10
11
  readonly label: string;
11
12
  readonly pattern: LyraMapLegendPattern;
12
13
  }
14
+ /**
15
+ * One `[value, color]` stop of a continuous legend ramp — deliberately the same shape as
16
+ * `LyraMapChoroplethLayer['stops']`, so a consumer passes the choropleth's own stops straight
17
+ * through instead of maintaining a second copy that drifts from the layer it describes.
18
+ */
19
+ export type LyraMapLegendGradientStop = readonly [number, string];
13
20
  /** Observable result of normalizing the latest `legend` assignment. */
14
21
  export interface LyraMapLegendProjection {
15
22
  readonly inputCount: number;
@@ -33,7 +40,41 @@ export interface LyraMapChoroplethLayer {
33
40
  * layer, if any, is left as-is) rather than applied.
34
41
  */
35
42
  readonly stops: readonly (readonly [number, string])[];
43
+ /**
44
+ * How the fill color is interpolated between `stops`. `'linear'` (the default, and the only
45
+ * previous behavior) spaces the ramp evenly in value; `'logarithmic'` compresses it, which is
46
+ * what a heavy-tailed quantity — price, population, income — needs. On a linear ramp every value
47
+ * below the maximum falls into the first color band, so the map reads as one flat color plus a
48
+ * couple of outliers.
49
+ *
50
+ * This exposes an existing maplibre-gl capability rather than adding one: it emits
51
+ * `['interpolate', ['exponential', base], …]`, whose sub-1 base yields the logarithmic-style
52
+ * compression. Crucially, `stops` stay in the data's own units either way, so the legend keeps
53
+ * reading in real values instead of log units.
54
+ */
55
+ readonly interpolation?: LyraMapChoroplethInterpolation;
56
+ /**
57
+ * Color for values BELOW the first `stops` threshold, used only when `interpolation` is
58
+ * `'step'` — maplibre's `['step', …]` requires that base output before its first threshold.
59
+ *
60
+ * Defaults to the first stop's own color, which makes the common case (a legend whose first band
61
+ * starts at the data's minimum) need no extra configuration. Set it when the map should
62
+ * distinguish "below the lowest advertised band" from the lowest band itself.
63
+ */
64
+ readonly stepBaseColor?: string;
36
65
  }
66
+ /**
67
+ * How a choropleth's fill color is derived from its stops.
68
+ *
69
+ * `'linear'` and `'logarithmic'` both emit a maplibre `['interpolate', …]` expression, producing a
70
+ * continuous ramp. `'step'` emits `['step', …]` instead, giving DISCRETE bands.
71
+ *
72
+ * A continuous ramp is wrong whenever the legend advertises a fixed set of ranges with one swatch
73
+ * each: it puts colors on the map that appear nowhere in the legend, and renders two regions in the
74
+ * same advertised band as visibly different colors. `legendGradient` covers the opposite case (a
75
+ * gradient legend) but could not express this one.
76
+ */
77
+ export type LyraMapChoroplethInterpolation = 'linear' | 'logarithmic' | 'step';
37
78
  /** One GeoJSON source rendered as three layers (`${sourceId}-fill` for polygons, `${sourceId}-line`
38
79
  * for lines/outlines, `${sourceId}-circle` for points). Colors resolve from `--lr-*` tokens at
39
80
  * apply time, defaulting to `accent`. */
@@ -43,6 +84,24 @@ export interface LyraMapGeoJsonDataLayer {
43
84
  readonly sourceId: string;
44
85
  readonly geojson: Feature | FeatureCollection;
45
86
  readonly tone?: 'accent' | 'success' | 'warning' | 'danger' | 'neutral';
87
+ /**
88
+ * Explicit fill color, overriding `tone` for the polygon fill only. Any CSS color, including a
89
+ * `var(--lr-…)` reference.
90
+ *
91
+ * Exists because a fill and its outline want opposite things on a choropleth-plus-overlay map,
92
+ * and the difference is measurable rather than aesthetic: the fill competes for area with the
93
+ * choropleth beside it, so it has to sit quiet, while the 1px outline competes with nothing and
94
+ * is the only thing keeping a no-data region's shape readable once the fill is that faint.
95
+ * Deriving one from the other put a real case at 1.41:1 against a light basemap — under WCAG
96
+ * 1.4.11's 3:1 floor for graphical objects — leaving the region indistinguishable from bare
97
+ * basemap.
98
+ */
99
+ readonly color?: string;
100
+ /**
101
+ * Explicit line/outline color, overriding `tone` for the `-line` and `-circle` layers. Falls back
102
+ * to `color`, then to `tone`. See `color` for why these are separable.
103
+ */
104
+ readonly strokeColor?: string;
46
105
  }
47
106
  export interface LyraMapMarker {
48
107
  /** Optional explicit business identity. Explicit IDs are trimmed and must be nonempty; the
@@ -89,12 +148,52 @@ export interface LyraMapInstance {
89
148
  setCenter(center: [number, number]): unknown;
90
149
  setZoom(zoom: number): unknown;
91
150
  resize(): unknown;
151
+ /**
152
+ * Deliberately `unknown` rather than `LyraMapBounds | null`. This interface is the peer-neutral
153
+ * surface the real maplibre `Map` must structurally satisfy, and maplibre spells this parameter
154
+ * `LngLatBoundsLike | null` — a union of a `LngLatBounds` class instance, a mutable
155
+ * `[LngLatLike, LngLatLike]` pair and a flat `[number, number, number, number]`. `LyraMapBounds`
156
+ * is a *readonly* tuple, so it is assignable to none of them, and the class instance is assignable
157
+ * to no tuple; with neither direction related, even method bivariance cannot bridge it and
158
+ * `MapLibreMap extends LyraMapInstance` silently becomes false. Restating maplibre's union here
159
+ * would mean importing its types into the peer-neutral layer, which is the one thing this
160
+ * interface exists to avoid. The component's own call site stays typed: it only ever passes
161
+ * `safeMaxBounds`, which is `LyraMapBounds | null`.
162
+ */
163
+ setMaxBounds?(bounds?: unknown): unknown;
92
164
  }
165
+ /** A pan-constraining box, `[[west, south], [east, north]]`, in the order maplibre-gl takes. */
166
+ export type LyraMapBounds = readonly [
167
+ readonly [number, number],
168
+ readonly [number, number]
169
+ ];
170
+ /**
171
+ * Builds a maplibre-gl `updateData()` diff when `next` differs from `previous` only in feature
172
+ * properties, and returns `null` otherwise so the caller replaces the whole source instead.
173
+ *
174
+ * `setData()` unconditionally re-tiles and repaints an entire source with no diffing. That is
175
+ * invisible on a static map and expensive on an animated one: advancing a choropleth a step every
176
+ * few hundred milliseconds re-tiles every polygon each time, when all that changed were the values
177
+ * driving the colour ramp.
178
+ *
179
+ * Deliberately strict about what counts as "geometry unchanged": geometries must be the *same
180
+ * object*, not merely deep-equal. Structurally comparing polygon rings would cost on the order of
181
+ * the re-tile this exists to avoid, and a false positive here paints stale geometry -- a visibly
182
+ * wrong map -- whereas a false negative merely takes the old path. An animation that reuses its
183
+ * geometry across frames, which is the efficient way to build one anyway, hits the fast path.
184
+ */
185
+ export declare function buildGeoJsonPropertyDiff(previous: unknown, next: unknown): MapLibreGeoJsonDiff | null;
93
186
  export interface LyraMapEventMap {
94
187
  'lr-map-load': CustomEvent<null>;
95
188
  'lr-map-click': CustomEvent<{
96
189
  readonly lngLat: readonly [number, number];
97
190
  readonly feature: Feature | undefined;
191
+ /** Which layer `feature` was hit on, so a click is attributable when both a choropleth and
192
+ * `dataLayers` are painted. `undefined` whenever `feature` is. */
193
+ readonly origin: 'choropleth' | 'data-layer' | undefined;
194
+ /** The authored `dataLayers[].sourceId` the hit belongs to; `undefined` for a choropleth hit
195
+ * (which has only one possible source) and when nothing was hit. */
196
+ readonly sourceId: string | undefined;
98
197
  }>;
99
198
  }
100
199
  /**
@@ -128,13 +227,20 @@ export interface LyraMapEventMap {
128
227
  *
129
228
  * @customElement lr-map
130
229
  * @event lr-map-load - Fired once the underlying maplibregl.Map loads.
131
- * @event lr-map-click - `detail: { lngLat, feature? }`.
230
+ * @event lr-map-click - `detail: { lngLat, feature?, origin?, sourceId? }`. `feature` resolves
231
+ * against the choropleth fill *and* every applied `dataLayers` fill/line/circle layer, topmost
232
+ * first; `origin`/`sourceId` name where it came from.
132
233
  * @csspart base - The non-semantic map wrapper. It exposes `aria-busy="true"` while the optional
133
234
  * map library loads and contains ordinary, non-live localized loading text.
134
235
  * @csspart container - The MapLibre container. Its generated canvas is the actual focusable map
135
236
  * region and receives the host-first accessible name and effective locale.
237
+ * @slot legend - Custom legend content, rendered inside the legend panel's own layout so it stays
238
+ * positioned with the map instead of floating beside it.
136
239
  * @csspart legend - The map legend.
137
240
  * @csspart legend-swatch - A legend color swatch.
241
+ * @csspart legend-gradient - The continuous ramp bar rendered from `legendGradient`.
242
+ * @csspart legend-lo - The low endpoint caption of the `legendGradient` bar (mirrors `lr-heatmap`).
243
+ * @csspart legend-hi - The high endpoint caption of the `legendGradient` bar (mirrors `lr-heatmap`).
138
244
  * @csspart legend-limit - Visible localized summary when legend input is bounded or shortened.
139
245
  * @csspart marker - A MapLibre-generated marker, with a 24px minimum target in both axes even
140
246
  * when a peer/custom marker has no intrinsic content size.
@@ -182,6 +288,18 @@ export declare class LyraMap extends LyraElement<LyraMapEventMap> {
182
288
  center: readonly [number, number];
183
289
  /** Initial and controlled map zoom level. */
184
290
  zoom: number;
291
+ /**
292
+ * Box the map may not pan outside, `[[west, south], [east, north]]`, or `null` for unconstrained.
293
+ *
294
+ * Exists because reaching for `map.setMaxBounds()` through the `.map` escape hatch can wedge
295
+ * maplibre-gl: at a sub-1 fractional zoom in a wide container, constraining to the full world box
296
+ * has been observed to leave `getZoom()` returning `null` permanently, after which every frame
297
+ * throws from inside the peer's own matrix math and the canvas never paints again -- a blank map,
298
+ * with nothing thrown at the call site to attribute it to. Going through this property applies
299
+ * the same call, then checks the camera survived it and reverts if it did not, so the worst case
300
+ * is an unconstrained map plus a dev-mode warning rather than a blank one.
301
+ */
302
+ maxBounds: LyraMapBounds | null;
185
303
  /** Required MapLibre style URL or peer-neutral style specification. No provider is contacted
186
304
  * unless a consumer assigns this property. */
187
305
  mapStyle?: Readonly<LyraMapStyleSpecification> | string;
@@ -191,6 +309,37 @@ export declare class LyraMap extends LyraElement<LyraMapEventMap> {
191
309
  * category identity available when authored colors collapse or are unavailable. */
192
310
  get legend(): readonly LyraMapLegendEntry[];
193
311
  set legend(value: readonly LyraMapLegendEntry[]);
312
+ /**
313
+ * Whether a consumer supplied `slot="legend"` content, so the panel renders for it alone.
314
+ *
315
+ * Seeded from the light DOM rather than from the slot's own `slotchange`: the slot lives INSIDE
316
+ * the legend panel, so a panel gated on slotchange could never render the slot that would fire
317
+ * it. `slotchange` still runs afterwards to track content added or removed later.
318
+ */
319
+ private hasLegendSlot;
320
+ /** Light-DOM probe for slotted legend content, valid before the slot itself has ever rendered. */
321
+ private probeLegendSlot;
322
+ private _legendGradient;
323
+ /**
324
+ * Renders the legend as a **continuous** gradient bar with endpoint labels instead of (or
325
+ * alongside) the discrete `legend` swatches — the standard key for a choropleth, whose
326
+ * `interpolate` fill is itself a continuous ramp that discrete rows cannot honestly describe.
327
+ *
328
+ * Takes the same `[value, color]` stop shape as `choropleth.stops`, so the usual assignment is
329
+ * `legendGradient = myChoropleth.stops` and the key cannot drift from the layer it describes.
330
+ * Stops are sorted ascending, bounded, and filtered to finite values carrying a CSS-parsable
331
+ * color; fewer than two usable stops render no bar at all, since a one-stop "gradient" is a flat
332
+ * block that describes nothing. Unset (the default) renders exactly today's markup.
333
+ *
334
+ * Endpoint labels default to this component's locale-aware formatting of the lowest and highest
335
+ * stop values; `legendGradientLoLabel`/`legendGradientHiLabel` override them.
336
+ */
337
+ get legendGradient(): readonly (readonly [number, string])[];
338
+ set legendGradient(value: readonly (readonly [number, string])[]);
339
+ /** Overrides the low endpoint's caption; defaults to the lowest stop value, locale-formatted. */
340
+ legendGradientLoLabel: string | null;
341
+ /** Overrides the high endpoint's caption; defaults to the highest stop value, locale-formatted. */
342
+ legendGradientHiLabel: string | null;
194
343
  /** Counts from the latest bounded legend normalization. `truncated` covers omitted rows or
195
344
  * shortened labels; the returned record is frozen and never aliases caller input. */
196
345
  get legendProjection(): LyraMapLegendProjection;
@@ -224,6 +373,9 @@ export declare class LyraMap extends LyraElement<LyraMapEventMap> {
224
373
  private _appliedChoroplethSourceId?;
225
374
  private _appliedFillLayerId?;
226
375
  private _appliedDataLayerIds;
376
+ /** Last GeoJSON applied per resolved source id, so an update can be diffed against it rather
377
+ * than replacing the whole source. Holds a reference, not a copy -- it is only ever compared. */
378
+ private _appliedGeoJson;
227
379
  private _nextDataLayerId;
228
380
  private _maplibreModule?;
229
381
  /** True only after WebGL2 has been proved in the current owner-document realm. */
@@ -241,6 +393,24 @@ export declare class LyraMap extends LyraElement<LyraMapEventMap> {
241
393
  * subset so consumers do not acquire a mandatory `maplibre-gl` type dependency. Consumers that
242
394
  * install the optional peer may explicitly narrow this value to its full `Map` type. */
243
395
  get map(): LyraMapInstance | undefined;
396
+ /** Pushes `geojson` into an existing source, preferring an incremental property update over a
397
+ * whole-source replace. `setData()` always re-tiles everything; `updateData()` (maplibre-gl 3+)
398
+ * does not, which is the difference between a smooth animated choropleth and a heavy one. */
399
+ private pushGeoJson;
400
+ /** Normalized `maxBounds`, or `null` when unset or unusable. Rejects rather than clamps a
401
+ * malformed box: a silently corrected constraint is harder to debug than none at all. */
402
+ private get safeMaxBounds();
403
+ /**
404
+ * Applies `maxBounds`, then verifies the peer's camera survived it.
405
+ *
406
+ * maplibre-gl constrains the camera when bounds are set, and that constrain pass can leave the
407
+ * transform in a state where `getZoom()` returns a non-number; from then on the map throws every
408
+ * frame from inside its own matrix math and never paints. There is no exception at the call site
409
+ * to catch, so the only reliable signal is to read the camera back afterwards. If it did not
410
+ * survive, drop the constraint and restore the camera -- an unconstrained map is a far smaller
411
+ * defect than a blank one -- and say so once, naming the property.
412
+ */
413
+ private applyMaxBounds;
244
414
  /** `zoom` normalized to a finite value clamped into `[0, 22]` -- maplibre-gl's own default
245
415
  * `minZoom`/`maxZoom` (this component passes neither option to `new maplibregl.Map()`, so
246
416
  * those are the bounds the underlying map itself enforces). A non-finite value would otherwise
@@ -305,6 +475,13 @@ export declare class LyraMap extends LyraElement<LyraMapEventMap> {
305
475
  private syncMapSemantics;
306
476
  private formatCount;
307
477
  private legendLimitText;
478
+ private onLegendSlotChange;
479
+ /**
480
+ * The continuous gradient bar plus its two endpoint captions, or nothing when `legendGradient`
481
+ * holds fewer than two usable stops. Part names mirror `lr-heatmap`'s
482
+ * `legend-lo`/`legend-hi` so a consumer styling both components learns one vocabulary.
483
+ */
484
+ private renderLegendGradient;
308
485
  render(): TemplateResult;
309
486
  }
310
487
  declare global {
@@ -1,4 +1,14 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{notifyMapCanvasReady}from"../../../internal/map-canvas-ready.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{srOnly}from"../../../internal/a11y.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{loadMaplibre}from"./map-loader.js";import{styles}from"./map.styles.js";import"../../overlays/skeleton/skeleton.class.js";import{LYRA_DEFAULT_close,LYRA_DEFAULT_items,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_mapInitializationFailed,LYRA_DEFAULT_mapLegend,LYRA_DEFAULT_mapMissingLibrary,LYRA_DEFAULT_mapStyleRequired,LYRA_DEFAULT_mapWebglUnavailable,LYRA_DEFAULT_paginationSummary}from"../../../internal/default-strings.generated.js";function supportsWebGL2(host){try{return host.ownerDocument.createElement("canvas").getContext("webgl2")!==null}catch{return!1}}function hasMapStyle(style){return typeof style=="string"?style.trim().length>0:style!==void 0}const MAP_LEGEND_ITEM_LIMIT=100,MAP_LEGEND_SCAN_LIMIT=1e3,MAP_LEGEND_LABEL_LIMIT=256,MAP_LEGEND_TOTAL_LABEL_LIMIT=8192,MAP_LEGEND_COLOR_LIMIT=256,MAP_LEGEND_PATTERNS=new Set(["solid","diagonal","dots","crosshatch"]),EMPTY_MAP_LEGEND=Object.freeze([]),EMPTY_MAP_LEGEND_PROJECTION=Object.freeze({inputCount:0,renderedCount:0,omittedCount:0,truncatedLabelCount:0,truncated:!1});function boundedLegendText(value,limit){return value.length<=limit?value:`${value.slice(0,Math.max(0,limit-1))}\u2026`}function normalizeMapLegend(value){let input;try{input=Array.isArray(value)?value:[]}catch{input=[]}let inputCount=0;try{inputCount=Math.max(0,Math.min(Number.MAX_SAFE_INTEGER,input.length))}catch{inputCount=0}const entries=[];let labelCharacters=0,truncatedLabelCount=0;const scanCount=Math.min(inputCount,MAP_LEGEND_SCAN_LIMIT);for(let index=0;index<scanCount&&entries.length<MAP_LEGEND_ITEM_LIMIT;index++)try{const candidate=input[index];if(!candidate||typeof candidate!="object")continue;const rawColor=candidate.color,rawLabel=candidate.label,rawPattern=candidate.pattern;if(typeof rawColor!="string"||typeof rawLabel!="string"||typeof rawPattern!="string"||!MAP_LEGEND_PATTERNS.has(rawPattern))continue;const remaining=MAP_LEGEND_TOTAL_LABEL_LIMIT-labelCharacters;if(remaining<=0)break;const labelLimit=Math.min(MAP_LEGEND_LABEL_LIMIT,remaining),label=boundedLegendText(rawLabel,labelLimit);if(!label.trim())continue;rawLabel.length>labelLimit&&truncatedLabelCount++,labelCharacters+=label.length,entries.push(Object.freeze({color:rawColor.slice(0,MAP_LEGEND_COLOR_LIMIT),label,pattern:rawPattern}))}catch{}const frozenEntries=entries.length?Object.freeze(entries):EMPTY_MAP_LEGEND,omittedCount=Math.max(0,inputCount-frozenEntries.length),projection=Object.freeze({inputCount,renderedCount:frozenEntries.length,omittedCount,truncatedLabelCount,truncated:omittedCount>0||truncatedLabelCount>0});return{entries:frozenEntries,projection}}function addPartToken(element,token){const tokens=new Set((element.getAttribute("part")??"").split(/\s+/).filter(Boolean));tokens.add(token),element.setAttribute("part",[...tokens].join(" "))}const MAX_MAP_MARKERS=2e3;function popupText(host,markup){const template=host.ownerDocument.createElement("template");template.innerHTML=markup;for(const hidden of template.content.querySelectorAll('script, style, template, [hidden], [aria-hidden="true"]'))hidden.remove();return(template.content.textContent??"").replace(/\s+/gu," ").trim()}const MAX_MAP_DATA_LAYERS=100;function normalizedDataLayers(value){if(!Array.isArray(value))return[];const output=[],seenSourceIds=new Set,scanCount=Math.min(value.length,MAX_MAP_DATA_LAYERS);for(let index=0;index<scanCount;index++){const candidate=value[index];try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const rawSourceId=candidate.sourceId;if(typeof rawSourceId!="string")continue;const sourceId=rawSourceId.trim();if(sourceId.length===0||seenSourceIds.has(sourceId))continue;seenSourceIds.add(sourceId),output.push(rawSourceId===sourceId?candidate:{...candidate,sourceId})}catch{}}return output}const FALLBACK_FILL_OPACITY=.75;function ownerWindow(host){return host.ownerDocument?.defaultView??null}function choroplethFillOpacity(host){const raw=ownerWindow(host)?.getComputedStyle(host).getPropertyValue("--lr-map-choropleth-fill-opacity").trim()??"",parsed=Number.parseFloat(raw);return Number.isFinite(parsed)?parsed:FALLBACK_FILL_OPACITY}const TONE_TOKEN={accent:"--lr-color-brand",success:"--lr-color-success",warning:"--lr-color-warning",danger:"--lr-color-danger",neutral:"--lr-color-text-quiet"};function dataLayerColor(host,tone){const token=TONE_TOKEN[tone??"accent"];return(ownerWindow(host)?.getComputedStyle(host).getPropertyValue(token).trim()??"")||"#0969da"}class LyraMap extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close,items:LYRA_DEFAULT_items,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,mapInitializationFailed:LYRA_DEFAULT_mapInitializationFailed,mapLegend:LYRA_DEFAULT_mapLegend,mapMissingLibrary:LYRA_DEFAULT_mapMissingLibrary,mapStyleRequired:LYRA_DEFAULT_mapStyleRequired,mapWebglUnavailable:LYRA_DEFAULT_mapWebglUnavailable,paginationSummary:LYRA_DEFAULT_paginationSummary}}static{this.immutableEventDetails=Object.freeze(["lr-map-click"])}static{this.identityEventDetailProperties=Object.freeze({"lr-map-click":Object.freeze(["feature"])})}static{this.ownedCollectionProperties=Object.freeze(["center","mapStyle","choropleth","markers","dataLayers"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static preload(){return loadMaplibre().then(module=>module!==null)}constructor(){super(),this.center=[0,0],this.zoom=2,this._legend=EMPTY_MAP_LEGEND,this._legendProjection=EMPTY_MAP_LEGEND_PROJECTION,this.markers=[],this.dataLayers=[],this.label="",this.loading=!0,this.loadLibrary=loadMaplibre,this.visible=ownerWindow(this)?.IntersectionObserver===void 0,this._styleLoaded=!1,this._appliedDataLayerIds=new Map,this._nextDataLayerId=0,this._webglReady=!1,this._markerInstances=new Map,this._markerLabels=new Map,this._markerPopupIds=new Map,this._configuredPopups=new WeakSet,this._nextPopupId=0,this._markerColors=new Map,this._connectGeneration=0,this.configuredMarkerElements=new WeakSet,new ThemeWatcher(this,()=>this.refreshThemePaint())}get legend(){return this._legend}set legend(value){const previous=this._legend,normalized=normalizeMapLegend(value);this._legend=normalized.entries,this._legendProjection=normalized.projection,this.requestUpdate("legend",previous)}get legendProjection(){return this._legendProjection}get map(){return this._map}get safeZoom(){return finiteRange(this.zoom,2,0,22)}get safeCenter(){const center=Array.isArray(this.center)?this.center:[];return[finiteRange(Number(center[0]),0,-180,180),finiteRange(Number(center[1]),0,-90,90)]}connectedCallback(){super.connectedCallback(),this.syncErrorAnnouncementSink();const generation=++this._connectGeneration,IntersectionObserverCtor=ownerWindow(this)?.IntersectionObserver;if(this.visible=IntersectionObserverCtor===void 0,this.failure=void 0,this.loading=!0,this._webglReady=!1,IntersectionObserverCtor){const observer=new IntersectionObserverCtor(entries=>{entries[0]?.isIntersecting&&(this.visible=!0)});this.intersectionObserver=observer,observer.observe(this)}(async()=>{let mod;try{mod=await this.loadLibrary()}catch{generation===this._connectGeneration&&this.isConnected&&this.failInitialization("missing-peer");return}if(!(generation!==this._connectGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.failInitialization("missing-peer");return}if(this._maplibreModule=mod,!hasMapStyle(this.mapStyle)){this.failInitialization("style-required");return}if(!supportsWebGL2(this)){this.failInitialization("webgl-unavailable");return}this._webglReady=!0,await this.updateComplete,!(generation!==this._connectGeneration||!this.containerEl||!this.isConnected)&&this.tryConstructMap()}})()}disconnectedCallback(){this.releaseErrorAnnouncementSink(),super.disconnectedCallback(),this.disposeMap(),this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0;for(const marker of this._markerInstances.values())marker.remove();this._markerInstances.clear(),this._markerColors.clear(),this._markerLabels.clear(),this._markerPopupIds.clear()}failureMessage(reason=this.failure??"initialization-failed"){switch(reason){case"missing-peer":return this.localize("mapMissingLibrary");case"style-required":return this.localize("mapStyleRequired");case"webgl-unavailable":return this.localize("mapWebglUnavailable");case"initialization-failed":return this.localize("mapInitializationFailed")}}failInitialization(reason,partialMap){try{partialMap?.remove()}catch{}this.disposeMap(),this.loading=!1,this.failure=reason,this.errorAnnouncementSink?.announce(this.failureMessage(reason))}disposeMap(){this.stopObservingPeerChrome();try{this._map?.remove()}catch{}this._map=void 0,this._styleLoaded=!1,this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0,this._appliedDataLayerIds.clear()}adoptedCallback(){super.adoptedCallback(),this.stopObservingPeerChrome(),this.releaseErrorAnnouncementSink(),this.syncErrorAnnouncementSink()}syncErrorAnnouncementSink(){this.isConnected&&this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseErrorAnnouncementSink(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}releaseErrorAnnouncementSink(){this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0}tryConstructMap(){if(this._map||!this._maplibreModule||!this._webglReady||!this.containerEl||!this.visible||!this.isConnected)return;if(!hasMapStyle(this.mapStyle)){this.failInitialization("style-required");return}const mod=this._maplibreModule;let candidate;try{candidate=new mod.Map({container:this.containerEl,style:this.mapStyle,center:this.safeCenter,zoom:this.safeZoom,locale:{"Map.Title":this.effectiveMapLabel,"Marker.Title":this.localize("map"),"Popup.Close":this.localize("close")}}),candidate.on("error",event=>{if(this._map===candidate&&!this._styleLoaded){this.failInitialization("initialization-failed");return}console.error("lr-map:",event.error??event)}),candidate.on("load",()=>{if(this._map===candidate)try{this._styleLoaded=!0,this.applyChoropleth(),this.applyMarkers(),this.applyDataLayers(),this.emit("lr-map-load")}catch{this.failInitialization("initialization-failed")}}),candidate.on("click",event=>{if(this._map!==candidate)return;const fillLayerId=this._appliedFillLayerId,features=fillLayerId&&candidate.getLayer(fillLayerId)?candidate.queryRenderedFeatures(event.point,{layers:[fillLayerId]}):[];this.emit("lr-map-click",{lngLat:[event.lngLat.lng,event.lngLat.lat],feature:features[0]})});const canvas=candidate.getCanvas?.();canvas&&notifyMapCanvasReady(this,canvas),this._map=candidate,this.observePeerChrome(),this.failure=void 0}catch{this.failInitialization("initialization-failed",candidate)}}updated(changed){if(super.updated(changed),this.setAttribute("aria-busy",String(this.loading)),changed.has("visible")&&this.visible&&this.tryConstructMap(),changed.has("mapStyle")&&!hasMapStyle(this.mapStyle)&&this._maplibreModule)this.failInitialization("style-required");else if(changed.has("mapStyle")&&!this._map&&this._maplibreModule&&hasMapStyle(this.mapStyle))this.tryConstructMap();else if(changed.has("mapStyle")&&this._map){this._styleLoaded=!1,this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0;const map=this._map;try{map.once("style.load",()=>{if(this._map===map)try{this._styleLoaded=!0,this._appliedDataLayerIds.clear(),this.applyChoropleth(),this.applyDataLayers()}catch{this.scheduleAfterUpdate(()=>this.failInitialization("initialization-failed"),"map-style-failure")}}),map.setStyle(this.mapStyle)}catch{this.scheduleAfterUpdate(()=>this.failInitialization("initialization-failed"),"map-style-failure")}}else if(this._styleLoaded&&(changed.has("dataLayers")||changed.has("choropleth"))){const nextChoroplethSourceId=this.choropleth?this.resolveChoroplethSourceId(this.choropleth.sourceId):void 0;this._appliedChoroplethSourceId&&this._appliedChoroplethSourceId!==nextChoroplethSourceId&&this.removeChoropleth(),changed.has("dataLayers")&&this.applyDataLayers(),this.applyChoropleth()}changed.has("center")&&this._map&&this._map.setCenter(this.safeCenter),changed.has("zoom")&&this._map&&this._map.setZoom(this.safeZoom),changed.has("markers")&&this._map&&this.applyMarkers(),this.syncMapSemantics()}willUpdate(changed){super.willUpdate(changed),changed.has("mapStyle")&&!this._map&&this._maplibreModule&&hasMapStyle(this.mapStyle)&&(this._webglReady||(this._webglReady=supportsWebGL2(this)),this.failure=this._webglReady?void 0:"webgl-unavailable",this._webglReady||(this.loading=!1,this.errorAnnouncementSink?.announce(this.failureMessage("webgl-unavailable"))))}refreshThemePaint(){if(!this._map||!this._styleLoaded)return;const fillOpacity=choroplethFillOpacity(this);this._appliedFillLayerId&&this._map.setPaintProperty(this._appliedFillLayerId,"fill-opacity",fillOpacity);const dataLayersBySourceId=new Map(normalizedDataLayers(this.dataLayers).map(layer=>[layer.sourceId,layer]));for(const[publicSourceId,sourceId]of this._appliedDataLayerIds){const dataLayer=dataLayersBySourceId.get(publicSourceId);if(!dataLayer)continue;const color=dataLayerColor(this,dataLayer.tone);this._map.setPaintProperty(`${sourceId}-fill`,"fill-color",color),this._map.setPaintProperty(`${sourceId}-fill`,"fill-opacity",fillOpacity),this._map.setPaintProperty(`${sourceId}-line`,"line-color",color),this._map.setPaintProperty(`${sourceId}-circle`,"circle-color",color)}}applyChoropleth(){if(!this._map)return;if(!this.choropleth){this.removeChoropleth();return}const{geojson,field,stops}=this.choropleth,sourceId=this.resolveChoroplethSourceId(this.choropleth.sourceId),fillLayerId=`${sourceId}-fill`;this._appliedChoroplethSourceId&&this._appliedChoroplethSourceId!==sourceId&&this.removeChoropleth();const existingSource=this._map.getSource(sourceId);if(existingSource?existingSource.setData(geojson):this._map.addSource(sourceId,{type:"geojson",data:geojson}),this._appliedChoroplethSourceId=sourceId,stops.length===0)return;const colorExpr=["interpolate",["linear"],["get",field]];for(const[value,color]of stops)colorExpr.push(value,color);this._map.getLayer(fillLayerId)?(this._map.setPaintProperty(fillLayerId,"fill-color",colorExpr),this._map.setPaintProperty(fillLayerId,"fill-opacity",choroplethFillOpacity(this))):this._map.addLayer({id:fillLayerId,type:"fill",source:sourceId,paint:{"fill-color":colorExpr,"fill-opacity":choroplethFillOpacity(this)}}),this._appliedFillLayerId=fillLayerId}resolveChoroplethSourceId(sourceId){const dataSourceIds=new Set(normalizedDataLayers(this.dataLayers).map(layer=>layer.sourceId));let resolved=sourceId;for(;dataSourceIds.has(resolved);)resolved=`lr-choropleth-${resolved}`;return resolved}removeChoropleth(){!this._map||!this._appliedChoroplethSourceId||(this._appliedFillLayerId&&this._map.getLayer(this._appliedFillLayerId)&&this._map.removeLayer(this._appliedFillLayerId),this._map.getSource(this._appliedChoroplethSourceId)&&this._map.removeSource(this._appliedChoroplethSourceId),this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0)}applyDataLayers(){if(!this._map)return;const layers=normalizedDataLayers(this.dataLayers),nextIds=new Set(layers.map(layer=>layer.sourceId));for(const publicSourceId of this._appliedDataLayerIds.keys())nextIds.has(publicSourceId)||this.removeDataLayer(publicSourceId);for(const layer of layers){const{sourceId:publicSourceId,geojson,tone}=layer,sourceId=this.resolveDataLayerSourceId(publicSourceId),existingSource=this._map.getSource(sourceId);existingSource?existingSource.setData(geojson):this._map.addSource(sourceId,{type:"geojson",data:geojson});const color=dataLayerColor(this,tone),fillId=`${sourceId}-fill`,lineId=`${sourceId}-line`,circleId=`${sourceId}-circle`;this._map.getLayer(fillId)?(this._map.setPaintProperty(fillId,"fill-color",color),this._map.setPaintProperty(fillId,"fill-opacity",choroplethFillOpacity(this))):this._map.addLayer({id:fillId,type:"fill",source:sourceId,filter:["==",["geometry-type"],"Polygon"],paint:{"fill-color":color,"fill-opacity":choroplethFillOpacity(this)}}),this._map.getLayer(lineId)?this._map.setPaintProperty(lineId,"line-color",color):this._map.addLayer({id:lineId,type:"line",source:sourceId,filter:["in",["geometry-type"],["literal",["LineString","Polygon"]]],paint:{"line-color":color,"line-width":2}}),this._map.getLayer(circleId)?this._map.setPaintProperty(circleId,"circle-color",color):this._map.addLayer({id:circleId,type:"circle",source:sourceId,filter:["==",["geometry-type"],"Point"],paint:{"circle-color":color,"circle-radius":5}}),this._appliedDataLayerIds.set(publicSourceId,sourceId)}}resolveDataLayerSourceId(publicSourceId){const applied=this._appliedDataLayerIds.get(publicSourceId);if(applied)return applied;let sourceId;do sourceId=`lr-data-layer-${this._nextDataLayerId++}`;while(this._map?.getSource(sourceId)||this._map?.getLayer(`${sourceId}-fill`)||this._map?.getLayer(`${sourceId}-line`)||this._map?.getLayer(`${sourceId}-circle`));return sourceId}removeDataLayer(publicSourceId){if(!this._map)return;const sourceId=this._appliedDataLayerIds.get(publicSourceId);if(sourceId){for(const layerId of[`${sourceId}-fill`,`${sourceId}-line`,`${sourceId}-circle`])this._map.getLayer(layerId)&&this._map.removeLayer(layerId);this._map.getSource(sourceId)&&this._map.removeSource(sourceId),this._appliedDataLayerIds.delete(publicSourceId)}}applyMarkers(){const map=this._map,mod=this._maplibreModule;if(!map||!mod)return;const visible=new Set,coordCounts=new Map,explicitIds=new Set,markers=Array.isArray(this.markers)?this.markers.slice(0,MAX_MAP_MARKERS):[];for(const candidate of markers){const lngLat=this.validMarkerLngLat(candidate);if(!lngLat)continue;const m=candidate,rawId=m.id;let key;if(rawId!==void 0){if(typeof rawId!="string")continue;const id=rawId.trim();if(id.length===0||explicitIds.has(id))continue;explicitIds.add(id),key=`id:${id}`}else{const coordKey=`${lngLat[0]},${lngLat[1]}`,occurrence=coordCounts.get(coordKey)??0;coordCounts.set(coordKey,occurrence+1),key=`coordinate:${coordKey}#${occurrence}`}visible.add(key);let existing=this._markerInstances.get(key);const markerColor=sanitizeCssColor(m.color);if(existing&&this._markerColors.get(key)!==markerColor&&(existing.remove(),this._markerInstances.delete(key),this._markerColors.delete(key),existing=void 0),existing){existing.setLngLat(lngLat);const popup=existing.getPopup();if(m.unsafeHtml)if(popup)popup.setHTML(m.unsafeHtml);else{const nextPopup=new mod.Popup({offset:12}).setHTML(m.unsafeHtml);existing.setPopup(nextPopup),this.configurePopupSemantics(key,existing,nextPopup)}else if(m.label)if(popup)popup.setText(m.label);else{const nextPopup=new mod.Popup({offset:12}).setText(m.label);existing.setPopup(nextPopup),this.configurePopupSemantics(key,existing,nextPopup)}else popup&&existing.setPopup(void 0)}else{const marker=new mod.Marker(markerColor?{color:markerColor}:void 0).setLngLat(lngLat);if(m.unsafeHtml||m.label){const popup=new mod.Popup({offset:12});m.unsafeHtml?popup.setHTML(m.unsafeHtml):m.label&&popup.setText(m.label),marker.setPopup(popup),this.configurePopupSemantics(key,marker,popup)}marker.addTo(map),this._markerInstances.set(key,marker),this._markerColors.set(key,markerColor)}const markerLabel=m.label?.trim()||(m.unsafeHtml?popupText(this,m.unsafeHtml):"");this._markerLabels.set(key,markerLabel||void 0);const markerElement=this._markerInstances.get(key)?.getElement?.();if(markerElement){addPartToken(markerElement,"marker"),markerElement.setAttribute("aria-label",markerLabel||this.localize("map")),markerElement.setAttribute("lang",this.effectiveLocale);const currentMarker=this._markerInstances.get(key),popup=currentMarker?.getPopup();popup&&currentMarker?(this.configurePopupSemantics(key,currentMarker,popup),this.syncPopupSemantics(key,currentMarker,popup),this.configureMarkerKeyboard(markerElement,currentMarker)):(markerElement.removeAttribute("aria-controls"),markerElement.removeAttribute("aria-expanded"))}}for(const[key,marker]of this._markerInstances)visible.has(key)||(marker.remove(),this._markerInstances.delete(key),this._markerColors.delete(key),this._markerLabels.delete(key),this._markerPopupIds.delete(key))}configureMarkerKeyboard(markerElement,marker){this.configuredMarkerElements.has(markerElement)||(this.configuredMarkerElements.add(markerElement),markerElement.addEventListener("keydown",event=>{event.key!==" "||!marker.getPopup?.()||event.defaultPrevented||event.preventDefault()},{capture:!0}))}get effectiveMapLabel(){return this.getAttribute("aria-label")===""?"":this.label||this.localize("map")}validMarkerLngLat(candidate){if(!candidate||typeof candidate!="object")return null;const lngLat=candidate.lngLat;if(!Array.isArray(lngLat)||lngLat.length<2)return null;const[lng,lat]=lngLat;return typeof lng!="number"||typeof lat!="number"||!Number.isFinite(lng)||!Number.isFinite(lat)||lat<-90||lat>90?null:[lng,lat]}popupId(key){let id=this._markerPopupIds.get(key);return id||(id=`map-popup-${this._connectGeneration}-${++this._nextPopupId}`,this._markerPopupIds.set(key,id)),id}configurePopupSemantics(key,marker,popup){!popup||typeof popup!="object"||this._configuredPopups.has(popup)||(this._configuredPopups.add(popup),popup.on?.("open",()=>this.syncPopupSemantics(key,marker,popup)),popup.on?.("close",()=>{marker.getElement?.()?.setAttribute("aria-expanded","false")}))}stopObservingPeerChrome(){this.peerChromeObserver?.disconnect(),this.peerChromeObserver=void 0,this.observedPeerContainer=void 0}syncPeerChromeParts(root=this.containerEl??this.renderRoot){const selectors=[[".maplibregl-marker","marker"],[".maplibregl-popup","popup"],[".maplibregl-popup-content","popup-content"],[".maplibregl-popup-close-button","popup-close-button"],[".maplibregl-ctrl-attrib","attribution"],[".maplibregl-ctrl-attrib-button","attribution-toggle"]];for(const[selector,part]of selectors){const candidate=root;candidate.matches?.(selector)&&addPartToken(candidate,part);for(const element of root.querySelectorAll(selector))addPartToken(element,part)}}observePeerChrome(){const container=this.containerEl;if(!container||(this.syncPeerChromeParts(container),this.observedPeerContainer===container&&this.peerChromeObserver))return;this.stopObservingPeerChrome();const MutationObserverCtor=container.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.observedPeerContainer=container,this.peerChromeObserver=new MutationObserverCtor(records=>{if(!(!this.isConnected||this.containerEl!==container))for(const record of records)for(const node of record.addedNodes)node.nodeType===Node.ELEMENT_NODE&&this.syncPeerChromeParts(node)}),this.peerChromeObserver.observe(container,{childList:!0,subtree:!0}))}syncPopupSemantics(key,marker,popup){const markerElement=marker?.getElement?.();if(!markerElement)return;const id=this.popupId(key);markerElement.setAttribute("aria-controls",id),markerElement.setAttribute("aria-expanded",popup?.isOpen?.()?"true":"false");const popupElement=popup?.getElement?.();if(!popupElement)return;addPartToken(markerElement,"marker"),addPartToken(popupElement,"popup"),popupElement.id=id,popupElement.setAttribute("role","dialog"),popupElement.setAttribute("lang",this.effectiveLocale),popupElement.setAttribute("aria-label",this._markerLabels.get(key)||this.effectiveMapLabel);const popupContent=popupElement.querySelector(".maplibregl-popup-content");popupContent&&addPartToken(popupContent,"popup-content");const closeButton=popupElement.querySelector(".maplibregl-popup-close-button");closeButton&&addPartToken(closeButton,"popup-close-button"),closeButton?.setAttribute("aria-label",this.localize("close"))}syncMapSemantics(){const canvas=this._map?.getCanvas?.();canvas&&(canvas.setAttribute("aria-label",this.effectiveMapLabel),canvas.setAttribute("lang",this.effectiveLocale),this.legend.length||this.legendProjection.truncated?canvas.setAttribute("aria-describedby","map-legend"):canvas.removeAttribute("aria-describedby"));for(const[key,marker]of this._markerInstances){const markerElement=marker.getElement?.();if(!markerElement)continue;addPartToken(markerElement,"marker"),markerElement.setAttribute("aria-label",this._markerLabels.get(key)||this.localize("map")),markerElement.setAttribute("lang",this.effectiveLocale);const popup=marker.getPopup?.();popup&&this.syncPopupSemantics(key,marker,popup)}this.syncPeerChromeParts()}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}legendLimitText(){return this.localize("paginationSummary",void 0,{start:this.formatCount(this.legend.length===0?0:1),end:this.formatCount(this.legend.length),total:this.formatCount(this.legendProjection.inputCount),itemLabel:this.localize("items")})}render(){return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{sanitizeCssColor}from"../../../internal/safe-css.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{notifyMapCanvasReady}from"../../../internal/map-canvas-ready.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{srOnly}from"../../../internal/a11y.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{loadMaplibre}from"./map-loader.js";import{styles}from"./map.styles.js";import"../../overlays/skeleton/skeleton.class.js";import{LYRA_DEFAULT_close,LYRA_DEFAULT_items,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_mapInitializationFailed,LYRA_DEFAULT_mapLegend,LYRA_DEFAULT_mapMissingLibrary,LYRA_DEFAULT_mapStyleRequired,LYRA_DEFAULT_mapWebglUnavailable,LYRA_DEFAULT_paginationSummary}from"../../../internal/default-strings.generated.js";function supportsWebGL2(host){try{return host.ownerDocument.createElement("canvas").getContext("webgl2")!==null}catch{return!1}}function hasMapStyle(style){return typeof style=="string"?style.trim().length>0:style!==void 0}const MAX_MAP_LEGEND_GRADIENT_STOPS=64;function normalizeMapLegendGradient(value){if(!Array.isArray(value))return[];const usable=[],scanCount=Math.min(value.length,MAX_MAP_LEGEND_GRADIENT_STOPS);for(let index=0;index<scanCount;index+=1){const stop=value[index];if(!Array.isArray(stop)||stop.length<2)continue;const[rawValue,rawColor]=stop;if(typeof rawValue!="number"||!Number.isFinite(rawValue)||typeof rawColor!="string")continue;const color=sanitizeCssColor(rawColor);color&&usable.push([rawValue,color])}return usable.length<2?[]:Object.freeze([...usable].sort((a,b)=>a[0]-b[0]))}const MAP_LEGEND_ITEM_LIMIT=100,MAP_LEGEND_SCAN_LIMIT=1e3,MAP_LEGEND_LABEL_LIMIT=256,MAP_LEGEND_TOTAL_LABEL_LIMIT=8192,MAP_LEGEND_COLOR_LIMIT=256,MAP_LEGEND_PATTERNS=new Set(["solid","diagonal","dots","crosshatch"]),EMPTY_MAP_LEGEND=Object.freeze([]),EMPTY_MAP_LEGEND_PROJECTION=Object.freeze({inputCount:0,renderedCount:0,omittedCount:0,truncatedLabelCount:0,truncated:!1});function boundedLegendText(value,limit){return value.length<=limit?value:`${value.slice(0,Math.max(0,limit-1))}\u2026`}function normalizeMapLegend(value){let input;try{input=Array.isArray(value)?value:[]}catch{input=[]}let inputCount=0;try{inputCount=Math.max(0,Math.min(Number.MAX_SAFE_INTEGER,input.length))}catch{inputCount=0}const entries=[];let labelCharacters=0,truncatedLabelCount=0;const scanCount=Math.min(inputCount,MAP_LEGEND_SCAN_LIMIT);for(let index=0;index<scanCount&&entries.length<MAP_LEGEND_ITEM_LIMIT;index++)try{const candidate=input[index];if(!candidate||typeof candidate!="object")continue;const rawColor=candidate.color,rawLabel=candidate.label,rawPattern=candidate.pattern;if(typeof rawColor!="string"||typeof rawLabel!="string"||typeof rawPattern!="string"||!MAP_LEGEND_PATTERNS.has(rawPattern))continue;const remaining=MAP_LEGEND_TOTAL_LABEL_LIMIT-labelCharacters;if(remaining<=0)break;const labelLimit=Math.min(MAP_LEGEND_LABEL_LIMIT,remaining),label=boundedLegendText(rawLabel,labelLimit);if(!label.trim())continue;rawLabel.length>labelLimit&&truncatedLabelCount++,labelCharacters+=label.length,entries.push(Object.freeze({color:rawColor.slice(0,MAP_LEGEND_COLOR_LIMIT),label,pattern:rawPattern}))}catch{}const frozenEntries=entries.length?Object.freeze(entries):EMPTY_MAP_LEGEND,omittedCount=Math.max(0,inputCount-frozenEntries.length),projection=Object.freeze({inputCount,renderedCount:frozenEntries.length,omittedCount,truncatedLabelCount,truncated:omittedCount>0||truncatedLabelCount>0});return{entries:frozenEntries,projection}}function addPartToken(element,token){const tokens=new Set((element.getAttribute("part")??"").split(/\s+/).filter(Boolean));tokens.add(token),element.setAttribute("part",[...tokens].join(" "))}const CHOROPLETH_LOG_INTERPOLATION_BASE=.25,MAX_MAP_MARKERS=2e3;function popupText(host,markup){const template=host.ownerDocument.createElement("template");template.innerHTML=markup;for(const hidden of template.content.querySelectorAll('script, style, template, [hidden], [aria-hidden="true"]'))hidden.remove();return(template.content.textContent??"").replace(/\s+/gu," ").trim()}const MAX_MAP_DATA_LAYERS=100;function normalizedDataLayers(value){if(!Array.isArray(value))return[];const output=[],seenSourceIds=new Set,scanCount=Math.min(value.length,MAX_MAP_DATA_LAYERS);for(let index=0;index<scanCount;index++){const candidate=value[index];try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))continue;const rawSourceId=candidate.sourceId;if(typeof rawSourceId!="string")continue;const sourceId=rawSourceId.trim();if(sourceId.length===0||seenSourceIds.has(sourceId))continue;seenSourceIds.add(sourceId),output.push(rawSourceId===sourceId?candidate:{...candidate,sourceId})}catch{}}return output}const FALLBACK_FILL_OPACITY=.75;function ownerWindow(host){return host.ownerDocument?.defaultView??null}function choroplethFillOpacity(host){const raw=ownerWindow(host)?.getComputedStyle(host).getPropertyValue("--lr-map-choropleth-fill-opacity").trim()??"",parsed=Number.parseFloat(raw);return Number.isFinite(parsed)?parsed:FALLBACK_FILL_OPACITY}const TONE_TOKEN={accent:"--lr-color-brand",success:"--lr-color-success",warning:"--lr-color-warning",danger:"--lr-color-danger",neutral:"--lr-color-text-quiet"};function dataLayerColor(host,tone){const token=TONE_TOKEN[tone??"accent"];return(ownerWindow(host)?.getComputedStyle(host).getPropertyValue(token).trim()??"")||"#0969da"}function resolvedLayerColor(host,explicit,tone){const candidate=typeof explicit=="string"?explicit.trim():"";if(!candidate)return dataLayerColor(host,tone);const reference=/^var\(\s*(--[\w-]+)/.exec(candidate);return reference?ownerWindow(host)?.getComputedStyle(host).getPropertyValue(reference[1]).trim()||dataLayerColor(host,tone):candidate}const UNTILEABLE_SCAN_FEATURE_LIMIT=1e4;function warnOnUntileableProperties(geojson,sourceLabel){const features=geojson?.features;if(!Array.isArray(features))return;const limit=Math.min(features.length,UNTILEABLE_SCAN_FEATURE_LIMIT);for(let index=0;index<limit;index+=1){const feature=features[index],properties=feature?.properties;if(!(!properties||typeof properties!="object"))for(const[key,value]of Object.entries(properties)){if(typeof value!="number"||!Number.isFinite(value)||Math.abs(value)<=Number.MAX_SAFE_INTEGER)continue;const identity=feature?.id??`index ${index}`;devWarnOnce(`lyra-map-untileable-property:${sourceLabel}:${key}`,`<lr-map>: feature ${String(identity)} in "${sourceLabel}" carries ${key}=${value}, which is too large to survive maplibre-gl's vector-tile encoding. Tiling happens in a worker, so the failure would reach you only as an opaque "Given varint doesn't fit into 10 bytes" error while the rest of the layer still paints. Carry a reduced figure in the feature and keep the exact value in your own data.`)}}}const GEOJSON_DIFF_FEATURE_LIMIT=1e4;function buildGeoJsonPropertyDiff(previous,next){const previousFeatures=previous?.features,nextFeatures=next?.features;if(!Array.isArray(previousFeatures)||!Array.isArray(nextFeatures)||previousFeatures.length!==nextFeatures.length||nextFeatures.length>GEOJSON_DIFF_FEATURE_LIMIT)return null;const update=[];for(let index=0;index<nextFeatures.length;index+=1){const before=previousFeatures[index],after=nextFeatures[index];if(!before||!after)return null;const id=after.id;if(typeof id!="string"&&typeof id!="number"||before.id!==id||before.geometry!==after.geometry)return null;const beforeProperties=before.properties??{},afterProperties=after.properties??{},addOrUpdateProperties=[];for(const[key,value]of Object.entries(afterProperties))Object.is(beforeProperties[key],value)||addOrUpdateProperties.push({key,value});const removeProperties=Object.keys(beforeProperties).filter(key=>!(key in afterProperties));addOrUpdateProperties.length===0&&removeProperties.length===0||update.push({id,addOrUpdateProperties,removeProperties})}return{update}}class LyraMap extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close,items:LYRA_DEFAULT_items,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,mapInitializationFailed:LYRA_DEFAULT_mapInitializationFailed,mapLegend:LYRA_DEFAULT_mapLegend,mapMissingLibrary:LYRA_DEFAULT_mapMissingLibrary,mapStyleRequired:LYRA_DEFAULT_mapStyleRequired,mapWebglUnavailable:LYRA_DEFAULT_mapWebglUnavailable,paginationSummary:LYRA_DEFAULT_paginationSummary}}static{this.immutableEventDetails=Object.freeze(["lr-map-click"])}static{this.identityEventDetailProperties=Object.freeze({"lr-map-click":Object.freeze(["feature"])})}static{this.ownedCollectionProperties=Object.freeze(["center","mapStyle","choropleth","markers","dataLayers"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static preload(){return loadMaplibre().then(module=>module!==null)}constructor(){super(),this.center=[0,0],this.zoom=2,this.maxBounds=null,this._legend=EMPTY_MAP_LEGEND,this._legendProjection=EMPTY_MAP_LEGEND_PROJECTION,this.hasLegendSlot=!1,this._legendGradient=Object.freeze([]),this.legendGradientLoLabel=null,this.legendGradientHiLabel=null,this.markers=[],this.dataLayers=[],this.label="",this.loading=!0,this.loadLibrary=loadMaplibre,this.visible=ownerWindow(this)?.IntersectionObserver===void 0,this._styleLoaded=!1,this._appliedDataLayerIds=new Map,this._appliedGeoJson=new Map,this._nextDataLayerId=0,this._webglReady=!1,this._markerInstances=new Map,this._markerLabels=new Map,this._markerPopupIds=new Map,this._configuredPopups=new WeakSet,this._nextPopupId=0,this._markerColors=new Map,this._connectGeneration=0,this.configuredMarkerElements=new WeakSet,this.onLegendSlotChange=event=>{const slot=event.target;this.hasLegendSlot=slot.assignedNodes({flatten:!0}).some(node=>node.nodeType===Node.ELEMENT_NODE||(node.textContent??"").trim().length>0)},new ThemeWatcher(this,()=>this.refreshThemePaint())}get legend(){return this._legend}set legend(value){const previous=this._legend,normalized=normalizeMapLegend(value);this._legend=normalized.entries,this._legendProjection=normalized.projection,this.requestUpdate("legend",previous)}probeLegendSlot(){for(const child of Array.from(this.children))if(child.getAttribute("slot")==="legend")return!0;return!1}get legendGradient(){return this._legendGradient}set legendGradient(value){const previous=this._legendGradient;this._legendGradient=normalizeMapLegendGradient(value),this.requestUpdate("legendGradient",previous)}get legendProjection(){return this._legendProjection}get map(){return this._map}pushGeoJson(source,resolvedSourceId,geojson){const previous=this._appliedGeoJson.get(resolvedSourceId),diff=typeof source.updateData=="function"&&previous!==void 0?buildGeoJsonPropertyDiff(previous,geojson):null;diff===null||typeof source.updateData!="function"?source.setData(geojson):diff.update.length>0&&source.updateData(diff),this._appliedGeoJson.set(resolvedSourceId,geojson)}get safeMaxBounds(){const bounds=this.maxBounds;if(!Array.isArray(bounds)||bounds.length!==2)return null;const[southWest,northEast]=bounds;if(!Array.isArray(southWest)||!Array.isArray(northEast))return null;const[west,south]=southWest,[east,north]=northEast,values=[west,south,east,north].map(Number);if(!values.every(value=>Number.isFinite(value)))return null;const[w,s,e,n]=values;return w>=e||s>=n||w<-180||e>180||s<-90||n>90?null:[[w,s],[e,n]]}applyMaxBounds(){const map=this._map;if(!map||typeof map.setMaxBounds!="function")return;const bounds=this.safeMaxBounds,zoomBefore=map.getZoom(),centerBefore=map.getCenter();map.setMaxBounds(bounds),bounds!==null&&(Number.isFinite(map.getZoom())||(map.setMaxBounds(null),Number.isFinite(zoomBefore)&&map.setZoom(zoomBefore),centerBefore&&map.setCenter([centerBefore.lng,centerBefore.lat]),devWarnOnce("lyra-map-max-bounds-rejected","<lr-map>: maxBounds left maplibre-gl without a usable zoom, so it was dropped and the camera restored. This is a peer limitation, not a bad value -- it shows up at sub-1 fractional zooms in wide containers. Raise the zoom, narrow the box, or leave maxBounds unset.")))}get safeZoom(){return finiteRange(this.zoom,2,0,22)}get safeCenter(){const center=Array.isArray(this.center)?this.center:[];return[finiteRange(Number(center[0]),0,-180,180),finiteRange(Number(center[1]),0,-90,90)]}connectedCallback(){super.connectedCallback(),this.syncErrorAnnouncementSink();const generation=++this._connectGeneration,IntersectionObserverCtor=ownerWindow(this)?.IntersectionObserver;if(this.visible=IntersectionObserverCtor===void 0,this.failure=void 0,this.loading=!0,this._webglReady=!1,IntersectionObserverCtor){const observer=new IntersectionObserverCtor(entries=>{entries[0]?.isIntersecting&&(this.visible=!0)});this.intersectionObserver=observer,observer.observe(this)}(async()=>{let mod;try{mod=await this.loadLibrary()}catch{generation===this._connectGeneration&&this.isConnected&&this.failInitialization("missing-peer");return}if(!(generation!==this._connectGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.failInitialization("missing-peer");return}if(this._maplibreModule=mod,!hasMapStyle(this.mapStyle)){this.failInitialization("style-required");return}if(!supportsWebGL2(this)){this.failInitialization("webgl-unavailable");return}this._webglReady=!0,await this.updateComplete,!(generation!==this._connectGeneration||!this.containerEl||!this.isConnected)&&this.tryConstructMap()}})()}disconnectedCallback(){this.releaseErrorAnnouncementSink(),super.disconnectedCallback(),this.disposeMap(),this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0;for(const marker of this._markerInstances.values())marker.remove();this._markerInstances.clear(),this._markerColors.clear(),this._markerLabels.clear(),this._markerPopupIds.clear()}failureMessage(reason=this.failure??"initialization-failed"){switch(reason){case"missing-peer":return this.localize("mapMissingLibrary");case"style-required":return this.localize("mapStyleRequired");case"webgl-unavailable":return this.localize("mapWebglUnavailable");case"initialization-failed":return this.localize("mapInitializationFailed")}}failInitialization(reason,partialMap){try{partialMap?.remove()}catch{}this.disposeMap(),this.loading=!1,this.failure=reason,this.errorAnnouncementSink?.announce(this.failureMessage(reason))}disposeMap(){this.stopObservingPeerChrome();try{this._map?.remove()}catch{}this._map=void 0,this._styleLoaded=!1,this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0,this._appliedDataLayerIds.clear(),this._appliedGeoJson.clear()}adoptedCallback(){super.adoptedCallback(),this.stopObservingPeerChrome(),this.releaseErrorAnnouncementSink(),this.syncErrorAnnouncementSink()}syncErrorAnnouncementSink(){this.isConnected&&this.errorAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseErrorAnnouncementSink(),this.errorAnnouncementSink=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}))}releaseErrorAnnouncementSink(){this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0}tryConstructMap(){if(this._map||!this._maplibreModule||!this._webglReady||!this.containerEl||!this.visible||!this.isConnected)return;if(!hasMapStyle(this.mapStyle)){this.failInitialization("style-required");return}const mod=this._maplibreModule;let candidate;try{candidate=new mod.Map({container:this.containerEl,style:this.mapStyle,center:this.safeCenter,zoom:this.safeZoom,locale:{"Map.Title":this.effectiveMapLabel,"Marker.Title":this.localize("map"),"Popup.Close":this.localize("close")}}),candidate.on("error",event=>{if(this._map===candidate&&!this._styleLoaded){this.failInitialization("initialization-failed");return}console.error("lr-map:",event.error??event)}),candidate.on("load",()=>{if(this._map===candidate)try{this._styleLoaded=!0,this.applyChoropleth(),this.applyMarkers(),this.applyDataLayers(),this.emit("lr-map-load")}catch{this.failInitialization("initialization-failed")}}),candidate.on("click",event=>{if(this._map!==candidate)return;const fillLayerId=this._appliedFillLayerId,layerIds=[];fillLayerId&&candidate.getLayer(fillLayerId)&&layerIds.push(fillLayerId);for(const resolvedSourceId of this._appliedDataLayerIds.values())for(const suffix of["-fill","-line","-circle"]){const layerId=`${resolvedSourceId}${suffix}`;candidate.getLayer(layerId)&&layerIds.push(layerId)}const hit=(layerIds.length?candidate.queryRenderedFeatures(event.point,{layers:layerIds}):[])[0],hitLayerId=hit?.layer?.id;let origin,sourceId;if(hitLayerId!==void 0){if(hitLayerId===fillLayerId)origin="choropleth";else for(const[publicSourceId,resolvedSourceId]of this._appliedDataLayerIds)if(hitLayerId.startsWith(`${resolvedSourceId}-`)){origin="data-layer",sourceId=publicSourceId;break}}this.emit("lr-map-click",{lngLat:[event.lngLat.lng,event.lngLat.lat],feature:hit,origin,sourceId})});const canvas=candidate.getCanvas?.();canvas&&notifyMapCanvasReady(this,canvas),this._map=candidate,this.observePeerChrome(),this.failure=void 0}catch{this.failInitialization("initialization-failed",candidate)}}updated(changed){if(super.updated(changed),this.setAttribute("aria-busy",String(this.loading)),changed.has("visible")&&this.visible&&this.tryConstructMap(),changed.has("mapStyle")&&!hasMapStyle(this.mapStyle)&&this._maplibreModule)this.failInitialization("style-required");else if(changed.has("mapStyle")&&!this._map&&this._maplibreModule&&hasMapStyle(this.mapStyle))this.tryConstructMap();else if(changed.has("mapStyle")&&this._map){this._styleLoaded=!1,this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0;const map=this._map;try{map.once("style.load",()=>{if(this._map===map)try{this._styleLoaded=!0,this._appliedDataLayerIds.clear(),this._appliedGeoJson.clear(),this.applyChoropleth(),this.applyDataLayers()}catch{this.scheduleAfterUpdate(()=>this.failInitialization("initialization-failed"),"map-style-failure")}}),map.setStyle(this.mapStyle)}catch{this.scheduleAfterUpdate(()=>this.failInitialization("initialization-failed"),"map-style-failure")}}else if(this._styleLoaded&&(changed.has("dataLayers")||changed.has("choropleth"))){const nextChoroplethSourceId=this.choropleth?this.resolveChoroplethSourceId(this.choropleth.sourceId):void 0;this._appliedChoroplethSourceId&&this._appliedChoroplethSourceId!==nextChoroplethSourceId&&this.removeChoropleth(),changed.has("dataLayers")&&this.applyDataLayers(),this.applyChoropleth()}changed.has("center")&&this._map&&this._map.setCenter(this.safeCenter),changed.has("zoom")&&this._map&&this._map.setZoom(this.safeZoom),changed.has("maxBounds")&&this._map&&this.applyMaxBounds(),changed.has("markers")&&this._map&&this.applyMarkers(),this.syncMapSemantics()}willUpdate(changed){super.willUpdate(changed),changed.has("mapStyle")&&!this._map&&this._maplibreModule&&hasMapStyle(this.mapStyle)&&(this._webglReady||(this._webglReady=supportsWebGL2(this)),this.failure=this._webglReady?void 0:"webgl-unavailable",this._webglReady||(this.loading=!1,this.errorAnnouncementSink?.announce(this.failureMessage("webgl-unavailable"))))}refreshThemePaint(){if(!this._map||!this._styleLoaded)return;const fillOpacity=choroplethFillOpacity(this);this._appliedFillLayerId&&this._map.setPaintProperty(this._appliedFillLayerId,"fill-opacity",fillOpacity);const dataLayersBySourceId=new Map(normalizedDataLayers(this.dataLayers).map(layer=>[layer.sourceId,layer]));for(const[publicSourceId,sourceId]of this._appliedDataLayerIds){const dataLayer=dataLayersBySourceId.get(publicSourceId);if(!dataLayer)continue;const color=resolvedLayerColor(this,dataLayer.color,dataLayer.tone),stroke=resolvedLayerColor(this,dataLayer.strokeColor??dataLayer.color,dataLayer.tone);this._map.setPaintProperty(`${sourceId}-fill`,"fill-color",color),this._map.setPaintProperty(`${sourceId}-fill`,"fill-opacity",fillOpacity),this._map.setPaintProperty(`${sourceId}-line`,"line-color",stroke),this._map.setPaintProperty(`${sourceId}-circle`,"circle-color",stroke)}}applyChoropleth(){if(!this._map)return;if(!this.choropleth){this.removeChoropleth();return}const{geojson,field,stops}=this.choropleth,sourceId=this.resolveChoroplethSourceId(this.choropleth.sourceId),fillLayerId=`${sourceId}-fill`;this._appliedChoroplethSourceId&&this._appliedChoroplethSourceId!==sourceId&&this.removeChoropleth(),warnOnUntileableProperties(geojson,"choropleth");const existingSource=this._map.getSource(sourceId);if(existingSource?this.pushGeoJson(existingSource,sourceId,geojson):(this._map.addSource(sourceId,{type:"geojson",data:geojson}),this._appliedGeoJson.set(sourceId,geojson)),this._appliedChoroplethSourceId=sourceId,stops.length===0)return;let colorExpr;if(this.choropleth.interpolation==="step"){const base=typeof this.choropleth.stepBaseColor=="string"&&this.choropleth.stepBaseColor.trim()?this.choropleth.stepBaseColor.trim():stops[0][1];colorExpr=["step",["get",field],base];for(const[value,color]of stops)colorExpr.push(value,color)}else{colorExpr=["interpolate",this.choropleth.interpolation==="logarithmic"?["exponential",CHOROPLETH_LOG_INTERPOLATION_BASE]:["linear"],["get",field]];for(const[value,color]of stops)colorExpr.push(value,color)}this._map.getLayer(fillLayerId)?(this._map.setPaintProperty(fillLayerId,"fill-color",colorExpr),this._map.setPaintProperty(fillLayerId,"fill-opacity",choroplethFillOpacity(this))):this._map.addLayer({id:fillLayerId,type:"fill",source:sourceId,paint:{"fill-color":colorExpr,"fill-opacity":choroplethFillOpacity(this)}}),this._appliedFillLayerId=fillLayerId}resolveChoroplethSourceId(sourceId){const dataSourceIds=new Set(normalizedDataLayers(this.dataLayers).map(layer=>layer.sourceId));let resolved=sourceId;for(;dataSourceIds.has(resolved);)resolved=`lr-choropleth-${resolved}`;return resolved}removeChoropleth(){!this._map||!this._appliedChoroplethSourceId||(this._appliedFillLayerId&&this._map.getLayer(this._appliedFillLayerId)&&this._map.removeLayer(this._appliedFillLayerId),this._map.getSource(this._appliedChoroplethSourceId)&&this._map.removeSource(this._appliedChoroplethSourceId),this._appliedGeoJson.delete(this._appliedChoroplethSourceId),this._appliedChoroplethSourceId=void 0,this._appliedFillLayerId=void 0)}applyDataLayers(){if(!this._map)return;const layers=normalizedDataLayers(this.dataLayers),nextIds=new Set(layers.map(layer=>layer.sourceId));for(const publicSourceId of this._appliedDataLayerIds.keys())nextIds.has(publicSourceId)||this.removeDataLayer(publicSourceId);for(const layer of layers){const{sourceId:publicSourceId,geojson,tone}=layer,sourceId=this.resolveDataLayerSourceId(publicSourceId);warnOnUntileableProperties(geojson,publicSourceId);const existingSource=this._map.getSource(sourceId);existingSource?this.pushGeoJson(existingSource,sourceId,geojson):(this._map.addSource(sourceId,{type:"geojson",data:geojson}),this._appliedGeoJson.set(sourceId,geojson));const color=resolvedLayerColor(this,layer.color,tone),stroke=resolvedLayerColor(this,layer.strokeColor??layer.color,tone),fillId=`${sourceId}-fill`,lineId=`${sourceId}-line`,circleId=`${sourceId}-circle`;this._map.getLayer(fillId)?(this._map.setPaintProperty(fillId,"fill-color",color),this._map.setPaintProperty(fillId,"fill-opacity",choroplethFillOpacity(this))):this._map.addLayer({id:fillId,type:"fill",source:sourceId,filter:["==",["geometry-type"],"Polygon"],paint:{"fill-color":color,"fill-opacity":choroplethFillOpacity(this)}}),this._map.getLayer(lineId)?this._map.setPaintProperty(lineId,"line-color",stroke):this._map.addLayer({id:lineId,type:"line",source:sourceId,filter:["in",["geometry-type"],["literal",["LineString","Polygon"]]],paint:{"line-color":stroke,"line-width":2}}),this._map.getLayer(circleId)?this._map.setPaintProperty(circleId,"circle-color",stroke):this._map.addLayer({id:circleId,type:"circle",source:sourceId,filter:["==",["geometry-type"],"Point"],paint:{"circle-color":stroke,"circle-radius":5}}),this._appliedDataLayerIds.set(publicSourceId,sourceId)}}resolveDataLayerSourceId(publicSourceId){const applied=this._appliedDataLayerIds.get(publicSourceId);if(applied)return applied;let sourceId;do sourceId=`lr-data-layer-${this._nextDataLayerId++}`;while(this._map?.getSource(sourceId)||this._map?.getLayer(`${sourceId}-fill`)||this._map?.getLayer(`${sourceId}-line`)||this._map?.getLayer(`${sourceId}-circle`));return sourceId}removeDataLayer(publicSourceId){if(!this._map)return;const sourceId=this._appliedDataLayerIds.get(publicSourceId);if(sourceId){for(const layerId of[`${sourceId}-fill`,`${sourceId}-line`,`${sourceId}-circle`])this._map.getLayer(layerId)&&this._map.removeLayer(layerId);this._map.getSource(sourceId)&&this._map.removeSource(sourceId),this._appliedDataLayerIds.delete(publicSourceId),this._appliedGeoJson.delete(sourceId)}}applyMarkers(){const map=this._map,mod=this._maplibreModule;if(!map||!mod)return;const visible=new Set,coordCounts=new Map,explicitIds=new Set,markers=Array.isArray(this.markers)?this.markers.slice(0,MAX_MAP_MARKERS):[];for(const candidate of markers){const lngLat=this.validMarkerLngLat(candidate);if(!lngLat)continue;const m=candidate,rawId=m.id;let key;if(rawId!==void 0){if(typeof rawId!="string")continue;const id=rawId.trim();if(id.length===0||explicitIds.has(id))continue;explicitIds.add(id),key=`id:${id}`}else{const coordKey=`${lngLat[0]},${lngLat[1]}`,occurrence=coordCounts.get(coordKey)??0;coordCounts.set(coordKey,occurrence+1),key=`coordinate:${coordKey}#${occurrence}`}visible.add(key);let existing=this._markerInstances.get(key);const markerColor=sanitizeCssColor(m.color);if(existing&&this._markerColors.get(key)!==markerColor&&(existing.remove(),this._markerInstances.delete(key),this._markerColors.delete(key),existing=void 0),existing){existing.setLngLat(lngLat);const popup=existing.getPopup();if(m.unsafeHtml)if(popup)popup.setHTML(m.unsafeHtml);else{const nextPopup=new mod.Popup({offset:12}).setHTML(m.unsafeHtml);existing.setPopup(nextPopup),this.configurePopupSemantics(key,existing,nextPopup)}else if(m.label)if(popup)popup.setText(m.label);else{const nextPopup=new mod.Popup({offset:12}).setText(m.label);existing.setPopup(nextPopup),this.configurePopupSemantics(key,existing,nextPopup)}else popup&&existing.setPopup(void 0)}else{const marker=new mod.Marker(markerColor?{color:markerColor}:void 0).setLngLat(lngLat);if(m.unsafeHtml||m.label){const popup=new mod.Popup({offset:12});m.unsafeHtml?popup.setHTML(m.unsafeHtml):m.label&&popup.setText(m.label),marker.setPopup(popup),this.configurePopupSemantics(key,marker,popup)}marker.addTo(map),this._markerInstances.set(key,marker),this._markerColors.set(key,markerColor)}const markerLabel=m.label?.trim()||(m.unsafeHtml?popupText(this,m.unsafeHtml):"");this._markerLabels.set(key,markerLabel||void 0);const markerElement=this._markerInstances.get(key)?.getElement?.();if(markerElement){addPartToken(markerElement,"marker"),markerElement.setAttribute("aria-label",markerLabel||this.localize("map")),markerElement.setAttribute("lang",this.effectiveLocale);const currentMarker=this._markerInstances.get(key),popup=currentMarker?.getPopup();popup&&currentMarker?(this.configurePopupSemantics(key,currentMarker,popup),this.syncPopupSemantics(key,currentMarker,popup),this.configureMarkerKeyboard(markerElement,currentMarker)):(markerElement.removeAttribute("aria-controls"),markerElement.removeAttribute("aria-expanded"))}}for(const[key,marker]of this._markerInstances)visible.has(key)||(marker.remove(),this._markerInstances.delete(key),this._markerColors.delete(key),this._markerLabels.delete(key),this._markerPopupIds.delete(key))}configureMarkerKeyboard(markerElement,marker){this.configuredMarkerElements.has(markerElement)||(this.configuredMarkerElements.add(markerElement),markerElement.addEventListener("keydown",event=>{event.key!==" "||!marker.getPopup?.()||event.defaultPrevented||event.preventDefault()},{capture:!0}))}get effectiveMapLabel(){return this.getAttribute("aria-label")===""?"":this.label||this.localize("map")}validMarkerLngLat(candidate){if(!candidate||typeof candidate!="object")return null;const lngLat=candidate.lngLat;if(!Array.isArray(lngLat)||lngLat.length<2)return null;const[lng,lat]=lngLat;return typeof lng!="number"||typeof lat!="number"||!Number.isFinite(lng)||!Number.isFinite(lat)||lat<-90||lat>90?null:[lng,lat]}popupId(key){let id=this._markerPopupIds.get(key);return id||(id=`map-popup-${this._connectGeneration}-${++this._nextPopupId}`,this._markerPopupIds.set(key,id)),id}configurePopupSemantics(key,marker,popup){!popup||typeof popup!="object"||this._configuredPopups.has(popup)||(this._configuredPopups.add(popup),popup.on?.("open",()=>this.syncPopupSemantics(key,marker,popup)),popup.on?.("close",()=>{marker.getElement?.()?.setAttribute("aria-expanded","false")}))}stopObservingPeerChrome(){this.peerChromeObserver?.disconnect(),this.peerChromeObserver=void 0,this.observedPeerContainer=void 0}syncPeerChromeParts(root=this.containerEl??this.renderRoot){const selectors=[[".maplibregl-marker","marker"],[".maplibregl-popup","popup"],[".maplibregl-popup-content","popup-content"],[".maplibregl-popup-close-button","popup-close-button"],[".maplibregl-ctrl-attrib","attribution"],[".maplibregl-ctrl-attrib-button","attribution-toggle"]];for(const[selector,part]of selectors){const candidate=root;candidate.matches?.(selector)&&addPartToken(candidate,part);for(const element of root.querySelectorAll(selector))addPartToken(element,part)}}observePeerChrome(){const container=this.containerEl;if(!container||(this.syncPeerChromeParts(container),this.observedPeerContainer===container&&this.peerChromeObserver))return;this.stopObservingPeerChrome();const MutationObserverCtor=container.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.observedPeerContainer=container,this.peerChromeObserver=new MutationObserverCtor(records=>{if(!(!this.isConnected||this.containerEl!==container))for(const record of records)for(const node of record.addedNodes)node.nodeType===Node.ELEMENT_NODE&&this.syncPeerChromeParts(node)}),this.peerChromeObserver.observe(container,{childList:!0,subtree:!0}))}syncPopupSemantics(key,marker,popup){const markerElement=marker?.getElement?.();if(!markerElement)return;const id=this.popupId(key);markerElement.setAttribute("aria-controls",id),markerElement.setAttribute("aria-expanded",popup?.isOpen?.()?"true":"false");const popupElement=popup?.getElement?.();if(!popupElement)return;addPartToken(markerElement,"marker"),addPartToken(popupElement,"popup"),popupElement.id=id,popupElement.setAttribute("role","dialog"),popupElement.setAttribute("lang",this.effectiveLocale),popupElement.setAttribute("aria-label",this._markerLabels.get(key)||this.effectiveMapLabel);const popupContent=popupElement.querySelector(".maplibregl-popup-content");popupContent&&addPartToken(popupContent,"popup-content");const closeButton=popupElement.querySelector(".maplibregl-popup-close-button");closeButton&&addPartToken(closeButton,"popup-close-button"),closeButton?.setAttribute("aria-label",this.localize("close"))}syncMapSemantics(){const canvas=this._map?.getCanvas?.();canvas&&(canvas.setAttribute("aria-label",this.effectiveMapLabel),canvas.setAttribute("lang",this.effectiveLocale),this.legend.length||this.legendProjection.truncated?canvas.setAttribute("aria-describedby","map-legend"):canvas.removeAttribute("aria-describedby"));for(const[key,marker]of this._markerInstances){const markerElement=marker.getElement?.();if(!markerElement)continue;addPartToken(markerElement,"marker"),markerElement.setAttribute("aria-label",this._markerLabels.get(key)||this.localize("map")),markerElement.setAttribute("lang",this.effectiveLocale);const popup=marker.getPopup?.();popup&&this.syncPopupSemantics(key,marker,popup)}this.syncPeerChromeParts()}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}legendLimitText(){return this.localize("paginationSummary",void 0,{start:this.formatCount(this.legend.length===0?0:1),end:this.formatCount(this.legend.length),total:this.formatCount(this.legendProjection.inputCount),itemLabel:this.localize("items")})}renderLegendGradient(){const stops=this.legendGradient;if(stops.length<2)return nothing;const lo=stops[0],hi=stops[stops.length-1],span=hi[0]-lo[0],image=stops.map(([value,color],index)=>{const percent=span>0?(value-lo[0])/span*100:index/(stops.length-1)*100;return`${color} ${percent}%`}).join(", ");return html`<div class="legend-gradient">
2
+ <span part="legend-lo">${this.legendGradientLoLabel??this.formatCount(lo[0])}</span>
3
+ <span
4
+ part="legend-gradient"
5
+ class="gradient-bar"
6
+ aria-hidden="true"
7
+ inert
8
+ style=${styleMap({backgroundImage:`linear-gradient(to right, ${image})`})}
9
+ ></span>
10
+ <span part="legend-hi">${this.legendGradientHiLabel??this.formatCount(hi[0])}</span>
11
+ </div>`}render(){return html`
2
12
  <div
3
13
  part="base"
4
14
  aria-busy=${String(this.loading)}
@@ -7,7 +17,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
7
17
  <span class="sr-only">${this.localize("loading")}</span>
8
18
  <lr-skeleton shape="rect" .announce=${!1}></lr-skeleton>
9
19
  `:html`<div part="container" id="map-container" lang=${this.effectiveLocale}></div>`}
10
- ${this.legend.length||this.legendProjection.truncated?html`<div
20
+ ${this.legend.length||this.legendProjection.truncated||this.legendGradient.length||this.hasLegendSlot||this.probeLegendSlot()?html`<div
11
21
  part="legend"
12
22
  id="map-legend"
13
23
  role="group"
@@ -15,6 +25,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
15
25
  aria-controls="map-container"
16
26
  data-truncated=${String(this.legendProjection.truncated)}
17
27
  >
28
+ ${this.renderLegendGradient()}
18
29
  <div class="legend-list" role="list">
19
30
  ${this.legend.map((entry,index)=>{const bg=sanitizeCssColor(entry.color);return html`<div
20
31
  class="legend-row"
@@ -35,6 +46,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
35
46
  ${this.legendProjection.truncated?html`<div id="map-legend-limit" part="legend-limit">
36
47
  ${this.legendLimitText()}
37
48
  </div>`:nothing}
49
+ <slot name="legend" @slotchange=${this.onLegendSlotChange}></slot>
38
50
  </div>`:nothing}
39
51
  </div>
40
- `}}__decorate([property({type:Array})],LyraMap.prototype,"center",void 0),__decorate([property({type:Number})],LyraMap.prototype,"zoom",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"mapStyle",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"legend",null),__decorate([property({attribute:!1})],LyraMap.prototype,"choropleth",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"markers",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"dataLayers",void 0),__decorate([property()],LyraMap.prototype,"label",void 0),__decorate([state()],LyraMap.prototype,"loading",void 0),__decorate([state()],LyraMap.prototype,"failure",void 0),__decorate([state()],LyraMap.prototype,"visible",void 0),__decorate([query('[part="container"]')],LyraMap.prototype,"containerEl",void 0);export{LyraMap};
52
+ `}}__decorate([property({type:Array})],LyraMap.prototype,"center",void 0),__decorate([property({type:Number})],LyraMap.prototype,"zoom",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"maxBounds",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"mapStyle",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"legend",null),__decorate([state()],LyraMap.prototype,"hasLegendSlot",void 0),__decorate([property({attribute:"legend-gradient-lo-label"})],LyraMap.prototype,"legendGradientLoLabel",void 0),__decorate([property({attribute:"legend-gradient-hi-label"})],LyraMap.prototype,"legendGradientHiLabel",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"choropleth",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"markers",void 0),__decorate([property({attribute:!1})],LyraMap.prototype,"dataLayers",void 0),__decorate([property()],LyraMap.prototype,"label",void 0),__decorate([state()],LyraMap.prototype,"loading",void 0),__decorate([state()],LyraMap.prototype,"failure",void 0),__decorate([state()],LyraMap.prototype,"visible",void 0),__decorate([query('[part="container"]')],LyraMap.prototype,"containerEl",void 0);export{LyraMap,buildGeoJsonPropertyDiff};
@@ -21,9 +21,6 @@ import{css}from"lit";const styles=css`
21
21
  block-size: 100%;
22
22
  overflow: hidden;
23
23
  }
24
- /* MapLibre creates these nodes inside the container above, hence inside this component's
25
- shadow root. Page-level peer CSS cannot reach them; the wrapper owns the layout and
26
- interaction rules for the MapLibre capabilities it exposes. */
27
24
  .maplibregl-canvas-container {
28
25
  inline-size: 100%;
29
26
  block-size: 100%;
@@ -85,13 +82,6 @@ import{css}from"lit";const styles=css`
85
82
  .maplibregl-popup-anchor-bottom-right {
86
83
  flex-direction: column-reverse;
87
84
  }
88
- /*
89
- * anchor-left/anchor-right are assigned by MapLibre at runtime from physical viewport
90
- * collision detection (which side of the map container has room for the popup relative to
91
- * the marker's screen position) -- they are not related to page text direction and must
92
- * never be re-mirrored for dir="rtl", or the popup's tip decouples from the marker it points
93
- * at.
94
- */
95
85
  .maplibregl-popup-anchor-left {
96
86
  flex-direction: row;
97
87
  }
@@ -189,8 +179,6 @@ import{css}from"lit";const styles=css`
189
179
  outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
190
180
  outline-offset: calc(-1 * var(--lr-focus-ring-offset));
191
181
  }
192
- /* Mirrors docx-viewer.styles.ts's identical [part='error'] treatment for the same "optional
193
- peer dependency missing" failure shape. */
194
182
  [part='error'] {
195
183
  margin: 0;
196
184
  padding: var(--lr-space-l);
@@ -215,8 +203,6 @@ import{css}from"lit";const styles=css`
215
203
  background: var(--lr-color-surface);
216
204
  border: var(--lr-border-width-thin) solid var(--lr-color-border);
217
205
  border-radius: var(--lr-radius);
218
- /* Overlay step: the legend is a floating cluster pinned over the tiles, so it reads as a layer
219
- above the map rather than a panel resting beside it. */
220
206
  box-shadow: var(--lr-shadow-m);
221
207
  font-size: var(--lr-font-size-xs);
222
208
  }
@@ -226,6 +212,26 @@ import{css}from"lit";const styles=css`
226
212
  gap: var(--lr-space-xs);
227
213
  min-inline-size: 0;
228
214
  }
215
+ .legend-gradient {
216
+ display: flex;
217
+ align-items: center;
218
+ gap: var(--lr-space-xs);
219
+ min-inline-size: 0;
220
+ }
221
+ .legend-gradient .gradient-bar {
222
+ flex: 1 1 var(--lr-size-6rem);
223
+ min-inline-size: 0;
224
+ block-size: var(--lr-size-0-5rem);
225
+ border-radius: var(--lr-size-2px);
226
+ }
227
+ [part='legend-lo'],
228
+ [part='legend-hi'] {
229
+ flex: 0 0 auto;
230
+ white-space: nowrap;
231
+ }
232
+ :host(:dir(rtl)) .legend-gradient .gradient-bar {
233
+ transform: scaleX(-1);
234
+ }
229
235
  .legend-row {
230
236
  display: flex;
231
237
  align-items: center;
@@ -287,8 +293,6 @@ import{css}from"lit";const styles=css`
287
293
  overflow-wrap: anywhere;
288
294
  }
289
295
 
290
- /* MapLibre's attribution control is generated in the same shadow-local container. Keep it
291
- anchored over the map and use Lyra's own surface, typography, and interaction tokens. */
292
296
  .maplibregl-ctrl-top-left,
293
297
  .maplibregl-ctrl-top-right,
294
298
  .maplibregl-ctrl-bottom-left,
@@ -369,7 +373,6 @@ import{css}from"lit";const styles=css`
369
373
  outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
370
374
  outline-offset: calc(-1 * var(--lr-focus-ring-offset));
371
375
  }
372
- /* Remove the native <summary> disclosure marker (the stray "▼") on the compact-toggle button. */
373
376
  .maplibregl-ctrl-attrib summary {
374
377
  list-style: none;
375
378
  appearance: none;
@@ -84,6 +84,14 @@ export interface LyraMediaCardEventMap {
84
84
  * control's own purpose label, and an explicitly empty host name does not
85
85
  * leave the still-interactive nested action unnamed.
86
86
  *
87
+ * **Decorative images.** `alt` is optional rather than empty-by-default, so
88
+ * `alt=""` -- the HTML idiom for a purely decorative image -- reaches the
89
+ * rendered `<img>` verbatim instead of collapsing into the unset case and
90
+ * picking up a generated description. Leaving `alt` off keeps the
91
+ * `filename`-then-generic fallback. The `<video>` label is deliberately
92
+ * outside that carve-out: an empty accessible name would leave an
93
+ * interactive player unnamed rather than mark it decorative.
94
+ *
87
95
  * @customElement lr-media-card
88
96
  * @event lr-media-open - An image card or video `open-button` requested consumer-owned viewing.
89
97
  * `detail: { src, filename }`; noncancelable notification.
@@ -127,9 +135,12 @@ export declare class LyraMediaCard extends LyraElement<LyraMediaCardEventMap> {
127
135
  /** Shown in the file-chip fallback, used as the download link's suggested
128
136
  * filename, and folded into the accessible name of the whole card. */
129
137
  filename: string;
130
- /** Alt text for the image case (and reused as a video label fallback).
131
- * Falls back to `filename`, then a generic per-kind description. */
132
- alt: string;
138
+ /** Alt text for the image case (and reused as a video label fallback). Unset falls back to
139
+ * `filename`, then a generic per-kind description; explicitly `""` marks the image decorative,
140
+ * matching `<lr-image-viewer>`/`<lr-document-preview>`. The `<video>` label is deliberately
141
+ * outside that carve-out: an empty accessible name would leave an interactive player unnamed
142
+ * rather than mark it decorative, so an empty `alt` still falls through there. */
143
+ alt?: string;
133
144
  /** Accessible-name input. A declarative `aria-label` names the host; a property-only assignment
134
145
  * names the internal action when no host label is present. Nested actions otherwise keep a
135
146
  * localized purpose name derived from `filename`, `alt`, or the resolved media kind. An
@@ -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}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{expandIcon,fileIcon}from"../../../internal/icons.js";import{safeDownloadHref as safeMediaCardLinkHref,safeMediaSrc as safeMediaCardSrc}from"../../../internal/safe-url.js";import{styles}from"./media-card.styles.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{LYRA_DEFAULT_mediaCardImageAttachment,LYRA_DEFAULT_mediaCardOpenFileAttachment,LYRA_DEFAULT_mediaCardOpenImageAttachment,LYRA_DEFAULT_mediaCardOpenName,LYRA_DEFAULT_mediaCardOpenVideoAttachment,LYRA_DEFAULT_mediaCardUntitledFile,LYRA_DEFAULT_mediaCardVideoAttachment}from"../../../internal/default-strings.generated.js";function detectKind(mimeType){const mt=mimeType.trim().toLowerCase();return mt.startsWith("image/")?"image":mt.startsWith("video/")?"video":"file"}class LyraMediaCard extends LyraElement{constructor(){super(...arguments),this.src="",this.mimeType="",this.filename="",this.alt="",this.accessibleLabel=null,this.maxHeight="",this.frame="card",this.onActivate=()=>{this.emit("lr-media-open",this.eventDetail())},this.onActionFocus=event=>{relayNativeEvent(this,event)},this.onActionBlur=event=>{relayNativeEvent(this,event)},this.onLinkClick=e=>{this.emit("lr-before-media-download",this.eventDetail(),{cancelable:!0}).defaultPrevented&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,mediaCardImageAttachment:LYRA_DEFAULT_mediaCardImageAttachment,mediaCardOpenFileAttachment:LYRA_DEFAULT_mediaCardOpenFileAttachment,mediaCardOpenImageAttachment:LYRA_DEFAULT_mediaCardOpenImageAttachment,mediaCardOpenName:LYRA_DEFAULT_mediaCardOpenName,mediaCardOpenVideoAttachment:LYRA_DEFAULT_mediaCardOpenVideoAttachment,mediaCardUntitledFile:LYRA_DEFAULT_mediaCardUntitledFile,mediaCardVideoAttachment:LYRA_DEFAULT_mediaCardVideoAttachment}}static{this.styles=[LyraElement.styles,styles]}get resolvedKind(){return this.kind??detectKind(this.mimeType)}get displayFilename(){return this.filename||this.localize("mediaCardUntitledFile")}get actionLabel(){const hostLabel=hostAriaLabel(this);if(this.accessibleLabel&&(hostLabel===null||this.accessibleLabel!==hostLabel))return this.accessibleLabel;const name=this.filename||this.alt;return name?this.localize("mediaCardOpenName",void 0,{name}):this.resolvedKind==="image"?this.localize("mediaCardOpenImageAttachment"):this.resolvedKind==="video"?this.localize("mediaCardOpenVideoAttachment"):this.localize("mediaCardOpenFileAttachment")}get imgAlt(){return this.alt||this.filename||this.localize("mediaCardImageAttachment")}get videoLabel(){return this.alt||this.filename||this.localize("mediaCardVideoAttachment")}get baseStyle(){const maxHeight=sanitizeCssLength(this.maxHeight);return maxHeight?styleMap({"--lr-media-card-max-height":maxHeight}):nothing}eventDetail(){return{src:safeMediaCardSrc(this.src)??safeMediaCardLinkHref(this.src)??this.src.trim(),filename:this.filename}}get primaryAction(){return this.shadowRoot?.querySelector('button[part="base"], button[part="open-button"], a[part="base"]')??null}focus(options){this.primaryAction?.focus(options)}blur(){this.primaryAction?.blur()}click(){this.primaryAction?.click()}renderImage(src){return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{expandIcon,fileIcon}from"../../../internal/icons.js";import{safeDownloadHref as safeMediaCardLinkHref,safeMediaSrc as safeMediaCardSrc}from"../../../internal/safe-url.js";import{styles}from"./media-card.styles.js";import{sanitizeCssLength}from"../../../internal/safe-css.js";import{LYRA_DEFAULT_mediaCardImageAttachment,LYRA_DEFAULT_mediaCardOpenFileAttachment,LYRA_DEFAULT_mediaCardOpenImageAttachment,LYRA_DEFAULT_mediaCardOpenName,LYRA_DEFAULT_mediaCardOpenVideoAttachment,LYRA_DEFAULT_mediaCardUntitledFile,LYRA_DEFAULT_mediaCardVideoAttachment}from"../../../internal/default-strings.generated.js";function detectKind(mimeType){const mt=mimeType.trim().toLowerCase();return mt.startsWith("image/")?"image":mt.startsWith("video/")?"video":"file"}class LyraMediaCard extends LyraElement{constructor(){super(...arguments),this.src="",this.mimeType="",this.filename="",this.accessibleLabel=null,this.maxHeight="",this.frame="card",this.onActivate=()=>{this.emit("lr-media-open",this.eventDetail())},this.onActionFocus=event=>{relayNativeEvent(this,event)},this.onActionBlur=event=>{relayNativeEvent(this,event)},this.onLinkClick=e=>{this.emit("lr-before-media-download",this.eventDetail(),{cancelable:!0}).defaultPrevented&&e.preventDefault()}}static{this.defaultStrings={...super.defaultStrings,mediaCardImageAttachment:LYRA_DEFAULT_mediaCardImageAttachment,mediaCardOpenFileAttachment:LYRA_DEFAULT_mediaCardOpenFileAttachment,mediaCardOpenImageAttachment:LYRA_DEFAULT_mediaCardOpenImageAttachment,mediaCardOpenName:LYRA_DEFAULT_mediaCardOpenName,mediaCardOpenVideoAttachment:LYRA_DEFAULT_mediaCardOpenVideoAttachment,mediaCardUntitledFile:LYRA_DEFAULT_mediaCardUntitledFile,mediaCardVideoAttachment:LYRA_DEFAULT_mediaCardVideoAttachment}}static{this.styles=[LyraElement.styles,styles]}get resolvedKind(){return this.kind??detectKind(this.mimeType)}get displayFilename(){return this.filename||this.localize("mediaCardUntitledFile")}get actionLabel(){const hostLabel=hostAriaLabel(this);if(this.accessibleLabel&&(hostLabel===null||this.accessibleLabel!==hostLabel))return this.accessibleLabel;const name=this.filename||this.alt;return name?this.localize("mediaCardOpenName",void 0,{name}):this.resolvedKind==="image"?this.localize("mediaCardOpenImageAttachment"):this.resolvedKind==="video"?this.localize("mediaCardOpenVideoAttachment"):this.localize("mediaCardOpenFileAttachment")}get imgAlt(){return this.alt??(this.filename||this.localize("mediaCardImageAttachment"))}get videoLabel(){return this.alt||this.filename||this.localize("mediaCardVideoAttachment")}get baseStyle(){const maxHeight=sanitizeCssLength(this.maxHeight);return maxHeight?styleMap({"--lr-media-card-max-height":maxHeight}):nothing}eventDetail(){return{src:safeMediaCardSrc(this.src)??safeMediaCardLinkHref(this.src)??this.src.trim(),filename:this.filename}}get primaryAction(){return this.shadowRoot?.querySelector('button[part="base"], button[part="open-button"], a[part="base"]')??null}focus(options){this.primaryAction?.focus(options)}blur(){this.primaryAction?.blur()}click(){this.primaryAction?.click()}renderImage(src){return html`
2
2
  <button
3
3
  part="base"
4
4
  type="button"