@aceshooting/lyra-ui 23.0.0 → 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +16 -39
  2. package/README.md +72 -35
  3. package/custom-elements.json +1 -1
  4. package/design-tokens.json +1 -1
  5. package/dist/cli/lyra-rename-ledger.mjs +1 -1
  6. package/dist/cli/migration-contract.json +1 -1
  7. package/dist/cli/migration-contract.mjs +1 -1
  8. package/dist/cli/migration-renames.mjs +2 -2
  9. package/dist/cli/migration-transforms.mjs +2 -2
  10. package/dist/components/agent-tools/approval-queue/approval-queue.class.d.ts +1 -4
  11. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +1 -3
  12. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +1 -4
  13. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +1 -1
  14. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.d.ts +1 -7
  15. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +2 -2
  16. package/dist/components/agent-tools/context-inspector/context-inspector.class.d.ts +1 -1
  17. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +2 -5
  18. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -3
  19. package/dist/components/agent-tools/terminal/terminal.class.d.ts +1 -4
  20. package/dist/components/agent-tools/terminal/terminal.class.js +2 -2
  21. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.d.ts +1 -7
  22. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.js +1 -1
  23. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +1 -4
  24. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +1 -3
  25. package/dist/components/charts/chart/lite-chart-axis-layout.d.ts +13 -0
  26. package/dist/components/charts/chart/lite-chart-axis-layout.js +1 -0
  27. package/dist/components/charts/chart/lite-chart.class.d.ts +1 -11
  28. package/dist/components/charts/chart/lite-chart.class.js +4 -4
  29. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +13 -3
  30. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +1 -2
  31. package/dist/components/conversation/chat-message/chat-message.class.d.ts +3 -9
  32. package/dist/components/conversation/chat-message/chat-message.class.js +1 -1
  33. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  34. package/dist/components/conversation/code-block/code-block-core.class.d.ts +6 -8
  35. package/dist/components/conversation/code-block/code-block-shared.d.ts +1 -4
  36. package/dist/components/conversation/code-block/code-block.class.d.ts +4 -6
  37. package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -3
  38. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  39. package/dist/components/conversation/markdown/markdown-core.class.d.ts +1 -4
  40. package/dist/components/conversation/markdown/markdown.class.d.ts +1 -4
  41. package/dist/components/conversation/message-actions/message-actions.class.d.ts +1 -4
  42. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  43. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +1 -4
  44. package/dist/components/conversation/message-feedback/message-feedback.class.js +2 -2
  45. package/dist/components/conversation/message-parts/message-parts.class.d.ts +2 -5
  46. package/dist/components/conversation/message-parts/message-parts.class.js +3 -3
  47. package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +1 -1
  48. package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +2 -0
  49. package/dist/components/conversation/streaming-text/streaming-text-core.class.js +0 -1
  50. package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +2 -0
  51. package/dist/components/conversation/streaming-text/streaming-text.class.js +0 -1
  52. package/dist/components/conversation/thread-list/thread-list.class.d.ts +6 -17
  53. package/dist/components/conversation/thread-list/thread-list.class.js +6 -6
  54. package/dist/components/data/context-meter/context-meter.class.d.ts +1 -6
  55. package/dist/components/data/context-meter/context-meter.class.js +1 -1
  56. package/dist/components/data/data-grid/data-grid.class.d.ts +0 -1
  57. package/dist/components/data/data-grid/data-grid.class.js +2 -2
  58. package/dist/components/data/document-library/document-library.class.d.ts +6 -13
  59. package/dist/components/data/document-library/document-library.class.js +1 -2
  60. package/dist/components/data/heatmap/heatmap-grid-navigation.d.ts +7 -0
  61. package/dist/components/data/heatmap/heatmap-grid-navigation.js +1 -0
  62. package/dist/components/data/heatmap/heatmap.class.d.ts +3 -23
  63. package/dist/components/data/heatmap/heatmap.class.js +2 -2
  64. package/dist/components/data/sequence-strip/sequence-strip.class.d.ts +3 -9
  65. package/dist/components/data/sequence-strip/sequence-strip.class.js +3 -3
  66. package/dist/components/data/table/table.class.d.ts +5 -14
  67. package/dist/components/data/table/table.class.js +6 -6
  68. package/dist/components/forms/button/button.class.d.ts +2 -2
  69. package/dist/components/forms/button/button.class.js +9 -9
  70. package/dist/components/forms/combobox/combobox.class.d.ts +1 -4
  71. package/dist/components/forms/combobox/combobox.class.js +2 -2
  72. package/dist/components/forms/input/time-input.class.d.ts +1 -1
  73. package/dist/components/forms/input/time-input.class.js +1 -1
  74. package/dist/components/forms/select/select.class.d.ts +1 -2
  75. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -1
  76. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  77. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +3 -6
  78. package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
  79. package/dist/components/layout/app-rail/app-rail.class.d.ts +2 -4
  80. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  81. package/dist/components/layout/app-rail-group/app-rail-group.class.d.ts +2 -6
  82. package/dist/components/layout/app-rail-group/app-rail-group.class.js +1 -1
  83. package/dist/components/layout/carousel/carousel.class.d.ts +1 -4
  84. package/dist/components/layout/carousel/carousel.class.js +2 -2
  85. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  86. package/dist/components/layout/details/details.class.d.ts +2 -4
  87. package/dist/components/layout/details/details.class.js +1 -1
  88. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +3 -7
  89. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  90. package/dist/components/layout/menu/menu.class.js +1 -1
  91. package/dist/components/layout/multi-split/multi-split.class.d.ts +2 -4
  92. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  93. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +2 -4
  94. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.js +1 -1
  95. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +1 -4
  96. package/dist/components/layout/reorder-list/reorder-item.class.js +2 -2
  97. package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +5 -9
  98. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +5 -5
  99. package/dist/components/media/av-player/av-player.class.js +3 -3
  100. package/dist/components/media/file-input/file-input.class.d.ts +3 -6
  101. package/dist/components/media/file-input/file-input.class.js +3 -3
  102. package/dist/components/media/lightbox/lightbox.class.d.ts +11 -20
  103. package/dist/components/media/lightbox/lightbox.class.js +1 -1
  104. package/dist/components/media/map/map-data-layers.d.ts +20 -0
  105. package/dist/components/media/map/map-data-layers.js +1 -0
  106. package/dist/components/media/map/map.class.js +3 -3
  107. package/dist/components/media/media-time.d.ts +2 -0
  108. package/dist/components/media/media-time.js +1 -0
  109. package/dist/components/media/video/video.class.js +5 -5
  110. package/dist/components/media/video-playlist/video-playlist.class.js +2 -2
  111. package/dist/components/overlays/callout/callout.class.d.ts +2 -5
  112. package/dist/components/overlays/callout/callout.class.js +2 -2
  113. package/dist/components/overlays/dialog/dialog.class.d.ts +4 -7
  114. package/dist/components/overlays/dialog/dialog.class.js +2 -2
  115. package/dist/components/overlays/overlay/dropdown.class.d.ts +5 -10
  116. package/dist/components/overlays/overlay/dropdown.class.js +2 -2
  117. package/dist/components/overlays/overlay/popover.class.d.ts +2 -3
  118. package/dist/components/overlays/popup/popup.class.js +1 -1
  119. package/dist/components/overlays/progress/progress-bar.class.d.ts +1 -4
  120. package/dist/components/overlays/progress/progress-bar.class.js +2 -2
  121. package/dist/components/overlays/progress/progress-ring.class.d.ts +1 -4
  122. package/dist/components/overlays/progress/progress-ring.class.js +2 -2
  123. package/dist/components/overlays/progress/progress-shared.d.ts +3 -3
  124. package/dist/components/overlays/progress/progress-shared.js +1 -1
  125. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  126. package/dist/components/retrieval/graph/graph.class.d.ts +5 -10
  127. package/dist/components/retrieval/graph/graph.class.js +1 -1
  128. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +7 -14
  129. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +2 -3
  130. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +2 -8
  131. package/dist/components/retrieval/memory-panel/memory-panel.class.js +0 -4
  132. package/dist/components/retrieval/rag-answer/rag-answer.class.js +1 -1
  133. package/dist/components/utility/export-button/export-button.class.d.ts +6 -10
  134. package/dist/components/utility/export-button/export-button.class.js +1 -1
  135. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  136. package/dist/components/viewers/geojson-view/geojson-view.class.d.ts +1 -1
  137. package/dist/components/viewers/highlight-layer/highlight-layer-timing.js +1 -1
  138. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +4 -4
  139. package/dist/events.d.ts +17 -78
  140. package/dist/framework-types.d.ts +1 -1
  141. package/dist/internal/catalog-picker.js +1 -1
  142. package/dist/internal/css-motion-time.d.ts +7 -0
  143. package/dist/internal/css-motion-time.js +1 -0
  144. package/dist/internal/data-state-renderer.d.ts +1 -3
  145. package/dist/internal/data-state-renderer.js +1 -1
  146. package/dist/internal/localization-runtime.d.ts +2 -0
  147. package/dist/internal/localization-runtime.js +1 -1
  148. package/dist/internal/lyra-element.js +2 -2
  149. package/dist/internal/package-metadata.d.ts +1 -1
  150. package/dist/internal/package-metadata.js +1 -1
  151. package/dist/looks/data.css +1 -1
  152. package/dist/looks/terminal.css +1 -1
  153. package/dist/lyra.d.ts +1 -592
  154. package/dist/lyra.js +1 -1
  155. package/dist/testing/event-factory.d.ts +2 -2
  156. package/dist/testing/interaction-drivers.d.ts +5 -3
  157. package/dist/testing/lyra-tag-event-map.js +1 -1
  158. package/dist/theme/looks/data.d.ts +1 -1
  159. package/dist/theme/looks/data.js +1 -1
  160. package/dist/theme/looks/terminal.d.ts +1 -1
  161. package/dist/theme/looks/terminal.js +1 -1
  162. package/dist/theme/theme.d.ts +2 -80
  163. package/dist/theme/theme.js +1 -1
  164. package/llms/components/lr-agent-workspace.md +24 -2
  165. package/llms/components/lr-alert.md +1 -1
  166. package/llms/components/lr-animation.md +1 -1
  167. package/llms/components/lr-app-rail.md +8 -10
  168. package/llms/components/lr-approval-queue.md +2 -4
  169. package/llms/components/lr-attachment-trigger.md +3 -4
  170. package/llms/components/lr-badge.md +2 -2
  171. package/llms/components/lr-button.md +45 -99
  172. package/llms/components/lr-callout.md +3 -4
  173. package/llms/components/lr-carousel.md +3 -5
  174. package/llms/components/lr-chat-message.md +1 -2
  175. package/llms/components/lr-claim-evidence.md +1 -1
  176. package/llms/components/lr-code-block-core.md +2 -2
  177. package/llms/components/lr-code-block.md +5 -6
  178. package/llms/components/lr-color-picker.md +1 -1
  179. package/llms/components/lr-combobox.md +5 -6
  180. package/llms/components/lr-compare-panel.md +2 -4
  181. package/llms/components/lr-confirm-bar.md +3 -7
  182. package/llms/components/lr-context-inspector.md +3 -2
  183. package/llms/components/lr-context-menu.md +2 -2
  184. package/llms/components/lr-context-meter.md +2 -4
  185. package/llms/components/lr-copy-button.md +1 -1
  186. package/llms/components/lr-data-grid.md +4 -7
  187. package/llms/components/lr-details.md +3 -3
  188. package/llms/components/lr-dialog.md +4 -6
  189. package/llms/components/lr-dock-panel.md +5 -6
  190. package/llms/components/lr-document-library.md +5 -7
  191. package/llms/components/lr-drawer.md +3 -3
  192. package/llms/components/lr-dropdown.md +4 -5
  193. package/llms/components/lr-eval-run.md +3 -5
  194. package/llms/components/lr-export-button.md +4 -7
  195. package/llms/components/lr-file-input.md +0 -5
  196. package/llms/components/lr-funnel.md +1 -1
  197. package/llms/components/lr-graph.md +3 -7
  198. package/llms/components/lr-icon.md +1 -1
  199. package/llms/components/lr-include.md +1 -1
  200. package/llms/components/lr-input.md +31 -79
  201. package/llms/components/lr-json-viewer.md +1 -1
  202. package/llms/components/lr-knowledge-base.md +4 -6
  203. package/llms/components/lr-knowledge-graph-explorer.md +2 -5
  204. package/llms/components/lr-known-date.md +1 -1
  205. package/llms/components/lr-lightbox.md +9 -7
  206. package/llms/components/lr-lite-chart.md +1 -5
  207. package/llms/components/lr-markdown-core.md +3 -4
  208. package/llms/components/lr-markdown.md +3 -5
  209. package/llms/components/lr-mcp-app.md +1 -1
  210. package/llms/components/lr-message-actions.md +2 -3
  211. package/llms/components/lr-message-feedback.md +1 -3
  212. package/llms/components/lr-message-parts.md +4 -5
  213. package/llms/components/lr-multi-split.md +8 -7
  214. package/llms/components/lr-native-time-input.md +1 -1
  215. package/llms/components/lr-navigation-menu.md +5 -5
  216. package/llms/components/lr-number-input.md +3 -1
  217. package/llms/components/lr-otp-input.md +2 -0
  218. package/llms/components/lr-page.md +1 -1
  219. package/llms/components/lr-pan-zoom.md +1 -1
  220. package/llms/components/lr-phone-input.md +3 -1
  221. package/llms/components/lr-popover.md +2 -2
  222. package/llms/components/lr-progress-bar.md +3 -5
  223. package/llms/components/lr-progress-ring.md +5 -7
  224. package/llms/components/lr-prompt-input.md +1 -1
  225. package/llms/components/lr-prompt-queue.md +1 -1
  226. package/llms/components/lr-prompt-studio.md +1 -1
  227. package/llms/components/lr-rag-eval-dashboard.md +1 -1
  228. package/llms/components/lr-rating.md +2 -2
  229. package/llms/components/lr-realtime-session.md +1 -1
  230. package/llms/components/lr-reorder-item.md +1 -1
  231. package/llms/components/lr-reorder-list.md +2 -3
  232. package/llms/components/lr-retrieval-compare.md +1 -1
  233. package/llms/components/lr-select.md +3 -1
  234. package/llms/components/lr-selection-toolbar.md +1 -1
  235. package/llms/components/lr-sequence-strip.md +3 -8
  236. package/llms/components/lr-span-waterfall.md +1 -1
  237. package/llms/components/lr-split-panel.md +1 -1
  238. package/llms/components/lr-streaming-text-core.md +2 -1
  239. package/llms/components/lr-streaming-text.md +3 -2
  240. package/llms/components/lr-subagent-panel.md +1 -1
  241. package/llms/components/lr-swatch-picker.md +7 -6
  242. package/llms/components/lr-switch.md +3 -1
  243. package/llms/components/lr-table.md +33 -85
  244. package/llms/components/lr-terminal.md +2 -5
  245. package/llms/components/lr-textarea.md +1 -1
  246. package/llms/components/lr-thread-list.md +8 -14
  247. package/llms/components/lr-time-input.md +1 -1
  248. package/llms/components/lr-toggle-group.md +2 -2
  249. package/llms/components/lr-toggle.md +1 -1
  250. package/llms/components/lr-tool-approval-dialog.md +4 -7
  251. package/llms/components/lr-tool-call-block.md +1 -1
  252. package/llms/components/lr-tool-timeline.md +2 -5
  253. package/llms/components/lr-video-playlist.md +1 -1
  254. package/llms/components/lr-video.md +1 -1
  255. package/llms/components/lr-widget-renderer.md +7 -6
  256. package/llms/components/lr-zoomable-frame.md +1 -1
  257. package/llms/index.md +3 -618
  258. package/llms/migration.md +614 -614
  259. package/llms/shared/events-and-types.md +32 -31
  260. package/llms/shared/frameworks-and-ssr.md +7 -3
  261. package/llms/shared/imports-and-registration.md +22 -22
  262. package/llms/shared/localization-and-rtl.md +2 -2
  263. package/llms/shared/native-styles-and-utilities.md +263 -0
  264. package/llms/shared/styles-and-tokens.md +85 -676
  265. package/llms/shared/testing-and-utilities.md +12 -11
  266. package/llms/shared/v23-to-v24-migration.md +167 -0
  267. package/llms/shared.md +149 -494
  268. package/llms/tokens.md +3 -3
  269. package/llms.txt +9 -4
  270. package/package.json +7 -311
  271. package/registrations.json +1 -1
  272. package/vscode-html-data.json +1 -1
  273. package/web-types.json +1 -1
  274. package/dist/ssr-loader.d.ts +0 -2
  275. package/dist/ssr-loader.js +0 -1
  276. package/dist/theme/presets/shadcn.d.ts +0 -22
  277. package/dist/theme/presets/shadcn.js +0 -1
  278. package/dist/theme/presets.d.ts +0 -49
  279. package/dist/theme/presets.js +0 -1
  280. package/dist/themes/shadcn.css +0 -1
