@aceshooting/lyra-ui 14.3.1 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/custom-elements.json +1 -1
  3. package/design-tokens.json +1 -1
  4. package/dist/cli/migration-contract.json +1 -1
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +4 -0
  6. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +3 -3
  7. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +3 -2
  8. package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +1 -1
  9. package/dist/components/agent-tools/commit-card/commit-card.styles.js +1 -1
  10. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +1 -1
  11. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +8 -3
  12. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +3 -1
  13. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +10 -1
  14. package/dist/components/agent-tools/eval-dataset/eval-dataset.styles.js +1 -1
  15. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
  16. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.d.ts +19 -1
  17. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +4 -4
  18. package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +1 -1
  19. package/dist/components/agent-tools/task-list/task-list.class.d.ts +5 -0
  20. package/dist/components/agent-tools/task-list/task-list.class.js +3 -3
  21. package/dist/components/agent-tools/terminal/terminal.class.d.ts +1 -1
  22. package/dist/components/agent-tools/terminal/terminal.styles.js +1 -1
  23. package/dist/components/agent-tools/test-results/test-results.class.js +1 -1
  24. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +10 -7
  25. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +15 -14
  26. package/dist/components/agent-tools/tool-param-form/tool-param-form.d.ts +1 -1
  27. package/dist/components/agent-tools/tool-param-form/tool-param-form.js +1 -1
  28. package/dist/components/agent-tools/tool-param-form/tool-param-form.styles.js +1 -1
  29. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.d.ts +5 -2
  30. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +1 -1
  31. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.d.ts +3 -1
  32. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +9 -1
  33. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.styles.js +1 -1
  34. package/dist/components/charts/chart/box-plot.class.d.ts +64 -4
  35. package/dist/components/charts/chart/box-plot.class.js +5 -5
  36. package/dist/components/charts/chart/chart-colors.d.ts +10 -0
  37. package/dist/components/charts/chart/chart-colors.js +1 -1
  38. package/dist/components/charts/chart/chart.class.d.ts +35 -10
  39. package/dist/components/charts/chart/chart.class.js +4 -4
  40. package/dist/components/charts/chart/lite-chart.class.d.ts +10 -2
  41. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  42. package/dist/components/conversation/markdown/markdown.class.d.ts +9 -1
  43. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  44. package/dist/components/conversation/message-parts/message-parts.class.d.ts +18 -1
  45. package/dist/components/conversation/message-parts/message-parts.class.js +4 -4
  46. package/dist/components/conversation/model-select/model-select.class.d.ts +6 -2
  47. package/dist/components/conversation/model-select/model-select.class.js +3 -3
  48. package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
  49. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +5 -1
  50. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  51. package/dist/components/data/calendar/calendar.class.js +2 -2
  52. package/dist/components/data/context-meter/context-meter.styles.js +1 -1
  53. package/dist/components/data/data-grid/data-grid-types.d.ts +8 -2
  54. package/dist/components/data/data-grid/data-grid.class.d.ts +16 -3
  55. package/dist/components/data/data-grid/data-grid.class.js +3 -2
  56. package/dist/components/data/env-list/env-list.styles.js +1 -1
  57. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +22 -2
  58. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
  59. package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +12 -4
  60. package/dist/components/data/flow-minimap/flow-minimap.class.js +2 -2
  61. package/dist/components/data/flow-minimap/flow-minimap.styles.js +1 -1
  62. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +5 -1
  63. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
  64. package/dist/components/data/heatmap/heatmap.class.d.ts +12 -1
  65. package/dist/components/data/heatmap/heatmap.class.js +3 -3
  66. package/dist/components/data/heatmap/heatmap.styles.js +1 -1
  67. package/dist/components/forms/code-editor/code-editor.class.js +1 -1
  68. package/dist/components/forms/combobox/combobox.class.js +1 -1
  69. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  70. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  71. package/dist/components/forms/date-picker/date-picker.class.d.ts +12 -1
  72. package/dist/components/forms/date-picker/date-picker.class.js +1 -1
  73. package/dist/components/forms/icon-button/icon-button.class.d.ts +27 -5
  74. package/dist/components/forms/icon-button/icon-button.class.js +7 -3
  75. package/dist/components/forms/input/input.styles.js +1 -1
  76. package/dist/components/forms/input/time-input.class.d.ts +13 -2
  77. package/dist/components/forms/input/time-input.class.js +1 -1
  78. package/dist/components/forms/otp-input/otp-input.class.d.ts +8 -1
  79. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  80. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +1 -1
  81. package/dist/components/forms/rubric-form/rubric-form.class.js +1 -1
  82. package/dist/components/forms/select/select.class.d.ts +1 -1
  83. package/dist/components/forms/select/select.class.js +1 -1
  84. package/dist/components/forms/slider/slider.class.d.ts +4 -1
  85. package/dist/components/forms/slider/slider.class.js +1 -1
  86. package/dist/components/forms/textarea/textarea.class.d.ts +9 -4
  87. package/dist/components/forms/textarea/textarea.class.js +1 -1
  88. package/dist/components/forms/time-range/time-range.class.js +1 -1
  89. package/dist/components/layout/app-rail/app-rail.class.d.ts +7 -2
  90. package/dist/components/layout/app-rail/app-rail.class.js +1 -1
  91. package/dist/components/layout/card/card.class.js +2 -2
  92. package/dist/components/layout/card/card.styles.js +1 -1
  93. package/dist/components/layout/control-group/control-group.class.js +1 -1
  94. package/dist/components/layout/dashboard-grid/dashboard-grid.styles.js +1 -1
  95. package/dist/components/layout/details/details.styles.js +1 -1
  96. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +13 -3
  97. package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
  98. package/dist/components/layout/menu/dropdown-item.class.d.ts +2 -0
  99. package/dist/components/layout/menu/menu-item.class.d.ts +28 -1
  100. package/dist/components/layout/menu/menu-item.class.js +45 -35
  101. package/dist/components/layout/menu/menu-item.styles.js +1 -1
  102. package/dist/components/layout/menu/menu.class.js +1 -1
  103. package/dist/components/layout/multi-split/multi-split.class.d.ts +12 -2
  104. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  105. package/dist/components/layout/page/page.class.js +2 -1
  106. package/dist/components/layout/page/page.styles.js +1 -1
  107. package/dist/components/layout/responsive-panel/responsive-panel.class.d.ts +6 -4
  108. package/dist/components/layout/responsive-panel/responsive-panel.class.js +2 -2
  109. package/dist/components/layout/responsive-panel/responsive-panel.styles.js +1 -1
  110. package/dist/components/layout/stepper/stepper.class.js +2 -2
  111. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  112. package/dist/components/layout/virtual-list/virtual-list.class.js +2 -2
  113. package/dist/components/layout/widget/widget.class.d.ts +12 -2
  114. package/dist/components/layout/widget/widget.class.js +2 -2
  115. package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +1 -1
  116. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
  117. package/dist/components/media/file-icon/file-icon.class.d.ts +3 -1
  118. package/dist/components/media/file-icon/file-icon.class.js +1 -1
  119. package/dist/components/media/file-input/file-input.class.d.ts +1 -1
  120. package/dist/components/media/file-input/file-input.class.js +1 -1
  121. package/dist/components/media/flag/flag.styles.js +1 -1
  122. package/dist/components/media/image-comparer/image-comparer.class.d.ts +5 -5
  123. package/dist/components/media/image-comparer/image-comparer.class.js +1 -1
  124. package/dist/components/media/image-comparer/image-comparer.styles.js +1 -1
  125. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  126. package/dist/components/media/map/map.styles.js +1 -1
  127. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  128. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  129. package/dist/components/media/video-playlist/video-playlist.styles.js +1 -1
  130. package/dist/components/overlays/alert/alert.class.d.ts +6 -0
  131. package/dist/components/overlays/alert/alert.styles.js +1 -1
  132. package/dist/components/overlays/badge/tag.class.js +1 -1
  133. package/dist/components/overlays/chip/chip.class.js +1 -1
  134. package/dist/components/overlays/empty/empty.class.js +2 -2
  135. package/dist/components/overlays/kbd/kbd.styles.js +1 -1
  136. package/dist/components/overlays/progress/progress-ring.class.d.ts +4 -1
  137. package/dist/components/overlays/progress/progress.styles.js +1 -1
  138. package/dist/components/overlays/toast/toast.styles.js +1 -1
  139. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  140. package/dist/components/retrieval/graph/graph.class.d.ts +10 -3
  141. package/dist/components/retrieval/graph/graph.class.js +1 -1
  142. package/dist/components/retrieval/graph/graph.styles.js +1 -1
  143. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +1 -1
  144. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +6 -6
  145. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js +2 -2
  146. package/dist/components/retrieval/mind-map/mind-map.styles.js +1 -1
  147. package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +3 -3
  148. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +3 -3
  149. package/dist/components/retrieval/node-palette/node-palette.class.d.ts +7 -1
  150. package/dist/components/retrieval/node-palette/node-palette.class.js +23 -13
  151. package/dist/components/retrieval/node-palette/node-palette.styles.js +1 -1
  152. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +4 -1
  153. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
  154. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +1 -1
  155. package/dist/components/retrieval/retrieval-search/retrieval-search.class.js +4 -3
  156. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
  157. package/dist/components/retrieval/source-list/source-list.class.d.ts +7 -1
  158. package/dist/components/retrieval/source-list/source-list.class.js +1 -1
  159. package/dist/components/utility/export-button/export-button.class.d.ts +14 -2
  160. package/dist/components/utility/export-button/export-button.class.js +3 -3
  161. package/dist/components/utility/export-button/export-button.styles.js +1 -1
  162. package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
  163. package/dist/components/utility/known-date/known-date.class.js +1 -1
  164. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +4 -2
  165. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  166. package/dist/components/viewers/csv-viewer/csv-viewer.class.d.ts +9 -1
  167. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +4 -4
  168. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +1 -1
  169. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +4 -4
  170. package/dist/components/viewers/document-compare/document-compare.class.d.ts +5 -0
  171. package/dist/components/viewers/document-compare/document-compare.class.js +9 -4
  172. package/dist/components/viewers/document-compare/document-compare.styles.js +1 -1
  173. package/dist/components/viewers/document-preview/document-preview.class.d.ts +9 -1
  174. package/dist/components/viewers/document-preview/document-preview.class.js +2 -1
  175. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.d.ts +5 -0
  176. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
  177. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +5 -0
  178. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.d.ts +1 -1
  179. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +3 -3
  180. package/dist/components/viewers/xml-viewer/xml-viewer.styles.js +1 -1
  181. package/dist/custom-elements-jsx.d.ts +1 -1
  182. package/dist/events.d.ts +5 -4
  183. package/dist/internal/accessibility-visibility.d.ts +13 -2
  184. package/dist/internal/accessibility-visibility.js +1 -1
  185. package/dist/internal/package-metadata.d.ts +1 -1
  186. package/dist/internal/package-metadata.js +1 -1
  187. package/dist/lyra.d.ts +1 -1
  188. package/dist/svelte.d.ts +1 -1
  189. package/dist/vue.d.ts +1 -1
  190. package/llms/components/lr-alert.md +11 -3
  191. package/llms/components/lr-box-plot.md +21 -4
  192. package/llms/components/lr-chart.md +13 -4
  193. package/llms/components/lr-code-block.md +5 -4
  194. package/llms/components/lr-data-grid.md +24 -10
  195. package/llms/components/lr-document-compare.md +5 -0
  196. package/llms/components/lr-dropdown-item.md +31 -0
  197. package/llms/components/lr-eval-dataset.md +5 -4
  198. package/llms/components/lr-export-button.md +10 -5
  199. package/llms/components/lr-filter-bar.md +4 -1
  200. package/llms/components/lr-flow-minimap.md +7 -1
  201. package/llms/components/lr-icon-button.md +6 -1
  202. package/llms/components/lr-lite-chart.md +2 -1
  203. package/llms/components/lr-markdown.md +2 -2
  204. package/llms/components/lr-menu-item.md +31 -0
  205. package/llms/components/lr-menu.md +31 -0
  206. package/llms/components/lr-message-parts.md +7 -0
  207. package/llms/components/lr-model-settings-panel.md +4 -1
  208. package/llms/components/lr-node-palette.md +5 -4
  209. package/llms/components/lr-pdf-viewer.md +7 -0
  210. package/llms/components/lr-responsive-panel.md +2 -2
  211. package/llms/components/lr-subagent-panel.md +17 -2
  212. package/llms/components/lr-thinking-panel.md +4 -0
  213. package/llms/components/lr-timeline-item.md +1 -1
  214. package/llms/components/lr-timeline.md +1 -1
  215. package/llms/components/lr-tool-select-dialog.md +4 -3
  216. package/llms/components/lr-virtual-list.md +11 -11
  217. package/llms-full.txt +212 -59
  218. package/package.json +3 -3
  219. package/vscode-css-data.json +1 -1
  220. package/vscode-html-data.json +1 -1
  221. package/web-types.json +1 -1
@@ -96,6 +96,10 @@ formatTimestamp?:(date:Date)=>string;
96
96
  renderText?:(entry:ActivityEntry)=>TemplateResult;
97
97
  /** At/above this entry count, the body renders through an internal `<lr-virtual-list>`. */
98
98
  virtualizeAt:number;private liveRegion?;private virtualListEl?;private readonly headerId;private readonly bodyId;
99
+ /** Stable across renders on purpose -- a fresh closure here would defeat the internal
100
+ * `<lr-virtual-list>`'s row-offset cache (it treats a `keyFunction` identity change the
101
+ * same as an `items` change) on every unrelated re-render. */
102
+ private readonly activityEntryKey;
99
103
  /** `true` until the first completed update -- gates the mode-transition announcement so
100
104
  * mounting in a non-default mode never announces historical state. */