@@ -0,0 +1 @@
1
+ import{finiteCount,finiteRange}from"../../../internal/numbers.js";function hasCategoryLabelText(label){return(label??"").trim()!==""}function categoryLabelGrowth(index,count){return count<=1?"middle":index===0?"right":index===count-1?"left":"middle"}function anchorAwareCategoryLabelPicks(positions,width,gap,firstGrowth,lastGrowth){const count=positions.length;if(count<=2)return;const last=count-1,leftEdge=candidate=>{const growth=candidate===0?firstGrowth:candidate===last?lastGrowth:"middle",x=positions[candidate];return growth==="right"?x:growth==="left"?x-width:x-width/2},clears=(before,after)=>leftEdge(after)-(leftEdge(before)+width)>=gap-1e-6;let everyCandidateFits=!0;for(let candidate=1;candidate<count&&everyCandidateFits;candidate++)everyCandidateFits=clears(candidate-1,candidate);if(everyCandidateFits)return;const firstCenter=leftEdge(0)+width/2,span=leftEdge(last)+width/2-firstCenter,densest=Math.min(last,Math.floor(span/(width+gap)+1e-9)+1);for(let labels=densest;labels>2;labels--){const picks=[0];let candidate=1,fits=!0;for(let slot=1;slot<labels-1&&fits;slot++){const center=firstCenter+slot*span/(labels-1),latest=last-(labels-1-slot);for(;candidate<latest&&Math.abs(positions[candidate+1]-center)<=Math.abs(positions[candidate]-center);)candidate++;fits=clears(picks[picks.length-1],candidate),picks.push(candidate++)}if(fits&&clears(picks[picks.length-1],last))return[...picks,last]}return[0,last]}function widestEstimatedCategoryLabel(labels,renderedIndexes,characterWidth){let widest=0;for(const index of renderedIndexes)widest=Math.max(widest,(labels[index]??"").length*characterWidth);return widest}function automaticMaxCategoryLabels(count,plotWidth,renderedIndexes,labels,bounds,estimatedWidth){if(count<=1)return count;const widest=estimatedWidth??widestEstimatedCategoryLabel(labels,renderedIndexes,bounds.characterWidth);if(widest===0)return count;const lane=widest+bounds.laneInset,fits=Math.floor(finiteRange(plotWidth,0,0,bounds.maxContentWidth)/lane);return Math.min(count,Math.max(2,fits))}function automaticCategoryLabelIndexes(count,renderedIndexes,positions,labels,bounds,estimatedWidth){if(count<=1)return;const widest=estimatedWidth??widestEstimatedCategoryLabel(labels,renderedIndexes,bounds.characterWidth);if(widest===0)return;for(let candidate=1;candidate<positions.length;candidate++)if(!(positions[candidate]>=positions[candidate-1]))return null;const picks=anchorAwareCategoryLabelPicks(positions,widest,bounds.laneInset,categoryLabelGrowth(renderedIndexes[0],count),categoryLabelGrowth(renderedIndexes[renderedIndexes.length-1],count));return picks&&new Set(picks.map(candidate=>renderedIndexes[candidate]))}function visibleCategoryLabelIndexes(count,plotWidth,renderedIndexes,labels,maxLabels,positions,bounds,estimatedWidth){if(maxLabels==null)return;let requested=maxLabels;if(maxLabels==="auto"){const widest=count>1?estimatedWidth??widestEstimatedCategoryLabel(labels,renderedIndexes,bounds.characterWidth):0;if(widest===0)return;if(positions){const automatic=automaticCategoryLabelIndexes(count,renderedIndexes,positions,labels,bounds,widest);if(automatic!==null)return automatic}requested=automaticMaxCategoryLabels(count,plotWidth,renderedIndexes,labels,bounds,widest)}if(typeof requested!="number")return;const max=finiteCount(requested,count);if(count<=max)return;const renderedCount=renderedIndexes.length,selectedCount=Math.min(renderedCount,bounds.maxRenderedRecords,Math.max(2,max));return selectedCount<=1?new Set(selectedCount===1?[renderedIndexes[0]]:[]):new Set(Array.from({length:selectedCount},(_,index)=>renderedIndexes[Math.round(index*(renderedCount-1)/(selectedCount-1))]))}function sparseCategoryLabelExtent(labels,xs,position,grow,pitch,width,margin,maxContentWidth){if(!hasCategoryLabelText(labels[position]))return width;const emptyBefore=position>0&&!hasCategoryLabelText(labels[position-1]),emptyAfter=position<labels.length-1&&!hasCategoryLabelText(labels[position+1]);if(!emptyBefore&&!emptyAfter)return width;const x=xs[position],halfToward=step=>{let outermost=-1;for(let index=position+step;index>=0&&index<labels.length;index+=step){if(hasCategoryLabelText(labels[index]))return Math.abs(x-xs[index])/2;outermost=index}return outermost<0?Number.POSITIVE_INFINITY:Math.abs(x-xs[outermost])+pitch/2},extent=grow==="middle"?2*Math.min(halfToward(-1),halfToward(1))-margin:halfToward(grow==="right"?1:-1)-margin;return finiteRange(Math.max(width,extent),width,width,maxContentWidth)}export{automaticCategoryLabelIndexes,categoryLabelGrowth,hasCategoryLabelText,sparseCategoryLabelExtent,visibleCategoryLabelIndexes,widestEstimatedCategoryLabel};
@@ -338,10 +338,7 @@ minBarHeight?:number;
338
338
  * forbids an attribute selector after `::part()`), so the outline is
339
339
  * painted inside the shadow root and exposed through that token. This component takes no opinion
340
340
  * on what the highlight looks like, only which marks it applies to. */
341
- selectedIndices:readonly number[];private legacyAccessibleLabel;
342
- /** Compatibility fallback below the host aria-label, including an explicitly empty host value.
343
- * @deprecated Use the host aria-label attribute or the native ariaLabel property. */
344
- get accessibleLabel():string|undefined;set accessibleLabel(value:string|undefined);
341
+ selectedIndices:readonly number[];
345
342
  /** The host `aria-label`, which names the chart ahead of every other source. Declared so a
346
343
  * later change re-renders the `<svg>` name. */
347
344
  private hostAccessibleLabel;
@@ -506,13 +503,6 @@ private roundedBarPath;private domain;private emitPoint;private emitNearestLineP
506
503
  private renderBars;private renderLines;render():TemplateResult;private resolvedValueAxisGutter;
507
504
  /** The widest rendered category label under the deterministic per-character estimate. */
508
505
  private widestEstimatedCategoryLabel;
509
- /** Width-only automatic cap, kept for tick positions that are not in source order (a reordering
510
- * `barX`), where "adjacent label" has no single meaning to measure. */
511
- private automaticMaxLabels;
512
- /** Automatic selection against the labels' anchored extents (anchorAwareCategoryLabelPicks()):
513
- * `undefined` renders every sampled label; `null` means the tick positions are not in source
514
- * order, so the caller falls back to the width-only cap. */
515
- private automaticLabelIndexes;
516
506
  /** Indexes retained by `maxLabels`, selected from the generated mark sample so an independently
517
507
  * sampled domain cannot erase requested labels at a later set intersection. The generated mark
518
508
  * sample caps the useful result at 1,000, so this selector must do the same rather than allocate
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{nativeSvgTitle}from"../../../internal/svg-title.js";import{html,svg,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-tokens.styles.js";import{hostAriaLabel,nextId,srOnly}from"../../../internal/a11y.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{finiteAdd,finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import"../../utility/live-region/live-region.class.js";import{styles}from"./lite-chart.styles.js";import{bidiStyles,isolateHtml,isolatedMessage}from"./chart-bidi.js";import{forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssColor,sanitizeCssLength}from"../../../internal/safe-css.js";import{warnDeprecatedUsage}from"../../../internal/dev-mode-attribute-warning.js";import{activeElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{MAX_RENDERED_CHART_RECORDS,sampleChartTableIndexes}from"./chart-table-sampling.js";import{chartChromeLegendPlacement,normalizeChartChromeLegendPosition}from"./chart-chrome.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_liteChartBarLabel,LYRA_DEFAULT_liteChartCustomMarkSummary,LYRA_DEFAULT_liteChartMarkSummary}from"../../../internal/default-strings.generated.js";function isLiteChartSeries(value){try{return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Array.isArray(value.data)}catch{return!1}}function normalizeLiteChartSeries(value){try{return Object.freeze(Array.isArray(value)?value.filter(isLiteChartSeries):[])}catch{return Object.freeze([])}}function normalizeLiteChartType(value){return value==="line"||value==="bar"?value:"bar"}const LITE_CHART_LAYOUT=literalSetConverter(["fit","scroll"],"fit"),autoNumberConverter={fromAttribute:value=>{if(value===null)return;const trimmed=value.trim();return trimmed.toLowerCase()==="auto"?"auto":Number(trimmed)}},DEFAULT_PALETTE=["var(--lr-chart-color-1, var(--lr-color-chart-1))","var(--lr-chart-color-2, var(--lr-color-chart-2))","var(--lr-chart-color-3, var(--lr-color-chart-3))","var(--lr-chart-color-4, var(--lr-color-chart-4))","var(--lr-chart-color-5, var(--lr-color-chart-5))","var(--lr-chart-color-6, var(--lr-color-chart-6))","var(--lr-chart-color-7, var(--lr-color-chart-7))","var(--lr-chart-color-8, var(--lr-color-chart-8))"],PAD_LEFT=36,PAD_RIGHT=8,PAD_TOP=8,PAD_BOTTOM=30,CATEGORY_LABEL_OFFSET=24,AXIS_TITLE_SPACE=14,TICK_COUNT=4,BAR_GROUP_GAP=.2,BAR_GAP=.08,BAR_CORNER_RADIUS=4,APPROX_LABEL_CHARACTER_WIDTH=7,AUTO_CATEGORY_LABEL_INSET=10,VALUE_AXIS_TICK_OFFSET=6,AUTO_VALUE_AXIS_SAFETY_INSET=8,MAX_AUTO_VALUE_AXIS_GUTTER=240,MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION=.4,MAX_SCROLL_CONTENT_WIDTH=1e6;function niceStep(span,count){const rough=span/Math.max(1,count),magnitude=10**Math.floor(Math.log10(rough)),residual=rough/magnitude;return(residual<1.5?1:residual<3?2:residual<7?5:10)*magnitude}function logDomainFraction(value,lo,hi){const top=Math.max(hi,0);if(!Number.isFinite(top)||top<=0)return domainFraction(value,lo,hi);const bottom=lo>0?lo:top/10;if(!Number.isFinite(bottom)||bottom<=0||bottom>=top)return domainFraction(value,lo,hi);if(!Number.isFinite(value)||value<=bottom)return 0;if(value>=top)return 1;const fraction=(Math.log10(value)-Math.log10(bottom))/(Math.log10(top)-Math.log10(bottom));return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function hasCategoryLabelText(label){return(label??"").trim()!==""}function categoryLabelGrowth(index,count){return count<=1?"middle":index===0?"right":index===count-1?"left":"middle"}function anchorAwareCategoryLabelPicks(positions,width,gap,firstGrowth,lastGrowth){const count=positions.length;if(count<=2)return;const last=count-1,leftEdge=candidate=>{const growth=candidate===0?firstGrowth:candidate===last?lastGrowth:"middle",x=positions[candidate];return growth==="right"?x:growth==="left"?x-width:x-width/2},clears=(before,after)=>leftEdge(after)-(leftEdge(before)+width)>=gap-1e-6;let everyCandidateFits=!0;for(let candidate=1;candidate<count&&everyCandidateFits;candidate++)everyCandidateFits=clears(candidate-1,candidate);if(everyCandidateFits)return;const firstCenter=leftEdge(0)+width/2,span=leftEdge(last)+width/2-firstCenter,densest=Math.min(last,Math.floor(span/(width+gap)+1e-9)+1);for(let labels=densest;labels>2;labels--){const picks=[0];let candidate=1,fits=!0;for(let slot=1;slot<labels-1&&fits;slot++){const center=firstCenter+slot*span/(labels-1),latest=last-(labels-1-slot);for(;candidate<latest&&Math.abs(positions[candidate+1]-center)<=Math.abs(positions[candidate]-center);)candidate++;fits=clears(picks[picks.length-1],candidate),picks.push(candidate++)}if(fits&&clears(picks[picks.length-1],last))return[...picks,last]}return[0,last]}function sparseCategoryLabelExtent(labels,xs,position,grow,pitch,width){if(!hasCategoryLabelText(labels[position]))return width;const emptyBefore=position>0&&!hasCategoryLabelText(labels[position-1]),emptyAfter=position<labels.length-1&&!hasCategoryLabelText(labels[position+1]);if(!emptyBefore&&!emptyAfter)return width;const x=xs[position],halfToward=step=>{let outermost=-1;for(let index=position+step;index>=0&&index<labels.length;index+=step){if(hasCategoryLabelText(labels[index]))return Math.abs(x-xs[index])/2;outermost=index}return outermost<0?Number.POSITIVE_INFINITY:Math.abs(x-xs[outermost])+pitch/2},extent=grow==="middle"?2*Math.min(halfToward(-1),halfToward(1))-BAR_CORNER_RADIUS:halfToward(grow==="right"?1:-1)-BAR_CORNER_RADIUS;return finiteRange(Math.max(width,extent),width,width,MAX_SCROLL_CONTENT_WIDTH)}function domainFraction(value,lo,hi){const span=hi-lo;if(Number.isFinite(span)&&span>0)return Math.min(1,Math.max(0,(value-lo)/span));const scale=Math.max(Math.abs(value),Math.abs(lo),Math.abs(hi),1),scaledSpan=hi/scale-lo/scale;if(!Number.isFinite(scaledSpan)||scaledSpan<=0)return 0;const fraction=(value/scale-lo/scale)/scaledSpan;return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function safeDomainTicks(lo,hi,count){return Array.from({length:Math.max(1,count)+1},(_,index)=>{if(index===0)return lo;if(index===count)return hi;const ratio=index/count;return lo*(1-ratio)+hi*ratio}).filter(Number.isFinite)}function logarithmicTicks(lo,hi,count){if(!(lo>0&&hi>lo)||!Number.isFinite(lo)||!Number.isFinite(hi))return;const start=Math.log10(lo),end=Math.log10(hi),span=end-start;if(!(span>0))return;const decades=span>=1,step=decades?Math.ceil(span/count):niceStep(hi-lo,count);if(!Number.isFinite(step)||step<=0)return[...new Set(safeDomainTicks(lo,hi,count))];const ticks=[lo],minimumGap=decades?step/2:span/(count*2),first=Math.ceil((decades?start:lo)/step);for(let index=0;index<=count+1;index++){const value=decades?10**((first+index)*step):(first+index)*step;if(!Number.isFinite(value)||value>=hi)break;if(value<=ticks.at(-1))continue;const logarithm=Math.log10(value);logarithm-Math.log10(ticks.at(-1))>=minimumGap&&end-logarithm>=minimumGap&&ticks.push(value)}return ticks.push(hi),ticks}function niceDomain(dataLo,dataHi,beginAtZero,count){let lo=beginAtZero?Math.min(0,dataLo):dataLo,hi=beginAtZero?Math.max(0,dataHi):dataHi;lo===hi&&(Math.abs(lo)>Number.MAX_VALUE/2?(lo=lo>0?lo/2:lo,hi=hi<0?hi/2:hi):(lo-=1,hi+=1));const span=hi-lo;if(!Number.isFinite(span))return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const step=niceStep(span,count);if(!Number.isFinite(step)||step<=0)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const roundedLo=Math.floor(lo/step)*step,roundedHi=Math.ceil(hi/step)*step;Number.isFinite(roundedLo)&&(lo=roundedLo),Number.isFinite(roundedHi)&&(hi=roundedHi);const slots=Math.floor((hi-lo)/step);if(!Number.isFinite(slots)||slots<0||slots>100)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const ticks=[];for(let index=0;index<=slots;index++){const value=lo+index*step;Number.isFinite(value)&&ticks.push(value)}return ticks.at(-1)!==hi&&ticks.push(hi),{lo,hi,ticks}}class LyraLiteChart extends LyraElement{constructor(){super(...arguments),this.type="bar",this.labels=[],this._datasets=Object.freeze([]),this.withLegend=!1,this.legendPosition="bottom",this.height="280px",this.xLabel="",this.yLabel="",this.withoutZeroBaseline=!1,this.stacked=!1,this.tableTotals=!1,this.withDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("lite-chart-data-table"),this._layout="fit",this.barWidth=32,this.roundedBars=!1,this.skipZero=!1,this.scale="linear",this.withoutValueAxis=!1,this.selectedIndices=[],this.legacyAccessibleLabel=void 0,this.hostAccessibleLabel=null,this.label=null,this.description=null,this.forcedColorPatternId=nextId("lite-chart-pattern"),this.descriptionId=nextId("lite-chart-description"),this.plotWidth=0,this.plotHeight=0,this.fitMeasurementAvailable=!1,this.activeMarkIndex=0,this.resizeObserverGeneration=0,this.axisTitleTargets=new Set,this.axisTitleFits=new WeakMap,this.categoryLabelFits=new WeakMap,this.refocusMarkAfterUpdate=!1,this.refocusChartAfterUpdate=!1,this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.onForcedColorsChange=()=>{!this.isConnected||this.ownerDocument.defaultView!==this.forcedColorsWindow||this.requestUpdate()}}static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartTotal:LYRA_DEFAULT_chartTotal,liteChartBarLabel:LYRA_DEFAULT_liteChartBarLabel,liteChartCustomMarkSummary:LYRA_DEFAULT_liteChartCustomMarkSummary,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["labels","datasets","selectedIndices"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly,bidiStyles]}get datasets(){return this._datasets}set datasets(value){const previous=this._datasets;this._datasets=normalizeLiteChartSeries(value),this.requestUpdate("datasets",previous)}get dataTableVisible(){return this.dataTableToggle?this.dataTableExpandedOverride??this.withDataTable:this.withDataTable}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get layout(){return this._layout}set layout(next){const normalized=LITE_CHART_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get accessibleLabel(){return this.legacyAccessibleLabel}set accessibleLabel(value){warnDeprecatedUsage(this,"property","accessibleLabel","aria-label"),this.legacyAccessibleLabel=value}appendData(label,values,maxPoints=0){const limit=Math.max(0,finiteCount(maxPoints,0));let domainLength=this.labels.length;for(const series of this.datasets)domainLength=Math.max(domainLength,series.data.length);const labels=[...this.labels,...Array.from({length:Math.max(0,domainLength-this.labels.length)},()=>""),label],datasets=this.datasets.map((series,index)=>({...series,data:[...series.data,...Array.from({length:Math.max(0,domainLength-series.data.length)},()=>null),values[index]??null]}));this.labels=limit>0?labels.slice(-limit):labels,this.datasets=limit>0?datasets.map(series=>({...series,data:series.data.slice(-limit)})):datasets}exportData(format){if(format==="svg"){const XMLSerializerCtor=this.ownerDocument.defaultView?.XMLSerializer;return!this.svgEl||typeof XMLSerializerCtor!="function"?"":new XMLSerializerCtor().serializeToString(this.svgEl)}const header=["label",...this.datasets.map(series=>series.label)].map(escapeCsvField).join(","),rows=Array.from({length:this.recordCount()},(_,index)=>{const label=this.labels[index]??"";return[label,...this.datasets.map((series,datasetIndex)=>{const value=series.data[index];return typeof value=="number"&&Number.isFinite(value)?this.formatter?.({value,surface:"export",datasetIndex,index,label,seriesLabel:series.label,axis:"y"})??value:""})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{nativeSvgTitle}from"../../../internal/svg-title.js";import{html,svg,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{specialistTokens}from"../../../internal/specialist-tokens.styles.js";import{nextId,srOnly}from"../../../internal/a11y.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{finiteAdd,finiteCount,finiteNumber,finiteRange}from"../../../internal/numbers.js";import{escapeCsvField}from"../../utility/export-button/csv.js";import"../../utility/live-region/live-region.class.js";import{styles}from"./lite-chart.styles.js";import{bidiStyles,isolateHtml,isolatedMessage}from"./chart-bidi.js";import{forcedColorEncoding,forcedColorsActive}from"./chart-forced-colors.js";import{literalSetConverter}from"../../../internal/converters.js";import{sanitizeCssColor,sanitizeCssLength}from"../../../internal/safe-css.js";import{activeElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{MAX_RENDERED_CHART_RECORDS,sampleChartTableIndexes}from"./chart-table-sampling.js";import{chartChromeLegendPlacement,normalizeChartChromeLegendPosition}from"./chart-chrome.js";import{categoryLabelGrowth,hasCategoryLabelText,sparseCategoryLabelExtent,visibleCategoryLabelIndexes,widestEstimatedCategoryLabel}from"./lite-chart-axis-layout.js";import{LYRA_DEFAULT_chart,LYRA_DEFAULT_chartCategory,LYRA_DEFAULT_chartData,LYRA_DEFAULT_chartDataSampled,LYRA_DEFAULT_chartSeriesLabel,LYRA_DEFAULT_chartTotal,LYRA_DEFAULT_liteChartBarLabel,LYRA_DEFAULT_liteChartCustomMarkSummary,LYRA_DEFAULT_liteChartMarkSummary}from"../../../internal/default-strings.generated.js";function isLiteChartSeries(value){try{return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Array.isArray(value.data)}catch{return!1}}function normalizeLiteChartSeries(value){try{return Object.freeze(Array.isArray(value)?value.filter(isLiteChartSeries):[])}catch{return Object.freeze([])}}function normalizeLiteChartType(value){return value==="line"||value==="bar"?value:"bar"}const LITE_CHART_LAYOUT=literalSetConverter(["fit","scroll"],"fit"),autoNumberConverter={fromAttribute:value=>{if(value===null)return;const trimmed=value.trim();return trimmed.toLowerCase()==="auto"?"auto":Number(trimmed)}},DEFAULT_PALETTE=["var(--lr-chart-color-1, var(--lr-color-chart-1))","var(--lr-chart-color-2, var(--lr-color-chart-2))","var(--lr-chart-color-3, var(--lr-color-chart-3))","var(--lr-chart-color-4, var(--lr-color-chart-4))","var(--lr-chart-color-5, var(--lr-color-chart-5))","var(--lr-chart-color-6, var(--lr-color-chart-6))","var(--lr-chart-color-7, var(--lr-color-chart-7))","var(--lr-chart-color-8, var(--lr-color-chart-8))"],PAD_LEFT=36,PAD_RIGHT=8,PAD_TOP=8,PAD_BOTTOM=30,CATEGORY_LABEL_OFFSET=24,AXIS_TITLE_SPACE=14,TICK_COUNT=4,BAR_GROUP_GAP=.2,BAR_GAP=.08,BAR_CORNER_RADIUS=4,APPROX_LABEL_CHARACTER_WIDTH=7,AUTO_CATEGORY_LABEL_INSET=10,VALUE_AXIS_TICK_OFFSET=6,AUTO_VALUE_AXIS_SAFETY_INSET=8,MAX_AUTO_VALUE_AXIS_GUTTER=240,MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION=.4,MAX_SCROLL_CONTENT_WIDTH=1e6,CATEGORY_LABEL_SELECTION_BOUNDS=Object.freeze({characterWidth:APPROX_LABEL_CHARACTER_WIDTH,laneInset:AUTO_CATEGORY_LABEL_INSET,maxContentWidth:MAX_SCROLL_CONTENT_WIDTH,maxRenderedRecords:MAX_RENDERED_CHART_RECORDS});function niceStep(span,count){const rough=span/Math.max(1,count),magnitude=10**Math.floor(Math.log10(rough)),residual=rough/magnitude;return(residual<1.5?1:residual<3?2:residual<7?5:10)*magnitude}function logDomainFraction(value,lo,hi){const top=Math.max(hi,0);if(!Number.isFinite(top)||top<=0)return domainFraction(value,lo,hi);const bottom=lo>0?lo:top/10;if(!Number.isFinite(bottom)||bottom<=0||bottom>=top)return domainFraction(value,lo,hi);if(!Number.isFinite(value)||value<=bottom)return 0;if(value>=top)return 1;const fraction=(Math.log10(value)-Math.log10(bottom))/(Math.log10(top)-Math.log10(bottom));return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function domainFraction(value,lo,hi){const span=hi-lo;if(Number.isFinite(span)&&span>0)return Math.min(1,Math.max(0,(value-lo)/span));const scale=Math.max(Math.abs(value),Math.abs(lo),Math.abs(hi),1),scaledSpan=hi/scale-lo/scale;if(!Number.isFinite(scaledSpan)||scaledSpan<=0)return 0;const fraction=(value/scale-lo/scale)/scaledSpan;return Number.isFinite(fraction)?Math.min(1,Math.max(0,fraction)):0}function safeDomainTicks(lo,hi,count){return Array.from({length:Math.max(1,count)+1},(_,index)=>{if(index===0)return lo;if(index===count)return hi;const ratio=index/count;return lo*(1-ratio)+hi*ratio}).filter(Number.isFinite)}function logarithmicTicks(lo,hi,count){if(!(lo>0&&hi>lo)||!Number.isFinite(lo)||!Number.isFinite(hi))return;const start=Math.log10(lo),end=Math.log10(hi),span=end-start;if(!(span>0))return;const decades=span>=1,step=decades?Math.ceil(span/count):niceStep(hi-lo,count);if(!Number.isFinite(step)||step<=0)return[...new Set(safeDomainTicks(lo,hi,count))];const ticks=[lo],minimumGap=decades?step/2:span/(count*2),first=Math.ceil((decades?start:lo)/step);for(let index=0;index<=count+1;index++){const value=decades?10**((first+index)*step):(first+index)*step;if(!Number.isFinite(value)||value>=hi)break;if(value<=ticks.at(-1))continue;const logarithm=Math.log10(value);logarithm-Math.log10(ticks.at(-1))>=minimumGap&&end-logarithm>=minimumGap&&ticks.push(value)}return ticks.push(hi),ticks}function niceDomain(dataLo,dataHi,beginAtZero,count){let lo=beginAtZero?Math.min(0,dataLo):dataLo,hi=beginAtZero?Math.max(0,dataHi):dataHi;lo===hi&&(Math.abs(lo)>Number.MAX_VALUE/2?(lo=lo>0?lo/2:lo,hi=hi<0?hi/2:hi):(lo-=1,hi+=1));const span=hi-lo;if(!Number.isFinite(span))return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const step=niceStep(span,count);if(!Number.isFinite(step)||step<=0)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const roundedLo=Math.floor(lo/step)*step,roundedHi=Math.ceil(hi/step)*step;Number.isFinite(roundedLo)&&(lo=roundedLo),Number.isFinite(roundedHi)&&(hi=roundedHi);const slots=Math.floor((hi-lo)/step);if(!Number.isFinite(slots)||slots<0||slots>100)return{lo,hi,ticks:safeDomainTicks(lo,hi,count)};const ticks=[];for(let index=0;index<=slots;index++){const value=lo+index*step;Number.isFinite(value)&&ticks.push(value)}return ticks.at(-1)!==hi&&ticks.push(hi),{lo,hi,ticks}}class LyraLiteChart extends LyraElement{constructor(){super(...arguments),this.type="bar",this.labels=[],this._datasets=Object.freeze([]),this.withLegend=!1,this.legendPosition="bottom",this.height="280px",this.xLabel="",this.yLabel="",this.withoutZeroBaseline=!1,this.stacked=!1,this.tableTotals=!1,this.withDataTable=!1,this.dataTableToggle=!1,this.dataTableExpandedOverride=null,this.dataTableId=nextId("lite-chart-data-table"),this._layout="fit",this.barWidth=32,this.roundedBars=!1,this.skipZero=!1,this.scale="linear",this.withoutValueAxis=!1,this.selectedIndices=[],this.hostAccessibleLabel=null,this.label=null,this.description=null,this.forcedColorPatternId=nextId("lite-chart-pattern"),this.descriptionId=nextId("lite-chart-description"),this.plotWidth=0,this.plotHeight=0,this.fitMeasurementAvailable=!1,this.activeMarkIndex=0,this.resizeObserverGeneration=0,this.axisTitleTargets=new Set,this.axisTitleFits=new WeakMap,this.categoryLabelFits=new WeakMap,this.refocusMarkAfterUpdate=!1,this.refocusChartAfterUpdate=!1,this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.onForcedColorsChange=()=>{!this.isConnected||this.ownerDocument.defaultView!==this.forcedColorsWindow||this.requestUpdate()}}static{this.defaultStrings={...super.defaultStrings,chart:LYRA_DEFAULT_chart,chartCategory:LYRA_DEFAULT_chartCategory,chartData:LYRA_DEFAULT_chartData,chartDataSampled:LYRA_DEFAULT_chartDataSampled,chartSeriesLabel:LYRA_DEFAULT_chartSeriesLabel,chartTotal:LYRA_DEFAULT_chartTotal,liteChartBarLabel:LYRA_DEFAULT_liteChartBarLabel,liteChartCustomMarkSummary:LYRA_DEFAULT_liteChartCustomMarkSummary,liteChartMarkSummary:LYRA_DEFAULT_liteChartMarkSummary}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["labels","datasets","selectedIndices"])}static{this.styles=[LyraElement.styles,specialistTokens,styles,srOnly,bidiStyles]}get datasets(){return this._datasets}set datasets(value){const previous=this._datasets;this._datasets=normalizeLiteChartSeries(value),this.requestUpdate("datasets",previous)}get dataTableVisible(){return this.dataTableToggle?this.dataTableExpandedOverride??this.withDataTable:this.withDataTable}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get layout(){return this._layout}set layout(next){const normalized=LITE_CHART_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}appendData(label,values,maxPoints=0){const limit=Math.max(0,finiteCount(maxPoints,0));let domainLength=this.labels.length;for(const series of this.datasets)domainLength=Math.max(domainLength,series.data.length);const labels=[...this.labels,...Array.from({length:Math.max(0,domainLength-this.labels.length)},()=>""),label],datasets=this.datasets.map((series,index)=>({...series,data:[...series.data,...Array.from({length:Math.max(0,domainLength-series.data.length)},()=>null),values[index]??null]}));this.labels=limit>0?labels.slice(-limit):labels,this.datasets=limit>0?datasets.map(series=>({...series,data:series.data.slice(-limit)})):datasets}exportData(format){if(format==="svg"){const XMLSerializerCtor=this.ownerDocument.defaultView?.XMLSerializer;return!this.svgEl||typeof XMLSerializerCtor!="function"?"":new XMLSerializerCtor().serializeToString(this.svgEl)}const header=["label",...this.datasets.map(series=>series.label)].map(escapeCsvField).join(","),rows=Array.from({length:this.recordCount()},(_,index)=>{const label=this.labels[index]??"";return[label,...this.datasets.map((series,datasetIndex)=>{const value=series.data[index];return typeof value=="number"&&Number.isFinite(value)?this.formatter?.({value,surface:"export",datasetIndex,index,label,seriesLabel:series.label,axis:"y"})??value:""})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
2
2
  `)}attributeChangedCallback(name,oldValue,value){super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&(name==="style"||name==="class")&&(this.fitAxisTitles(),this.fitCategoryLabels())}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.armResizeObserver(),this.armForcedColorsWatcher()}armResizeObserver(){const target=this.svgEl,ownerDocument=this.ownerDocument;if(!this.isConnected||!target||this.resizeObserver&&this.resizeObserverDocument===ownerDocument&&this.resizeObserverTarget===target)return;this.resetResizeObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.resizeObserverGeneration,observer=new ResizeObserverCtor(entries=>{if(this.resizeObserver!==observer||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.resizeObserverTarget!==target)return;const svgEntry=entries.find(entry=>entry.target===target);if(svgEntry){const box=svgEntry.contentBoxSize?.[0];if(box)this.plotWidth=box.inlineSize,this.plotHeight=box.blockSize;else{const rect=target.getBoundingClientRect();this.plotWidth=rect.width,this.plotHeight=rect.height}}entries.some(entry=>this.axisTitleTargets.has(entry.target))&&this.queueAxisTitleFit()});this.resizeObserver=observer,this.resizeObserverDocument=ownerDocument,this.resizeObserverTarget=target,target&&observer.observe(target),this.syncAxisTitleTargets()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink(),this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.resetResizeObserver(),this.disarmForcedColorsWatcher()}adoptedCallback(){super.adoptedCallback(),this.resetResizeObserver(),this.releaseAnnouncementSink(),this.syncAnnouncementSink(),this.refreshFitMeasurementAvailability(),this.armForcedColorsWatcher()}armForcedColorsWatcher(){const ownerWindow=this.ownerDocument?.defaultView??void 0;ownerWindow?.matchMedia&&(this.forcedColorsWindow===ownerWindow&&this.forcedColorsQuery||(this.disarmForcedColorsWatcher(),this.forcedColorsWindow=ownerWindow,this.forcedColorsQuery=ownerWindow.matchMedia("(forced-colors: active)"),this.forcedColorsQuery.addEventListener("change",this.onForcedColorsChange)))}disarmForcedColorsWatcher(){this.forcedColorsQuery?.removeEventListener("change",this.onForcedColorsChange),this.forcedColorsQuery=void 0,this.forcedColorsWindow=void 0}syncAnnouncementSink(){this.isConnected&&this.politeAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.politeAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}releaseAnnouncementSink(){this.politeAnnouncementSink?.release(),this.politeAnnouncementSink=void 0}resetResizeObserver(){this.axisTitleFrame!==void 0&&(this.resizeObserverDocument?.defaultView?.cancelAnimationFrame(this.axisTitleFrame),this.axisTitleFrame=void 0),this.axisTitleTargets.clear(),this.resizeObserverGeneration+=1,this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeObserverDocument=void 0,this.resizeObserverTarget=void 0}firstUpdated(changed){super.firstUpdated(changed),this.armResizeObserver()}willUpdate(changed){if(super.willUpdate(changed),this.seedFirstRenderState(()=>{this.refreshFitMeasurementAvailability()}),!["type","labels","datasets","skipZero"].some(name=>changed.has(name)))return;const active=activeElementIn(this.shadowRoot)??null,hadFocusedMark=active?.matches('[part="bar"], [part="point"]')??!1,priorPosition=Number(active?.getAttribute("data-mark-index")??this.activeMarkIndex),datasetAttribute=active?.getAttribute("data-dataset-index"),indexAttribute=active?.getAttribute("data-index"),datasetIndex=Number(datasetAttribute),index=Number(indexAttribute),marks=this.interactiveMarks(),sameIdentity=datasetAttribute!=null&&indexAttribute!==null&&indexAttribute!==void 0?marks.findIndex(mark=>mark.datasetIndex===datasetIndex&&mark.index===index):-1;this.activeMarkIndex=marks.length?sameIdentity>=0?sameIdentity:Math.min(Math.max(priorPosition,0),marks.length-1):0,this.refocusMarkAfterUpdate=hadFocusedMark&&marks.length>0,this.refocusChartAfterUpdate=hadFocusedMark&&marks.length===0}updated(changed){super.updated(changed);const wasMounting=this.isMounting;if(this.isMounting=!1,changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}const dataTruncation=this.dataTruncationMessage();wasMounting?this.lastDataTruncationAnnouncement=dataTruncation:dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.politeAnnouncementSink?.announce(dataTruncation)),this.refocusMarkAfterUpdate&&(this.refocusMarkAfterUpdate=!1,this.renderRoot.querySelectorAll('[part="bar"], [part="point"]')[this.normalizedMarkIndex()]?.focus()),this.refocusChartAfterUpdate&&(this.refocusChartAfterUpdate=!1,this.svgEl?.focus()),this.fitAxisTitles(),this.fitCategoryLabels(),this.syncAxisTitleTargets()}fitAxisTitles(){if(!(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length))for(const title of this.svgEl.querySelectorAll('[part="axis-title"]')){const text=Array.from(title.childNodes).find(node=>node.nodeType===3);if(!text)continue;const source=title.getAttribute("aria-label")??"",extent=finiteRange(Number(title.getAttribute("data-title-extent")),0,0,MAX_SCROLL_CONTENT_WIDTH),previous=this.axisTitleFits.get(title);if(!(previous?.source===source&&previous.extent===extent&&previous.display===text.data&&previous.width===title.getComputedTextLength())){if(title.style.removeProperty("opacity"),text.data=source,title.getComputedTextLength()>extent)if(text.data="…",title.getComputedTextLength()>extent)title.style.opacity="0";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=`${source.slice(0,middle)}…`,title.getComputedTextLength()<=extent?lower=middle:upper=middle-1}const last=source.charCodeAt(lower-1);last>=55296&&last<=56319&&(lower-=1),text.data=`${source.slice(0,lower)}…`}this.axisTitleFits.set(title,{source,extent,display:text.data,width:title.getComputedTextLength()})}}}fitOneCategoryLabel(tick,x,anchor,extent){const bounded=finiteRange(extent,0,0,MAX_SCROLL_CONTENT_WIDTH);tick.setAttribute("data-label-extent",String(bounded));const text=Array.from(tick.childNodes).find(node=>node.nodeType===3);if(!text)return x;const source=tick.getAttribute("data-full-label")??"",previous=this.categoryLabelFits.get(tick);if(previous?.source===source&&previous.extent===bounded&&previous.display===text.data&&previous.width===tick.getComputedTextLength())return anchor==="start"?x+previous.width:anchor==="end"?x-previous.width:x;if(text.data=source,tick.getComputedTextLength()>bounded)if(source.length<=1)text.data=source.length===0?source:"…";else{let lower=0,upper=source.length;for(;lower<upper;){const middle=Math.ceil((lower+upper)/2);text.data=middle===0?"…":`${source.slice(0,middle)}…`,tick.getComputedTextLength()<=bounded?lower=middle:upper=middle-1}const lastCode=source.charCodeAt(lower-1);lastCode>=55296&&lastCode<=56319&&(lower-=1),text.data=lower===0?"…":`${source.slice(0,lower)}…`}text.data===source?tick.removeAttribute("aria-label"):tick.setAttribute("aria-label",source);const width=tick.getComputedTextLength();return this.categoryLabelFits.set(tick,{source,extent:bounded,display:text.data,width}),anchor==="start"?x+width:anchor==="end"?x-width:x}fitCategoryLabels(){if(!this.ownerDocument?.defaultView||!this.isConnected||!this.svgEl?.getClientRects().length)return;const ticks=[...this.svgEl.querySelectorAll('[part="axis-label"][data-full-label]')].filter(tick=>hasCategoryLabelText(tick.getAttribute("data-full-label"))).sort((a,b)=>Number(a.getAttribute("x"))-Number(b.getAttribute("x"))),count=ticks.length;if(count===0)return;const MARGIN=BAR_CORNER_RADIUS,positionOf=tick=>Number(tick.getAttribute("x"))||0,anchorOf=tick=>tick.getAttribute("text-anchor")??"middle",first=ticks[0],last=ticks[count-1],firstIsBoundary=count>1&&anchorOf(first)!=="middle",lastIsBoundary=count>1&&anchorOf(last)!=="middle";let firstRightEdge=positionOf(first),lastLeftEdge=positionOf(last);if(firstIsBoundary&&lastIsBoundary&&count===2){const half=Math.max(0,(positionOf(last)-positionOf(first))/2-MARGIN);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),half),lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),half)}else{if(firstIsBoundary){const gap=positionOf(ticks[1])-positionOf(first);firstRightEdge=this.fitOneCategoryLabel(first,positionOf(first),anchorOf(first),gap-MARGIN)}if(lastIsBoundary){const gap=positionOf(last)-positionOf(ticks[count-2]);lastLeftEdge=this.fitOneCategoryLabel(last,positionOf(last),anchorOf(last),gap-MARGIN)}}for(let index=0;index<count;index++){if(index===0&&firstIsBoundary||index===count-1&&lastIsBoundary)continue;const tick=ticks[index],x=positionOf(tick),leftAvailable=index===0?MAX_SCROLL_CONTENT_WIDTH:index===1&&firstIsBoundary?x-firstRightEdge:(x-positionOf(ticks[index-1]))/2,rightAvailable=index===count-1?MAX_SCROLL_CONTENT_WIDTH:index===count-2&&lastIsBoundary?lastLeftEdge-x:(positionOf(ticks[index+1])-x)/2,extent=2*Math.min(leftAvailable,rightAvailable)-MARGIN;this.fitOneCategoryLabel(tick,x,anchorOf(tick),extent)}}syncAxisTitleTargets(){if(!this.resizeObserver||!this.svgEl)return;const current=new Set(this.svgEl.querySelectorAll('[part="axis-title"]'));for(const title of this.axisTitleTargets)current.has(title)||this.resizeObserver.unobserve(title);for(const title of current)this.axisTitleTargets.has(title)||this.resizeObserver.observe(title);this.axisTitleTargets=current}queueAxisTitleFit(){const document=this.resizeObserverDocument,window=document?.defaultView;if(!window||this.axisTitleFrame!==void 0)return;const generation=this.resizeObserverGeneration,frame=window.requestAnimationFrame(()=>{this.axisTitleFrame!==frame||this.resizeObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==document||(this.axisTitleFrame=void 0,this.fitAxisTitles())});this.axisTitleFrame=frame}colorFor(index,series){return sanitizeCssColor(series.color)??DEFAULT_PALETTE[index%DEFAULT_PALETTE.length]}get effectiveType(){return normalizeLiteChartType(this.type)}forcedColors(){return forcedColorsActive(this.ownerDocument?.defaultView)}markPaint(index,series){const color=this.colorFor(index,series);return this.effectiveType==="bar"&&this.forcedColors()?`url(#${this.forcedColorPatternId}-${index})`:color}legendEncoding(index){return this.forcedColors()?forcedColorEncoding(index).name:nothing}markDash(index){if(!this.forcedColors())return nothing;const dash=forcedColorEncoding(index).dash;return dash.length?dash.join(" "):"none"}renderForcedColorPatterns(){if(this.effectiveType!=="bar"||!this.forcedColors())return nothing;const size=8,half=size/2,texture="var(--lr-color-surface)";return svg`<defs>
3
3
  ${this.recordSample().seriesIndexes.map(index=>{const series=this.datasets[index],encoding=forcedColorEncoding(index).name,shapes=(()=>{switch(encoding){case"horizontal":return svg`<rect y=${half} width=${size} height="1" fill=${texture}></rect>`;case"vertical":return svg`<rect x=${half} width="1" height=${size} fill=${texture}></rect>`;case"diagonal":return svg`<path
4
4
  d=${`M${-half},${size} L${half},0 M${half},${size} L${size+half},0`}
@@ -120,7 +120,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
120
120
  d=${d.trim()}
121
121
  stroke=${color}
122
122
  stroke-dasharray=${this.markDash(di)}
123
- ></path>${dots}`})}render(){return this.renderChart()}resolvedValueAxisGutter(ticks,measuredWidth){if(typeof this.valueAxisGutter=="number")return finiteRange(this.valueAxisGutter,PAD_LEFT,0,MAX_SCROLL_CONTENT_WIDTH);if(this.valueAxisGutter!=="auto"||ticks.length===0)return PAD_LEFT;let widest=0;for(const tick of ticks)widest=Math.max(widest,tick.label.length*APPROX_LABEL_CHARACTER_WIDTH);const requested=Math.ceil(widest)+VALUE_AXIS_TICK_OFFSET+AUTO_VALUE_AXIS_SAFETY_INSET,maximum=this.layout==="scroll"?MAX_AUTO_VALUE_AXIS_GUTTER:Math.max(PAD_LEFT,Math.min(MAX_AUTO_VALUE_AXIS_GUTTER,measuredWidth*MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION));return finiteRange(requested,PAD_LEFT,PAD_LEFT,maximum)}widestEstimatedCategoryLabel(renderedIndexes){let widest=0;for(const index of renderedIndexes){const label=this.labels[index]??"";widest=Math.max(widest,label.length*APPROX_LABEL_CHARACTER_WIDTH)}return widest}automaticMaxLabels(n,plotW,renderedIndexes){if(n<=1)return n;const widest=this.widestEstimatedCategoryLabel(renderedIndexes);if(widest===0)return n;const lane=widest+AUTO_CATEGORY_LABEL_INSET,fits=Math.floor(finiteRange(plotW,0,0,MAX_SCROLL_CONTENT_WIDTH)/lane);return Math.min(n,Math.max(2,fits))}automaticLabelIndexes(n,renderedIndexes,tickX){if(n<=1)return;const widest=this.widestEstimatedCategoryLabel(renderedIndexes);if(widest===0)return;const positions=renderedIndexes.map(tickX);for(let candidate=1;candidate<positions.length;candidate++)if(!(positions[candidate]>=positions[candidate-1]))return null;const picks=anchorAwareCategoryLabelPicks(positions,widest,AUTO_CATEGORY_LABEL_INSET,categoryLabelGrowth(renderedIndexes[0],n),categoryLabelGrowth(renderedIndexes[renderedIndexes.length-1],n));return picks&&new Set(picks.map(candidate=>renderedIndexes[candidate]))}visibleLabelIndexes(n,plotW,renderedIndexes,tickX){if(this.maxLabels==null)return;if(this.maxLabels==="auto"&&tickX){const automatic=this.automaticLabelIndexes(n,renderedIndexes,tickX);if(automatic!==null)return automatic}const requested=this.maxLabels==="auto"?this.automaticMaxLabels(n,plotW,renderedIndexes):this.maxLabels;if(typeof requested!="number")return;const max=finiteCount(requested,n);if(n<=max)return;const renderedCount=renderedIndexes.length,count=Math.min(renderedCount,MAX_RENDERED_CHART_RECORDS,Math.max(2,max));return count<=1?new Set(count===1?[renderedIndexes[0]]:[]):new Set(Array.from({length:count},(_,index)=>renderedIndexes[Math.round(index*(renderedCount-1)/(count-1))]))}fixedBarSlotWidth(n){const requested=typeof this.barSlotWidth=="number"?finiteNumber(this.barSlotWidth,0):0;if(requested<=0)return;const maxSlot=n>0?MAX_SCROLL_CONTENT_WIDTH/n:MAX_SCROLL_CONTENT_WIDTH;return finiteRange(requested,0,0,maxSlot)}displayCategoryLabel(label,availableWidth){const maxCharacters=Math.max(1,Math.floor(availableWidth/APPROX_LABEL_CHARACTER_WIDTH));return label.length<=maxCharacters?label:maxCharacters===1?"…":`${label.slice(0,maxCharacters-1)}…`}renderChart(){const direction=this.effectiveDirection==="rtl"?"rtl":"ltr",n=this.recordCount(),awaitingFitMeasurement=this.awaitingFitMeasurement(),h=finiteRange(this.plotHeight||200,200,0,MAX_SCROLL_CONTENT_WIDTH),measuredWidth=finiteRange(this.plotWidth||400,400,0,MAX_SCROLL_CONTENT_WIDTH),{lo,hi,ticks}=this.domain(),formattedTicks=awaitingFitMeasurement||this.withoutValueAxis?[]:ticks.map(value=>({value,label:this.formatValueAxisTick(value)})),axisGutter=this.resolvedValueAxisGutter(formattedTicks,measuredWidth)+(this.yLabel?AXIS_TITLE_SPACE:0),rtl=this.effectiveDirection==="rtl",padBottom=PAD_BOTTOM+(this.xLabel?AXIS_TITLE_SPACE:0),plotX=rtl?PAD_RIGHT:axisGutter,plotY=PAD_TOP,plotH=Math.max(0,h-plotY-padBottom);let w,plotW,slot,fixedSlot;if(this.layout==="scroll"){const maxSlot=n>0?MAX_SCROLL_CONTENT_WIDTH/n:MAX_SCROLL_CONTENT_WIDTH;slot=finiteRange(this.barWidth,32,0,maxSlot),plotW=n*slot,w=axisGutter+plotW+PAD_RIGHT}else w=measuredWidth,plotW=Math.max(0,w-axisGutter-PAD_RIGHT),fixedSlot=this.fixedBarSlotWidth(n),slot=fixedSlot??(n>0?plotW/n:0);const recordSample=this.recordSample(),selectedIndices=new Set,renderedRows=new Set(recordSample.rowIndexes);for(let index=0;index<this.selectedIndices.length;index++){const candidate=this.selectedIndices[index];typeof candidate=="number"&&Number.isInteger(candidate)&&renderedRows.has(candidate)&&selectedIndices.add(candidate)}const barOrigins=this.effectiveType==="bar"&&!awaitingFitMeasurement?new Map(recordSample.rowIndexes.map(index=>{const fallback=plotX+index*slot,candidate=typeof this.barX=="function"?this.barX(index):fallback;return[index,finiteRange(candidate,fallback,-MAX_SCROLL_CONTENT_WIDTH,MAX_SCROLL_CONTENT_WIDTH)]})):new Map,grid=awaitingFitMeasurement||this.withoutValueAxis?[]:this.renderGrid(plotX,plotY,plotW,plotH,formattedTicks,lo,hi),marks=awaitingFitMeasurement?[]:this.effectiveType==="bar"?this.renderBars(plotX,plotY,plotH,slot,lo,hi,barOrigins,recordSample,selectedIndices):this.renderLines(plotX,plotY,plotW,plotH,lo,hi,recordSample,selectedIndices),categoryLabelX=i=>this.effectiveType==="bar"&&n>0?(barOrigins.get(i)??plotX+i*slot)+slot/2:plotX+(n>1?i/(n-1)*plotW:plotW/2),visibleLabelIndexes=this.visibleLabelIndexes(n,fixedSlot===void 0||this.effectiveType!=="bar"?plotW:n*slot,recordSample.rowIndexes,categoryLabelX),tickOverrides=new Map,renderedTickIndexes=[];for(const i of recordSample.rowIndexes){if(visibleLabelIndexes&&!visibleLabelIndexes.has(i))continue;const label=this.labels[i]??"",override=this.axisLabelText?.(label,i);override!==null&&(tickOverrides.set(i,override),renderedTickIndexes.push(i))}const categoryLabelPitch=(renderedTickIndexes.length?n/renderedTickIndexes.length:1)*(this.effectiveType==="bar"?slot:n>1?plotW/(n-1):plotW),categoryLabelWidth=Math.max(0,categoryLabelPitch-BAR_CORNER_RADIUS),tickFullLabels=renderedTickIndexes.map(i=>{const override=tickOverrides.get(i);return typeof override=="string"?override:this.labels[i]??""}),tickXs=renderedTickIndexes.map(categoryLabelX),categoryLabels=awaitingFitMeasurement?[]:renderedTickIndexes.map((i,position)=>{const fullLabel=tickFullLabels[position],x=tickXs[position],growth=categoryLabelGrowth(i,n),textAnchor=growth==="middle"?"middle":growth==="right"?rtl?"end":"start":rtl?"start":"end",labelExtent=sparseCategoryLabelExtent(tickFullLabels,tickXs,position,growth,categoryLabelPitch,categoryLabelWidth),displayLabel=this.displayCategoryLabel(fullLabel,labelExtent);return svg`<text
123
+ ></path>${dots}`})}render(){return this.renderChart()}resolvedValueAxisGutter(ticks,measuredWidth){if(typeof this.valueAxisGutter=="number")return finiteRange(this.valueAxisGutter,PAD_LEFT,0,MAX_SCROLL_CONTENT_WIDTH);if(this.valueAxisGutter!=="auto"||ticks.length===0)return PAD_LEFT;let widest=0;for(const tick of ticks)widest=Math.max(widest,tick.label.length*APPROX_LABEL_CHARACTER_WIDTH);const requested=Math.ceil(widest)+VALUE_AXIS_TICK_OFFSET+AUTO_VALUE_AXIS_SAFETY_INSET,maximum=this.layout==="scroll"?MAX_AUTO_VALUE_AXIS_GUTTER:Math.max(PAD_LEFT,Math.min(MAX_AUTO_VALUE_AXIS_GUTTER,measuredWidth*MAX_AUTO_VALUE_AXIS_GUTTER_FRACTION));return finiteRange(requested,PAD_LEFT,PAD_LEFT,maximum)}widestEstimatedCategoryLabel(renderedIndexes){return widestEstimatedCategoryLabel(this.labels,renderedIndexes,APPROX_LABEL_CHARACTER_WIDTH)}visibleLabelIndexes(n,plotW,renderedIndexes,tickX){if(this.maxLabels==null)return;let estimatedWidth,positions;return this.maxLabels==="auto"&&tickX&&n>1&&(estimatedWidth=this.widestEstimatedCategoryLabel(renderedIndexes),estimatedWidth>0&&(positions=renderedIndexes.map(tickX))),visibleCategoryLabelIndexes(n,plotW,renderedIndexes,this.labels,this.maxLabels,positions,CATEGORY_LABEL_SELECTION_BOUNDS,estimatedWidth)}fixedBarSlotWidth(n){const requested=typeof this.barSlotWidth=="number"?finiteNumber(this.barSlotWidth,0):0;if(requested<=0)return;const maxSlot=n>0?MAX_SCROLL_CONTENT_WIDTH/n:MAX_SCROLL_CONTENT_WIDTH;return finiteRange(requested,0,0,maxSlot)}displayCategoryLabel(label,availableWidth){const maxCharacters=Math.max(1,Math.floor(availableWidth/APPROX_LABEL_CHARACTER_WIDTH));return label.length<=maxCharacters?label:maxCharacters===1?"…":`${label.slice(0,maxCharacters-1)}…`}renderChart(){const direction=this.effectiveDirection==="rtl"?"rtl":"ltr",n=this.recordCount(),awaitingFitMeasurement=this.awaitingFitMeasurement(),h=finiteRange(this.plotHeight||200,200,0,MAX_SCROLL_CONTENT_WIDTH),measuredWidth=finiteRange(this.plotWidth||400,400,0,MAX_SCROLL_CONTENT_WIDTH),{lo,hi,ticks}=this.domain(),formattedTicks=awaitingFitMeasurement||this.withoutValueAxis?[]:ticks.map(value=>({value,label:this.formatValueAxisTick(value)})),axisGutter=this.resolvedValueAxisGutter(formattedTicks,measuredWidth)+(this.yLabel?AXIS_TITLE_SPACE:0),rtl=this.effectiveDirection==="rtl",padBottom=PAD_BOTTOM+(this.xLabel?AXIS_TITLE_SPACE:0),plotX=rtl?PAD_RIGHT:axisGutter,plotY=PAD_TOP,plotH=Math.max(0,h-plotY-padBottom);let w,plotW,slot,fixedSlot;if(this.layout==="scroll"){const maxSlot=n>0?MAX_SCROLL_CONTENT_WIDTH/n:MAX_SCROLL_CONTENT_WIDTH;slot=finiteRange(this.barWidth,32,0,maxSlot),plotW=n*slot,w=axisGutter+plotW+PAD_RIGHT}else w=measuredWidth,plotW=Math.max(0,w-axisGutter-PAD_RIGHT),fixedSlot=this.fixedBarSlotWidth(n),slot=fixedSlot??(n>0?plotW/n:0);const recordSample=this.recordSample(),selectedIndices=new Set,renderedRows=new Set(recordSample.rowIndexes);for(let index=0;index<this.selectedIndices.length;index++){const candidate=this.selectedIndices[index];typeof candidate=="number"&&Number.isInteger(candidate)&&renderedRows.has(candidate)&&selectedIndices.add(candidate)}const barOrigins=this.effectiveType==="bar"&&!awaitingFitMeasurement?new Map(recordSample.rowIndexes.map(index=>{const fallback=plotX+index*slot,candidate=typeof this.barX=="function"?this.barX(index):fallback;return[index,finiteRange(candidate,fallback,-MAX_SCROLL_CONTENT_WIDTH,MAX_SCROLL_CONTENT_WIDTH)]})):new Map,grid=awaitingFitMeasurement||this.withoutValueAxis?[]:this.renderGrid(plotX,plotY,plotW,plotH,formattedTicks,lo,hi),marks=awaitingFitMeasurement?[]:this.effectiveType==="bar"?this.renderBars(plotX,plotY,plotH,slot,lo,hi,barOrigins,recordSample,selectedIndices):this.renderLines(plotX,plotY,plotW,plotH,lo,hi,recordSample,selectedIndices),categoryLabelX=i=>this.effectiveType==="bar"&&n>0?(barOrigins.get(i)??plotX+i*slot)+slot/2:plotX+(n>1?i/(n-1)*plotW:plotW/2),visibleLabelIndexes=this.visibleLabelIndexes(n,fixedSlot===void 0||this.effectiveType!=="bar"?plotW:n*slot,recordSample.rowIndexes,categoryLabelX),tickOverrides=new Map,renderedTickIndexes=[];for(const i of recordSample.rowIndexes){if(visibleLabelIndexes&&!visibleLabelIndexes.has(i))continue;const label=this.labels[i]??"",override=this.axisLabelText?.(label,i);override!==null&&(tickOverrides.set(i,override),renderedTickIndexes.push(i))}const categoryLabelPitch=(renderedTickIndexes.length?n/renderedTickIndexes.length:1)*(this.effectiveType==="bar"?slot:n>1?plotW/(n-1):plotW),categoryLabelWidth=Math.max(0,categoryLabelPitch-BAR_CORNER_RADIUS),tickFullLabels=renderedTickIndexes.map(i=>{const override=tickOverrides.get(i);return typeof override=="string"?override:this.labels[i]??""}),tickXs=renderedTickIndexes.map(categoryLabelX),categoryLabels=awaitingFitMeasurement?[]:renderedTickIndexes.map((i,position)=>{const fullLabel=tickFullLabels[position],x=tickXs[position],growth=categoryLabelGrowth(i,n),textAnchor=growth==="middle"?"middle":growth==="right"?rtl?"end":"start":rtl?"start":"end",labelExtent=sparseCategoryLabelExtent(tickFullLabels,tickXs,position,growth,categoryLabelPitch,categoryLabelWidth,BAR_CORNER_RADIUS,MAX_SCROLL_CONTENT_WIDTH),displayLabel=this.displayCategoryLabel(fullLabel,labelExtent);return svg`<text
124
124
  part="axis-label"
125
125
  x=${x}
126
126
  y=${plotY+plotH+CATEGORY_LABEL_OFFSET}
@@ -128,7 +128,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
128
128
  data-label-extent=${labelExtent}
129
129
  data-full-label=${fullLabel}
130
130
  aria-label=${displayLabel===fullLabel?nothing:fullLabel}
131
- >${displayLabel}</text>`}),datasetLabels=recordSample.seriesIndexes.map(datasetIndex=>this.datasets[datasetIndex].label),chartLabel=this.hostAccessibleLabel??hostAriaLabel(this)??(this.label||this.accessibleLabel||(datasetLabels.length?getListFormat(this.effectiveLocale,{type:"conjunction"}).format(datasetLabels):"")||this.localize("chart")),marksForA11y=this.interactiveMarks(),tableNumberFormat=getNumberFormat(this.effectiveLocale),showTableTotals=this.effectiveType==="bar"&&this.stacked&&this.tableTotals,dataTruncation=this.dataTruncationMessage(),hasCustomDataTable=this.hasCustomDataTable();return html`
131
+ >${displayLabel}</text>`}),datasetLabels=recordSample.seriesIndexes.map(datasetIndex=>this.datasets[datasetIndex].label),chartLabel=this.hostAccessibleLabel??(this.label||(datasetLabels.length?getListFormat(this.effectiveLocale,{type:"conjunction"}).format(datasetLabels):"")||this.localize("chart")),marksForA11y=this.interactiveMarks(),tableNumberFormat=getNumberFormat(this.effectiveLocale),showTableTotals=this.effectiveType==="bar"&&this.stacked&&this.tableTotals,dataTruncation=this.dataTruncationMessage(),hasCustomDataTable=this.hasCustomDataTable();return html`
132
132
  <div
133
133
  part="base"
134
134
  data-legend-position=${this.withLegend?chartChromeLegendPlacement(this.legendPosition):nothing}
@@ -211,4 +211,4 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
211
211
  `})}
212
212
  </div>`:nothing}
213
213
  </div>
214
- `}}__decorate([property({converter:{fromAttribute:value=>normalizeLiteChartType(value)}})],LyraLiteChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"labels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"datasets",null),__decorate([property({type:Boolean,attribute:"with-legend"})],LyraLiteChart.prototype,"withLegend",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:normalizeChartChromeLegendPosition}})],LyraLiteChart.prototype,"legendPosition",void 0),__decorate([property()],LyraLiteChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraLiteChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraLiteChart.prototype,"yLabel",void 0),__decorate([property({type:Boolean,attribute:"without-zero-baseline"})],LyraLiteChart.prototype,"withoutZeroBaseline",void 0),__decorate([property({type:Boolean})],LyraLiteChart.prototype,"stacked",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tickFormat",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tableCellFormatter",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"formatter",void 0),__decorate([property({type:Boolean,attribute:"table-totals"})],LyraLiteChart.prototype,"tableTotals",void 0),__decorate([property({type:Boolean,attribute:"with-data-table"})],LyraLiteChart.prototype,"withDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraLiteChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraLiteChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({reflect:!0,converter:LITE_CHART_LAYOUT})],LyraLiteChart.prototype,"layout",null),__decorate([property({type:Number,attribute:"bar-width"})],LyraLiteChart.prototype,"barWidth",void 0),__decorate([property({type:Number,attribute:"bar-slot-width"})],LyraLiteChart.prototype,"barSlotWidth",void 0),__decorate([property({converter:autoNumberConverter,attribute:"max-labels"})],LyraLiteChart.prototype,"maxLabels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"barX",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"pointText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"legendText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"axisLabelText",void 0),__decorate([property({type:Boolean,attribute:"rounded-bars"})],LyraLiteChart.prototype,"roundedBars",void 0),__decorate([property({type:Boolean,attribute:"skip-zero"})],LyraLiteChart.prototype,"skipZero",void 0),__decorate([property({converter:autoNumberConverter,attribute:"value-axis-gutter"})],LyraLiteChart.prototype,"valueAxisGutter",void 0),__decorate([property({type:Number,attribute:"bar-gap-ratio"})],LyraLiteChart.prototype,"barGapRatio",void 0),__decorate([property()],LyraLiteChart.prototype,"scale",void 0),__decorate([property({type:Boolean,attribute:"without-value-axis"})],LyraLiteChart.prototype,"withoutValueAxis",void 0),__decorate([property({type:Number,attribute:"min-bar-height"})],LyraLiteChart.prototype,"minBarHeight",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"selectedIndices",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"accessibleLabel",null),__decorate([property({attribute:"aria-label"})],LyraLiteChart.prototype,"hostAccessibleLabel",void 0),__decorate([property()],LyraLiteChart.prototype,"label",void 0),__decorate([property()],LyraLiteChart.prototype,"description",void 0),__decorate([state()],LyraLiteChart.prototype,"plotWidth",void 0),__decorate([state()],LyraLiteChart.prototype,"plotHeight",void 0),__decorate([state()],LyraLiteChart.prototype,"fitMeasurementAvailable",void 0),__decorate([state()],LyraLiteChart.prototype,"activeMarkIndex",void 0),__decorate([query("svg")],LyraLiteChart.prototype,"svgEl",void 0),__decorate([query("lr-live-region")],LyraLiteChart.prototype,"liveRegion",void 0);function formatTick(v,locale){return getNumberFormat(locale,{maximumFractionDigits:6}).format(Number(v.toFixed(6)))}export{LyraLiteChart};
214
+ `}}__decorate([property({converter:{fromAttribute:value=>normalizeLiteChartType(value)}})],LyraLiteChart.prototype,"type",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"labels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"datasets",null),__decorate([property({type:Boolean,attribute:"with-legend"})],LyraLiteChart.prototype,"withLegend",void 0),__decorate([property({attribute:"legend-position",converter:{fromAttribute:normalizeChartChromeLegendPosition}})],LyraLiteChart.prototype,"legendPosition",void 0),__decorate([property()],LyraLiteChart.prototype,"height",void 0),__decorate([property({attribute:"x-label"})],LyraLiteChart.prototype,"xLabel",void 0),__decorate([property({attribute:"y-label"})],LyraLiteChart.prototype,"yLabel",void 0),__decorate([property({type:Boolean,attribute:"without-zero-baseline"})],LyraLiteChart.prototype,"withoutZeroBaseline",void 0),__decorate([property({type:Boolean})],LyraLiteChart.prototype,"stacked",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tickFormat",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"tableCellFormatter",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"formatter",void 0),__decorate([property({type:Boolean,attribute:"table-totals"})],LyraLiteChart.prototype,"tableTotals",void 0),__decorate([property({type:Boolean,attribute:"with-data-table"})],LyraLiteChart.prototype,"withDataTable",void 0),__decorate([property({type:Boolean,attribute:"data-table-toggle"})],LyraLiteChart.prototype,"dataTableToggle",void 0),__decorate([state()],LyraLiteChart.prototype,"dataTableExpandedOverride",void 0),__decorate([property({reflect:!0,converter:LITE_CHART_LAYOUT})],LyraLiteChart.prototype,"layout",null),__decorate([property({type:Number,attribute:"bar-width"})],LyraLiteChart.prototype,"barWidth",void 0),__decorate([property({type:Number,attribute:"bar-slot-width"})],LyraLiteChart.prototype,"barSlotWidth",void 0),__decorate([property({converter:autoNumberConverter,attribute:"max-labels"})],LyraLiteChart.prototype,"maxLabels",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"barX",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"pointText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"legendText",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"axisLabelText",void 0),__decorate([property({type:Boolean,attribute:"rounded-bars"})],LyraLiteChart.prototype,"roundedBars",void 0),__decorate([property({type:Boolean,attribute:"skip-zero"})],LyraLiteChart.prototype,"skipZero",void 0),__decorate([property({converter:autoNumberConverter,attribute:"value-axis-gutter"})],LyraLiteChart.prototype,"valueAxisGutter",void 0),__decorate([property({type:Number,attribute:"bar-gap-ratio"})],LyraLiteChart.prototype,"barGapRatio",void 0),__decorate([property()],LyraLiteChart.prototype,"scale",void 0),__decorate([property({type:Boolean,attribute:"without-value-axis"})],LyraLiteChart.prototype,"withoutValueAxis",void 0),__decorate([property({type:Number,attribute:"min-bar-height"})],LyraLiteChart.prototype,"minBarHeight",void 0),__decorate([property({attribute:!1})],LyraLiteChart.prototype,"selectedIndices",void 0),__decorate([property({attribute:"aria-label"})],LyraLiteChart.prototype,"hostAccessibleLabel",void 0),__decorate([property()],LyraLiteChart.prototype,"label",void 0),__decorate([property()],LyraLiteChart.prototype,"description",void 0),__decorate([state()],LyraLiteChart.prototype,"plotWidth",void 0),__decorate([state()],LyraLiteChart.prototype,"plotHeight",void 0),__decorate([state()],LyraLiteChart.prototype,"fitMeasurementAvailable",void 0),__decorate([state()],LyraLiteChart.prototype,"activeMarkIndex",void 0),__decorate([query("svg")],LyraLiteChart.prototype,"svgEl",void 0),__decorate([query("lr-live-region")],LyraLiteChart.prototype,"liveRegion",void 0);function formatTick(v,locale){return getNumberFormat(locale,{maximumFractionDigits:6}).format(Number(v.toFixed(6)))}export{LyraLiteChart};
@@ -1,4 +1,4 @@
1
- import type{MarkdownStreamingRender}from'../markdown/markdown-shared.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{ChatComposerStatus}from'../chat-composer/chat-composer.class.js';import type{AgentRunMetric}from'../../agent-tools/agent-run/agent-run.class.js';export type{AgentRunMetric}from'../../agent-tools/agent-run/agent-run.class.js';import type{ContextInspectorSegment}from'../../agent-tools/context-inspector/context-inspector.class.js';export type{ContextInspectorSegment}from'../../agent-tools/context-inspector/context-inspector.class.js';import type{AgentRun,CancelEventDetail,ChatMessage,Citation,CitationSelectEventDetail,GroundingAssessment,RetrievalChunk,RetryEventDetail}from'../../../ai/types.js';import type{RetrievalResultsSelectDetail}from'../../retrieval/retrieval-results/retrieval-results.class.js';import type{ToolTimelineEntry,ToolTimelineApprovalDetail}from'../../agent-tools/tool-timeline/tool-timeline.class.js';export type{ToolTimelineEntry}from'../../agent-tools/tool-timeline/tool-timeline.class.js';export interface LyraAgentWorkspaceEventMap{'lr-input':CustomEvent<{value:string;}>;'lr-submit':CustomEvent<{value:string;}>;'lr-stop':CustomEvent<null>;'lr-message-retry':CustomEvent<{messageId:string;}>;'lr-follow-change':CustomEvent<{following:boolean;}>;'lr-retrieval-select':CustomEvent<LyraEventDetailSnapshot<RetrievalResultsSelectDetail>>;'lr-citation-select':CustomEvent<LyraEventDetailSnapshot<CitationSelectEventDetail>>;'lr-tool-approval-decide':CustomEvent<ToolTimelineApprovalDetail>;'lr-cancel':CustomEvent<CancelEventDetail>;'lr-run-retry':CustomEvent<RetryEventDetail>;}
1
+ import type{MarkdownStreamingRender}from'../markdown/markdown-shared.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{ChatComposerStatus}from'../chat-composer/chat-composer.class.js';import type{AgentRunMetric}from'../../agent-tools/agent-run/agent-run.class.js';export type{AgentRunMetric}from'../../agent-tools/agent-run/agent-run.class.js';import type{ContextInspectorSegment}from'../../agent-tools/context-inspector/context-inspector.class.js';export type{ContextInspectorSegment}from'../../agent-tools/context-inspector/context-inspector.class.js';import type{AgentRun,CancelEventDetail,ChatMessage,Citation,CitationSelectEventDetail,GroundingAssessment,RetrievalChunk,RetryEventDetail}from'../../../ai/types.js';import type{RetrievalResultsSelectDetail}from'../../retrieval/retrieval-results/retrieval-results.class.js';import type{ToolTimelineEntry,ToolTimelineApprovalDetail}from'../../agent-tools/tool-timeline/tool-timeline.class.js';export type{ToolTimelineEntry}from'../../agent-tools/tool-timeline/tool-timeline.class.js';export interface LyraAgentWorkspaceEventMap{'lr-input':CustomEvent<{value:string;}>;'lr-submit':CustomEvent<{value:string;}>;'lr-stop':CustomEvent<null>;'lr-message-retry':CustomEvent<{messageId:string;}>;'lr-follow-change':CustomEvent<{following:boolean;}>;'lr-retrieval-select':CustomEvent<LyraEventDetailSnapshot<RetrievalResultsSelectDetail>>;'lr-citation-select':CustomEvent<LyraEventDetailSnapshot<CitationSelectEventDetail>>;'lr-tool-approval-decide-request':CustomEvent<ToolTimelineApprovalDetail>;'lr-cancel':CustomEvent<CancelEventDetail>;'lr-run-retry':CustomEvent<RetryEventDetail>;}
2
2
  /**
3
3
  * `<lr-agent-workspace>` — a responsive, controlled shell for an AI conversation and its
4
4
  * supporting agent state. It renders the transcript and composer in the main pane, and composes
@@ -15,6 +15,10 @@ import type{MarkdownStreamingRender}from'../markdown/markdown-shared.js';import
15
15
  * Composer value, follow state, and retrieval selection are request-only:
16
16
  * child events are forwarded, but the workspace never writes those public
17
17
  * properties. The host applies accepted state back to the component.
18
+ * A vetoed tool approval in the built-in timeline stays pending until the host calls
19
+ * `finalizePendingApproval()` after persistence or `revertPendingApproval()` after failure.
20
+ * Async hosts must ignore stale completions after replacing the run or tools because these
21
+ * methods act on the currently pending approval.
18
22
  *
19
23
  * Public collection properties take bounded, clone-owned readonly snapshots. Create a new
20
24
  * collection and reassign it after changes; mutating the assigned array does not update the view.
@@ -44,7 +48,7 @@ import type{MarkdownStreamingRender}from'../markdown/markdown-shared.js';import
44
48
  * @event lr-follow-change - Forwarded from the transcript viewport. `detail: { following }`.
45
49
  * @event lr-retrieval-select - Forwarded from the built-in retrieval results. `detail: { chunkIds, chunks }`.
46
50
  * @event lr-citation-select - Forwarded from the built-in grounding summary. `detail: { citation }`.
47
- * @event lr-tool-approval-decide - Forwarded from the built-in tool timeline.
51
+ * @event lr-tool-approval-decide-request - Forwarded from the built-in tool timeline.
48
52
  * @event lr-cancel - Forwarded from the built-in agent run.
49
53
  * @event lr-run-retry - Forwarded from the built-in agent run.
50
54
  * @csspart base - The root workspace wrapper.
@@ -117,7 +121,13 @@ private composerStatusValue;get composerStatus():ChatComposerStatus;set composer
117
121
  /** Placeholder for the built-in composer. */