101
105
  private isMounting;private scrollRafId?;private scrollRafOwner?;private scrollRafDocument?;private virtualAnchorReleaseRafId?;private virtualAnchorReleaseRafOwner?;private virtualAnchorReleaseRafDocument?;private anchoringVirtualTail;private ownerRealmGeneration;private virtualAnchorRequest;private externalLabelledByLease?;private externalDescribedByLease?;private relationshipSyncRequest;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{chevronIcon}from"../../../internal/icons.js";import{getDateTimeFormat,getNumberFormat,getPluralRules}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{styles}from"./activity-feed.styles.js";import{literalSetConverter,presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_activityFeedCompletedStep,LYRA_DEFAULT_activityFeedCompletedSteps,LYRA_DEFAULT_activityFeedLabel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const ACTIVITY_FEED_MODE=literalSetConverter(["live","post-hoc"],"live"),NEAR_BOTTOM_PX=48;function variantDotPart(variant){return variant==="brand"?"variant-dot variant-dot-brand":variant==="success"?"variant-dot variant-dot-success":variant==="warning"?"variant-dot variant-dot-warning":variant==="danger"?"variant-dot variant-dot-danger":"variant-dot variant-dot-neutral"}function defaultFormatTimestamp(date,locale){return getDateTimeFormat(locale,{hour:"numeric",minute:"2-digit"}).format(date)}class LyraActivityFeed extends LyraElement{constructor(){super(...arguments),this.entries=[],this._mode="live",this.follow=!0,this.expanded=!1,this.showTimestamps=!1,this.virtualizeAt=199,this.headerId=nextId("activity-feed-header"),this.bodyId=nextId("activity-feed-body"),this.isMounting=!0,this.anchoringVirtualTail=!1,this.ownerRealmGeneration=0,this.virtualAnchorRequest=0,this.relationshipSyncRequest=0,this.toggle=()=>{this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded})},this.onBodyScroll=e=>{if(this.isVirtualized||this.mode!=="live")return;const body=e.currentTarget,nearBottom=body.scrollHeight-body.scrollTop-body.clientHeight<=NEAR_BOTTOM_PX;this.setFollowFromUser(nearBottom)},this.onVirtualListRangeChanged=e=>{if(e.stopPropagation(),this.mode!=="live"||this.anchoringVirtualTail)return;const entries=this.normalizedEntries,atBottom=entries.length>0&&e.detail.end>=entries.length-1;this.setFollowFromUser(atBottom)},this.stopOwnedEvent=event=>{event.stopPropagation()}}static{this.defaultStrings={...super.defaultStrings,activityFeedCompletedStep:LYRA_DEFAULT_activityFeedCompletedStep,activityFeedCompletedSteps:LYRA_DEFAULT_activityFeedCompletedSteps,activityFeedLabel:LYRA_DEFAULT_activityFeedLabel,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.ownedCollectionProperties=Object.freeze(["entries"])}static{this.styles=[LyraElement.styles,styles]}get mode(){return this._mode}set mode(next){const normalized=ACTIVITY_FEED_MODE.normalizeReflected(this,"mode",next),old=this._mode;old!==normalized&&(this._mode=normalized,this.requestUpdate("mode",old))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.syncListRelationships(),this.scheduleListRelationshipSync()),this.hasUpdated&&this.shouldFollowLiveTail&&this.scrollToLatest()}disconnectedCallback(){this.releaseListRelationships(),this.resetOwnerRealmWork(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseListRelationships(),this.resetOwnerRealmWork(),this.isConnected&&this.hasUpdated&&(this.syncListRelationships(),this.scheduleListRelationshipSync()),this.isConnected&&this.shouldFollowLiveTail&&this.scrollToLatest()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,199)}get normalizedEntries(){return firstByIdentity(Array.isArray(this.entries)?this.entries:[],entry=>entry.id)}get isVirtualized(){return this.normalizedEntries.length>this.effectiveVirtualizeAt}get shouldFollowLiveTail(){return this.expanded&&this.mode==="live"&&this.follow}cancelScrollFrame(){this.scrollRafId!==void 0&&this.scrollRafOwner?.cancelAnimationFrame(this.scrollRafId),this.scrollRafId=void 0,this.scrollRafOwner=void 0,this.scrollRafDocument=void 0}cancelVirtualAnchorReleaseFrame(){this.virtualAnchorReleaseRafId!==void 0&&this.virtualAnchorReleaseRafOwner?.cancelAnimationFrame(this.virtualAnchorReleaseRafId),this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0}resetOwnerRealmWork(){this.ownerRealmGeneration+=1,this.virtualAnchorRequest+=1,this.relationshipSyncRequest+=1,this.cancelScrollFrame(),this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!1}willUpdate(changed){super.willUpdate(changed),(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live"&&(this.follow=!0)}updated(changed){super.updated(changed),this.syncListRelationships(),this.scheduleListRelationshipSync();const wasMounting=this.isMounting;if(this.isMounting=!1,!wasMounting&&changed.has("mode")&&changed.get("mode")==="live"&&this.mode==="post-hoc"){const region=this.liveRegion;region&&(region.mode="polite",region.announce(this.completedStepsSummary(),{force:!0}))}const justAnchored=(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live",followingChangedRenderPath=changed.has("virtualizeAt")&&this.expanded&&this.mode==="live"&&this.follow;(justAnchored||followingChangedRenderPath||changed.has("entries")&&this.expanded&&this.mode==="live"&&this.follow)&&this.scrollToLatest()}scrollToLatest(){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected||!this.shouldFollowLiveTail)return;const generation=this.ownerRealmGeneration;if(this.isVirtualized){this.cancelScrollFrame(),this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!0;const request=++this.virtualAnchorRequest;this.updateComplete.then(()=>{const list=this.virtualListEl;if(request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||this.ownerDocument!==ownerDocument||!this.isConnected)return;if(!list||!this.isVirtualized||!this.shouldFollowLiveTail){this.anchoringVirtualTail=!1;return}list.scrollToIndex(this.normalizedEntries.length-1,{align:"end",behavior:"auto"});const firstHandle=ownerWindow.requestAnimationFrame(()=>{if(this.virtualAnchorReleaseRafId!==firstHandle||this.virtualAnchorReleaseRafOwner!==ownerWindow||this.virtualAnchorReleaseRafDocument!==ownerDocument||request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument)return;if(this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0,!this.anchoringVirtualTail||!this.isVirtualized||!this.shouldFollowLiveTail){this.anchoringVirtualTail=!1;return}const secondHandle=ownerWindow.requestAnimationFrame(()=>{this.virtualAnchorReleaseRafId!==secondHandle||this.virtualAnchorReleaseRafOwner!==ownerWindow||this.virtualAnchorReleaseRafDocument!==ownerDocument||request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument||(this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0,this.anchoringVirtualTail=!1)});this.virtualAnchorReleaseRafId=secondHandle,this.virtualAnchorReleaseRafOwner=ownerWindow,this.virtualAnchorReleaseRafDocument=ownerDocument});this.virtualAnchorReleaseRafId=firstHandle,this.virtualAnchorReleaseRafOwner=ownerWindow,this.virtualAnchorReleaseRafDocument=ownerDocument});return}if(this.virtualAnchorRequest+=1,this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!1,this.scrollRafId!==void 0)return;const handle=ownerWindow.requestAnimationFrame(()=>{if(this.scrollRafId!==handle||this.scrollRafOwner!==ownerWindow||this.scrollRafDocument!==ownerDocument||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument||(this.scrollRafId=void 0,this.scrollRafOwner=void 0,this.scrollRafDocument=void 0,!this.shouldFollowLiveTail||this.isVirtualized))return;const body=this.renderRoot.querySelector('[part="body"]');body&&(body.scrollTop=body.scrollHeight)});this.scrollRafId=handle,this.scrollRafOwner=ownerWindow,this.scrollRafDocument=ownerDocument}completedStepsSummary(){const count=this.normalizedEntries.length,key=getPluralRules(this.effectiveLocale).select(count)==="one"?"activityFeedCompletedStep":"activityFeedCompletedSteps";return this.localize(key,void 0,{count:getNumberFormat(this.effectiveLocale).format(count)})}get listSemanticOwner(){return this.isVirtualized?this.virtualListEl?.scrollContainer??null:this.renderRoot.querySelector('[part="body"][role="list"]')}syncListRelationships(){const target=this.listSemanticOwner;if(!target){this.releaseListRelationships();return}this.externalLabelledByLease?this.externalLabelledByLease.update(target):this.externalLabelledByLease=acquireResolvedAriaRelationship(this,target,"aria-labelledby"),this.externalDescribedByLease?this.externalDescribedByLease.update(target):this.externalDescribedByLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}scheduleListRelationshipSync(){const list=this.virtualListEl;if(!this.isVirtualized||!list||!this.isConnected){this.relationshipSyncRequest+=1;return}const request=++this.relationshipSyncRequest,ownerDocument=this.ownerDocument,generation=this.ownerRealmGeneration;list.updateComplete.then(()=>{request!==this.relationshipSyncRequest||generation!==this.ownerRealmGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||!this.isVirtualized||this.virtualListEl!==list||this.syncListRelationships()})}releaseListRelationships(){this.externalLabelledByLease?.release(),this.externalLabelledByLease=void 0,this.externalDescribedByLease?.release(),this.externalDescribedByLease=void 0}setFollowFromUser(following){following!==this.follow&&(this.follow=following,this.emit("lr-follow-change",{following}))}normalizedTimestamp(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}entryTemplate(entry,ownRole){const ts=this.normalizedTimestamp(entry.timestamp),formatter=this.formatTimestamp??(date=>defaultFormatTimestamp(date,this.effectiveLocale)),variant=entry.variant??"neutral",dotPart=variantDotPart(variant);return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{chevronIcon}from"../../../internal/icons.js";import{getDateTimeFormat,getNumberFormat,getPluralRules}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{styles}from"./activity-feed.styles.js";import{literalSetConverter,presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_activityFeedCompletedStep,LYRA_DEFAULT_activityFeedCompletedSteps,LYRA_DEFAULT_activityFeedLabel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const ACTIVITY_FEED_MODE=literalSetConverter(["live","post-hoc"],"live"),NEAR_BOTTOM_PX=48;function variantDotPart(variant){return variant==="brand"?"variant-dot variant-dot-brand":variant==="success"?"variant-dot variant-dot-success":variant==="warning"?"variant-dot variant-dot-warning":variant==="danger"?"variant-dot variant-dot-danger":"variant-dot variant-dot-neutral"}function defaultFormatTimestamp(date,locale){return getDateTimeFormat(locale,{hour:"numeric",minute:"2-digit"}).format(date)}class LyraActivityFeed extends LyraElement{constructor(){super(...arguments),this.entries=[],this._mode="live",this.follow=!0,this.expanded=!1,this.showTimestamps=!1,this.virtualizeAt=199,this.headerId=nextId("activity-feed-header"),this.bodyId=nextId("activity-feed-body"),this.activityEntryKey=item=>item.id,this.isMounting=!0,this.anchoringVirtualTail=!1,this.ownerRealmGeneration=0,this.virtualAnchorRequest=0,this.relationshipSyncRequest=0,this.toggle=()=>{this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded})},this.onBodyScroll=e=>{if(this.isVirtualized||this.mode!=="live")return;const body=e.currentTarget,nearBottom=body.scrollHeight-body.scrollTop-body.clientHeight<=NEAR_BOTTOM_PX;this.setFollowFromUser(nearBottom)},this.onVirtualListRangeChanged=e=>{if(e.stopPropagation(),this.mode!=="live"||this.anchoringVirtualTail)return;const entries=this.normalizedEntries,atBottom=entries.length>0&&e.detail.end>=entries.length-1;this.setFollowFromUser(atBottom)},this.stopOwnedEvent=event=>{event.stopPropagation()}}static{this.defaultStrings={...super.defaultStrings,activityFeedCompletedStep:LYRA_DEFAULT_activityFeedCompletedStep,activityFeedCompletedSteps:LYRA_DEFAULT_activityFeedCompletedSteps,activityFeedLabel:LYRA_DEFAULT_activityFeedLabel,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.ownedCollectionProperties=Object.freeze(["entries"])}static{this.styles=[LyraElement.styles,styles]}get mode(){return this._mode}set mode(next){const normalized=ACTIVITY_FEED_MODE.normalizeReflected(this,"mode",next),old=this._mode;old!==normalized&&(this._mode=normalized,this.requestUpdate("mode",old))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.syncListRelationships(),this.scheduleListRelationshipSync()),this.hasUpdated&&this.shouldFollowLiveTail&&this.scrollToLatest()}disconnectedCallback(){this.releaseListRelationships(),this.resetOwnerRealmWork(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.releaseListRelationships(),this.resetOwnerRealmWork(),this.isConnected&&this.hasUpdated&&(this.syncListRelationships(),this.scheduleListRelationshipSync()),this.isConnected&&this.shouldFollowLiveTail&&this.scrollToLatest()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,199)}get normalizedEntries(){return firstByIdentity(Array.isArray(this.entries)?this.entries:[],entry=>entry.id)}get isVirtualized(){return this.normalizedEntries.length>this.effectiveVirtualizeAt}get shouldFollowLiveTail(){return this.expanded&&this.mode==="live"&&this.follow}cancelScrollFrame(){this.scrollRafId!==void 0&&this.scrollRafOwner?.cancelAnimationFrame(this.scrollRafId),this.scrollRafId=void 0,this.scrollRafOwner=void 0,this.scrollRafDocument=void 0}cancelVirtualAnchorReleaseFrame(){this.virtualAnchorReleaseRafId!==void 0&&this.virtualAnchorReleaseRafOwner?.cancelAnimationFrame(this.virtualAnchorReleaseRafId),this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0}resetOwnerRealmWork(){this.ownerRealmGeneration+=1,this.virtualAnchorRequest+=1,this.relationshipSyncRequest+=1,this.cancelScrollFrame(),this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!1}willUpdate(changed){super.willUpdate(changed),(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live"&&(this.follow=!0)}updated(changed){super.updated(changed),this.syncListRelationships(),this.scheduleListRelationshipSync();const wasMounting=this.isMounting;if(this.isMounting=!1,!wasMounting&&changed.has("mode")&&changed.get("mode")==="live"&&this.mode==="post-hoc"){const region=this.liveRegion;region&&(region.mode="polite",region.announce(this.completedStepsSummary(),{force:!0}))}const justAnchored=(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live",followingChangedRenderPath=changed.has("virtualizeAt")&&this.expanded&&this.mode==="live"&&this.follow;(justAnchored||followingChangedRenderPath||changed.has("entries")&&this.expanded&&this.mode==="live"&&this.follow)&&this.scrollToLatest()}scrollToLatest(){const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected||!this.shouldFollowLiveTail)return;const generation=this.ownerRealmGeneration;if(this.isVirtualized){this.cancelScrollFrame(),this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!0;const request=++this.virtualAnchorRequest;this.updateComplete.then(()=>{const list=this.virtualListEl;if(request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||this.ownerDocument!==ownerDocument||!this.isConnected)return;if(!list||!this.isVirtualized||!this.shouldFollowLiveTail){this.anchoringVirtualTail=!1;return}list.scrollToIndex(this.normalizedEntries.length-1,{align:"end",behavior:"auto"});const firstHandle=ownerWindow.requestAnimationFrame(()=>{if(this.virtualAnchorReleaseRafId!==firstHandle||this.virtualAnchorReleaseRafOwner!==ownerWindow||this.virtualAnchorReleaseRafDocument!==ownerDocument||request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument)return;if(this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0,!this.anchoringVirtualTail||!this.isVirtualized||!this.shouldFollowLiveTail){this.anchoringVirtualTail=!1;return}const secondHandle=ownerWindow.requestAnimationFrame(()=>{this.virtualAnchorReleaseRafId!==secondHandle||this.virtualAnchorReleaseRafOwner!==ownerWindow||this.virtualAnchorReleaseRafDocument!==ownerDocument||request!==this.virtualAnchorRequest||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument||(this.virtualAnchorReleaseRafId=void 0,this.virtualAnchorReleaseRafOwner=void 0,this.virtualAnchorReleaseRafDocument=void 0,this.anchoringVirtualTail=!1)});this.virtualAnchorReleaseRafId=secondHandle,this.virtualAnchorReleaseRafOwner=ownerWindow,this.virtualAnchorReleaseRafDocument=ownerDocument});this.virtualAnchorReleaseRafId=firstHandle,this.virtualAnchorReleaseRafOwner=ownerWindow,this.virtualAnchorReleaseRafDocument=ownerDocument});return}if(this.virtualAnchorRequest+=1,this.cancelVirtualAnchorReleaseFrame(),this.anchoringVirtualTail=!1,this.scrollRafId!==void 0)return;const handle=ownerWindow.requestAnimationFrame(()=>{if(this.scrollRafId!==handle||this.scrollRafOwner!==ownerWindow||this.scrollRafDocument!==ownerDocument||generation!==this.ownerRealmGeneration||!this.isConnected||this.ownerDocument!==ownerDocument||(this.scrollRafId=void 0,this.scrollRafOwner=void 0,this.scrollRafDocument=void 0,!this.shouldFollowLiveTail||this.isVirtualized))return;const body=this.renderRoot.querySelector('[part="body"]');body&&(body.scrollTop=body.scrollHeight)});this.scrollRafId=handle,this.scrollRafOwner=ownerWindow,this.scrollRafDocument=ownerDocument}completedStepsSummary(){const count=this.normalizedEntries.length,key=getPluralRules(this.effectiveLocale).select(count)==="one"?"activityFeedCompletedStep":"activityFeedCompletedSteps";return this.localize(key,void 0,{count:getNumberFormat(this.effectiveLocale).format(count)})}get listSemanticOwner(){return this.isVirtualized?this.virtualListEl?.scrollContainer??null:this.renderRoot.querySelector('[part="body"][role="list"]')}syncListRelationships(){const target=this.listSemanticOwner;if(!target){this.releaseListRelationships();return}this.externalLabelledByLease?this.externalLabelledByLease.update(target):this.externalLabelledByLease=acquireResolvedAriaRelationship(this,target,"aria-labelledby"),this.externalDescribedByLease?this.externalDescribedByLease.update(target):this.externalDescribedByLease=acquireResolvedAriaRelationship(this,target,"aria-describedby")}scheduleListRelationshipSync(){const list=this.virtualListEl;if(!this.isVirtualized||!list||!this.isConnected){this.relationshipSyncRequest+=1;return}const request=++this.relationshipSyncRequest,ownerDocument=this.ownerDocument,generation=this.ownerRealmGeneration;list.updateComplete.then(()=>{request!==this.relationshipSyncRequest||generation!==this.ownerRealmGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||!this.isVirtualized||this.virtualListEl!==list||this.syncListRelationships()})}releaseListRelationships(){this.externalLabelledByLease?.release(),this.externalLabelledByLease=void 0,this.externalDescribedByLease?.release(),this.externalDescribedByLease=void 0}setFollowFromUser(following){following!==this.follow&&(this.follow=following,this.emit("lr-follow-change",{following}))}normalizedTimestamp(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}entryTemplate(entry,ownRole){const ts=this.normalizedTimestamp(entry.timestamp),formatter=this.formatTimestamp??(date=>defaultFormatTimestamp(date,this.effectiveLocale)),variant=entry.variant??"neutral",dotPart=variantDotPart(variant);return html`
2
2
  <div part="entry" role=${ownRole?"listitem":nothing} data-variant=${variant}>
3
3
  <span part="entry-icon" aria-hidden="true"
4
4
  >${entry.icon?entry.icon:html`<span part=${dotPart} data-variant=${variant}></span>`}</span
@@ -33,9 +33,9 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
33
33
  >
34
34
  ${virtualized?html`<lr-virtual-list
35
35
  exportparts="entry:entry, entry-icon:entry-icon, variant-dot:variant-dot, variant-dot-neutral:variant-dot-neutral, variant-dot-brand:variant-dot-brand, variant-dot-success:variant-dot-success, variant-dot-warning:variant-dot-warning, variant-dot-danger:variant-dot-danger, entry-text:entry-text, entry-timestamp:entry-timestamp"
36
- .items=${entries}
36
+ .items=${guard([this.entries],()=>entries)}
37
37
  .renderItem=${item=>this.entryTemplate(item,!1)}
38
- .keyFunction=${item=>item.id}
38
+ .keyFunction=${this.activityEntryKey}
39
39
  aria-label=${listAriaLabel}
40
40
  @lr-visible-range-change=${this.onVirtualListRangeChanged}
41
41
  @lr-virtual-scroll=${this.stopOwnedEvent}
@@ -1,14 +1,15 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{keyed}from"lit/directives/keyed.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./approval-queue.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_approvalQueueEmpty,LYRA_DEFAULT_approvalQueueLabel,LYRA_DEFAULT_approvalQueueOpen,LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_approvalQueuePendingCount,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied}from"../../../internal/default-strings.generated.js";class LyraApprovalQueue extends LyraElement{constructor(){super(...arguments),this.requests=[],this.selectedInvocationId=null,this.open=!1,this.editable=!0,this.nestedCloseInvocationId=null}static{this.defaultStrings={...super.defaultStrings,approvalQueueEmpty:LYRA_DEFAULT_approvalQueueEmpty,approvalQueueLabel:LYRA_DEFAULT_approvalQueueLabel,approvalQueueOpen:LYRA_DEFAULT_approvalQueueOpen,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,approvalQueuePendingCount:LYRA_DEFAULT_approvalQueuePendingCount,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied}}static{this.ownedCollectionProperties=Object.freeze(["requests"])}static{this.styles=[LyraElement.styles,styles]}normalizedRequestsFor(value){const requests=Array.isArray(value)?value:[];return firstByIdentity(requests,request=>request.id)}get normalizedRequests(){return this.normalizedRequestsFor(this.requests)}get selectedRequest(){return this.normalizedRequests.find(request=>request.id===this.selectedInvocationId)}willUpdate(changed){if(super.willUpdate(changed),!changed.has("requests")&&!changed.has("selectedInvocationId"))return;const selectedInvocationId=this.selectedInvocationId,selected=this.selectedRequest;if(selected&&(selected.status??"pending")==="pending")return;const previousSelected=selectedInvocationId!==null&&changed.has("requests")?this.normalizedRequestsFor(changed.get("requests")).find(request=>request.id===selectedInvocationId):void 0,invalidated=this.hasUpdated&&!changed.has("selectedInvocationId")&&selectedInvocationId!==null&&previousSelected!==void 0&&(previousSelected.status??"pending")==="pending",nestedCloseInSameCycle=this.nestedCloseInvocationId===selectedInvocationId;this.selectedInvocationId=null,this.open=!1,invalidated&&!nestedCloseInSameCycle&&this.emit("lr-approval-close",{invocationId:selectedInvocationId,reason:"request-invalidated"})}updated(changed){super.updated(changed),this.nestedCloseInvocationId=null}pendingCount(){return this.normalizedRequests.filter(request=>(request.status??"pending")==="pending").length}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}statusLabel(status){return status==="approved"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending")}statusVariant(status){return status==="approved"?"success":status==="denied"?"danger":"warning"}select(request){(request.status??"pending")==="pending"&&(this.selectedInvocationId=request.id,this.open=!0,this.emit("lr-approval-select",{invocationId:request.id}))}onApprove(request,event){if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.emit("lr-approval-decision",{invocationId:request.id,approved:!0,args:event.detail.args},{cancelable:!0}).defaultPrevented&&event.preventDefault()}onDeny(request,event){if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.emit("lr-approval-decision",{invocationId:request.id,approved:!1},{cancelable:!0}).defaultPrevented&&event.preventDefault()}onClose(request,event){if(event.stopPropagation(),this.nestedCloseInvocationId=request.id,request.id===this.selectedInvocationId){const wasOpen=this.open;this.open=!1,wasOpen||this.requestUpdate()}else this.requestUpdate();this.emit("lr-approval-close",{invocationId:request.id,reason:event.detail})}renderRequest(request){const status=request.status??"pending";return html`<div role="listitem"><button
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{keyed}from"lit/directives/keyed.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./approval-queue.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_approvalQueueEmpty,LYRA_DEFAULT_approvalQueueLabel,LYRA_DEFAULT_approvalQueueOpen,LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_approvalQueuePendingCount,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied}from"../../../internal/default-strings.generated.js";class LyraApprovalQueue extends LyraElement{constructor(){super(...arguments),this.requests=[],this.selectedInvocationId=null,this.open=!1,this.editable=!0,this.nestedCloseInvocationId=null}static{this.defaultStrings={...super.defaultStrings,approvalQueueEmpty:LYRA_DEFAULT_approvalQueueEmpty,approvalQueueLabel:LYRA_DEFAULT_approvalQueueLabel,approvalQueueOpen:LYRA_DEFAULT_approvalQueueOpen,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,approvalQueuePendingCount:LYRA_DEFAULT_approvalQueuePendingCount,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied}}static{this.ownedCollectionProperties=Object.freeze(["requests"])}static{this.styles=[LyraElement.styles,styles]}normalizedRequestsFor(value){const requests=Array.isArray(value)?value:[];return firstByIdentity(requests,request=>request.id)}get normalizedRequests(){return this.normalizedRequestsFor(this.requests)}get selectedRequest(){return this.normalizedRequests.find(request=>request.id===this.selectedInvocationId)}willUpdate(changed){if(super.willUpdate(changed),!changed.has("requests")&&!changed.has("selectedInvocationId"))return;const selectedInvocationId=this.selectedInvocationId,selected=this.selectedRequest;if(selected&&(selected.status??"pending")==="pending")return;const previousSelected=selectedInvocationId!==null&&changed.has("requests")?this.normalizedRequestsFor(changed.get("requests")).find(request=>request.id===selectedInvocationId):void 0,invalidated=this.hasUpdated&&!changed.has("selectedInvocationId")&&selectedInvocationId!==null&&previousSelected!==void 0&&(previousSelected.status??"pending")==="pending",nestedCloseInSameCycle=this.nestedCloseInvocationId===selectedInvocationId;this.selectedInvocationId=null,this.open=!1,invalidated&&!nestedCloseInSameCycle&&this.emit("lr-approval-close",{invocationId:selectedInvocationId,reason:"request-invalidated"})}updated(changed){super.updated(changed),this.nestedCloseInvocationId=null}pendingCount(){return this.normalizedRequests.filter(request=>(request.status??"pending")==="pending").length}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}statusLabel(status){return status==="approved"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending")}statusVariant(status){return status==="approved"?"success":status==="denied"?"danger":"warning"}select(request){(request.status??"pending")==="pending"&&(this.selectedInvocationId=request.id,this.open=!0,this.emit("lr-approval-select",{invocationId:request.id}))}onApprove(request,event){if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.emit("lr-approval-decision",{invocationId:request.id,approved:!0,args:event.detail.args},{cancelable:!0}).defaultPrevented&&event.preventDefault()}onDeny(request,event){if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.emit("lr-approval-decision",{invocationId:request.id,approved:!1},{cancelable:!0}).defaultPrevented&&event.preventDefault()}onClose(request,event){if(event.stopPropagation(),this.nestedCloseInvocationId=request.id,request.id===this.selectedInvocationId){const wasOpen=this.open;this.open=!1,wasOpen||this.requestUpdate()}else this.requestUpdate();this.emit("lr-approval-close",{invocationId:request.id,reason:event.detail})}renderRequest(request){const status=request.status??"pending",statusId=`approval-queue-status-${request.id}`;return html`<div role="listitem"><button
2
2
  part="request"
3
3
  type="button"
4
4
  data-selected=${request.id===this.selectedInvocationId?"true":"false"}
5
5
  aria-current=${request.id===this.selectedInvocationId?"true":"false"}
6
6
  aria-label=${this.localize("approvalQueueOpen",void 0,{tool:request.toolName})}
7
+ aria-describedby=${statusId}
7
8
  ?disabled=${status!=="pending"}
8
9
  @click=${()=>this.select(request)}
9
10
  >
10
11
  <span part="request-info"><span part="tool-name">${request.toolName}</span><span part="request-id">${request.id}</span></span>
11
- <lr-badge part="status" variant=${this.statusVariant(status)}>${this.statusLabel(status)}</lr-badge>
12
+ <lr-badge id=${statusId} part="status" variant=${this.statusVariant(status)}>${this.statusLabel(status)}</lr-badge>
12
13
  </button></div>`}render(){const label=this.label==null?this.localize("approvalQueueLabel"):this.label,request=this.selectedRequest,requests=this.normalizedRequests,pendingCount=this.pendingCount();return html`<section part="base" aria-label=${overallSemanticLabel(this,label)??nothing}>
13
14
  <div part="heading-row">
14
15
  <h2 part="heading">${label}</h2>
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{box-sizing:border-box;border:var(--lr-size-1px) solid var(--lr-color-border);border-radius:var(--lr-radius);flex-direction:column;block-size:100%;min-inline-size:0;max-inline-size:100%;display:flex;overflow:hidden}[part=header]{box-sizing:border-box;align-items:center;gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-size-1px) solid var(--lr-color-border);flex-wrap:wrap;display:flex}[part=label]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold)}[part=kind]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet);border:var(--lr-size-1px) solid var(--lr-color-border);border-radius:var(--lr-radius-pill);padding:0 var(--lr-space-xs)}[part=view-toggle]{gap:var(--lr-size-1px);display:flex}[part=view-button]{box-sizing:border-box;min-block-size:var(--lr-size-1-5rem);font:inherit;font-size:var(--lr-font-size-xs);background:var(--lr-color-surface);border:var(--lr-size-1px) solid var(--lr-color-border);padding:var(--lr-space-2xs) var(--lr-space-s);cursor:pointer}[part=view-button][aria-pressed=true]{background:var(--lr-artifact-panel-view-active-bg,var(--lr-color-brand-quiet));color:var(--lr-artifact-panel-view-active-color,var(--lr-color-brand))}[part=restore-button],[part=copy-button],[part=download-button]{box-sizing:border-box;min-block-size:var(--lr-size-1-5rem);font:inherit;font-size:var(--lr-font-size-xs);background:var(--lr-color-surface);border:var(--lr-size-1px) solid var(--lr-color-border);border-radius:var(--lr-radius);padding:var(--lr-space-2xs) var(--lr-space-s);cursor:pointer}[part=restore-button]:hover,[part=copy-button]:hover,[part=download-button]:hover,[part=view-button]:hover:not([aria-pressed=true]){background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=restore-button]:active,[part=copy-button]:active,[part=download-button]:active,[part=view-button]:active:not([aria-pressed=true]){background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=restore-button]:focus-visible,[part=copy-button]:focus-visible,[part=download-button]:focus-visible,[part=view-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=version-nav]{align-items:center;gap:var(--lr-space-xs);font-size:var(--lr-font-size-xs);margin-inline-start:auto;display:flex}[part=version-label]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet)}[part=version-previous],[part=version-next]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:var(--lr-color-text);font-size:var(--lr-font-size-m);cursor:pointer;border-radius:var(--lr-radius);background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}[part=version-previous]:hover:not(:disabled),[part=version-next]:hover:not(:disabled){background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=version-previous]:active:not(:disabled),[part=version-next]:active:not(:disabled){background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=version-previous]:focus-visible,[part=version-next]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=version-previous]:disabled,[part=version-next]:disabled{cursor:not-allowed;opacity:var(--lr-opacity-disabled)}:host(:dir(rtl)) [part=version-previous-glyph],:host(:dir(rtl)) [part=version-next-glyph]{transform:scaleX(-1)}[part=body]{padding:var(--lr-space-m);flex:auto;overflow:auto}[part=body][aria-busy=true]{position:relative}[part=streaming-indicator]{font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet)}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);flex-direction:column;block-size:100%;min-inline-size:0;max-inline-size:100%;display:flex;overflow:hidden}[part=header]{box-sizing:border-box;align-items:center;gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;padding:var(--lr-space-xs) var(--lr-space-s);border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border);flex-wrap:wrap;display:flex}[part=label]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold)}[part=kind]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-pill);padding:0 var(--lr-space-xs)}[part=view-toggle]{gap:var(--lr-border-width-thin);display:flex}[part=view-button]{box-sizing:border-box;min-block-size:var(--lr-size-1-5rem);font:inherit;font-size:var(--lr-font-size-xs);background:var(--lr-color-surface);border:var(--lr-border-width-thin) solid var(--lr-color-border);padding:var(--lr-space-2xs) var(--lr-space-s);cursor:pointer}[part=view-button][aria-pressed=true]{background:var(--lr-artifact-panel-view-active-bg,var(--lr-color-brand-quiet));color:var(--lr-artifact-panel-view-active-color,var(--lr-color-brand))}[part=restore-button],[part=copy-button],[part=download-button]{box-sizing:border-box;min-block-size:var(--lr-size-1-5rem);font:inherit;font-size:var(--lr-font-size-xs);background:var(--lr-color-surface);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);padding:var(--lr-space-2xs) var(--lr-space-s);cursor:pointer}[part=restore-button]:hover,[part=copy-button]:hover,[part=download-button]:hover,[part=view-button]:hover:not([aria-pressed=true]){background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=restore-button]:active,[part=copy-button]:active,[part=download-button]:active,[part=view-button]:active:not([aria-pressed=true]){background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=restore-button]:focus-visible,[part=copy-button]:focus-visible,[part=download-button]:focus-visible,[part=view-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=version-nav]{align-items:center;gap:var(--lr-space-xs);font-size:var(--lr-font-size-xs);margin-inline-start:auto;display:flex}[part=version-label]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet)}[part=version-previous],[part=version-next]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);color:var(--lr-color-text);font-size:var(--lr-font-size-m);cursor:pointer;border-radius:var(--lr-radius);background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}[part=version-previous]:hover:not(:disabled),[part=version-next]:hover:not(:disabled){background:var(--lr-color-brand-quiet);color:var(--lr-color-brand)}[part=version-previous]:active:not(:disabled),[part=version-next]:active:not(:disabled){background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=version-previous]:focus-visible,[part=version-next]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=version-previous]:disabled,[part=version-next]:disabled{cursor:not-allowed;opacity:var(--lr-opacity-disabled)}:host(:dir(rtl)) [part=version-previous-glyph],:host(:dir(rtl)) [part=version-next-glyph]{transform:scaleX(-1)}[part=body]{padding:var(--lr-space-m);flex:auto;overflow:auto}[part=body][aria-busy=true]{position:relative}[part=streaming-indicator]{font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet)}`;export{styles};
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{box-sizing:border-box;border:var(--lr-size-1px) solid var(--lr-color-border);border-radius:var(--lr-radius);min-inline-size:0;max-inline-size:100%;padding:var(--lr-space-m)}:host([compact]) [part=base]{padding:var(--lr-commit-card-compact-padding,var(--lr-space-s))}:host([frame=plain]) [part=base]{border:0;border-radius:0;padding:0}[part=subject]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold)}[part=body]{overflow-wrap:anywhere;white-space:pre-wrap;min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs)}[part=meta]{gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet);flex-wrap:wrap;align-items:center;margin-block-start:var(--lr-space-xs);display:flex}[part=hash]{font-family:var(--lr-font-mono)}[part=author]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}[part=additions]{color:var(--lr-color-success)}[part=deletions]{color:var(--lr-color-danger)}[part=files-toggle]{font:inherit;font-size:var(--lr-font-size-xs);color:var(--lr-color-brand);cursor:pointer;padding:var(--lr-space-xs) 0;background:0 0;border:none}[part=files-toggle]:hover{background:var(--lr-color-brand-quiet)}[part=files-toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=files-toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=file]{box-sizing:border-box;justify-content:space-between;align-items:flex-start;gap:var(--lr-space-s);inline-size:100%;min-inline-size:0;max-inline-size:100%;font:inherit;font-family:var(--lr-font-mono);text-align:start;cursor:pointer;padding:var(--lr-space-2xs) 0;background:0 0;border:none;display:flex}[part=file-path]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}.file-stats{white-space:nowrap;flex:none}[part=file]:hover{background:var(--lr-color-brand-quiet)}[part=file]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=file]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=copy-button]{font:inherit;font-size:var(--lr-font-size-xs);border:var(--lr-size-1px) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);padding:var(--lr-space-2xs) var(--lr-space-xs);cursor:pointer;background:0 0}[part=copy-button]:hover{background:var(--lr-color-brand-quiet)}[part=copy-button]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=copy-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{min-inline-size:0;max-inline-size:100%;display:block}[part=base]{box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);min-inline-size:0;max-inline-size:100%;padding:var(--lr-space-m)}:host([compact]) [part=base]{padding:var(--lr-commit-card-compact-padding,var(--lr-space-s))}:host([frame=plain]) [part=base]{border:0;border-radius:0;padding:0}[part=subject]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold)}[part=body]{overflow-wrap:anywhere;white-space:pre-wrap;min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);margin-block-start:var(--lr-space-xs)}[part=meta]{gap:var(--lr-space-s);min-inline-size:0;max-inline-size:100%;font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet);flex-wrap:wrap;align-items:center;margin-block-start:var(--lr-space-xs);display:flex}[part=hash]{font-family:var(--lr-font-mono)}[part=author]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}[part=additions]{color:var(--lr-color-success)}[part=deletions]{color:var(--lr-color-danger)}[part=files-toggle]{font:inherit;font-size:var(--lr-font-size-xs);color:var(--lr-color-brand);cursor:pointer;padding:var(--lr-space-xs) 0;background:0 0;border:none}[part=files-toggle]:hover{background:var(--lr-color-brand-quiet)}[part=files-toggle]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=files-toggle]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=file]{box-sizing:border-box;justify-content:space-between;align-items:flex-start;gap:var(--lr-space-s);inline-size:100%;min-inline-size:0;max-inline-size:100%;font:inherit;font-family:var(--lr-font-mono);text-align:start;cursor:pointer;padding:var(--lr-space-2xs) 0;background:0 0;border:none;display:flex}[part=file-path]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%}.file-stats{white-space:nowrap;flex:none}[part=file]:hover{background:var(--lr-color-brand-quiet)}[part=file]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=file]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=copy-button]{font:inherit;font-size:var(--lr-font-size-xs);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-xs);padding:var(--lr-space-2xs) var(--lr-space-xs);cursor:pointer;background:0 0}[part=copy-button]:hover{background:var(--lr-color-brand-quiet)}[part=copy-button]:active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=copy-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}`;export{styles};
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);--_lr-compare-panel-max-height:var(--lr-size-24rem);min-inline-size:0;max-inline-size:100%;display:block;container-type:inline-size}[part=base]{gap:var(--lr-space-m);min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text);flex-direction:column;display:flex}[part=prompt]{padding:var(--lr-space-s) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface-raised)}[part=prompt][hidden]{display:none}[part=panes]{gap:var(--lr-space-m);align-items:stretch;min-inline-size:0;max-inline-size:100%;display:flex}[part=pane-a],[part=pane-b]{gap:var(--lr-space-xs);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);min-inline-size:0;padding:var(--lr-space-m);max-block-size:var(--lr-compare-panel-max-height,var(--_lr-compare-panel-max-height));flex-direction:column;flex:1 1 0;display:flex;overflow:hidden auto}[part=pane-a]:focus-visible,[part=pane-b]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-width))}[part=pane-header]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet);text-transform:uppercase;letter-spacing:var(--lr-size-0-02em)}[part=vote-bar]{gap:var(--lr-space-s);flex-wrap:wrap;min-inline-size:0;max-inline-size:100%;display:flex}[part=vote-button]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font:inherit;font-size:var(--lr-font-size-sm);border-radius:var(--lr-radius-pill);padding:var(--lr-space-xs) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);color:var(--lr-color-text);cursor:pointer;transition:background-color var(--lr-transition-fast), border-color var(--lr-transition-fast)}[part=vote-button]:where(:not(:disabled)):hover{background:var(--lr-color-brand-quiet)}[part=vote-button]:where(:not(:disabled)):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=vote-button][data-selected]{background:var(--lr-compare-panel-selected-background,var(--lr-color-brand-quiet));border-color:var(--lr-compare-panel-selected-border-color,var(--lr-color-brand));color:var(--lr-compare-panel-selected-color,var(--lr-color-brand));font-weight:var(--lr-compare-panel-selected-font-weight,var(--lr-font-weight-semibold))}[part=vote-button][data-selected]:where(:not(:disabled)):active{background:color-mix(in oklab, var(--lr-compare-panel-selected-background,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=vote-button]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=vote-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}@container (inline-size<=639.98px){[part=panes]{flex-direction:column}[part=pane-a],[part=pane-b]{flex-basis:auto}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);--_lr-compare-panel-max-height:var(--lr-size-24rem);min-inline-size:0;max-inline-size:100%;display:block;container-type:inline-size}[part=base]{gap:var(--lr-space-m);min-inline-size:0;max-inline-size:100%;color:var(--lr-color-text);flex-direction:column;display:flex}[part=prompt]{padding:var(--lr-space-s) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface-raised)}[part=prompt][hidden]{display:none}[part=panes]{gap:var(--lr-space-m);align-items:stretch;min-inline-size:0;max-inline-size:100%;display:flex}[part=pane-a],[part=pane-b]{gap:var(--lr-space-xs);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);min-inline-size:0;padding:var(--lr-space-m);max-block-size:var(--lr-compare-panel-max-height,var(--_lr-compare-panel-max-height));flex-direction:column;flex:1 1 0;display:flex;overflow:hidden auto}[part=pane-a]:focus-visible,[part=pane-b]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-width))}[part=pane-header]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font-weight:var(--lr-font-weight-semibold);font-size:var(--lr-font-size-xs);color:var(--lr-color-text-quiet);text-transform:uppercase;letter-spacing:var(--lr-size-0-02em)}[part=vote-bar]{gap:var(--lr-space-s);flex-wrap:wrap;min-inline-size:0;max-inline-size:100%;display:flex}[part=vote-button]{overflow-wrap:anywhere;min-inline-size:0;max-inline-size:100%;font:inherit;font-size:var(--lr-font-size-sm);border-radius:var(--lr-radius-pill);padding:var(--lr-space-xs) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);color:var(--lr-color-text);cursor:pointer;transition:background-color var(--lr-transition-fast), border-color var(--lr-transition-fast)}[part=vote-button]:where(:not(:disabled)):hover{background:var(--lr-color-brand-quiet)}[part=vote-button]:where(:not(:disabled)):active{background:color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=vote-button][data-selected]{background:var(--lr-compare-panel-selected-background,var(--lr-color-brand-quiet));border-color:var(--lr-compare-panel-selected-border-color,var(--lr-color-brand));color:var(--lr-compare-panel-selected-color,var(--lr-color-brand));font-weight:var(--lr-compare-panel-selected-font-weight,var(--lr-font-weight-semibold))}[part=vote-button][data-selected]:where(:not(:disabled)):active{background:color-mix(in oklab, var(--lr-compare-panel-selected-background,var(--lr-color-brand-quiet)), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=vote-button]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=vote-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}@media (prefers-reduced-motion:reduce){[part=vote-button]{transition:none!important}}@container (inline-size<=639.98px){[part=panes]{flex-direction:column}[part=pane-a],[part=pane-b]{flex-basis:auto}}`;export{styles};
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hasRealContent,nextId}from"../../../internal/a11y.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hasRealContent,hostAriaLabel,nextId}from"../../../internal/a11y.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading}from"../../../internal/default-strings.generated.js";const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
2
2
  <svg width="1em" height="1em" viewBox=${ICON_VIEW_BOX} fill="none" stroke="currentColor" stroke-width=${ICON_STROKE_WIDTH} stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
3
3
  <circle cx="12" cy="12" r="9"></circle>
4
4
  <polyline points="8 12.5 11 15.5 16 9.5"></polyline>
@@ -9,8 +9,13 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
9
9
  <line x1="9" y1="9" x2="15" y2="15"></line>
10
10
  <line x1="15" y1="9" x2="9" y2="15"></line>
11
11
  </svg>
12
- `}class LyraConfirmBar extends LyraElement{constructor(){super(...arguments),this.toolName="",this.heading="",this.args=void 0,this.decision=null,this.pending=null,this.variant="neutral",this.compact=!1,this.frame="card",this.hasBodySlot=!1,this.headingId=nextId("confirm-bar-heading"),this.onBodySlotChange=e=>{this.hasBodySlot=hasRealContent(e.target.assignedNodes({flatten:!0}))}}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmApprovedAnnounce:LYRA_DEFAULT_confirmApprovedAnnounce,confirmDenied:LYRA_DEFAULT_confirmDenied,confirmDeniedAnnounce:LYRA_DEFAULT_confirmDeniedAnnounce,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,toolApprovalArgsLabel:LYRA_DEFAULT_toolApprovalArgsLabel,toolApprovalGenericTool:LYRA_DEFAULT_toolApprovalGenericTool,toolApprovalHeading:LYRA_DEFAULT_toolApprovalHeading}}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const defaultSlotNodes=Array.from(this.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||!node.getAttribute("slot"));this.hasBodySlot=hasRealContent(defaultSlotNodes)}changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null&&this.pending!=null&&(this.statusEl?.focus(),this.pending=null)}decide(next){if(this.decision!=null||this.pending!=null)return;const eventName=next==="approved"?"lr-approve":"lr-deny",detail=next==="approved"?{args:this.args}:void 0;if(this.emit(eventName,detail,{cancelable:!0}).defaultPrevented){this.statusEl?.focus(),this.pending=approvalAction(next);return}this.statusEl?.focus(),this.decision=next}updated(changed){if(super.updated(changed),changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null){const key=this.decision==="approved"?"confirmApprovedAnnounce":"confirmDeniedAnnounce";this.liveRegion?.announce(this.localize(key),{force:!0})}}renderHeading(){if(this.heading)return html`${this.heading}`;const toolName=this.toolName||this.localize("toolApprovalGenericTool"),template=this.localize("toolApprovalHeading"),pieces=resolveLocalizedParts(template,marker=>this.localize("toolApprovalHeading",void 0,{tool:marker}));return html`${pieces.map((piece,index)=>index<pieces.length-1?html`${piece}<span part="tool-name">${toolName}</span>`:piece)}`}statusText(){return this.decision==="approved"?this.localize("confirmApproved"):this.localize("confirmDenied")}stopNestedLifecycle(event){event.stopPropagation()}render(){const decided=this.decision!=null;return html`
13
- <div part="base" role="group" aria-labelledby=${this.headingId}>
12
+ `}class LyraConfirmBar extends LyraElement{constructor(){super(...arguments),this.toolName="",this.heading="",this.args=void 0,this.decision=null,this.pending=null,this.variant="neutral",this.compact=!1,this.frame="card",this.hasBodySlot=!1,this.headingId=nextId("confirm-bar-heading"),this.onBodySlotChange=e=>{this.hasBodySlot=hasRealContent(e.target.assignedNodes({flatten:!0}))}}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmApprovedAnnounce:LYRA_DEFAULT_confirmApprovedAnnounce,confirmDenied:LYRA_DEFAULT_confirmDenied,confirmDeniedAnnounce:LYRA_DEFAULT_confirmDeniedAnnounce,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,toolApprovalArgsLabel:LYRA_DEFAULT_toolApprovalArgsLabel,toolApprovalGenericTool:LYRA_DEFAULT_toolApprovalGenericTool,toolApprovalHeading:LYRA_DEFAULT_toolApprovalHeading}}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated){const defaultSlotNodes=Array.from(this.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||!node.getAttribute("slot"));this.hasBodySlot=hasRealContent(defaultSlotNodes)}changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null&&this.pending!=null&&(this.statusEl?.focus(),this.pending=null)}decide(next){if(this.decision!=null||this.pending!=null)return;const eventName=next==="approved"?"lr-approve":"lr-deny",detail=next==="approved"?{args:this.args}:void 0;if(this.emit(eventName,detail,{cancelable:!0}).defaultPrevented){this.statusEl?.focus(),this.pending=approvalAction(next);return}this.statusEl?.focus(),this.decision=next}updated(changed){if(super.updated(changed),changed.has("decision")&&changed.get("decision")!==void 0&&this.decision!=null){const key=this.decision==="approved"?"confirmApprovedAnnounce":"confirmDeniedAnnounce";this.liveRegion?.announce(this.localize(key),{force:!0})}}renderHeading(){if(this.heading)return html`${this.heading}`;const toolName=this.toolName||this.localize("toolApprovalGenericTool"),template=this.localize("toolApprovalHeading"),pieces=resolveLocalizedParts(template,marker=>this.localize("toolApprovalHeading",void 0,{tool:marker}));return html`${pieces.map((piece,index)=>index<pieces.length-1?html`${piece}<span part="tool-name">${toolName}</span>`:piece)}`}statusText(){return this.decision==="approved"?this.localize("confirmApproved"):this.localize("confirmDenied")}stopNestedLifecycle(event){event.stopPropagation()}render(){const decided=this.decision!=null,hostLabel=hostAriaLabel(this);return html`
13
+ <div
14
+ part="base"
15
+ role="group"
16
+ aria-label=${hostLabel??nothing}
17
+ aria-labelledby=${hostLabel===null?this.headingId:nothing}
18
+ >
14
19
  <div part="heading" id=${this.headingId}>${this.renderHeading()}</div>
15
20
  <div part="body" ?hidden=${!this.hasBodySlot}><slot @slotchange=${this.onBodySlotChange}></slot></div>
16
21
  ${this.args!==void 0?html`<lr-details part="args" summary=${this.localize("toolApprovalArgsLabel")}
@@ -74,6 +74,8 @@ export interface EvalExample{id:string;input:string;expectedOutput?:string;tags?
74
74
  * @csspart export - The internal `<lr-export-button>`.
75
75
  * @csspart search - The search field's wrapper. Only rendered while `searchable`.
76
76
  * @csspart search-input - The `<input type="search">`. Only rendered while `searchable`.
77
+ * @csspart search-clear - The clear-search button, replacing the native search-cancel glyph the
78
+ * component resets. Only rendered while the field has text.
77
79
  * @csspart tag-filter - The tag-filter chip group's wrapper. Only rendered while `examples`
78
80
  * carries at least one tag.
79
81
  * @csspart grid - The internal `<lr-table>`.
@@ -127,4 +129,4 @@ disabled:boolean;
127
129
  label:string;private searchText;private activeTags;private selectedId;private get normalizedExamples();protected willUpdate(changed:PropertyValues):void;private clearSelection;private allTags;
128
130
  /** `examples` narrowed by the active tag filter (OR across `activeTags`) and the search text
129
131
  * (AND with the tag filter -- both narrow the same list further). */
130
- private get visibleExamples();private buildColumns;private onAddClick;private onRemoveClick;private onGridRowClick;private onFiles;private onExportButtonExport;private onTagChipSelect;private onSearchInput;private onSearchFocus;private onSearchBlur;private stopOwnedEvent;private renderToolbar;private renderSearch;private renderTagFilter;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-eval-dataset':LyraEvalDataset;}}
132
+ private get visibleExamples();private buildColumns;private onAddClick;private onRemoveClick;private onGridRowClick;private onFiles;private onExportButtonExport;private onTagChipSelect;private onSearchInput;private onClearSearch;private onSearchFocus;private onSearchBlur;private stopOwnedEvent;private renderToolbar;private renderSearch;private renderTagFilter;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-eval-dataset':LyraEvalDataset;}}
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getCollator}from"../../../internal/intl-cache.js";import{trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{styles}from"./eval-dataset.styles.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_evalDatasetAddExample,LYRA_DEFAULT_evalDatasetColumnExpectedOutput,LYRA_DEFAULT_evalDatasetColumnInput,LYRA_DEFAULT_evalDatasetColumnTags,LYRA_DEFAULT_evalDatasetEmpty,LYRA_DEFAULT_evalDatasetImportLabel,LYRA_DEFAULT_evalDatasetLabel,LYRA_DEFAULT_evalDatasetNoMatches,LYRA_DEFAULT_evalDatasetRemoveExample,LYRA_DEFAULT_evalDatasetSearchLabel,LYRA_DEFAULT_evalDatasetTagFilterLabel}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_EXAMPLES=100;class LyraEvalDataset extends LyraElement{constructor(){super(...arguments),this.examples=[],this.searchable=!1,this.autocomplete="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.inputMode="",this.enterKeyHint="",this.accept="",this.exportFormats=["csv","json"],this.disabled=!1,this.label="",this.searchText="",this.activeTags=new Set,this.selectedId=null,this.onAddClick=()=>{this.disabled||this.emit("lr-example-add-request")},this.onRemoveClick=()=>{this.disabled||this.selectedId===null||this.emit("lr-example-remove-request",{exampleId:this.selectedId})},this.onGridRowClick=e=>{if(e.stopPropagation(),this.disabled)return;const id=e.detail.row.id;this.selectedId=id,this.emit("lr-example-select",{exampleId:id})},this.onFiles=e=>{e.stopPropagation(),!(this.disabled||e.detail.files.length===0)&&this.emit("lr-import-request",{files:[...e.detail.files]})},this.onExportButtonExport=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.emit("lr-export-request",{format:e.detail.format})},this.onSearchInput=e=>{e.stopPropagation(),!this.disabled&&(this.searchText=e.target.value)},this.onSearchFocus=event=>{event.stopPropagation(),this.emit("focus")},this.onSearchBlur=event=>{event.stopPropagation(),this.emit("blur")}}static{this.defaultStrings={...super.defaultStrings,evalDatasetAddExample:LYRA_DEFAULT_evalDatasetAddExample,evalDatasetColumnExpectedOutput:LYRA_DEFAULT_evalDatasetColumnExpectedOutput,evalDatasetColumnInput:LYRA_DEFAULT_evalDatasetColumnInput,evalDatasetColumnTags:LYRA_DEFAULT_evalDatasetColumnTags,evalDatasetEmpty:LYRA_DEFAULT_evalDatasetEmpty,evalDatasetImportLabel:LYRA_DEFAULT_evalDatasetImportLabel,evalDatasetLabel:LYRA_DEFAULT_evalDatasetLabel,evalDatasetNoMatches:LYRA_DEFAULT_evalDatasetNoMatches,evalDatasetRemoveExample:LYRA_DEFAULT_evalDatasetRemoveExample,evalDatasetSearchLabel:LYRA_DEFAULT_evalDatasetSearchLabel,evalDatasetTagFilterLabel:LYRA_DEFAULT_evalDatasetTagFilterLabel}}static{this.ownedCollectionProperties=Object.freeze(["examples","exportFormats"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-import-request"])}get normalizedExamples(){return firstByIdentity(Array.isArray(this.examples)?this.examples:[],example=>example.id)}willUpdate(changed){if(super.willUpdate(changed),changed.has("searchable")&&!this.searchable&&(this.searchText=""),changed.has("examples")){this.selectedId!==null&&!this.normalizedExamples.some(example=>example.id===this.selectedId)&&this.clearSelection();const available=this.allTags();[...this.activeTags].some(tag=>!available.includes(tag))&&(this.activeTags=new Set([...this.activeTags].filter(tag=>available.includes(tag))))}(changed.has("examples")||changed.has("searchText")||changed.has("activeTags")||changed.has("searchable"))&&this.selectedId!==null&&!this.visibleExamples.some(example=>example.id===this.selectedId)&&this.clearSelection()}clearSelection(){this.selectedId=null,this.emit("lr-example-select",{exampleId:null})}allTags(){const tags=new Set;for(const example of this.normalizedExamples)for(const tag of example.tags??[])tags.add(tag);return[...tags].sort(getCollator(this.effectiveLocale).compare)}get visibleExamples(){const query=this.searchText.trim().toLocaleLowerCase(this.effectiveLocale);return this.normalizedExamples.filter(example=>this.activeTags.size>0&&!(example.tags??[]).some(tag=>this.activeTags.has(tag))?!1:query===""?!0:[example.input,example.expectedOutput??"",...example.tags??[]].join(" ").toLocaleLowerCase(this.effectiveLocale).includes(query))}buildColumns(){return[{key:"input",label:this.localize("evalDatasetColumnInput"),sortable:!0,sortValue:row=>row.input,cell:row=>row.input},{key:"expectedOutput",label:this.localize("evalDatasetColumnExpectedOutput"),sortable:!0,sortValue:row=>row.expectedOutput??"",cell:row=>row.expectedOutput??""},{key:"tags",label:this.localize("evalDatasetColumnTags"),sortable:!0,sortValue:row=>(row.tags??[]).join(", "),cell:row=>(row.tags??[]).join(", ")}]}onTagChipSelect(tag,e){if(e.stopPropagation(),this.disabled)return;const next=new Set(this.activeTags);e.detail.selected?next.add(tag):next.delete(tag),this.activeTags=next}stopOwnedEvent(event){event.stopPropagation()}renderToolbar(){return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getCollator}from"../../../internal/intl-cache.js";import{trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{styles}from"./eval-dataset.styles.js";import{firstByIdentity}from"../collection-identity.js";import{closeIcon}from"../../../internal/icons.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_evalDatasetAddExample,LYRA_DEFAULT_evalDatasetColumnExpectedOutput,LYRA_DEFAULT_evalDatasetColumnInput,LYRA_DEFAULT_evalDatasetColumnTags,LYRA_DEFAULT_evalDatasetEmpty,LYRA_DEFAULT_evalDatasetImportLabel,LYRA_DEFAULT_evalDatasetLabel,LYRA_DEFAULT_evalDatasetNoMatches,LYRA_DEFAULT_evalDatasetRemoveExample,LYRA_DEFAULT_evalDatasetSearchLabel,LYRA_DEFAULT_evalDatasetTagFilterLabel}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_EXAMPLES=100;class LyraEvalDataset extends LyraElement{constructor(){super(...arguments),this.examples=[],this.searchable=!1,this.autocomplete="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.inputMode="",this.enterKeyHint="",this.accept="",this.exportFormats=["csv","json"],this.disabled=!1,this.label="",this.searchText="",this.activeTags=new Set,this.selectedId=null,this.onAddClick=()=>{this.disabled||this.emit("lr-example-add-request")},this.onRemoveClick=()=>{this.disabled||this.selectedId===null||this.emit("lr-example-remove-request",{exampleId:this.selectedId})},this.onGridRowClick=e=>{if(e.stopPropagation(),this.disabled)return;const id=e.detail.row.id;this.selectedId=id,this.emit("lr-example-select",{exampleId:id})},this.onFiles=e=>{e.stopPropagation(),!(this.disabled||e.detail.files.length===0)&&this.emit("lr-import-request",{files:[...e.detail.files]})},this.onExportButtonExport=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.emit("lr-export-request",{format:e.detail.format})},this.onSearchInput=e=>{e.stopPropagation(),!this.disabled&&(this.searchText=e.target.value)},this.onClearSearch=()=>{this.disabled||(this.searchText="",this.renderRoot.querySelector('[part="search-input"]')?.focus())},this.onSearchFocus=event=>{event.stopPropagation(),this.emit("focus")},this.onSearchBlur=event=>{event.stopPropagation(),this.emit("blur")}}static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,evalDatasetAddExample:LYRA_DEFAULT_evalDatasetAddExample,evalDatasetColumnExpectedOutput:LYRA_DEFAULT_evalDatasetColumnExpectedOutput,evalDatasetColumnInput:LYRA_DEFAULT_evalDatasetColumnInput,evalDatasetColumnTags:LYRA_DEFAULT_evalDatasetColumnTags,evalDatasetEmpty:LYRA_DEFAULT_evalDatasetEmpty,evalDatasetImportLabel:LYRA_DEFAULT_evalDatasetImportLabel,evalDatasetLabel:LYRA_DEFAULT_evalDatasetLabel,evalDatasetNoMatches:LYRA_DEFAULT_evalDatasetNoMatches,evalDatasetRemoveExample:LYRA_DEFAULT_evalDatasetRemoveExample,evalDatasetSearchLabel:LYRA_DEFAULT_evalDatasetSearchLabel,evalDatasetTagFilterLabel:LYRA_DEFAULT_evalDatasetTagFilterLabel}}static{this.ownedCollectionProperties=Object.freeze(["examples","exportFormats"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-import-request"])}get normalizedExamples(){return firstByIdentity(Array.isArray(this.examples)?this.examples:[],example=>example.id)}willUpdate(changed){if(super.willUpdate(changed),changed.has("searchable")&&!this.searchable&&(this.searchText=""),changed.has("examples")){this.selectedId!==null&&!this.normalizedExamples.some(example=>example.id===this.selectedId)&&this.clearSelection();const available=this.allTags();[...this.activeTags].some(tag=>!available.includes(tag))&&(this.activeTags=new Set([...this.activeTags].filter(tag=>available.includes(tag))))}(changed.has("examples")||changed.has("searchText")||changed.has("activeTags")||changed.has("searchable"))&&this.selectedId!==null&&!this.visibleExamples.some(example=>example.id===this.selectedId)&&this.clearSelection()}clearSelection(){this.selectedId=null,this.emit("lr-example-select",{exampleId:null})}allTags(){const tags=new Set;for(const example of this.normalizedExamples)for(const tag of example.tags??[])tags.add(tag);return[...tags].sort(getCollator(this.effectiveLocale).compare)}get visibleExamples(){const query=this.searchText.trim().toLocaleLowerCase(this.effectiveLocale);return this.normalizedExamples.filter(example=>this.activeTags.size>0&&!(example.tags??[]).some(tag=>this.activeTags.has(tag))?!1:query===""?!0:[example.input,example.expectedOutput??"",...example.tags??[]].join(" ").toLocaleLowerCase(this.effectiveLocale).includes(query))}buildColumns(){return[{key:"input",label:this.localize("evalDatasetColumnInput"),sortable:!0,sortValue:row=>row.input,cell:row=>row.input},{key:"expectedOutput",label:this.localize("evalDatasetColumnExpectedOutput"),sortable:!0,sortValue:row=>row.expectedOutput??"",cell:row=>row.expectedOutput??""},{key:"tags",label:this.localize("evalDatasetColumnTags"),sortable:!0,sortValue:row=>(row.tags??[]).join(", "),cell:row=>(row.tags??[]).join(", ")}]}onTagChipSelect(tag,e){if(e.stopPropagation(),this.disabled)return;const next=new Set(this.activeTags);e.detail.selected?next.add(tag):next.delete(tag),this.activeTags=next}stopOwnedEvent(event){event.stopPropagation()}renderToolbar(){return html`
2
2
  <div part="toolbar">
3
3
  <button part="add-button" type="button" ?disabled=${this.disabled} @click=${this.onAddClick}>
4
4
  ${this.localize("evalDatasetAddExample")}
@@ -53,6 +53,15 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
53
53
  @focus=${this.onSearchFocus}
54
54
  @blur=${this.onSearchBlur}
55
55
  />
56
+ ${this.searchText?html`<button
57
+ part="search-clear"
58
+ type="button"
59
+ ?disabled=${this.disabled}
60
+ aria-label=${this.localize("clear")}
61
+ @click=${this.onClearSearch}
62
+ >
63
+ <span aria-hidden="true" inert>${closeIcon()}</span>
64
+ </button>`:nothing}
56
65
  </div>
57
66
  `}renderTagFilter(tags){return html`
58
67
  <div part="tag-filter" role="group" aria-label=${this.localize("evalDatasetTagFilterLabel")}>
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{min-inline-size:0;display:block}[part=base]{gap:var(--lr-space-s);flex-direction:column;min-inline-size:0;display:flex}[part=toolbar]{align-items:center;gap:var(--lr-space-xs);flex-wrap:wrap;display:flex}[part=add-button],[part=remove-button]{padding:var(--lr-space-xs) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;cursor:pointer;align-items:center;display:inline-flex}:where([part=add-button]):hover:where(:not(:disabled)),:where([part=remove-button]):hover:where(:not(:disabled)){border-color:var(--lr-color-brand)}:where([part=add-button]):active:where(:not(:disabled)),:where([part=remove-button]):active:where(:not(:disabled)){background:color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=add-button]:disabled,[part=remove-button]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=add-button]:focus-visible,[part=remove-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=import]{min-inline-size:0;max-inline-size:var(--lr-size-14rem);flex:0 auto}[part=search]{display:block}[part=search-input]{box-sizing:border-box;-webkit-appearance:none;appearance:none;inline-size:100%;padding-inline:var(--lr-space-s);padding-block:var(--lr-space-xs);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit}[part=search-input]::placeholder{color:var(--lr-color-text-quiet);opacity:1}[part=search-input]::-webkit-search-cancel-button,[part=search-input]::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}[part=search-input]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=search-input]):hover:where(:not(:disabled)){border-color:var(--lr-color-brand)}[part=search-input]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=tag-filter]{display:block}[part=grid]{min-inline-size:0;display:block}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{min-inline-size:0;display:block}[part=base]{gap:var(--lr-space-s);flex-direction:column;min-inline-size:0;display:flex}[part=toolbar]{align-items:center;gap:var(--lr-space-xs);flex-wrap:wrap;display:flex}[part=add-button],[part=remove-button]{padding:var(--lr-space-xs) var(--lr-space-m);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;cursor:pointer;align-items:center;display:inline-flex}:where([part=add-button]):hover:where(:not(:disabled)),:where([part=remove-button]):hover:where(:not(:disabled)){border-color:var(--lr-color-brand)}:where([part=add-button]):active:where(:not(:disabled)),:where([part=remove-button]):active:where(:not(:disabled)){background:color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=add-button]:disabled,[part=remove-button]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=add-button]:focus-visible,[part=remove-button]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=import]{min-inline-size:0;max-inline-size:var(--lr-size-14rem);flex:0 auto}[part=search]{display:block;position:relative}[part=search-input]{box-sizing:border-box;-webkit-appearance:none;appearance:none;inline-size:100%;padding-inline-start:var(--lr-space-s);padding-inline-end:var(--lr-icon-button-size);padding-block:var(--lr-space-xs);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit}[part=search-clear]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size);cursor:pointer;color:var(--lr-color-text-quiet);padding:var(--lr-space-xs);background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex;position:absolute;inset-block:0;inset-inline-end:0}[part=search-clear]:not(:disabled):hover{color:var(--lr-color-text)}[part=search-clear]:not(:disabled):active{color:var(--lr-color-text);background:color-mix(in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=search-clear]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-width))}[part=search-clear]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=search-input]::placeholder{color:var(--lr-color-text-quiet);opacity:1}[part=search-input]::-webkit-search-cancel-button,[part=search-input]::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}[part=search-input]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}:where([part=search-input]):hover:where(:not(:disabled)){border-color:var(--lr-color-brand)}[part=search-input]:disabled{opacity:var(--lr-opacity-disabled);cursor:not-allowed}[part=tag-filter]{display:block}[part=grid]{min-inline-size:0;display:block}`;export{styles};
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteRatio,finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{styles}from"./span-waterfall.styles.js";import{MAX_RENDERED_LYRA_SPANS,normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool,LYRA_DEFAULT_spanProjectionLimit,LYRA_DEFAULT_spanStartedAtOffset,LYRA_DEFAULT_spanWaterfall,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings.generated.js";const KIND_LABEL_KEY={agent:"spanKindAgent",llm:"spanKindLlm",tool:"spanKindTool",retriever:"spanKindRetriever",embedding:"spanKindEmbedding",other:"spanKindOther"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_TONE={success:"success",error:"danger",denied:"warning",running:"accent",pending:"neutral"};function niceStep(span,count){if(span<=0)return 1;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 axisTicks(start,end,count=5){const step=niceStep(end-start,count);if(!Number.isFinite(step)||step<=0)return[start,end];const first=Math.ceil(start/step)*step;if(!Number.isFinite(first))return[start,end];const ticks=[];for(let index=0;index<=count+2;index++){const value=first+index*step;if(!Number.isFinite(value)||value>end+step/2)break;const rounded=Math.round(value/step)*step;Number.isFinite(rounded)&&(ticks.length===0||rounded>ticks[ticks.length-1])&&ticks.push(rounded)}return ticks}class LyraSpanWaterfall extends LyraElement{constructor(){super(...arguments),this.spans=[],this.activeSpanId=null,this.viewStartMs=null,this.viewEndMs=null,this.hideAxis=!1,this.label="",this.focusedId=null,this.sortedActiveSpanId=null,this.sortedCache=[],this.sortedCacheTruncated=!1,this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.onKeyDown=e=>{const view=this.viewWindow(),rows=this.sortedSpans().filter(span=>this.barGeometry(span,view).visible);if(rows.length===0)return;const currentIndex=rows.findIndex(s=>s.id===this.focusedId),idx=currentIndex>=0?currentIndex:0;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(rows[Math.min(rows.length-1,idx+1)]);break;case"ArrowUp":e.preventDefault(),this.focusRow(rows[Math.max(0,idx-1)]);break;case"Home":e.preventDefault(),this.focusRow(rows[0]);break;case"End":e.preventDefault(),this.focusRow(rows[rows.length-1]);break;case"Enter":case" ":e.preventDefault(),this.selectRow(rows[idx].id);break;default:return}}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,spanProjectionLimit:LYRA_DEFAULT_spanProjectionLimit,spanStartedAtOffset:LYRA_DEFAULT_spanStartedAtOffset,spanWaterfall:LYRA_DEFAULT_spanWaterfall,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,tokensIn:LYRA_DEFAULT_tokensIn,tokensOut:LYRA_DEFAULT_tokensOut}}static{this.ownedCollectionProperties=Object.freeze(["spans"])}static{this.identityCollectionProperties=Object.freeze(["spans"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.syncLimitAnnouncementSink(),this.limitAnnouncementInitialized=this.hasUpdated,this.previouslyTruncated=this.sortedCacheTruncated}disconnectedCallback(){this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=void 0,this.syncLimitAnnouncementSink()}syncLimitAnnouncementSink(){!this.isConnected||this.limitAnnouncementSink?.element.ownerDocument===this.ownerDocument||(this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}sortedSpans(){if(this.sortedSource===this.spans&&this.sortedActiveSpanId===this.activeSpanId)return this.sortedCache;this.sortedSource=this.spans,this.sortedActiveSpanId=this.activeSpanId;const projection=normalizeLyraSpans(this.spans,this.activeSpanId);return this.sortedCacheTruncated=projection.truncated,this.sortedCache=projection.spans.map((s,i)=>({s,i})).sort((a,b)=>a.s.startMs-b.s.startMs||a.i-b.i).map(x=>x.s),this.sortedCache}viewWindow(){const extentEnd=this.sortedSpans().reduce((m,s)=>Math.max(m,s.endMs??s.startMs,s.startMs),0),fallbackEnd=Math.max(extentEnd,1),start=this.viewStartMs==null?0:finiteRange(this.viewStartMs,0,0,Number.MAX_SAFE_INTEGER-1),end=this.viewEndMs==null?fallbackEnd:finiteRange(this.viewEndMs,fallbackEnd,0,Number.MAX_SAFE_INTEGER);return{start,end:end>start?end:start+1}}barGeometry(span,view){const endMs=span.endMs??(span.status==="running"?view.end:span.startMs),visible=span.startMs<=view.end&&endMs>=view.start,clampedStart=Math.max(view.start,span.startMs),clampedEnd=Math.min(view.end,Math.max(endMs,span.startMs)),startPct=finiteRatio(clampedStart,view.start,view.end)*100,endPct=finiteRatio(clampedEnd,view.start,view.end)*100;return{startPct,widthPct:Math.max(0,endPct-startPct),visible}}formatDuration(ms){if(ms==null||!Number.isFinite(ms))return"";const milliseconds=Math.max(0,ms);return milliseconds<1e3?getNumberFormat(this.effectiveLocale,{style:"unit",unit:"millisecond",unitDisplay:"short",maximumFractionDigits:0}).format(milliseconds):getNumberFormat(this.effectiveLocale,{style:"unit",unit:"second",unitDisplay:"short",maximumFractionDigits:1}).format(milliseconds/1e3)}projectionLimitText(){return this.localize("spanProjectionLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_LYRA_SPANS)})}focusRow(span){if(!span)return;const previous=this.renderRoot.querySelector('[part="bar"][tabindex="0"]');this.focusedId=span.id,this.announceFocus(span),previous?.setAttribute("tabindex","-1");const next=this.renderedBarById(span.id);next?.setAttribute("tabindex","0"),next?.focus()}announceFocus(span){const parts=[span.name,this.localize(KIND_LABEL_KEY[span.kind]),this.localize(STATUS_LABEL_KEY[span.status]),this.localize("spanStartedAtOffset",void 0,{value:this.formatDuration(span.startMs)||this.localize("durationMilliseconds",void 0,{value:0})})];span.endMs!=null&&parts.push(this.formatDuration(span.endMs-span.startMs)),this.liveRegion?.announce(parts.join(this.localize("accessibleLabelSeparator")),{force:!0})}selectRow(id){this.focusedId=id,this.emit("lr-span-select",{spanId:id})}willUpdate(changed){if(super.willUpdate(changed),(changed.has("spans")||changed.has("activeSpanId"))&&(this.sortedSource=void 0),changed.has("spans")||changed.has("viewStartMs")||changed.has("viewEndMs")||changed.has("activeSpanId")){const view=this.viewWindow(),ids=new Set(this.sortedSpans().filter(span=>this.barGeometry(span,view).visible).map(span=>span.id));(this.focusedId==null||!ids.has(this.focusedId))&&(this.focusedId=this.activeSpanId&&ids.has(this.activeSpanId)?this.activeSpanId:this.sortedSpans()[0]?.id??null),this.focusedId!==null&&!ids.has(this.focusedId)&&(this.focusedId=this.sortedSpans().find(span=>ids.has(span.id))?.id??null),changed.has("activeSpanId")&&this.activeSpanId&&ids.has(this.activeSpanId)&&(this.focusedId=this.activeSpanId)}}renderedBarById(id){const ownerCss=this.ownerDocument.defaultView?.CSS;return typeof ownerCss?.escape=="function"?this.renderRoot.querySelector(`[data-id="${ownerCss.escape(id)}"]`):Array.from(this.renderRoot.querySelectorAll("[data-id]")).find(element=>element.dataset.id===id)??null}updated(changed){if(super.updated(changed),changed.has("activeSpanId")&&this.activeSpanId){const bar=this.renderedBarById(this.activeSpanId);if(bar&&!bar.hidden){const ownerWindow=bar.ownerDocument.defaultView,reducedMotion=!ownerWindow||prefersReducedMotion(ownerWindow);bar.scrollIntoView({block:"nearest",behavior:reducedMotion?"auto":"smooth"})}}this.limitAnnouncementInitialized&&this.sortedCacheTruncated&&!this.previouslyTruncated&&this.limitAnnouncementSink?.announce(this.projectionLimitText()),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.sortedCacheTruncated}renderAxis(view){const ticks=axisTicks(view.start,view.end);return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{finiteRatio,finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./span-waterfall.styles.js";import{MAX_RENDERED_LYRA_SPANS,normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_accessibleLabelSeparator,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool,LYRA_DEFAULT_spanProjectionLimit,LYRA_DEFAULT_spanStartedAtOffset,LYRA_DEFAULT_spanWaterfall,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings.generated.js";const KIND_LABEL_KEY={agent:"spanKindAgent",llm:"spanKindLlm",tool:"spanKindTool",retriever:"spanKindRetriever",embedding:"spanKindEmbedding",other:"spanKindOther"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_TONE={success:"success",error:"danger",denied:"warning",running:"accent",pending:"neutral"};function niceStep(span,count){if(span<=0)return 1;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 axisTicks(start,end,count=5){const step=niceStep(end-start,count);if(!Number.isFinite(step)||step<=0)return[start,end];const first=Math.ceil(start/step)*step;if(!Number.isFinite(first))return[start,end];const ticks=[];for(let index=0;index<=count+2;index++){const value=first+index*step;if(!Number.isFinite(value)||value>end+step/2)break;const rounded=Math.round(value/step)*step;Number.isFinite(rounded)&&(ticks.length===0||rounded>ticks[ticks.length-1])&&ticks.push(rounded)}return ticks}class LyraSpanWaterfall extends LyraElement{constructor(){super(...arguments),this.spans=[],this.activeSpanId=null,this.viewStartMs=null,this.viewEndMs=null,this.hideAxis=!1,this.label="",this.focusedId=null,this.sortedActiveSpanId=null,this.sortedCache=[],this.sortedCacheTruncated=!1,this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.onKeyDown=e=>{const view=this.viewWindow(),rows=this.sortedSpans().filter(span=>this.barGeometry(span,view).visible);if(rows.length===0)return;const currentIndex=rows.findIndex(s=>s.id===this.focusedId),idx=currentIndex>=0?currentIndex:0;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(rows[Math.min(rows.length-1,idx+1)]);break;case"ArrowUp":e.preventDefault(),this.focusRow(rows[Math.max(0,idx-1)]);break;case"Home":e.preventDefault(),this.focusRow(rows[0]);break;case"End":e.preventDefault(),this.focusRow(rows[rows.length-1]);break;case"Enter":case" ":e.preventDefault(),this.selectRow(rows[idx].id);break;default:return}}}static{this.defaultStrings={...super.defaultStrings,accessibleLabelSeparator:LYRA_DEFAULT_accessibleLabelSeparator,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,spanProjectionLimit:LYRA_DEFAULT_spanProjectionLimit,spanStartedAtOffset:LYRA_DEFAULT_spanStartedAtOffset,spanWaterfall:LYRA_DEFAULT_spanWaterfall,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,tokensIn:LYRA_DEFAULT_tokensIn,tokensOut:LYRA_DEFAULT_tokensOut}}static{this.ownedCollectionProperties=Object.freeze(["spans"])}static{this.identityCollectionProperties=Object.freeze(["spans"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.syncLimitAnnouncementSink(),this.limitAnnouncementInitialized=this.hasUpdated,this.previouslyTruncated=this.sortedCacheTruncated}disconnectedCallback(){this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=void 0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=void 0,this.syncLimitAnnouncementSink()}syncLimitAnnouncementSink(){!this.isConnected||this.limitAnnouncementSink?.element.ownerDocument===this.ownerDocument||(this.limitAnnouncementSink?.release(),this.limitAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}sortedSpans(){if(this.sortedSource===this.spans&&this.sortedActiveSpanId===this.activeSpanId)return this.sortedCache;this.sortedSource=this.spans,this.sortedActiveSpanId=this.activeSpanId;const projection=normalizeLyraSpans(this.spans,this.activeSpanId);return this.sortedCacheTruncated=projection.truncated,this.sortedCache=projection.spans.map((s,i)=>({s,i})).sort((a,b)=>a.s.startMs-b.s.startMs||a.i-b.i).map(x=>x.s),this.sortedCache}viewWindow(){const extentEnd=this.sortedSpans().reduce((m,s)=>Math.max(m,s.endMs??s.startMs,s.startMs),0),fallbackEnd=Math.max(extentEnd,1),start=this.viewStartMs==null?0:finiteRange(this.viewStartMs,0,0,Number.MAX_SAFE_INTEGER-1),end=this.viewEndMs==null?fallbackEnd:finiteRange(this.viewEndMs,fallbackEnd,0,Number.MAX_SAFE_INTEGER);return{start,end:end>start?end:start+1}}barGeometry(span,view){const endMs=span.endMs??(span.status==="running"?view.end:span.startMs),visible=span.startMs<=view.end&&endMs>=view.start,clampedStart=Math.max(view.start,span.startMs),clampedEnd=Math.min(view.end,Math.max(endMs,span.startMs)),startPct=finiteRatio(clampedStart,view.start,view.end)*100,endPct=finiteRatio(clampedEnd,view.start,view.end)*100;return{startPct,widthPct:Math.max(0,endPct-startPct),visible}}formatDuration(ms){if(ms==null||!Number.isFinite(ms))return"";const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}projectionLimitText(){return this.localize("spanProjectionLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_LYRA_SPANS)})}focusRow(span){if(!span)return;const previous=this.renderRoot.querySelector('[part="bar"][tabindex="0"]');this.focusedId=span.id,this.announceFocus(span),previous?.setAttribute("tabindex","-1");const next=this.renderedBarById(span.id);next?.setAttribute("tabindex","0"),next?.focus()}announceFocus(span){const parts=[span.name,this.localize(KIND_LABEL_KEY[span.kind]),this.localize(STATUS_LABEL_KEY[span.status]),this.localize("spanStartedAtOffset",void 0,{value:this.formatDuration(span.startMs)||this.localize("durationMilliseconds",void 0,{value:0})})];span.endMs!=null&&parts.push(this.formatDuration(span.endMs-span.startMs)),this.liveRegion?.announce(parts.join(this.localize("accessibleLabelSeparator")),{force:!0})}selectRow(id){this.focusedId=id,this.emit("lr-span-select",{spanId:id})}willUpdate(changed){if(super.willUpdate(changed),(changed.has("spans")||changed.has("activeSpanId"))&&(this.sortedSource=void 0),changed.has("spans")||changed.has("viewStartMs")||changed.has("viewEndMs")||changed.has("activeSpanId")){const view=this.viewWindow(),ids=new Set(this.sortedSpans().filter(span=>this.barGeometry(span,view).visible).map(span=>span.id));(this.focusedId==null||!ids.has(this.focusedId))&&(this.focusedId=this.activeSpanId&&ids.has(this.activeSpanId)?this.activeSpanId:this.sortedSpans()[0]?.id??null),this.focusedId!==null&&!ids.has(this.focusedId)&&(this.focusedId=this.sortedSpans().find(span=>ids.has(span.id))?.id??null),changed.has("activeSpanId")&&this.activeSpanId&&ids.has(this.activeSpanId)&&(this.focusedId=this.activeSpanId)}}renderedBarById(id){const ownerCss=this.ownerDocument.defaultView?.CSS;return typeof ownerCss?.escape=="function"?this.renderRoot.querySelector(`[data-id="${ownerCss.escape(id)}"]`):Array.from(this.renderRoot.querySelectorAll("[data-id]")).find(element=>element.dataset.id===id)??null}updated(changed){if(super.updated(changed),changed.has("activeSpanId")&&this.activeSpanId){const bar=this.renderedBarById(this.activeSpanId);if(bar&&!bar.hidden){const ownerWindow=bar.ownerDocument.defaultView,reducedMotion=!ownerWindow||prefersReducedMotion(ownerWindow);bar.scrollIntoView({block:"nearest",behavior:reducedMotion?"auto":"smooth"})}}this.limitAnnouncementInitialized&&this.sortedCacheTruncated&&!this.previouslyTruncated&&this.limitAnnouncementSink?.announce(this.projectionLimitText()),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.sortedCacheTruncated}renderAxis(view){const ticks=axisTicks(view.start,view.end);return html`
2
2
  <div part="axis" aria-hidden="true">
3
3
  ${ticks.map(t=>{const pct=finiteRatio(t,view.start,view.end)*100;return pct<0||pct>100?nothing:html`<span
4
4
  part="tick"
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import type{AgentStatusKind}from'../../../ai/types.js';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import'../../overlays/badge/badge.class.js';import'../../overlays/empty/empty.class.js';import type{AgentRunActivateDetail}from'../run-events.js';export interface SubagentRun{readonly id:string;readonly parentId?:string;readonly label:string;readonly status:AgentStatusKind;readonly task?:string;readonly model?:string;
1
+ import{type TemplateResult,type PropertyValues}from'lit';import type{AgentStatusKind}from'../../../ai/types.js';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import type{LyraFrame}from'../../../internal/variants.js';import'../../overlays/badge/badge.class.js';import'../../overlays/empty/empty.class.js';import type{AgentRunActivateDetail}from'../run-events.js';export interface SubagentRun{readonly id:string;readonly parentId?:string;readonly label:string;readonly status:AgentStatusKind;readonly task?:string;readonly model?:string;
2
2
  /** Completion ratio in the inclusive 0..1 range. */
3
3
  readonly progressRatio?:number;readonly startedAt?:number;readonly endedAt?:number;readonly metadata?:Readonly<Record<string,unknown>>;}export interface LyraSubagentPanelEventMap{'lr-run-activate':CustomEvent<LyraEventDetailSnapshot<AgentRunActivateDetail<SubagentRun>>>;'lr-cancel':CustomEvent<LyraEventDetailSnapshot<{runId:string;}>>;'lr-run-retry':CustomEvent<LyraEventDetailSnapshot<{runId:string;}>>;}
4
4
  /**
@@ -32,6 +32,14 @@ readonly progressRatio?:number;readonly startedAt?:number;readonly endedAt?:numb
32
32
  * @cssprop [--lr-subagent-panel-selected-border=var(--lr-color-brand)] - Selected run border.
33
33
  * @cssprop [--lr-subagent-panel-progress-track=var(--lr-color-border)] - Progress track.
34
34
  * @cssprop [--lr-subagent-panel-progress-fill=var(--lr-color-brand)] - Progress fill.
35
+ * @cssprop [--lr-subagent-panel-compact-trigger-padding=var(--lr-space-2xs) var(--lr-space-s)] -
36
+ * `[part="run-trigger"]` padding while `compact`.
37
+ * @cssprop [--lr-subagent-panel-compact-trigger-gap=var(--lr-space-2xs)] - Gap between
38
+ * `[part="run-trigger"]`'s label/status/task/model/progress while `compact`.
39
+ * @cssprop [--lr-subagent-panel-compact-font-size=var(--lr-font-size-2xs)] - `[part="task"]`/
40
+ * `[part="model"]` font size while `compact`.
41
+ * @cssprop [--lr-subagent-panel-compact-action-padding=var(--lr-space-2xs)] - `[part="cancel"]`/
42
+ * `[part="retry"]` padding while `compact`.
35
43
  * @status stable
36
44
  * @since 7.0.0
37
45
  */
@@ -39,6 +47,16 @@ export declare class LyraSubagentPanel extends LyraElement<LyraSubagentPanelEven
39
47
  /** Optional accessible-name override for the `role="tree"` element. Omission localizes the
40
48
  * default; any supplied string, including `''`, is rendered verbatim. */
41
49
  label?:string;
50
+ /** Tighter run-row padding/gaps and smaller task/model text -- same convention as
51
+ * `lr-task-list`/`lr-stack-trace`/`lr-thinking-panel`/`lr-terminal`'s `compact`. Defaults to
52
+ * `false`, i.e. full padding. Purely a density knob: each row's own border stays, so use
53
+ * `frame="plain"` instead to drop the chrome entirely. */
54
+ compact:boolean;
55
+ /** Visual chrome for each run row, in the library's shared container-frame vocabulary. `'card'`
56
+ * (the default) keeps each row's own border/radius; `'plain'` drops it, for a transcript or
57
+ * message-bubble context that already draws its own border around a nested
58
+ * `<lr-subagent-panel>` and would otherwise double it. */
59
+ frame:LyraFrame;
42
60
  /** Roving-tabindex focus target. `null` defaults the first rendered row to `tabindex="0"`. */
43
61
  private focusedId;
44
62
  /**
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{firstByIdentity}from"../collection-identity.js";import"../../overlays/badge/badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./subagent-panel.styles.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_subagentPanelCancelRun,LYRA_DEFAULT_subagentPanelEmpty,LYRA_DEFAULT_subagentPanelLabel,LYRA_DEFAULT_subagentPanelLimit,LYRA_DEFAULT_subagentPanelRetry,LYRA_DEFAULT_subagentPanelRetryRun}from"../../../internal/default-strings.generated.js";const ACTIVE=new Set(["queued","running","collecting","waiting-input","waiting-approval"]),MAX_RENDERED_RUNS=500,MAX_VISUAL_INDENT_DEPTH=12;class LyraSubagentPanel extends LyraElement{constructor(){super(...arguments),this.runs=[],this.selectedRunId=null,this.focusedId=null,this.orderedRunsCache={rows:[],truncated:!1},this.previousLimitText="",this.suppressNextLimitAnnouncement=!0,this.onKeyDown=e=>{const{rows}=this.orderedRunsCache;if(rows.length===0)return;const currentIndex=rows.findIndex(r=>r.run.id===this.focusedId);switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(rows[Math.min(rows.length-1,currentIndex+1)]);break;case"ArrowUp":e.preventDefault(),this.focusRow(rows[Math.max(0,currentIndex-1)]);break;case"Home":e.preventDefault(),this.focusRow(rows[0]);break;case"End":e.preventDefault(),this.focusRow(rows[rows.length-1]);break;case"Enter":case" ":{const target=e.target;if(target.getAttribute("role")!=="treeitem")return;const row=rows.find(candidate=>candidate.run.id===target.dataset.runId);if(!row)return;e.preventDefault(),this.emit("lr-run-activate",{runId:row.run.id,run:row.run});break}default:return}},this.onFocusIn=e=>{const runId=e.target?.closest('[role="treeitem"]')?.dataset.runId;runId&&(this.focusedId=runId)},this.renderRun=({run,depth,posInSet,setSize},firstId)=>{const selected=run.id===this.selectedRunId,progress=typeof run.progressRatio=="number"?finiteRange(run.progressRatio,0,0,1):null,runPart=selected?"run run-selected":"run",tabbable=this.focusedId===run.id||this.focusedId==null&&run.id===firstId;return html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{firstByIdentity}from"../collection-identity.js";import"../../overlays/badge/badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./subagent-panel.styles.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_progress,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_subagentPanelCancelRun,LYRA_DEFAULT_subagentPanelEmpty,LYRA_DEFAULT_subagentPanelLabel,LYRA_DEFAULT_subagentPanelLimit,LYRA_DEFAULT_subagentPanelRetry,LYRA_DEFAULT_subagentPanelRetryRun}from"../../../internal/default-strings.generated.js";const ACTIVE=new Set(["queued","running","collecting","waiting-input","waiting-approval"]),MAX_RENDERED_RUNS=500,MAX_VISUAL_INDENT_DEPTH=12;class LyraSubagentPanel extends LyraElement{constructor(){super(...arguments),this.runs=[],this.selectedRunId=null,this.compact=!1,this.frame="card",this.focusedId=null,this.orderedRunsCache={rows:[],truncated:!1},this.previousLimitText="",this.suppressNextLimitAnnouncement=!0,this.onKeyDown=e=>{const{rows}=this.orderedRunsCache;if(rows.length===0)return;const currentIndex=rows.findIndex(r=>r.run.id===this.focusedId);switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(rows[Math.min(rows.length-1,currentIndex+1)]);break;case"ArrowUp":e.preventDefault(),this.focusRow(rows[Math.max(0,currentIndex-1)]);break;case"Home":e.preventDefault(),this.focusRow(rows[0]);break;case"End":e.preventDefault(),this.focusRow(rows[rows.length-1]);break;case"Enter":case" ":{const target=e.target;if(target.getAttribute("role")!=="treeitem")return;const row=rows.find(candidate=>candidate.run.id===target.dataset.runId);if(!row)return;e.preventDefault(),this.emit("lr-run-activate",{runId:row.run.id,run:row.run});break}default:return}},this.onFocusIn=e=>{const runId=e.target?.closest('[role="treeitem"]')?.dataset.runId;runId&&(this.focusedId=runId)},this.renderRun=({run,depth,posInSet,setSize},firstId)=>{const selected=run.id===this.selectedRunId,progress=typeof run.progressRatio=="number"?finiteRange(run.progressRatio,0,0,1):null,runPart=selected?"run run-selected":"run",tabbable=this.focusedId===run.id||this.focusedId==null&&run.id===firstId;return html`
2
2
  <li
3
3
  part=${runPart}
4
4
  data-run-id=${run.id}
@@ -24,7 +24,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
24
24
  ${progress!=null?html`<span
25
25
  part="progress"
26
26
  role="progressbar"
27
- aria-label=${run.label}
27
+ aria-label=${run.label||this.localize("progress")}
28
28
  aria-valuemin="0"
29
29
  aria-valuemax="100"
30
30
  aria-valuenow=${Math.round(progress*100)}
@@ -46,7 +46,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
46
46
  </span>
47
47
  </div>
48
48
  </li>
49
- `}}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,subagentPanelCancelRun:LYRA_DEFAULT_subagentPanelCancelRun,subagentPanelEmpty:LYRA_DEFAULT_subagentPanelEmpty,subagentPanelLabel:LYRA_DEFAULT_subagentPanelLabel,subagentPanelLimit:LYRA_DEFAULT_subagentPanelLimit,subagentPanelRetry:LYRA_DEFAULT_subagentPanelRetry,subagentPanelRetryRun:LYRA_DEFAULT_subagentPanelRetryRun}}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-cancel","lr-run-retry"])}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}statusLabel(status){switch(status){case"idle":return this.localize("agentRunStatusIdle");case"queued":return this.localize("agentRunStatusQueued");case"running":return this.localize("statusRunning");case"collecting":return this.localize("agentRunStatusCollecting");case"waiting-input":return this.localize("agentRunStatusWaitingInput");case"waiting-approval":return this.localize("agentRunStatusWaitingApproval");case"done":return this.localize("agentRunStatusDone");case"error":return this.localize("statusError");case"cancelled":return this.localize("agentRunStatusCancelled");default:return status}}ordered(){const normalized=[],byId=new Map,runs=firstByIdentity(Array.isArray(this.runs)?this.runs:[],run=>run.id),truncated=runs.length>MAX_RENDERED_RUNS;for(const run of runs.slice(0,MAX_RENDERED_RUNS))normalized.push(run),byId.set(run.id,run);const byParent=new Map,roots=[],hasCyclicParentChain=run=>{const visited2=new Set([run.id]);let parentId=run.parentId;for(;parentId;){if(visited2.has(parentId))return!0;visited2.add(parentId),parentId=byId.get(parentId)?.parentId}return!1};for(const run of normalized){const parent=run.parentId&&byId.has(run.parentId)&&!hasCyclicParentChain(run)?run.parentId:"";byParent.set(parent,[...byParent.get(parent)??[],run]),parent||roots.push(run)}const rows=[],stack=[...roots].reverse().map((run,reverseIndex)=>({run,depth:0,posInSet:roots.length-reverseIndex,setSize:roots.length})),visited=new Set;for(;stack.length>0&&rows.length<MAX_RENDERED_RUNS;){const row=stack.pop();if(!row||visited.has(row.run.id))continue;visited.add(row.run.id),rows.push(row);const children=byParent.get(row.run.id)??[];for(let index=children.length-1;index>=0;index--){const child=children[index];child&&stack.push({run:child,depth:row.depth+1,posInSet:index+1,setSize:children.length})}}return{rows,truncated}}willUpdate(changed){if(super.willUpdate(changed),changed.has("runs")){this.orderedRunsCache=this.ordered();const rows=this.orderedRunsCache.rows,ids=new Set(rows.map(row=>row.run.id));(this.focusedId==null||!ids.has(this.focusedId))&&(this.focusedId=rows[0]?.run.id??null)}}updated(_changed){super.updated(_changed);const limitText=this.renderRoot.querySelector('[part="limit"]')?.textContent?.trim()??"";!this.suppressNextLimitAnnouncement&&limitText&&limitText!==this.previousLimitText&&this.announcementSink?.announce(limitText),this.previousLimitText=limitText,this.suppressNextLimitAnnouncement=!1}runElement(runId){const ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=this.renderRoot.querySelector(`[data-run-id="${ownerCss.escape(runId)}"]`);if(candidate?.getAttribute("data-run-id")===runId)return candidate}catch{}return Array.from(this.renderRoot.querySelectorAll("[data-run-id]")).find(candidate=>candidate.getAttribute("data-run-id")===runId)??null}focusRow(row){row&&(this.focusedId=row.run.id,this.updateComplete.then(()=>{this.runElement(row.run.id)?.focus()}))}render(){const label=hostAriaLabel(this)??(this.label==null?this.localize("subagentPanelLabel"):this.label),ordered=this.orderedRunsCache,firstId=ordered.rows[0]?.run.id;return html`
49
+ `}}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,progress:LYRA_DEFAULT_progress,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,subagentPanelCancelRun:LYRA_DEFAULT_subagentPanelCancelRun,subagentPanelEmpty:LYRA_DEFAULT_subagentPanelEmpty,subagentPanelLabel:LYRA_DEFAULT_subagentPanelLabel,subagentPanelLimit:LYRA_DEFAULT_subagentPanelLimit,subagentPanelRetry:LYRA_DEFAULT_subagentPanelRetry,subagentPanelRetryRun:LYRA_DEFAULT_subagentPanelRetryRun}}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-cancel","lr-run-retry"])}syncAnnouncementSink(){this.isConnected&&this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.announcementSink?.release(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink(),this.hasUpdated&&(this.suppressNextLimitAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.announcementSink?.release(),this.announcementSink=void 0,this.suppressNextLimitAnnouncement=!0}statusLabel(status){switch(status){case"idle":return this.localize("agentRunStatusIdle");case"queued":return this.localize("agentRunStatusQueued");case"running":return this.localize("statusRunning");case"collecting":return this.localize("agentRunStatusCollecting");case"waiting-input":return this.localize("agentRunStatusWaitingInput");case"waiting-approval":return this.localize("agentRunStatusWaitingApproval");case"done":return this.localize("agentRunStatusDone");case"error":return this.localize("statusError");case"cancelled":return this.localize("agentRunStatusCancelled");default:return status}}ordered(){const normalized=[],byId=new Map,runs=firstByIdentity(Array.isArray(this.runs)?this.runs:[],run=>run.id),truncated=runs.length>MAX_RENDERED_RUNS;for(const run of runs.slice(0,MAX_RENDERED_RUNS))normalized.push(run),byId.set(run.id,run);const byParent=new Map,roots=[],hasCyclicParentChain=run=>{const visited2=new Set([run.id]);let parentId=run.parentId;for(;parentId;){if(visited2.has(parentId))return!0;visited2.add(parentId),parentId=byId.get(parentId)?.parentId}return!1};for(const run of normalized){const parent=run.parentId&&byId.has(run.parentId)&&!hasCyclicParentChain(run)?run.parentId:"";byParent.set(parent,[...byParent.get(parent)??[],run]),parent||roots.push(run)}const rows=[],stack=[...roots].reverse().map((run,reverseIndex)=>({run,depth:0,posInSet:roots.length-reverseIndex,setSize:roots.length})),visited=new Set;for(;stack.length>0&&rows.length<MAX_RENDERED_RUNS;){const row=stack.pop();if(!row||visited.has(row.run.id))continue;visited.add(row.run.id),rows.push(row);const children=byParent.get(row.run.id)??[];for(let index=children.length-1;index>=0;index--){const child=children[index];child&&stack.push({run:child,depth:row.depth+1,posInSet:index+1,setSize:children.length})}}return{rows,truncated}}willUpdate(changed){if(super.willUpdate(changed),changed.has("runs")){this.orderedRunsCache=this.ordered();const rows=this.orderedRunsCache.rows,ids=new Set(rows.map(row=>row.run.id));(this.focusedId==null||!ids.has(this.focusedId))&&(this.focusedId=rows[0]?.run.id??null)}}updated(_changed){super.updated(_changed);const limitText=this.renderRoot.querySelector('[part="limit"]')?.textContent?.trim()??"";!this.suppressNextLimitAnnouncement&&limitText&&limitText!==this.previousLimitText&&this.announcementSink?.announce(limitText),this.previousLimitText=limitText,this.suppressNextLimitAnnouncement=!1}runElement(runId){const ownerCss=this.ownerDocument.defaultView?.CSS;if(typeof ownerCss?.escape=="function")try{const candidate=this.renderRoot.querySelector(`[data-run-id="${ownerCss.escape(runId)}"]`);if(candidate?.getAttribute("data-run-id")===runId)return candidate}catch{}return Array.from(this.renderRoot.querySelectorAll("[data-run-id]")).find(candidate=>candidate.getAttribute("data-run-id")===runId)??null}focusRow(row){row&&(this.focusedId=row.run.id,this.updateComplete.then(()=>{this.runElement(row.run.id)?.focus()}))}render(){const label=hostAriaLabel(this)??(this.label==null?this.localize("subagentPanelLabel"):this.label),ordered=this.orderedRunsCache,firstId=ordered.rows[0]?.run.id;return html`
50
50
  <div part="base">
51
51
  ${ordered.rows.length?html`<ul
52
52
  part="list"
@@ -57,4 +57,4 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
57
57
  >${ordered.rows.map(row=>this.renderRun(row,firstId))}</ul>
58
58
  ${ordered.truncated?html`<p part="limit">${this.localize("subagentPanelLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_RUNS)})}</p>`:nothing}`:html`<lr-empty part="empty" heading=${this.localize("subagentPanelEmpty")}></lr-empty>`}
59
59
  </div>
60
- `}}__decorate([property({attribute:!1})],LyraSubagentPanel.prototype,"runs",void 0),__decorate([property({attribute:"selected-run-id"})],LyraSubagentPanel.prototype,"selectedRunId",void 0),__decorate([property()],LyraSubagentPanel.prototype,"label",void 0),__decorate([state()],LyraSubagentPanel.prototype,"focusedId",void 0);export{LyraSubagentPanel};
60
+ `}}__decorate([property({attribute:!1})],LyraSubagentPanel.prototype,"runs",void 0),__decorate([property({attribute:"selected-run-id"})],LyraSubagentPanel.prototype,"selectedRunId",void 0),__decorate([property()],LyraSubagentPanel.prototype,"label",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraSubagentPanel.prototype,"compact",void 0),__decorate([property({reflect:!0})],LyraSubagentPanel.prototype,"frame",void 0),__decorate([state()],LyraSubagentPanel.prototype,"focusedId",void 0);export{LyraSubagentPanel};
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);display:block;container-type:inline-size}[part=list]{gap:var(--lr-space-xs);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}[part~=run]{border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);margin-inline-start:calc(var(--lr-subagent-depth,0) * var(--lr-space-l));overflow:hidden}[part~=run-selected]{border-color:var(--lr-subagent-panel-selected-border,var(--lr-color-brand))}[part=run-row]{grid-template-columns:minmax(0,1fr) auto;display:grid}[part=run-trigger]{gap:var(--lr-space-xs);min-inline-size:0;min-block-size:var(--lr-icon-button-size);padding:var(--lr-space-s);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;text-align:start;cursor:pointer;border:0;grid-template-columns:minmax(0,1fr) auto;display:grid}[part=run-trigger]:hover,[part=cancel]:hover,[part=retry]:hover{background:var(--lr-color-surface-raised)}[part=run-trigger]:active,[part=cancel]:active,[part=retry]:active{background:color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=run-trigger]:focus-visible,[part=cancel]:focus-visible,[part=retry]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(var(--lr-focus-ring-offset) * -1)}[part=label],[part=task],[part=model]{overflow-wrap:break-word;min-inline-size:0}[part=task],[part=model]{color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);grid-column:1/-1}[part=progress]{block-size:var(--lr-size-0-25rem);border-radius:var(--lr-radius-pill);background:var(--lr-subagent-panel-progress-track,var(--lr-color-border));grid-column:1/-1;overflow:hidden}[part=progress]>span{background:var(--lr-subagent-panel-progress-fill,var(--lr-color-brand));block-size:100%;display:block}[part=actions]{display:flex}[part=cancel],[part=retry]{min-block-size:var(--lr-icon-button-size);min-inline-size:var(--lr-icon-button-size);padding:var(--lr-space-xs);border:0;border-inline-start:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;cursor:pointer}@container (inline-size<=20rem){[part~=run]{margin-inline-start:calc(var(--lr-subagent-depth,0) * var(--lr-space-s))}[part=run-trigger]{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}[part=status]{min-inline-size:0;max-inline-size:100%}[part=run-row]{grid-template-columns:1fr}[part=actions]{border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border)}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{contain-intrinsic-inline-size:var(--lr-size-20rem);display:block;container-type:inline-size}[part=list]{gap:var(--lr-space-xs);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}[part~=run]{border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);margin-inline-start:calc(var(--lr-subagent-depth,0) * var(--lr-space-l));overflow:hidden}[part~=run-selected]{border-color:var(--lr-subagent-panel-selected-border,var(--lr-color-brand))}[part=run-row]{grid-template-columns:minmax(0,1fr) auto;display:grid}[part=run-trigger]{gap:var(--lr-space-xs);min-inline-size:0;min-block-size:var(--lr-icon-button-size);padding:var(--lr-space-s);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;text-align:start;cursor:pointer;border:0;grid-template-columns:minmax(0,1fr) auto;display:grid}[part=run-trigger]:hover,[part=cancel]:hover,[part=retry]:hover{background:var(--lr-color-surface-raised)}[part=run-trigger]:active,[part=cancel]:active,[part=retry]:active{background:color-mix(in oklab, var(--lr-color-surface-raised), var(--lr-color-mix-partner) var(--lr-color-mix-active))}[part=run-trigger]:focus-visible,[part=cancel]:focus-visible,[part=retry]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(var(--lr-focus-ring-offset) * -1)}[part=label],[part=task],[part=model]{overflow-wrap:break-word;min-inline-size:0}[part=task],[part=model]{color:var(--lr-color-text-quiet);font-size:var(--lr-font-size-sm);grid-column:1/-1}[part=progress]{block-size:var(--lr-size-0-25rem);border-radius:var(--lr-radius-pill);background:var(--lr-subagent-panel-progress-track,var(--lr-color-border));grid-column:1/-1;overflow:hidden}[part=progress]>span{background:var(--lr-subagent-panel-progress-fill,var(--lr-color-brand));block-size:100%;display:block}[part=actions]{display:flex}[part=cancel],[part=retry]{min-block-size:var(--lr-icon-button-size);min-inline-size:var(--lr-icon-button-size);padding:var(--lr-space-xs);border:0;border-inline-start:var(--lr-border-width-thin) solid var(--lr-color-border);background:var(--lr-color-surface);color:var(--lr-color-text);font:inherit;cursor:pointer}:host([compact]) [part=run-trigger]{padding:var(--lr-subagent-panel-compact-trigger-padding,var(--lr-space-2xs) var(--lr-space-s));gap:var(--lr-subagent-panel-compact-trigger-gap,var(--lr-space-2xs))}:host([compact]) [part=task],:host([compact]) [part=model]{font-size:var(--lr-subagent-panel-compact-font-size,var(--lr-font-size-2xs))}:host([compact]) [part=cancel],:host([compact]) [part=retry]{padding:var(--lr-subagent-panel-compact-action-padding,var(--lr-space-2xs))}:host([frame=plain]) [part~=run]{border:0;border-radius:0}@container (inline-size<=20rem){[part~=run]{margin-inline-start:calc(var(--lr-subagent-depth,0) * var(--lr-space-s))}[part=run-trigger]{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}[part=status]{min-inline-size:0;max-inline-size:100%}[part=run-row]{grid-template-columns:1fr}[part=actions]{border-block-start:var(--lr-border-width-thin) solid var(--lr-color-border)}}`;export{styles};
@@ -36,6 +36,11 @@ children?:readonly TaskItem[];}export interface TaskListToggleDetail{expanded:bo
36
36
  * Public collection properties take bounded, clone-owned readonly snapshots. Create a new
37
37
  * collection and reassign it after changes; mutating the assigned array does not update the view.
38
38
  *
39
+ * Only the first 500 top-level items are mounted into the DOM (matching the render ceiling this
40
+ * family's other bounded lists use); the header's "N of M completed" summary still counts every
41
+ * item in `items`, and reorder index math still reads full sibling order from `items` regardless
42
+ * of what is actually rendered.
43
+ *
39
44
  * @customElement lr-task-list
40
45
  * @slot detail-<id> - Dynamic, one per item id (e.g. `slot="detail-step-3"`). Rich detail under
41
46
  * that item's label, after its `detail` text -- typically a `<lr-tool-call-chip>` or file
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,svg,nothing}from"lit";import{repeat}from"lit/directives/repeat.js";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./task-list.styles.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_item,LYRA_DEFAULT_items,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_taskListCompletedOfTotal,LYRA_DEFAULT_taskListLabel,LYRA_DEFAULT_taskListStepCompletedAnnounce,LYRA_DEFAULT_taskListStepFailedAnnounce,LYRA_DEFAULT_taskListStepStartedAnnounce,LYRA_DEFAULT_treeNodeMoved}from"../../../internal/default-strings.generated.js";function normalizeTaskStatus(value){return value==="running"||value==="success"||value==="error"?value:"pending"}const DEEP_NESTING_WARNING_KEY="lyra-task-list-nesting-depth",DEEP_NESTING_WARNING="<lr-task-list>: task nesting deeper than one level is ignored.";function validTaskItems(value){const items=[];for(const item of Array.isArray(value)?value:[])try{item!==null&&typeof item=="object"&&!Array.isArray(item)&&typeof item.id=="string"&&item.id.trim().length>0&&items.push(item)}catch{}return items}const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,svg,nothing}from"lit";import{repeat}from"lit/directives/repeat.js";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{chevronIcon}from"../../../internal/icons.js";import{styles}from"./task-list.styles.js";import{presenceTrueDefaultBooleanConverter as trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_item,LYRA_DEFAULT_items,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_taskListCompletedOfTotal,LYRA_DEFAULT_taskListLabel,LYRA_DEFAULT_taskListStepCompletedAnnounce,LYRA_DEFAULT_taskListStepFailedAnnounce,LYRA_DEFAULT_taskListStepStartedAnnounce,LYRA_DEFAULT_treeNodeMoved}from"../../../internal/default-strings.generated.js";function normalizeTaskStatus(value){return value==="running"||value==="success"||value==="error"?value:"pending"}const DEEP_NESTING_WARNING_KEY="lyra-task-list-nesting-depth",DEEP_NESTING_WARNING="<lr-task-list>: task nesting deeper than one level is ignored.",MAX_RENDERED_TASKS=500;function validTaskItems(value){const items=[];for(const item of Array.isArray(value)?value:[])try{item!==null&&typeof item=="object"&&!Array.isArray(item)&&typeof item.id=="string"&&item.id.trim().length>0&&items.push(item)}catch{}return items}const ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function icon(paths){return svg`
2
2
  <svg
3
3
  width="1em"
4
4
  height="1em"
@@ -34,7 +34,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
34
34
  ${canReorder?repeat(children,child=>child.id,child=>this.renderItem(child,1,item.id,canReorder)):children.map(child=>this.renderItem(child,1,item.id,canReorder))}
35
35
  </div>`:nothing}
36
36
  </div>
37
- `}render(){const label=this.label==null?this.localize("taskListLabel"):this.label,ariaLabel=hostAriaLabel(this)??label,items=validTaskItems(this.items),total=items.length,completed=items.filter(item=>normalizeTaskStatus(item.status)==="success").length,canReorder=this.canReorderItems(),number=getNumberFormat(this.effectiveLocale),summary=this.localize("taskListCompletedOfTotal",void 0,{completed:number.format(completed),total:number.format(total)}),headingLevel=resolveHeadingLevel(this.headingLevel),header=this.collapsible?html`
37
+ `}render(){const label=this.label==null?this.localize("taskListLabel"):this.label,ariaLabel=hostAriaLabel(this)??label,items=validTaskItems(this.items),total=items.length,completed=items.filter(item=>normalizeTaskStatus(item.status)==="success").length,renderedItems=items.slice(0,MAX_RENDERED_TASKS),canReorder=this.canReorderItems(),number=getNumberFormat(this.effectiveLocale),summary=this.localize("taskListCompletedOfTotal",void 0,{completed:number.format(completed),total:number.format(total)}),headingLevel=resolveHeadingLevel(this.headingLevel),header=this.collapsible?html`
38
38
  <button
39
39
  part="header"
40
40
  type="button"
@@ -58,7 +58,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
58
58
  ${header}
59
59
  </div>
60
60
  <div part="body" id=${this.bodyId} role="list" aria-label=${ariaLabel} ?hidden=${!this.expanded}>
61
- ${canReorder?repeat(items,item=>item.id,item=>this.renderItem(item,0,null,canReorder)):items.map(item=>this.renderItem(item,0,null,canReorder))}
61
+ ${canReorder?repeat(renderedItems,item=>item.id,item=>this.renderItem(item,0,null,canReorder)):renderedItems.map(item=>this.renderItem(item,0,null,canReorder))}
62
62
  </div>
63
63
  <lr-live-region></lr-live-region>
64
64
  </div>
@@ -1,4 +1,4 @@
1
- import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAnchor,LyraHighlight,HighlightActivateDetail,TextSelectDetail}from'../../viewers/document-viewer/anchors.js';import type{LyraFrame}from'../../../internal/variants.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';export interface LyraTerminalEventMap{'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-error':CustomEvent<null>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;'lr-download':CustomEvent<{filename:string;}>;'lr-follow-change':CustomEvent<{following:boolean;}>;'lr-search-change':CustomEvent<LyraSearchChangeDetail>;'lr-highlight-activate':CustomEvent<HighlightActivateDetail>;'lr-text-select':CustomEvent<TextSelectDetail>;}
1
+ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAnchor,LyraHighlight,HighlightActivateDetail,TextSelectDetail}from'../../viewers/document-viewer/anchors.js';export type{LyraAnchor,LyraHighlight,LyraHighlightTone,HighlightActivateDetail,TextSelectDetail,}from'../../viewers/document-viewer/anchors.js';import type{LyraFrame}from'../../../internal/variants.js';import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';export interface LyraTerminalEventMap{'lr-copy':CustomEvent<LyraClipboardWriteSuccess>;'lr-error':CustomEvent<null>;'lr-copy-error':CustomEvent<LyraClipboardWriteFailure>;'lr-download':CustomEvent<{filename:string;}>;'lr-follow-change':CustomEvent<{following:boolean;}>;'lr-search-change':CustomEvent<LyraSearchChangeDetail>;'lr-highlight-activate':CustomEvent<HighlightActivateDetail>;'lr-text-select':CustomEvent<TextSelectDetail>;}
2
2
  /**
3
3
  * `<lr-terminal>` — read-only ANSI console for streamed agent/tool output. Not a PTY: no
4
4
  * stdin/keystroke handling, no cursor-addressed full-screen apps. Split ANSI sequences retain at