118
122
  composerPlaceholder?:string;
119
123
  /** Minimum and maximum rows for the built-in composer. */
120
- composerMinRows:number;composerMaxRows:number;private hasSlotted;private get safeContextTotal();private get effectiveTools();private get effectiveRetrievalChunks();private get effectiveCitations();private get effectiveContextSegments();private get effectiveMessages();private get safeUnreadStartIndex();private get safeComposerMinRows();private get safeComposerMaxRows();private onRetrievalSelect;private onMessageRetry;private stopOwnedEvent;private renderMessage;private renderMessages;private messageWindowOffsetFor;
124
+ composerMinRows:number;composerMaxRows:number;private hasSlotted;private builtInToolTimeline;
125
+ /** Closes a vetoed approval in the built-in tool timeline after the host persists its decision.
126
+ * No-op when that timeline or a pending approval is absent, including with a custom details slot. */
127
+ finalizePendingApproval():void;
128
+ /** Releases a vetoed approval in the built-in tool timeline after persistence fails, preserving
129
+ * the open dialog and its edited arguments for retry. No-op without the built-in timeline. */
130
+ revertPendingApproval():void;private get safeContextTotal();private get effectiveTools();private get effectiveRetrievalChunks();private get effectiveCitations();private get effectiveContextSegments();private get effectiveMessages();private get safeUnreadStartIndex();private get safeComposerMinRows();private get safeComposerMaxRows();private onRetrievalSelect;private onMessageRetry;private stopOwnedEvent;private renderMessage;private renderMessages;private messageWindowOffsetFor;
121
131
  /** Bound to every named slot whose assignment `render()` reads back through `hasSlotted()` --
122
132
  * `messages` (which decides how `safeUnreadStartIndex` is projected), `details`, `composer`, and
123
133
  * `header-actions` (whose empty wrapper is hidden).
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{normalizeChatComposerStatus}from"../chat-composer/chat-composer.class.js";import{styles}from"./agent-workspace.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_agentWorkspaceContext,LYRA_DEFAULT_agentWorkspaceConversation,LYRA_DEFAULT_agentWorkspaceDetails,LYRA_DEFAULT_agentWorkspaceEmpty,LYRA_DEFAULT_agentWorkspaceGrounding,LYRA_DEFAULT_agentWorkspaceLabel,LYRA_DEFAULT_agentWorkspaceRetrieval,LYRA_DEFAULT_agentWorkspaceRun,LYRA_DEFAULT_agentWorkspaceTools,LYRA_DEFAULT_composerPlaceholder,LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_MESSAGES=500;function firstByWorkspaceIdentity(items,identity){const result=[],seen=new Set;for(const item of items){let id;try{id=identity(item)}catch{continue}typeof id!="string"||id.trim()===""||seen.has(id)||(seen.add(id),result.push(item))}return result}class LyraAgentWorkspace extends LyraElement{constructor(){super(...arguments),this.streamingRender="plain",this.accessibleLabel=null,this.messages=[],this.run=null,this.metrics=[],this.tools=[],this.retrievalChunks=[],this.selectedRetrievalChunkIds=[],this.retrievalLoading=!1,this.retrievalHasMore=!1,this.retrievalErrorText="",this.groundingAssessment=null,this.citations=[],this.contextSegments=[],this.contextTotal=0,this.follow=!0,this.unreadStartIndex=null,this.withoutDetails=!1,this.withoutComposer=!1,this.composerValue="",this.composerStatusValue="idle",this.composerMinRows=1,this.composerMaxRows=8,this.onRetrievalSelect=event=>{event.stopPropagation(),this.emit("lr-retrieval-select",event.detail)},this.onMessageRetry=event=>{event.stopPropagation(),event.detail.messageId&&this.emit("lr-message-retry",{messageId:event.detail.messageId})},this.onNamedSlotChange=()=>{this.requestUpdate()}}static{this.defaultStrings={...super.defaultStrings,agentWorkspaceContext:LYRA_DEFAULT_agentWorkspaceContext,agentWorkspaceConversation:LYRA_DEFAULT_agentWorkspaceConversation,agentWorkspaceDetails:LYRA_DEFAULT_agentWorkspaceDetails,agentWorkspaceEmpty:LYRA_DEFAULT_agentWorkspaceEmpty,agentWorkspaceGrounding:LYRA_DEFAULT_agentWorkspaceGrounding,agentWorkspaceLabel:LYRA_DEFAULT_agentWorkspaceLabel,agentWorkspaceRetrieval:LYRA_DEFAULT_agentWorkspaceRetrieval,agentWorkspaceRun:LYRA_DEFAULT_agentWorkspaceRun,agentWorkspaceTools:LYRA_DEFAULT_agentWorkspaceTools,composerPlaceholder:LYRA_DEFAULT_composerPlaceholder,fieldRequired:LYRA_DEFAULT_fieldRequired}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-retrieval-select"])}static{this.ownedCollectionProperties=Object.freeze(["messages","run","metrics","tools","retrievalChunks","selectedRetrievalChunkIds","groundingAssessment","citations","contextSegments"])}static{this.styles=[LyraElement.styles,styles]}get composerStatus(){return this.composerStatusValue}set composerStatus(value){const previous=this.composerStatusValue;this.composerStatusValue=normalizeChatComposerStatus(value),this.requestUpdate("composerStatus",previous)}hasSlotted(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}get safeContextTotal(){return finiteCount(this.contextTotal)}get effectiveTools(){return firstByWorkspaceIdentity(this.tools,entry=>{const id=entry.id;if(typeof id!="string"||id.trim()==="")return;const sourceKey=entry.sourceKey;return`${typeof sourceKey=="string"?sourceKey:""}\0${id}`})}get effectiveRetrievalChunks(){return firstByWorkspaceIdentity(this.retrievalChunks,chunk=>chunk.id)}get effectiveCitations(){return firstByWorkspaceIdentity(this.citations,citation=>citation.id)}get effectiveContextSegments(){return firstByWorkspaceIdentity(this.contextSegments,segment=>segment.id)}get effectiveMessages(){const source=this.messages,seen=new Set,messages=[];for(let sourceIndex=0;sourceIndex<source.length;sourceIndex++){const message=source[sourceIndex];if(!message)continue;const id=message?.id;typeof id!="string"||id.trim()===""||seen.has(id)||(seen.add(id),messages.push({message,sourceIndex}))}return messages}get safeUnreadStartIndex(){if(this.unreadStartIndex==null)return null;const normalized=finiteCount(this.unreadStartIndex);if(this.hasSlotted("messages"))return normalized;const messages=this.effectiveMessages,effectiveIndex=messages.filter(({sourceIndex})=>sourceIndex<normalized).length;return Math.max(0,effectiveIndex-this.messageWindowOffsetFor(messages))}get safeComposerMinRows(){return Math.max(1,finiteCount(this.composerMinRows,1))}get safeComposerMaxRows(){return Math.max(this.safeComposerMinRows,finiteCount(this.composerMaxRows,8))}stopOwnedEvent(event){event.stopPropagation()}renderMessage(message){return html`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{normalizeChatComposerStatus}from"../chat-composer/chat-composer.class.js";import{styles}from"./agent-workspace.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_agentWorkspaceContext,LYRA_DEFAULT_agentWorkspaceConversation,LYRA_DEFAULT_agentWorkspaceDetails,LYRA_DEFAULT_agentWorkspaceEmpty,LYRA_DEFAULT_agentWorkspaceGrounding,LYRA_DEFAULT_agentWorkspaceLabel,LYRA_DEFAULT_agentWorkspaceRetrieval,LYRA_DEFAULT_agentWorkspaceRun,LYRA_DEFAULT_agentWorkspaceTools,LYRA_DEFAULT_composerPlaceholder,LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_MESSAGES=500;function firstByWorkspaceIdentity(items,identity){const result=[],seen=new Set;for(const item of items){let id;try{id=identity(item)}catch{continue}typeof id!="string"||id.trim()===""||seen.has(id)||(seen.add(id),result.push(item))}return result}class LyraAgentWorkspace extends LyraElement{constructor(){super(...arguments),this.streamingRender="plain",this.accessibleLabel=null,this.messages=[],this.run=null,this.metrics=[],this.tools=[],this.retrievalChunks=[],this.selectedRetrievalChunkIds=[],this.retrievalLoading=!1,this.retrievalHasMore=!1,this.retrievalErrorText="",this.groundingAssessment=null,this.citations=[],this.contextSegments=[],this.contextTotal=0,this.follow=!0,this.unreadStartIndex=null,this.withoutDetails=!1,this.withoutComposer=!1,this.composerValue="",this.composerStatusValue="idle",this.composerMinRows=1,this.composerMaxRows=8,this.onRetrievalSelect=event=>{event.stopPropagation(),this.emit("lr-retrieval-select",event.detail)},this.onMessageRetry=event=>{event.stopPropagation(),event.detail.messageId&&this.emit("lr-message-retry",{messageId:event.detail.messageId})},this.onNamedSlotChange=()=>{this.requestUpdate()}}static{this.defaultStrings={...super.defaultStrings,agentWorkspaceContext:LYRA_DEFAULT_agentWorkspaceContext,agentWorkspaceConversation:LYRA_DEFAULT_agentWorkspaceConversation,agentWorkspaceDetails:LYRA_DEFAULT_agentWorkspaceDetails,agentWorkspaceEmpty:LYRA_DEFAULT_agentWorkspaceEmpty,agentWorkspaceGrounding:LYRA_DEFAULT_agentWorkspaceGrounding,agentWorkspaceLabel:LYRA_DEFAULT_agentWorkspaceLabel,agentWorkspaceRetrieval:LYRA_DEFAULT_agentWorkspaceRetrieval,agentWorkspaceRun:LYRA_DEFAULT_agentWorkspaceRun,agentWorkspaceTools:LYRA_DEFAULT_agentWorkspaceTools,composerPlaceholder:LYRA_DEFAULT_composerPlaceholder,fieldRequired:LYRA_DEFAULT_fieldRequired}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-retrieval-select"])}static{this.ownedCollectionProperties=Object.freeze(["messages","run","metrics","tools","retrievalChunks","selectedRetrievalChunkIds","groundingAssessment","citations","contextSegments"])}static{this.styles=[LyraElement.styles,styles]}get composerStatus(){return this.composerStatusValue}set composerStatus(value){const previous=this.composerStatusValue;this.composerStatusValue=normalizeChatComposerStatus(value),this.requestUpdate("composerStatus",previous)}hasSlotted(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}builtInToolTimeline(){return this.withoutDetails||this.hasSlotted("details")?null:this.renderRoot?.querySelector(tag("tool-timeline"))??null}finalizePendingApproval(){this.builtInToolTimeline()?.finalizePendingApproval()}revertPendingApproval(){this.builtInToolTimeline()?.revertPendingApproval()}get safeContextTotal(){return finiteCount(this.contextTotal)}get effectiveTools(){return firstByWorkspaceIdentity(this.tools,entry=>{const id=entry.id;if(typeof id!="string"||id.trim()==="")return;const sourceKey=entry.sourceKey;return`${typeof sourceKey=="string"?sourceKey:""}\0${id}`})}get effectiveRetrievalChunks(){return firstByWorkspaceIdentity(this.retrievalChunks,chunk=>chunk.id)}get effectiveCitations(){return firstByWorkspaceIdentity(this.citations,citation=>citation.id)}get effectiveContextSegments(){return firstByWorkspaceIdentity(this.contextSegments,segment=>segment.id)}get effectiveMessages(){const source=this.messages,seen=new Set,messages=[];for(let sourceIndex=0;sourceIndex<source.length;sourceIndex++){const message=source[sourceIndex];if(!message)continue;const id=message?.id;typeof id!="string"||id.trim()===""||seen.has(id)||(seen.add(id),messages.push({message,sourceIndex}))}return messages}get safeUnreadStartIndex(){if(this.unreadStartIndex==null)return null;const normalized=finiteCount(this.unreadStartIndex);if(this.hasSlotted("messages"))return normalized;const messages=this.effectiveMessages,effectiveIndex=messages.filter(({sourceIndex})=>sourceIndex<normalized).length;return Math.max(0,effectiveIndex-this.messageWindowOffsetFor(messages))}get safeComposerMinRows(){return Math.max(1,finiteCount(this.composerMinRows,1))}get safeComposerMaxRows(){return Math.max(this.safeComposerMinRows,finiteCount(this.composerMaxRows,8))}stopOwnedEvent(event){event.stopPropagation()}renderMessage(message){return html`
2
2
  <lr-chat-message
3
3
  part="messages message"
4
4
  .messageRole=${message.role}
@@ -10,7 +10,6 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
10
10
  ${message.parts?.length?html`<lr-message-parts .parts=${message.parts} .streamingRender=${this.streamingRender}></lr-message-parts>`:html`<lr-markdown
11
11
  .content=${message.text??""}
12
12
  @lr-render-error=${this.stopOwnedEvent}
13
- @lr-link-click=${this.stopOwnedEvent}
14
13
  @lr-highlight-activate=${this.stopOwnedEvent}
15
14
  @lr-text-select=${this.stopOwnedEvent}
16
15
  @lr-anchor-result=${this.stopOwnedEvent}
@@ -8,10 +8,7 @@ export type ChatMessageAttachmentsPlacement='before'|'after';
8
8
  export interface ChatMessageToggleDetail{
9
9
  /** Whether the message body is shown in the resulting (on `lr-toggle-request`, the proposed)
10
10
  * state. */
11
- expanded:boolean;
12
- /** The inverse of `expanded`.
13
- * @deprecated Read `expanded` instead; removal not before 23.0.0. */
14
- collapsed:boolean;}export interface LyraChatMessageEventMap{'lr-message-retry':CustomEvent<{messageId?:string;}>;'lr-toggle-request':CustomEvent<ChatMessageToggleDetail>;'lr-toggle':CustomEvent<ChatMessageToggleDetail>;}
11
+ expanded:boolean;}export interface LyraChatMessageEventMap{'lr-message-retry':CustomEvent<{messageId?:string;}>;'lr-toggle-request':CustomEvent<ChatMessageToggleDetail>;'lr-toggle':CustomEvent<ChatMessageToggleDetail>;}
15
12
  /**
16
13
  * `<lr-chat-message>` — a role-based message bubble *shell* for a chat/
17
14
  * agent conversation surface. It renders none of the message content itself:
@@ -81,11 +78,8 @@ collapsed:boolean;}export interface LyraChatMessageEventMap{'lr-message-retry':C
81
78
  * `new CustomEvent('lr-message-retry', { bubbles: true, composed: true })` to stay consistent with the
82
79
  * same event contract a listener further up a conversation surface already relies on for every
83
80
  * other message.
84
- * @event lr-toggle-request - Cancelable request to change collapse state. `detail: { expanded,
85
- * collapsed }` is the proposed state; `expanded` is the canonical key and the deprecated
86
- * `collapsed` its inverse.
87
- * @event lr-toggle - Collapse state committed. `detail: { expanded, collapsed }`, the resulting
88
- * state; the deprecated `collapsed` is the inverse of `expanded`.
81
+ * @event lr-toggle-request - Cancelable request to change collapse state. `detail: { expanded }` is the proposed state.
82
+ * @event lr-toggle - Collapse state committed. `detail: { expanded }` carries the resulting state.
89
83
  * @csspart bubble - The message article and bubble root. Programmatically focusable (`tabindex="-1"`) so focus has a stable place to land when the built-in retry button is removed. Its fill, text, and geometry derive from the documented theme hooks.
90
84
  * @csspart header - The row above the message body — avatar, badges, and the collapse toggle. Hidden entirely when none of those have anything to show.
91
85
  * @csspart avatar - The wrapper around the `avatar` slot.
@@ -11,7 +11,7 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{property,
11
11
  aria-hidden="true"
12
12
  focusable="false"
13
13
  ><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>
14
- `}function defaultFormatTimestamp(date,locale){return getDateTimeFormat(locale,{hour:"numeric",minute:"2-digit"}).format(date)}const STATUS_TEXT_KEY={sending:"chatSending",streaming:"chatResponding",failed:"chatFailedToSend"},CHAT_MESSAGE_STATUS=literalSetConverter(["sending","sent","failed","streaming"],"sent");class LyraChatMessage extends LyraElement{constructor(){super(...arguments),this.messageRole="assistant",this.messageId="",this.collapsible=!1,this.collapsed=!1,this.attachmentsPlacement="after",this.actionsPlacement="inside",this.hasAvatarSlot=!1,this.hasBadgesSlot=!1,this.hasAttachmentsSlot=!1,this.hasActionsSlot=!1,this.hasFailureSlot=!1,this.bodyId=nextId("chat-message-body"),this._status="sent",this.previousStatus="sent",this.isMounting=!0,this.onAvatarSlotChange=()=>{this.hasAvatarSlot=this.hasSlotted("avatar")},this.onBadgesSlotChange=()=>{this.hasBadgesSlot=this.hasSlotted("badges")},this.onAttachmentsSlotChange=()=>{this.hasAttachmentsSlot=this.hasSlotted("attachments")},this.onActionsSlotChange=()=>{this.hasActionsSlot=this.hasSlotted("actions")},this.onFailureSlotChange=()=>{this.hasFailureSlot=this.hasSlotted("failure")},this.toggleCollapsed=()=>{const detail={expanded:this.collapsed,collapsed:!this.collapsed};this.emit("lr-toggle-request",detail,{cancelable:!0}).defaultPrevented||(this.collapsed=!detail.expanded,this.emit("lr-toggle",detail))},this.onRetryClick=()=>{this.emit("lr-message-retry",{messageId:this.messageId||void 0}),this.status!=="failed"&&this.bubbleEl?.focus()}}static{this.defaultStrings={...super.defaultStrings,chatCompleteAnnounce:LYRA_DEFAULT_chatCompleteAnnounce,chatFailedAnnounce:LYRA_DEFAULT_chatFailedAnnounce,chatFailedToSend:LYRA_DEFAULT_chatFailedToSend,chatResponding:LYRA_DEFAULT_chatResponding,chatSending:LYRA_DEFAULT_chatSending,collapse:LYRA_DEFAULT_collapse,collapseMessage:LYRA_DEFAULT_collapseMessage,details:LYRA_DEFAULT_details,expandMessage:LYRA_DEFAULT_expandMessage,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,promptStudioRoleAssistant:LYRA_DEFAULT_promptStudioRoleAssistant,promptStudioRoleSystem:LYRA_DEFAULT_promptStudioRoleSystem,promptStudioRoleUser:LYRA_DEFAULT_promptStudioRoleUser,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}static{this.properties={status:{reflect:!0,noAccessor:!0,converter:CHAT_MESSAGE_STATUS}}}get status(){return this._status}set status(value){const normalized=CHAT_MESSAGE_STATUS.normalizeReflected(this,"status",value),old=this._status;normalized!==old&&(this.previousStatus=old,this._status=normalized,this.requestUpdate("status",old))}willUpdate(changed){super.willUpdate(changed),this.hasUpdated?changed.has("status")&&(this.status==="failed"?this.hasFailureSlot=this.hasSlotted("failure"):this.previousStatus==="failed"&&this.hasFailureSlot&&this.isFocusWithinFailureSlot()&&this.bubbleEl?.focus()):(this.hasAvatarSlot=this.hasSlotted("avatar"),this.hasBadgesSlot=this.hasSlotted("badges"),this.hasAttachmentsSlot=this.hasSlotted("attachments"),this.hasActionsSlot=this.hasSlotted("actions"),this.status==="failed"&&(this.hasFailureSlot=this.hasSlotted("failure")))}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("status")&&this.announceStatusChange(this.previousStatus)}connectedCallback(){super.connectedCallback(),this.statusAtDisconnect!==void 0&&(this.isMounting=this.status!==this.statusAtDisconnect&&this.isUpdatePending,this.statusAtDisconnect=void 0)}disconnectedCallback(){this.statusAtDisconnect=this.status,this.isMounting=!0,super.disconnectedCallback()}hasSlotted(name){return Array.from(this.children).some(el=>el.getAttribute("slot")===name)}isFocusWithinFailureSlot(){const root=this.getRootNode(),active=activeElementIn(root.nodeType===Node.ELEMENT_NODE?null:root);try{return!active||active.nodeType!==Node.ELEMENT_NODE?!1:Array.from(this.children).some(el=>el.getAttribute("slot")==="failure"&&el.contains(active))}catch{return!1}}get normalizedTimestamp(){return normalizeLyraTimestamp(this.timestamp)}get statusText(){return this.status==="sent"?void 0:this.localize(STATUS_TEXT_KEY[this.status])}announceStatusChange(previous){if(previous===this.status)return;const region=this.liveRegion;if(region)if(this.status==="failed"){if(this.hasFailureSlot)return;region.mode="assertive",region.announce(this.localize("chatFailedAnnounce"),{force:!0})}else previous==="streaming"&&this.status==="sent"&&(region.mode="polite",region.announce(this.localize("chatCompleteAnnounce"),{force:!0}))}render(){const ts=this.normalizedTimestamp,formatter=this.formatTimestamp??(date=>defaultFormatTimestamp(date,this.effectiveLocale)),suppressBuiltInFailedUi=this.status==="failed"&&this.hasFailureSlot,statusText=suppressBuiltInFailedUi?void 0:this.statusText,showHeader=this.hasAvatarSlot||this.hasBadgesSlot||this.collapsible,actionsOutside=this.actionsPlacement==="outside",showFooter=!!statusText||!!ts||!actionsOutside&&this.hasActionsSlot,authorLabel=this.localize(this.messageRole==="user"?"promptStudioRoleUser":this.messageRole==="system"?"promptStudioRoleSystem":"promptStudioRoleAssistant"),articleLabel=this.hasAttribute("aria-label")?this.getAttribute("aria-label")??"":authorLabel,actionsBlock=html`<span part="actions" ?hidden=${!this.hasActionsSlot}
14
+ `}function defaultFormatTimestamp(date,locale){return getDateTimeFormat(locale,{hour:"numeric",minute:"2-digit"}).format(date)}const STATUS_TEXT_KEY={sending:"chatSending",streaming:"chatResponding",failed:"chatFailedToSend"},CHAT_MESSAGE_STATUS=literalSetConverter(["sending","sent","failed","streaming"],"sent");class LyraChatMessage extends LyraElement{constructor(){super(...arguments),this.messageRole="assistant",this.messageId="",this.collapsible=!1,this.collapsed=!1,this.attachmentsPlacement="after",this.actionsPlacement="inside",this.hasAvatarSlot=!1,this.hasBadgesSlot=!1,this.hasAttachmentsSlot=!1,this.hasActionsSlot=!1,this.hasFailureSlot=!1,this.bodyId=nextId("chat-message-body"),this._status="sent",this.previousStatus="sent",this.isMounting=!0,this.onAvatarSlotChange=()=>{this.hasAvatarSlot=this.hasSlotted("avatar")},this.onBadgesSlotChange=()=>{this.hasBadgesSlot=this.hasSlotted("badges")},this.onAttachmentsSlotChange=()=>{this.hasAttachmentsSlot=this.hasSlotted("attachments")},this.onActionsSlotChange=()=>{this.hasActionsSlot=this.hasSlotted("actions")},this.onFailureSlotChange=()=>{this.hasFailureSlot=this.hasSlotted("failure")},this.toggleCollapsed=()=>{const detail={expanded:this.collapsed};this.emit("lr-toggle-request",detail,{cancelable:!0}).defaultPrevented||(this.collapsed=!detail.expanded,this.emit("lr-toggle",detail))},this.onRetryClick=()=>{this.emit("lr-message-retry",{messageId:this.messageId||void 0}),this.status!=="failed"&&this.bubbleEl?.focus()}}static{this.defaultStrings={...super.defaultStrings,chatCompleteAnnounce:LYRA_DEFAULT_chatCompleteAnnounce,chatFailedAnnounce:LYRA_DEFAULT_chatFailedAnnounce,chatFailedToSend:LYRA_DEFAULT_chatFailedToSend,chatResponding:LYRA_DEFAULT_chatResponding,chatSending:LYRA_DEFAULT_chatSending,collapse:LYRA_DEFAULT_collapse,collapseMessage:LYRA_DEFAULT_collapseMessage,details:LYRA_DEFAULT_details,expandMessage:LYRA_DEFAULT_expandMessage,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,promptStudioRoleAssistant:LYRA_DEFAULT_promptStudioRoleAssistant,promptStudioRoleSystem:LYRA_DEFAULT_promptStudioRoleSystem,promptStudioRoleUser:LYRA_DEFAULT_promptStudioRoleUser,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}static{this.properties={status:{reflect:!0,noAccessor:!0,converter:CHAT_MESSAGE_STATUS}}}get status(){return this._status}set status(value){const normalized=CHAT_MESSAGE_STATUS.normalizeReflected(this,"status",value),old=this._status;normalized!==old&&(this.previousStatus=old,this._status=normalized,this.requestUpdate("status",old))}willUpdate(changed){super.willUpdate(changed),this.hasUpdated?changed.has("status")&&(this.status==="failed"?this.hasFailureSlot=this.hasSlotted("failure"):this.previousStatus==="failed"&&this.hasFailureSlot&&this.isFocusWithinFailureSlot()&&this.bubbleEl?.focus()):(this.hasAvatarSlot=this.hasSlotted("avatar"),this.hasBadgesSlot=this.hasSlotted("badges"),this.hasAttachmentsSlot=this.hasSlotted("attachments"),this.hasActionsSlot=this.hasSlotted("actions"),this.status==="failed"&&(this.hasFailureSlot=this.hasSlotted("failure")))}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("status")&&this.announceStatusChange(this.previousStatus)}connectedCallback(){super.connectedCallback(),this.statusAtDisconnect!==void 0&&(this.isMounting=this.status!==this.statusAtDisconnect&&this.isUpdatePending,this.statusAtDisconnect=void 0)}disconnectedCallback(){this.statusAtDisconnect=this.status,this.isMounting=!0,super.disconnectedCallback()}hasSlotted(name){return Array.from(this.children).some(el=>el.getAttribute("slot")===name)}isFocusWithinFailureSlot(){const root=this.getRootNode(),active=activeElementIn(root.nodeType===Node.ELEMENT_NODE?null:root);try{return!active||active.nodeType!==Node.ELEMENT_NODE?!1:Array.from(this.children).some(el=>el.getAttribute("slot")==="failure"&&el.contains(active))}catch{return!1}}get normalizedTimestamp(){return normalizeLyraTimestamp(this.timestamp)}get statusText(){return this.status==="sent"?void 0:this.localize(STATUS_TEXT_KEY[this.status])}announceStatusChange(previous){if(previous===this.status)return;const region=this.liveRegion;if(region)if(this.status==="failed"){if(this.hasFailureSlot)return;region.mode="assertive",region.announce(this.localize("chatFailedAnnounce"),{force:!0})}else previous==="streaming"&&this.status==="sent"&&(region.mode="polite",region.announce(this.localize("chatCompleteAnnounce"),{force:!0}))}render(){const ts=this.normalizedTimestamp,formatter=this.formatTimestamp??(date=>defaultFormatTimestamp(date,this.effectiveLocale)),suppressBuiltInFailedUi=this.status==="failed"&&this.hasFailureSlot,statusText=suppressBuiltInFailedUi?void 0:this.statusText,showHeader=this.hasAvatarSlot||this.hasBadgesSlot||this.collapsible,actionsOutside=this.actionsPlacement==="outside",showFooter=!!statusText||!!ts||!actionsOutside&&this.hasActionsSlot,authorLabel=this.localize(this.messageRole==="user"?"promptStudioRoleUser":this.messageRole==="system"?"promptStudioRoleSystem":"promptStudioRoleAssistant"),articleLabel=this.hasAttribute("aria-label")?this.getAttribute("aria-label")??"":authorLabel,actionsBlock=html`<span part="actions" ?hidden=${!this.hasActionsSlot}
15
15
  ><slot name="actions" @slotchange=${this.onActionsSlotChange}></slot
16
16
  ></span>`,attachmentsBlock=html`<div part="attachments" ?hidden=${!this.hasAttachmentsSlot}>
17
17
  <slot name="attachments" @slotchange=${this.onAttachmentsSlotChange}></slot>
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{CodeBlockHeaderActionsController,CodeBlockInteractionController,applyCodeBlockAriaBusy,clampCodeBlockFocusedLine,codeBlockActiveHighlightLineSet,codeBlockLineHasFocus,codeBlockLineCount,codeBlockLineHighlightSet,renderCodeBlockPlainCode,renderCodeBlockShell,restoreCodeBlockLineFocus,scrollCodeBlockToAnchor,tokenizeCodeBlock}from"./code-block-shared.js";import{LYRA_DEFAULT_codeBlockLineLabel,LYRA_DEFAULT_codeRegion,LYRA_DEFAULT_codeRegionWithLanguage,LYRA_DEFAULT_collapseCode,LYRA_DEFAULT_copied,LYRA_DEFAULT_copiedToClipboard,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyCode,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_expandCode}from"../../../internal/default-strings.generated.js";class LyraCodeBlockBase extends LyraElement{static{this.defaultStrings={...super.defaultStrings,codeBlockLineLabel:LYRA_DEFAULT_codeBlockLineLabel,codeRegion:LYRA_DEFAULT_codeRegion,codeRegionWithLanguage:LYRA_DEFAULT_codeRegionWithLanguage,collapseCode:LYRA_DEFAULT_collapseCode,copied:LYRA_DEFAULT_copied,copiedToClipboard:LYRA_DEFAULT_copiedToClipboard,copy:LYRA_DEFAULT_copy,copyCode:LYRA_DEFAULT_copyCode,copyFailed:LYRA_DEFAULT_copyFailed,expandCode:LYRA_DEFAULT_expandCode}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-text-select"])}constructor(){super(),this.hasHeaderActions=!1,this.focusedLine=1,this.highlightedHtml=null,this.shikiReady=!1,this.justCopied=!1,this.copyFailed=!1,this.isDarkTheme=!1,this.restoreFocusedLineAfterUpdate=!1,this.highlightToken=0,this.bodyId=nextId("code-block-body"),this.interactions=new CodeBlockInteractionController({host:this,setFocusedLine:line=>{this.focusedLine=line},setJustCopied:value=>{this.justCopied=value},setCopyFailed:value=>{this.copyFailed=value},setDarkTheme:value=>{this.isDarkTheme=value},emitLineActivate:line=>this.emit("lr-line-activate",{line}),emitCopy:outcome=>this.emit("lr-copy",outcome),emitError:()=>this.emit("lr-error",null),emitCopyError:outcome=>this.emit("lr-copy-error",outcome),requestToggle:collapsed=>!this.emit("lr-toggle-request",{expanded:!collapsed,collapsed},{cancelable:!0}).defaultPrevented,emitToggle:collapsed=>this.emit("lr-toggle",{expanded:!collapsed,collapsed}),emitTextSelect:selection=>this.emit("lr-text-select",selection)}),this.headerActions=new CodeBlockHeaderActionsController({host:this,setHasHeaderActions:value=>{this.hasHeaderActions=value}}),new ThemeWatcher(this,()=>this.refreshTheme())}connectedCallback(){super.connectedCallback(),this.refreshTheme(),this.headerActions.observe()}disconnectedCallback(){this.highlightToken+=1,super.disconnectedCallback(),this.headerActions.disconnect(),this.interactions.disconnect(),this.highlightedHtml=null}adoptedCallback(){super.adoptedCallback(),this.interactions.disconnect()}async scrollToAnchor(target){return scrollCodeBlockToAnchor(this,target)}refreshTheme(){this.interactions.refreshTheme()}willUpdate(changed){super.willUpdate(changed),this.headerActions.sync(),this.restoreFocusedLineAfterUpdate=codeBlockLineHasFocus(this),changed.has("code")&&(this.focusedLine=clampCodeBlockFocusedLine(this.focusedLine,this.lineCount())),this.beforeHighlightUpdate(changed),this.interactions.needsHighlightResync(changed,this.effectiveLocale,this.localize("codeBlockLineLabel"))&&(this.shikiReady||this.preSuppliedGrammar()?this.syncHighlight():this.highlightedHtml=null)}updated(changed){super.updated(changed),applyCodeBlockAriaBusy(this,this.showsSkeleton()),this.restoreFocusedLineAfterUpdate&&(restoreCodeBlockLineFocus(this,this.focusedLine),this.restoreFocusedLineAfterUpdate=!1)}beforeHighlightUpdate(_changed){}lineHighlightSet(){return codeBlockLineHighlightSet(this.highlightLines??"",this.highlights,this.lineCount())}activeHighlightLineSet(){return codeBlockActiveHighlightLineSet(this.highlights,this.activeHighlightId,this.lineCount())}lineCount(){return codeBlockLineCount(this.code??"")}tokenize(hl,lang){return tokenizeCodeBlock(hl,{code:this.code??"",lang,lineNumbers:this.lineNumbers,activatableLines:this.activatableLines,focusedLine:this.focusedLine,highlightedLines:this.lineHighlightSet(),activeLines:this.activeHighlightLineSet(),lineLabel:line=>this.localize("codeBlockLineLabel",void 0,{line:getNumberFormat(this.effectiveLocale).format(line)}),lineNumberText:line=>getNumberFormat(this.effectiveLocale).format(line)})}renderPlainCode(){return renderCodeBlockPlainCode({code:this.code??"",lineNumbers:this.lineNumbers,activatableLines:this.activatableLines,focusedLine:this.focusedLine,highlightedLines:this.lineHighlightSet(),activeLines:this.activeHighlightLineSet(),localize:this.localize.bind(this),lineLabel:line=>this.localize("codeBlockLineLabel",void 0,{line:getNumberFormat(this.effectiveLocale).format(line)}),lineNumberText:line=>getNumberFormat(this.effectiveLocale).format(line),onLineActivate:line=>this.interactions.onLineActivate(line),onLineKeyDown:(event,line)=>this.interactions.onLineKeyDown(event,line)})}render(){return renderCodeBlockShell({filename:this.filename,language:this.language,copyable:!this.withoutCopyButton,copyAppearance:this.copyAppearance,hasHeaderActions:this.hasHeaderActions,collapsible:this.collapsible,collapsed:this.collapsed,justCopied:this.justCopied,copyFailed:this.copyFailed,bodyId:this.bodyId,accessibleLabel:this.accessibleLabel,maxHeight:this.maxHeight,isDarkTheme:this.isDarkTheme,showSkeleton:this.showsSkeleton(),highlightedHtml:this.highlightedHtml,lineNumbers:this.lineNumbers,localize:this.localize.bind(this),renderPlainCode:()=>this.renderPlainCode(),onToggle:this.interactions.toggleCollapsed,onCopy:this.interactions.copy,onBodyMouseUp:this.interactions.onBodyMouseUp,onBodyClick:this.interactions.onBodyClick,onBodyKeyDown:this.interactions.onBodyKeyDown,onBodyFocusIn:this.interactions.onBodyFocusIn})}}__decorate([state()],LyraCodeBlockBase.prototype,"hasHeaderActions",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"focusedLine",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"highlightedHtml",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"shikiReady",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"justCopied",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"copyFailed",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"isDarkTheme",void 0);export{LyraCodeBlockBase};
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import"lit";import{state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{ThemeWatcher}from"../../../internal/theme-watcher.js";import{CodeBlockHeaderActionsController,CodeBlockInteractionController,applyCodeBlockAriaBusy,clampCodeBlockFocusedLine,codeBlockActiveHighlightLineSet,codeBlockLineHasFocus,codeBlockLineCount,codeBlockLineHighlightSet,renderCodeBlockPlainCode,renderCodeBlockShell,restoreCodeBlockLineFocus,scrollCodeBlockToAnchor,tokenizeCodeBlock}from"./code-block-shared.js";import{LYRA_DEFAULT_codeBlockLineLabel,LYRA_DEFAULT_codeRegion,LYRA_DEFAULT_codeRegionWithLanguage,LYRA_DEFAULT_collapseCode,LYRA_DEFAULT_copied,LYRA_DEFAULT_copiedToClipboard,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyCode,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_expandCode}from"../../../internal/default-strings.generated.js";class LyraCodeBlockBase extends LyraElement{static{this.defaultStrings={...super.defaultStrings,codeBlockLineLabel:LYRA_DEFAULT_codeBlockLineLabel,codeRegion:LYRA_DEFAULT_codeRegion,codeRegionWithLanguage:LYRA_DEFAULT_codeRegionWithLanguage,collapseCode:LYRA_DEFAULT_collapseCode,copied:LYRA_DEFAULT_copied,copiedToClipboard:LYRA_DEFAULT_copiedToClipboard,copy:LYRA_DEFAULT_copy,copyCode:LYRA_DEFAULT_copyCode,copyFailed:LYRA_DEFAULT_copyFailed,expandCode:LYRA_DEFAULT_expandCode}}static{this.collectionSupport=collectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-text-select"])}constructor(){super(),this.hasHeaderActions=!1,this.focusedLine=1,this.highlightedHtml=null,this.shikiReady=!1,this.justCopied=!1,this.copyFailed=!1,this.isDarkTheme=!1,this.restoreFocusedLineAfterUpdate=!1,this.highlightToken=0,this.bodyId=nextId("code-block-body"),this.interactions=new CodeBlockInteractionController({host:this,setFocusedLine:line=>{this.focusedLine=line},setJustCopied:value=>{this.justCopied=value},setCopyFailed:value=>{this.copyFailed=value},setDarkTheme:value=>{this.isDarkTheme=value},emitLineActivate:line=>this.emit("lr-line-activate",{line}),emitCopy:outcome=>this.emit("lr-copy",outcome),emitError:()=>this.emit("lr-error",null),emitCopyError:outcome=>this.emit("lr-copy-error",outcome),requestToggle:collapsed=>!this.emit("lr-toggle-request",{expanded:!collapsed},{cancelable:!0}).defaultPrevented,emitToggle:collapsed=>this.emit("lr-toggle",{expanded:!collapsed}),emitTextSelect:selection=>this.emit("lr-text-select",selection)}),this.headerActions=new CodeBlockHeaderActionsController({host:this,setHasHeaderActions:value=>{this.hasHeaderActions=value}}),new ThemeWatcher(this,()=>this.refreshTheme())}connectedCallback(){super.connectedCallback(),this.refreshTheme(),this.headerActions.observe()}disconnectedCallback(){this.highlightToken+=1,super.disconnectedCallback(),this.headerActions.disconnect(),this.interactions.disconnect(),this.highlightedHtml=null}adoptedCallback(){super.adoptedCallback(),this.interactions.disconnect()}async scrollToAnchor(target){return scrollCodeBlockToAnchor(this,target)}refreshTheme(){this.interactions.refreshTheme()}willUpdate(changed){super.willUpdate(changed),this.headerActions.sync(),this.restoreFocusedLineAfterUpdate=codeBlockLineHasFocus(this),changed.has("code")&&(this.focusedLine=clampCodeBlockFocusedLine(this.focusedLine,this.lineCount())),this.beforeHighlightUpdate(changed),this.interactions.needsHighlightResync(changed,this.effectiveLocale,this.localize("codeBlockLineLabel"))&&(this.shikiReady||this.preSuppliedGrammar()?this.syncHighlight():this.highlightedHtml=null)}updated(changed){super.updated(changed),applyCodeBlockAriaBusy(this,this.showsSkeleton()),this.restoreFocusedLineAfterUpdate&&(restoreCodeBlockLineFocus(this,this.focusedLine),this.restoreFocusedLineAfterUpdate=!1)}beforeHighlightUpdate(_changed){}lineHighlightSet(){return codeBlockLineHighlightSet(this.highlightLines??"",this.highlights,this.lineCount())}activeHighlightLineSet(){return codeBlockActiveHighlightLineSet(this.highlights,this.activeHighlightId,this.lineCount())}lineCount(){return codeBlockLineCount(this.code??"")}tokenize(hl,lang){return tokenizeCodeBlock(hl,{code:this.code??"",lang,lineNumbers:this.lineNumbers,activatableLines:this.activatableLines,focusedLine:this.focusedLine,highlightedLines:this.lineHighlightSet(),activeLines:this.activeHighlightLineSet(),lineLabel:line=>this.localize("codeBlockLineLabel",void 0,{line:getNumberFormat(this.effectiveLocale).format(line)}),lineNumberText:line=>getNumberFormat(this.effectiveLocale).format(line)})}renderPlainCode(){return renderCodeBlockPlainCode({code:this.code??"",lineNumbers:this.lineNumbers,activatableLines:this.activatableLines,focusedLine:this.focusedLine,highlightedLines:this.lineHighlightSet(),activeLines:this.activeHighlightLineSet(),localize:this.localize.bind(this),lineLabel:line=>this.localize("codeBlockLineLabel",void 0,{line:getNumberFormat(this.effectiveLocale).format(line)}),lineNumberText:line=>getNumberFormat(this.effectiveLocale).format(line),onLineActivate:line=>this.interactions.onLineActivate(line),onLineKeyDown:(event,line)=>this.interactions.onLineKeyDown(event,line)})}render(){return renderCodeBlockShell({filename:this.filename,language:this.language,copyable:!this.withoutCopyButton,copyAppearance:this.copyAppearance,hasHeaderActions:this.hasHeaderActions,collapsible:this.collapsible,collapsed:this.collapsed,justCopied:this.justCopied,copyFailed:this.copyFailed,bodyId:this.bodyId,accessibleLabel:this.accessibleLabel,maxHeight:this.maxHeight,isDarkTheme:this.isDarkTheme,showSkeleton:this.showsSkeleton(),highlightedHtml:this.highlightedHtml,lineNumbers:this.lineNumbers,localize:this.localize.bind(this),renderPlainCode:()=>this.renderPlainCode(),onToggle:this.interactions.toggleCollapsed,onCopy:this.interactions.copy,onBodyMouseUp:this.interactions.onBodyMouseUp,onBodyClick:this.interactions.onBodyClick,onBodyKeyDown:this.interactions.onBodyKeyDown,onBodyFocusIn:this.interactions.onBodyFocusIn})}}__decorate([state()],LyraCodeBlockBase.prototype,"hasHeaderActions",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"focusedLine",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"highlightedHtml",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"shikiReady",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"justCopied",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"copyFailed",void 0),__decorate([state()],LyraCodeBlockBase.prototype,"isDarkTheme",void 0);export{LyraCodeBlockBase};
@@ -6,8 +6,8 @@ import{type PropertyValues}from'lit';import{type ShikiLanguageSource}from'./shik
6
6
  * capability leaf) with `languages`' already-resolved entries — never `loadShikiHighlighter()`, the
7
7
  * default ~200-language dynamic-import table loader `<lr-code-block>` calls. This component's own
8
8
  * module never textually contains a call to (or import of) `loadShikiHighlighter` at all, so a
9
- * consumer importing this entry point instead of `code-block.js` gets a
10
- * genuinely shiki-full-table-free build.
9
+ * consumer importing `@aceshooting/lyra-ui/components/lr-code-block-core.js` instead of
10
+ * `@aceshooting/lyra-ui/components/lr-code-block.js` gets a genuinely shiki-full-table-free build.
11
11
  *
12
12
  * A `languages` entry may also be a lazy loader (`() => import('@shikijs/langs/<name>')`) instead
13
13
  * of an already-resolved grammar — resolved and registered into the highlighter (via
@@ -53,12 +53,10 @@ import{type PropertyValues}from'lit';import{type ShikiLanguageSource}from'./shik
53
53
  * `{ ok: false, text, reason, error }`, where `reason` is
54
54
  * `'unsupported' | 'denied' | 'failed'`.
55
55
  * @event lr-toggle-request - Cancelable request emitted before collapse state changes.
56
- * `detail: { expanded, collapsed }` is the proposed next state; `expanded` is the canonical key
57
- * and the deprecated `collapsed` its inverse.
56
+ * `detail: { expanded }` carries the proposed next state.
58
57
  * @event lr-toggle - The collapse/expand header button was activated.
59
- * `detail: { expanded, collapsed }` — same event name and shape convention as
60
- * `<lr-thinking-panel>`'s own `lr-toggle`; `expanded` is the resulting state and the deprecated
61
- * `collapsed` its inverse.
58
+ * `detail: { expanded }` carries the resulting state, matching
59
+ * `<lr-thinking-panel>`'s own `lr-toggle` event name and shape convention.
62
60
  * @event lr-line-activate - A gutter line number was activated (click, or Enter/Space while
63
61
  * focused) while `activatable-lines` is set. `detail: { line }`.
64
62
  * @event lr-text-select - Fired when a text selection inside the code body ends. `detail: {
@@ -186,7 +184,7 @@ readonly anchorKinds:readonly LyraAnchor['kind'][];
186
184
  * default) never highlights at all. Replacing the map starts a new loading generation; an
187
185
  * older map that settles later cannot clear the current map's loading state or replace its
188
186
  * highlighted output. For a TypeScript annotation, use `import type { ShikiLanguageSource } from
189
- * '@aceshooting/lyra-ui/components/conversation/code-block/code-block-core.js'`; this granular
187
+ * '@aceshooting/lyra-ui/components/lr-code-block-core.js'`; this granular
190
188
  * type-only import emits no registration side effect. */
191
189
  languages:Readonly<Record<string,ShikiLanguageSource>>;private highlighterGeneration;private activeLanguages?;connectedCallback():void;disconnectedCallback():void;protected preSuppliedGrammar():ShikiLanguageSource|undefined;protected beforeHighlightUpdate(changed:PropertyValues):void;
192
190
  /** Resolves a `line-range` anchor (or a `highlights` id string resolving to one) by scrolling
@@ -119,10 +119,7 @@ export type LyraCodeBlockCopyAppearance='text'|'icon';
119
119
  export interface LyraCodeBlockToggleDetail{
120
120
  /** Whether the code region is shown in the resulting (on `lr-toggle-request`, the proposed)
121
121
  * state. */
122
- expanded:boolean;
123
- /** The inverse of `expanded`.
124
- * @deprecated Read `expanded` instead; removal not before 23.0.0. */
125
- collapsed:boolean;}export interface CodeBlockShellOptions{filename:string;language:string;copyable:boolean;copyAppearance:LyraCodeBlockCopyAppearance;
122
+ expanded:boolean;}export interface CodeBlockShellOptions{filename:string;language:string;copyable:boolean;copyAppearance:LyraCodeBlockCopyAppearance;
126
123
  /** Whether a light-DOM child is assigned to the `header-actions` slot, so the header renders for
127
124
  * a code block that has nothing else to put in it. */
128
125
  hasHeaderActions:boolean;collapsible:boolean;collapsed:boolean;justCopied:boolean;copyFailed:boolean;bodyId:string;
@@ -70,12 +70,10 @@ import{type ShikiLanguageInput}from'./code-loader.js';import type{LyraCodeBlockC
70
70
  * `{ ok: false, text, reason, error }`, where `reason` is
71
71
  * `'unsupported' | 'denied' | 'failed'`.
72
72
  * @event lr-toggle-request - Cancelable request emitted before collapse state changes.
73
- * `detail: { expanded, collapsed }` is the proposed next state; `expanded` is the canonical key
74
- * and the deprecated `collapsed` its inverse.
73
+ * `detail: { expanded }` carries the proposed next state.
75
74
  * @event lr-toggle - The collapse/expand header button was activated.
76
- * `detail: { expanded, collapsed }` — same event name and shape convention as
77
- * `<lr-thinking-panel>`'s own `lr-toggle`; `expanded` is the resulting state and the deprecated
78
- * `collapsed` its inverse.
75
+ * `detail: { expanded }` carries the resulting state, matching
76
+ * `<lr-thinking-panel>`'s own `lr-toggle` event name and shape convention.
79
77
  * @event lr-line-activate - A gutter line number was activated (click, or Enter/Space while
80
78
  * focused) while `activatable-lines` is set. `detail: { line }`.
81
79
  * @event lr-text-select - Fired when a text selection inside the code body ends. `detail: {
@@ -205,7 +203,7 @@ readonly anchorKinds:readonly LyraAnchor['kind'][];
205
203
  * this map (or left unset, or when `languages` itself is unset) falls
206
204
  * back to that default dynamic-import path unchanged. For a TypeScript
207
205
  * annotation, use `import type { ShikiLanguageInput } from
208
- * '@aceshooting/lyra-ui/components/conversation/code-block/code-block.js'`;
206
+ * '@aceshooting/lyra-ui/components/lr-code-block.js'`;
209
207
  * this granular type-only import emits no registration side effect. */
210
208
  languages?:Readonly<Record<string,ShikiLanguageInput>>;private highlighter?;private defaultHighlighterLoading;connectedCallback():void;private ensureDefaultHighlighter;protected preSuppliedGrammar():ShikiLanguageInput|undefined;protected showsSkeleton():boolean;
211
209
  /** Resolves a `line-range` anchor (or a `highlights` id string resolving to one) by scrolling
@@ -1,6 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraAnchorTargetEventMap}from'../../../internal/anchor-target.js';import type{LyraClipboardWriteSuccess,LyraClipboardWriteFailure}from'../../../internal/clipboard.js';import type{LyraAnchor,LyraAnchorKind}from'../../viewers/document-viewer/anchors.js';import type{ShikiLanguageSource}from'../code-block/shiki-types.js';import type{LyraMarkedParser}from'./markdown-loader.js';import{MarkdownParserController,type MarkdownHeadingItem,type MarkdownHtmlMode,type MarkdownKatexState,type PendingHighlight}from'./markdown-shared.js';export interface MarkdownRuntimeEventMap extends LyraAnchorTargetEventMap{'lr-render-error':CustomEvent<{error:unknown;}>;'lr-link-activate':CustomEvent<{href:string;}>;
2
- /** @deprecated Use lr-link-activate. */
3
- 'lr-link-click':CustomEvent<{href:string;}>;'lr-content-settled':CustomEvent<null>;'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;}
1
+ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraAnchorTargetEventMap}from'../../../internal/anchor-target.js';import type{LyraClipboardWriteSuccess,LyraClipboardWriteFailure}from'../../../internal/clipboard.js';import type{LyraAnchor,LyraAnchorKind}from'../../viewers/document-viewer/anchors.js';import type{ShikiLanguageSource}from'../code-block/shiki-types.js';import type{LyraMarkedParser}from'./markdown-loader.js';import{MarkdownParserController,type MarkdownHeadingItem,type MarkdownHtmlMode,type MarkdownKatexState,type PendingHighlight}from'./markdown-shared.js';export interface MarkdownRuntimeEventMap extends LyraAnchorTargetEventMap{'lr-render-error':CustomEvent<{error:unknown;}>;'lr-link-activate':CustomEvent<{href:string;}>;'lr-content-settled':CustomEvent<null>;'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;}
4
2
  /** Markdown behavior while a Markdown source is still arriving. */
5
3
  export type MarkdownStreamingRenderMode=import('./markdown-shared.js').MarkdownStreamingRender;declare class LyraMarkdownRuntimeElement extends LyraElement<MarkdownRuntimeEventMap>{}
6
4
  /** Shared per-tag state. The two concrete tags deliberately keep separate parser defaults,