@aceshooting/lyra-ui 11.0.0 → 11.2.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.
- package/CHANGELOG.md +151 -0
- package/README.md +8 -0
- package/custom-elements.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +1 -1
- package/dist/components/agent-tools/browser-frame/browser-frame.class.js +1 -1
- package/dist/components/agent-tools/commit-card/commit-card.class.js +1 -1
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/test-results/test-results.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +1 -0
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
- package/dist/components/charts/chart/bar-chart.class.js +1 -1
- package/dist/components/charts/chart/bubble-chart.class.js +1 -1
- package/dist/components/charts/chart/chart.class.js +1 -1
- package/dist/components/charts/chart/doughnut-chart.class.js +1 -1
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/line-chart.class.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +32 -0
- package/dist/components/charts/chart/lite-chart.class.js +17 -4
- package/dist/components/charts/chart/lite-chart.styles.js +29 -0
- package/dist/components/charts/chart/pie-chart.class.js +1 -1
- package/dist/components/charts/chart/polar-area-chart.class.js +1 -1
- package/dist/components/charts/chart/radar-chart.class.js +1 -1
- package/dist/components/charts/chart/scatter-chart.class.js +1 -1
- package/dist/components/conversation/chat-message/chat-message.class.js +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +1 -0
- package/dist/components/conversation/model-select/model-select.class.js +1 -1
- package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +1 -0
- package/dist/components/conversation/voice-picker/voice-picker.class.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +1 -0
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +36 -1
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/table/table.class.d.ts +19 -0
- package/dist/components/data/table/table.class.js +3 -3
- package/dist/components/forms/checkbox/checkbox.class.d.ts +1 -0
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +1 -0
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +1 -0
- package/dist/components/forms/combobox/combobox.class.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +12 -1
- package/dist/components/forms/date-picker/date-input.class.js +4 -2
- package/dist/components/forms/date-picker/date-picker.class.d.ts +30 -4
- package/dist/components/forms/date-picker/date-picker.class.js +4 -4
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +1 -0
- package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +1 -0
- package/dist/components/forms/radio/radio-group.class.js +1 -1
- package/dist/components/forms/radio/radio.class.d.ts +1 -0
- package/dist/components/forms/radio/radio.class.js +1 -1
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +1 -0
- package/dist/components/forms/rubric-form/rubric-form.class.js +1 -1
- package/dist/components/forms/select/select.class.d.ts +1 -0
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/slider/slider.class.d.ts +1 -0
- package/dist/components/forms/slider/slider.class.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +1 -0
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/time-range/time-range.class.d.ts +1 -0
- package/dist/components/forms/time-range/time-range.class.js +1 -1
- package/dist/components/forms/token-input/token-input.class.d.ts +1 -0
- package/dist/components/forms/token-input/token-input.class.js +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.js +2 -2
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +2 -2
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +1 -0
- package/dist/components/media/file-input/file-input.class.js +1 -1
- package/dist/components/media/flag/flag-peer-bulk.d.ts +12 -0
- package/dist/components/media/flag/flag-peer-bulk.js +1 -0
- package/dist/components/media/flag/flag.class.d.ts +28 -0
- package/dist/components/media/flag/flag.class.js +2 -2
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +1 -1
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +2 -2
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/document-compare/document-compare.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
- package/dist/custom-elements-jsx.d.ts +5 -3
- package/dist/events.d.ts +7 -0
- package/dist/internal/canvas.js +1 -1
- package/dist/internal/form-associated.d.ts +1 -0
- package/dist/internal/form-associated.js +1 -1
- package/dist/internal/form-control-labels.js +1 -1
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/svelte.d.ts +5 -3
- package/dist/theme.css +32 -0
- package/dist/vue.d.ts +5 -3
- package/llms/components/lr-agent-eval-dashboard.md +1 -1
- package/llms/components/lr-agent-workspace.md +1 -1
- package/llms/components/lr-box-plot.md +2 -2
- package/llms/components/lr-chart.md +1 -1
- package/llms/components/lr-chunk-inspector.md +1 -1
- package/llms/components/lr-combobox.md +3 -3
- package/llms/components/lr-date-input.md +22 -6
- package/llms/components/lr-date-picker.md +21 -5
- package/llms/components/lr-entity-dossier.md +1 -1
- package/llms/components/lr-eval-run.md +1 -1
- package/llms/components/lr-flag.md +24 -1
- package/llms/components/lr-grounding-summary.md +1 -1
- package/llms/components/lr-heatmap.md +18 -6
- package/llms/components/lr-lite-chart.md +19 -3
- package/llms/components/lr-map.md +2 -2
- package/llms/components/lr-memory-panel.md +1 -1
- package/llms/components/lr-option.md +3 -3
- package/llms/components/lr-popover.md +1 -1
- package/llms/components/lr-provenance-panel.md +1 -1
- package/llms/components/lr-rag-answer.md +1 -1
- package/llms/components/lr-rag-eval-dashboard.md +1 -1
- package/llms/components/lr-retrieval-results.md +1 -1
- package/llms/components/lr-retrieval-trace.md +1 -1
- package/llms/peers.md +10 -10
- package/llms/shared.md +19 -0
- package/llms/tokens.md +12 -0
- package/llms-full.txt +109 -21
- package/package.json +6 -6
- package/vscode-css-data.json +14 -0
- package/vscode-html-data.json +17 -3
- package/web-types.json +30 -4
|
@@ -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{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,
|
|
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{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.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)}}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.shouldFollowLiveTail&&this.scrollToLatest()}disconnectedCallback(){this.resetOwnerRealmWork(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetOwnerRealmWork(),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.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);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)})}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">${entry.icon?entry.icon:html`<span part=${dotPart} data-variant=${variant}></span>`}</span>
|
|
4
4
|
${this.renderText?this.renderText(entry):html`<span part="entry-text">${entry.text}</span>`}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-eval-dashboard.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{finiteCount}from"../../../internal/numbers.js";import{agentStatusKind,agentStatusLabel,agentStatusMessage,agentStatusVariant}from"../agent-status-presentation.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.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_chartValueLabel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_evaluationDashboardLabel,LYRA_DEFAULT_evaluationDashboardNoRuns,LYRA_DEFAULT_evaluationDashboardRunsLabel,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,
|
|
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{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-eval-dashboard.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{finiteCount}from"../../../internal/numbers.js";import{agentStatusKind,agentStatusLabel,agentStatusMessage,agentStatusVariant}from"../agent-status-presentation.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.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_chartValueLabel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_evaluationDashboardLabel,LYRA_DEFAULT_evaluationDashboardNoRuns,LYRA_DEFAULT_evaluationDashboardRunsLabel,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings.generated.js";class LyraAgentEvalDashboard extends LyraElement{constructor(){super(...arguments),this.metrics=[],this.runs=[],this.metricId=null,this.currency="USD",this.showChart=!0,this.chartHeight="220px",this.maxRenderedRuns=100}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,chartValueLabel:LYRA_DEFAULT_chartValueLabel,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,evaluationDashboardLabel:LYRA_DEFAULT_evaluationDashboardLabel,evaluationDashboardNoRuns:LYRA_DEFAULT_evaluationDashboardNoRuns,evaluationDashboardRunsLabel:LYRA_DEFAULT_evaluationDashboardRunsLabel,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning}}static{this.ownedCollectionProperties=Object.freeze(["metrics","runs"])}static{this.styles=[LyraElement.styles,styles]}get normalizedMetrics(){return firstByIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}get normalizedRuns(){return firstByIdentity(Array.isArray(this.runs)?this.runs:[],run=>run.id)}get activeMetric(){const metrics=this.normalizedMetrics;return this.metricId===null?metrics[0]:metrics.find(metric=>metric.id===this.metricId)??metrics[0]}statusLabel(status){const override=agentStatusLabel(status);if(override!==void 0)return override;const kind=agentStatusKind(status),keys={idle:"agentRunStatusIdle",queued:"agentRunStatusQueued",running:"statusRunning",collecting:"agentRunStatusCollecting","waiting-input":"agentRunStatusWaitingInput","waiting-approval":"agentRunStatusWaitingApproval",done:"agentRunStatusDone",error:"statusError",cancelled:"agentRunStatusCancelled"};return keys[kind]?this.localize(keys[kind]):kind.replace(/[-_]+/g," ")}get projectedRuns(){const limit=Math.max(1,finiteCount(this.maxRenderedRuns,100,500));return this.normalizedRuns.slice(0,limit)}formatMetric(metric,value=metric.value){const safe=Number.isFinite(value)?value:0;switch(metric.format){case"percent":return getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(safe);case"milliseconds":return getNumberFormat(this.effectiveLocale,{style:"unit",unit:"millisecond",unitDisplay:"short",maximumFractionDigits:0}).format(safe);case"currency":try{return getNumberFormat(this.effectiveLocale,{style:"currency",currency:this.currency,maximumFractionDigits:2}).format(safe)}catch{return getNumberFormat(this.effectiveLocale,{style:"currency",currency:"USD",maximumFractionDigits:2}).format(safe)}default:return getNumberFormat(this.effectiveLocale,{maximumFractionDigits:2}).format(safe)}}renderRuns(runs){if(!runs.length)return html`<p part="empty">${this.localize("evaluationDashboardNoRuns")}</p>`;const active=this.activeMetric;return html`<section part="runs" aria-label=${this.localize("evaluationDashboardRunsLabel")}><h3 part="runs-heading">${this.localize("evaluationDashboardRunsLabel")}</h3>${runs.map(run=>{const kind=agentStatusKind(run.status),message=agentStatusMessage(run.status);return html`<button part="run" type="button" @click=${()=>this.emit("lr-run-activate",{runId:run.id,run})}><span part="run-label">${run.label}</span><span part="run-meta"><lr-badge part="run-status" variant=${agentStatusVariant(run.status,AGENT_STATUS_VARIANTS[kind]??"neutral")}>${this.statusLabel(run.status)}</lr-badge>${message!==void 0?html`<span part="run-status-message">${message}</span>`:nothing}${active&&run.metrics?.[active.id]!=null?html`<span>${this.formatMetric(active,run.metrics[active.id])}</span>`:nothing}</span></button>`})}</section>`}render(){const label=this.label==null?this.localize("evaluationDashboardLabel"):this.label,semanticLabel=overallSemanticLabel(this,label),active=this.activeMetric,runs=this.projectedRuns,metrics=this.normalizedMetrics,values=runs.map(run=>{const value=active?run.metrics?.[active.id]:void 0;return value!=null&&Number.isFinite(value)?value:null});return html`<section part="base" aria-label=${semanticLabel??nothing}>
|
|
2
2
|
<h2 part="heading">${label}</h2>
|
|
3
3
|
${metrics.length?html`<div part="metrics">${metrics.map(metric=>{const value=this.formatMetric(metric);return html`<button
|
|
4
4
|
part="metric"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{spinnerIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-run.styles.js";import{firstByIdentity}from"../collection-identity.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_agentRunCurrentStepLabel,LYRA_DEFAULT_agentRunStatusAnnounce,LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_cancel,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,
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{spinnerIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-run.styles.js";import{firstByIdentity}from"../collection-identity.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_agentRunCurrentStepLabel,LYRA_DEFAULT_agentRunStatusAnnounce,LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_cancel,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_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings.generated.js";const TICKING_KINDS=new Set(["running","collecting","waiting-input","waiting-approval"]),TERMINAL_KINDS=new Set(["done","error","cancelled"]),STATUS_LABEL={idle:{key:"agentRunStatusIdle"},running:{key:"statusRunning"},queued:{key:"agentRunStatusQueued"},collecting:{key:"agentRunStatusCollecting"},"waiting-input":{key:"agentRunStatusWaitingInput"},"waiting-approval":{key:"agentRunStatusWaitingApproval"},done:{key:"agentRunStatusDone"},error:{key:"statusError"},cancelled:{key:"agentRunStatusCancelled"}},STEP_TO_TASK_STATUS={idle:"pending",running:"running",collecting:"running","waiting-input":"running","waiting-approval":"running",done:"success",error:"error",cancelled:"error"};function toTaskItem(step){return{id:step.id,label:step.label,status:STEP_TO_TASK_STATUS[step.status.kind]??"pending",detail:step.status.message}}class LyraAgentRun extends LyraElement{constructor(){super(...arguments),this.run=null,this.statusLabels={},this.statusVariants={},this.metrics=[],this.showCancel=!0,this.showRetry=!0,this.compact=!1,this.frame="card",this.retryAttempt=0,this.hasHeaderSlot=!1,this.hasSummarySlot=!1,this.onHeaderSlotChange=e=>{this.hasHeaderSlot=e.target.assignedElements({flatten:!0}).length>0},this.onSummarySlotChange=e=>{this.hasSummarySlot=e.target.assignedElements({flatten:!0}).length>0},this.onCancelClick=()=>{this.emit("lr-cancel",{})},this.onRetryClick=()=>{this.retryAttempt+=1,this.emit("lr-run-retry",{attempt:this.retryAttempt})}}static{this.defaultStrings={...super.defaultStrings,agentRunCurrentStepLabel:LYRA_DEFAULT_agentRunCurrentStepLabel,agentRunStatusAnnounce:LYRA_DEFAULT_agentRunStatusAnnounce,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,cancel:LYRA_DEFAULT_cancel,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,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning}}static{this.ownedCollectionProperties=Object.freeze(["run","statusLabels","statusVariants","metrics"])}static{this.styles=[LyraElement.styles,srOnly,styles]}get normalizedMetrics(){return firstByIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasHeaderSlot=this.hasSlotted("header"),this.hasSummarySlot=this.hasSlotted("summary")),changed.has("run")&&this.run?.id!==this.previousRunId&&(this.retryAttempt=0)}hasSlotted(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}updated(changed){super.updated(changed),changed.has("run")&&this.handleRunChange()}handleRunChange(){const runId=this.run?.id,kind=this.run?.status.kind;!(runId!==this.previousRunId)&&kind!==void 0&&kind!==this.previousStatusKind&&this.isAttentionKind(kind)&&this.announceStatus(kind),this.previousRunId=runId,this.previousStatusKind=kind}isAttentionKind(kind){return kind==="waiting-input"||kind==="waiting-approval"||TERMINAL_KINDS.has(kind)}announceStatus(kind){const region=this.liveRegion;region&&(region.mode=kind==="error"||kind==="waiting-input"||kind==="waiting-approval"?"assertive":"polite",region.announce(this.localize("agentRunStatusAnnounce",void 0,{status:this.statusLabel(kind)}),{force:!0}))}statusLabel(kind){const custom=this.statusLabels[kind];if(custom)return custom;const builtIn=STATUS_LABEL[kind];return builtIn?this.localize(builtIn.key):kind.replace(/[-_]+/g," ").replace(/\b\w/g,letter=>letter.toUpperCase())}get currentStep(){const steps=this.run?.steps;if(steps){for(let i=steps.length-1;i>=0;i--)if(steps[i].status.kind==="running")return steps[i]}}get isTicking(){const kind=this.run?.status.kind;return kind!==void 0&&TICKING_KINDS.has(kind)&&Number.isFinite(this.run?.startedAt)}get staticElapsedText(){const run=this.run;if(!run||!TERMINAL_KINDS.has(run.status.kind))return;const startedAt=run.startedAt,endedAt=run.endedAt;if(startedAt==null||endedAt==null||!Number.isFinite(startedAt)||!Number.isFinite(endedAt))return;const d=durationMessageValue(Math.max(0,endedAt-startedAt));return this.localize(d.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:d.key==="durationSeconds"?1:0}).format(d.value)})}get costText(){const cost=this.run?.costEstimate;if(cost==null||!Number.isFinite(cost))return"";const value=finiteRange(cost,cost,0);return(this.formatCost??(c=>getNumberFormat(this.effectiveLocale,{maximumFractionDigits:4}).format(c)))(value)}get canCancel(){const kind=this.run?.status.kind;return this.showCancel&&kind!==void 0&&TICKING_KINDS.has(kind)}get canRetry(){const kind=this.run?.status.kind;return this.showRetry&&(kind==="error"||kind==="cancelled")}render(){const run=this.run;if(!run)return html`<div part="base"><lr-empty part="empty" heading=${this.localize("noData")}></lr-empty></div>`;const kind=run.status.kind,step=this.currentStep,ticking=this.isTicking,staticElapsed=this.staticElapsedText,cost=this.costText,metrics=this.normalizedMetrics,hasSummary=!!run.model||cost!==""||metrics.length>0;return html`
|
|
2
2
|
<div part="base">
|
|
3
3
|
<div part="header">
|
|
4
4
|
<slot name="header" @slotchange=${this.onHeaderSlotChange}></slot>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styles}from"./agent-trace.styles.js";import{normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_agentTraceFilterLabel,
|
|
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{LyraElement}from"../../../internal/lyra-element.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styles}from"./agent-trace.styles.js";import{normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_agentTraceFilterLabel,LYRA_DEFAULT_handoffFromToAgent,LYRA_DEFAULT_handoffToAgent,LYRA_DEFAULT_popover,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool}from"../../../internal/default-strings.generated.js";const KIND_ORDER=["agent","llm","tool","retriever","embedding","other"],KIND_LABEL_KEY={agent:"spanKindAgent",llm:"spanKindLlm",tool:"spanKindTool",retriever:"spanKindRetriever",embedding:"spanKindEmbedding",other:"spanKindOther"};class LyraAgentTrace extends LyraElement{constructor(){super(...arguments),this.spans=[],this.activeSpanId=null,this.hiddenKinds=[],this.showTokens=!1,this.showCost=!1,this.showBars=!0,this.onVisibilityChange=e=>{e.stopPropagation(),this.hiddenKinds=e.detail.hiddenTypes,this.emit("lr-span-visibility-change",{hiddenKinds:[...this.hiddenKinds]})},this.onTreeSpanSelect=e=>{this.activeSpanId=e.detail.spanId}}static{this.defaultStrings={...super.defaultStrings,agentTraceFilterLabel:LYRA_DEFAULT_agentTraceFilterLabel,handoffFromToAgent:LYRA_DEFAULT_handoffFromToAgent,handoffToAgent:LYRA_DEFAULT_handoffToAgent,popover:LYRA_DEFAULT_popover,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool}}static{this.ownedCollectionProperties=Object.freeze(["spans","hiddenKinds"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-span-visibility-change"])}presentKinds(spans){const present=new Set(spans.map(s=>s.kind));return KIND_ORDER.filter(k=>present.has(k))}filteredSpans(spans){if(this.hiddenKinds.length===0)return[...spans];const hidden=new Set(this.hiddenKinds);return spans.filter(span=>!hidden.has(span.kind))}handoffSpans(spans){return spans.filter(span=>span.kind==="agent")}handoffFromAgent(span,byId){if(!span.parentId)return"";const parent=byId.get(span.parentId);return parent?.kind==="agent"?parent.name:""}handoffAccessibleLabel(span,fromAgent){return fromAgent?this.localize("handoffFromToAgent",void 0,{from:fromAgent,to:span.name}):this.localize("handoffToAgent",void 0,{agent:span.name})}selectSpan(id){this.activeSpanId=id,this.emit("lr-span-select",{spanId:id})}renderFilter(spans){const kinds=this.presentKinds(spans);if(kinds.length===0)return nothing;const types=kinds.map(k=>({id:k,label:this.localize(KIND_LABEL_KEY[k])}));return html`
|
|
2
2
|
<lr-graph-legend
|
|
3
3
|
part="filter"
|
|
4
4
|
.label=${this.localize("agentTraceFilterLabel")}
|
|
@@ -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{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,
|
|
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{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf,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 BROWSER_FRAME_PHASE=literalSetConverter(["idle","connecting","streaming","stalled"],"idle");function containRect(containerW,containerH,naturalW,naturalH){if(naturalW===0||naturalH===0||containerW===0||containerH===0)return{left:0,top:0,width:containerW,height:containerH};const containerRatio=containerW/containerH,naturalRatio=naturalW/naturalH;if(naturalRatio>containerRatio){const height=containerW/naturalRatio;return{left:0,top:(containerH-height)/2,width:containerW,height}}const width=containerH*naturalRatio;return{left:(containerW-width)/2,top:0,width,height:containerH}}const STATUS_KEY={idle:"browserFrameStatusIdle",connecting:"browserFrameStatusConnecting",streaming:"browserFrameStatusLive",stalled:"browserFrameStatusStalled"};class LyraBrowserFrame extends LyraElement{constructor(){super(...arguments),this._frameSrc="",this.url="",this._phase="idle",this.controller="agent",this.pings=[],this.controls=!0,this.hasDefaultSlotContent=!1,this.contentRect=null,this.viewportObserverGeneration=0,this.suppressNextStatusAnnouncement=!0,this.onSlotChange=e=>{this.hasDefaultSlotContent=e.target.assignedElements({flatten:!0}).length>0,this.contentRect=null,this.requestUpdate()},this.onFrameLoad=()=>{this.observeViewport(),this.recomputeContentRect()},this.onFrameError=()=>{this.contentRect=null},this.onTakeOver=()=>{const requested=this.controller==="agent"?"user":"agent";this.emit("lr-take-over",{controller:requested})}}static{this.defaultStrings={...super.defaultStrings,browserFrameControllerAgent:LYRA_DEFAULT_browserFrameControllerAgent,browserFrameControllerUser:LYRA_DEFAULT_browserFrameControllerUser,browserFrameHandBack:LYRA_DEFAULT_browserFrameHandBack,browserFrameLabel:LYRA_DEFAULT_browserFrameLabel,browserFrameStatusConnecting:LYRA_DEFAULT_browserFrameStatusConnecting,browserFrameStatusIdle:LYRA_DEFAULT_browserFrameStatusIdle,browserFrameStatusLive:LYRA_DEFAULT_browserFrameStatusLive,browserFrameStatusStalled:LYRA_DEFAULT_browserFrameStatusStalled,browserFrameStop:LYRA_DEFAULT_browserFrameStop,browserFrameTakeOver:LYRA_DEFAULT_browserFrameTakeOver,browserFrameUrlLabel:LYRA_DEFAULT_browserFrameUrlLabel,browserFrameViewOf:LYRA_DEFAULT_browserFrameViewOf,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(["pings"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get frameSrc(){return this._frameSrc}set frameSrc(next){const old=this._frameSrc;this._frameSrc=next??"",old!==this._frameSrc&&(this.contentRect=null,this.requestUpdate("frameSrc",old))}get phase(){return this._phase}set phase(next){const normalized=BROWSER_FRAME_PHASE.normalizeReflected(this,"phase",next),old=this._phase;old!==normalized&&(this._phase=normalized,this.requestUpdate("phase",old))}syncStatusAnnouncementSink(){this.isConnected&&this.statusAnnouncementSink?.element.ownerDocument!==this.ownerDocument&&(this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}connectedCallback(){super.connectedCallback(),this.syncStatusAnnouncementSink(),this.hasUpdated&&(this.suppressNextStatusAnnouncement=!0,this.requestUpdate(),this.observeViewport(),this.recomputeContentRect())}disconnectedCallback(){super.disconnectedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}adoptedCallback(){super.adoptedCallback(),this.resetViewportObserver(),this.statusAnnouncementSink?.release(),this.statusAnnouncementSink=void 0,this.suppressNextStatusAnnouncement=!0}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&!this.suppressNextStatusAnnouncement&&changed.has("phase")&&this.statusAnnouncementSink?.announce(this.localize(STATUS_KEY[this.phase]))}updated(_changed){super.updated(_changed),this.suppressNextStatusAnnouncement=!1}observeViewport(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),ownerDocument=this.ownerDocument;if(!this.isConnected||!viewport||this.viewportResizeObserver&&this.viewportObserverDocument===ownerDocument&&this.viewportObserverTarget===viewport)return;this.resetViewportObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.viewportObserverGeneration,observer=new ResizeObserverCtor(()=>{this.viewportResizeObserver!==observer||this.viewportObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.viewportObserverTarget!==viewport||this.recomputeContentRect()});this.viewportResizeObserver=observer,this.viewportObserverDocument=ownerDocument,this.viewportObserverTarget=viewport,observer.observe(viewport)}resetViewportObserver(){this.viewportObserverGeneration+=1,this.viewportResizeObserver?.disconnect(),this.viewportResizeObserver=void 0,this.viewportObserverDocument=void 0,this.viewportObserverTarget=void 0}recomputeContentRect(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),img=this.renderRoot.querySelector('[part="frame"]');if(!viewport||!img||!img.naturalWidth||!img.naturalHeight){this.contentRect=null;return}this.contentRect=containRect(viewport.clientWidth,viewport.clientHeight,img.naturalWidth,img.naturalHeight)}pingStyle(ping){const x=finiteRange(ping.x,0,0,100),y=finiteRange(ping.y,0,0,100),rect=this.contentRect;return rect?styleMap({left:`${rect.left+x/100*rect.width}px`,top:`${rect.top+y/100*rect.height}px`}):styleMap({left:`${x}%`,top:`${y}%`})}render(){const safeSrc=safeMediaSrc(this.frameSrc);return html`
|
|
2
2
|
<div
|
|
3
3
|
part="base"
|
|
4
4
|
role=${overallSemanticRole(this,"group")??nothing}
|
|
@@ -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{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{styles}from"./commit-card.styles.js";import{getDateTimeFormat}from"../../../internal/intl-cache.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_commitCardCopyHash,LYRA_DEFAULT_commitCardDiffSummary,LYRA_DEFAULT_commitCardHideFiles,LYRA_DEFAULT_commitCardLabel,LYRA_DEFAULT_commitCardShowFiles,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_details,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,
|
|
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{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{styles}from"./commit-card.styles.js";import{getDateTimeFormat}from"../../../internal/intl-cache.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_commitCardCopyHash,LYRA_DEFAULT_commitCardDiffSummary,LYRA_DEFAULT_commitCardHideFiles,LYRA_DEFAULT_commitCardLabel,LYRA_DEFAULT_commitCardShowFiles,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_details,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,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 GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},MAX_DATE_EPOCH_MS=864e13,GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};class LyraCommitCard extends LyraElement{constructor(){super(...arguments),this.hash="",this.message="",this.author="",this.files=[],this.filesExpanded=!1,this.copyable=!0,this.compact=!1,this.frame="card",this.copyStatus="rest",this.copyGeneration=0,this.onCopy=()=>{this.copyHash()},this.toggleFiles=()=>{this.filesExpanded=!this.filesExpanded,this.emit("lr-toggle",{collapsed:!this.filesExpanded})}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,commitCardCopyHash:LYRA_DEFAULT_commitCardCopyHash,commitCardDiffSummary:LYRA_DEFAULT_commitCardDiffSummary,commitCardHideFiles:LYRA_DEFAULT_commitCardHideFiles,commitCardLabel:LYRA_DEFAULT_commitCardLabel,commitCardShowFiles:LYRA_DEFAULT_commitCardShowFiles,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,details:LYRA_DEFAULT_details,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,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(["files"])}static{this.styles=[LyraElement.styles,styles]}get normalizedFiles(){return firstByIdentity(Array.isArray(this.files)?this.files:[],file=>file.path)}disconnectedCallback(){super.disconnectedCallback(),this.resetCopyFeedback()}adoptedCallback(){super.adoptedCallback(),this.resetCopyFeedback()}cancelCopyTimer(){const timer=this.copyTimer;this.copyTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}resetCopyFeedback(){this.copyGeneration+=1,this.cancelCopyTimer(),this.copyStatus="rest"}get subject(){return this.message.split(`
|
|
2
2
|
`)[0]??""}get body(){return this.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim()}get validTimestamp(){if(!(this.timestamp==null||!Number.isFinite(this.timestamp)||this.timestamp>MAX_DATE_EPOCH_MS))return finiteRange(this.timestamp,this.timestamp,0)}get totals(){return this.normalizedFiles.reduce((acc,file)=>({additions:finiteCount(acc.additions+finiteCount(file.additions)),deletions:finiteCount(acc.deletions+finiteCount(file.deletions))}),{additions:0,deletions:0})}async copyHash(){const text=this.hash,owner=this.isConnected?this.ownerDocument.defaultView:null,generation=++this.copyGeneration;this.cancelCopyTimer(),this.copyStatus="rest";const outcome=await writeClipboardText(owner,text);if(!(!owner||!this.isCurrentCopy(generation,owner))){if(!outcome.ok){this.showCopyStatus("error",generation,owner),this.emit("lr-error"),this.emit("lr-copy-error",outcome);return}this.showCopyStatus("success",generation,owner),this.emit("lr-copy",outcome)}}isCurrentCopy(generation,owner){return this.isConnected&&generation===this.copyGeneration&&this.ownerDocument.defaultView===owner}showCopyStatus(status,generation,owner){this.copyStatus=status,this.cancelCopyTimer();let handle=0;handle=owner.setTimeout(()=>{this.copyTimer?.owner!==owner||this.copyTimer.handle!==handle||this.copyTimer.generation!==generation||generation!==this.copyGeneration||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.copyTimer=void 0,this.copyStatus="rest")},1500),this.copyTimer={owner,handle,generation}}render(){const files=this.normalizedFiles,{additions,deletions}=this.totals,timestamp=this.validTimestamp;return html`
|
|
@@ -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{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,
|
|
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{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_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,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}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,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,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}}static{this.ownedCollectionProperties=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)}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.localize("spanProjectionLimit",void 0,{count:MAX_RENDERED_LYRA_SPANS})),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
|
-
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{nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.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,
|
|
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{nextId}from"../../../internal/a11y.js";import{activeElementIn}from"../../../internal/active-element.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 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"
|
|
@@ -15,7 +15,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
15
15
|
<circle cx="12" cy="12" r="9"></circle>
|
|
16
16
|
<line x1="9" y1="9" x2="15" y2="15"></line>
|
|
17
17
|
<line x1="15" y1="9" x2="9" y2="15"></line>
|
|
18
|
-
`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError"};class LyraTaskList extends LyraElement{constructor(){super(...arguments),this.items=[],this.reorderable=!1,this.headingLevel="3",this.expanded=!0,this.collapsible=!0,this.compact=!1,this.frame="card",this.headerId=nextId("task-list-header"),this.bodyId=nextId("task-list-body"),this.isMounting=!0,this.previousStatusById=new Map,this.pendingFocusId=null,this.toggle=()=>{this.collapsible&&(this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,item:LYRA_DEFAULT_item,items:LYRA_DEFAULT_items,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,
|
|
18
|
+
`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError"};class LyraTaskList extends LyraElement{constructor(){super(...arguments),this.items=[],this.reorderable=!1,this.headingLevel="3",this.expanded=!0,this.collapsible=!0,this.compact=!1,this.frame="card",this.headerId=nextId("task-list-header"),this.bodyId=nextId("task-list-body"),this.isMounting=!0,this.previousStatusById=new Map,this.pendingFocusId=null,this.toggle=()=>{this.collapsible&&(this.expanded=!this.expanded,this.emit("lr-toggle",{expanded:this.expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,item:LYRA_DEFAULT_item,items:LYRA_DEFAULT_items,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,taskListCompletedOfTotal:LYRA_DEFAULT_taskListCompletedOfTotal,taskListLabel:LYRA_DEFAULT_taskListLabel,taskListStepCompletedAnnounce:LYRA_DEFAULT_taskListStepCompletedAnnounce,taskListStepFailedAnnounce:LYRA_DEFAULT_taskListStepFailedAnnounce,taskListStepStartedAnnounce:LYRA_DEFAULT_taskListStepStartedAnnounce,treeNodeMoved:LYRA_DEFAULT_treeNodeMoved}}static{this.ownedCollectionProperties=Object.freeze(["items"])}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){if(super.willUpdate(changed),changed.has("reorderable")&&!this.reorderable&&this.clearPendingReorder(),changed.has("items")){for(const item of this.items)for(const child of item.children??[])for(const grandchild of child.children??[])console.warn(`<lr-task-list> item "${grandchild.id}" is nested more than one level deep and will be ignored -- only one level of nesting is supported.`);this.capturePendingReorderFocus()}}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,changed.has("items")&&(this.diffAndAnnounce(wasMounting),this.confirmPendingReorder())}disconnectedCallback(){super.disconnectedCallback(),this.clearPendingReorder()}flattenOneLevel(items){const out=[];for(const item of items){out.push(item);for(const child of item.children??[])out.push(child)}return out}diffAndAnnounce(firstSight){const region=this.liveRegion,nextMap=new Map;for(const item of this.flattenOneLevel(this.items)){const status=normalizeTaskStatus(item.status);if(nextMap.set(item.id,status),!firstSight&®ion){const previous=this.previousStatusById.get(item.id);previous!==void 0&&previous!==status&&(status==="running"?(region.mode="polite",region.announce(this.localize("taskListStepStartedAnnounce",void 0,{label:item.label}),{force:!0})):status==="success"?(region.mode="polite",region.announce(this.localize("taskListStepCompletedAnnounce",void 0,{label:item.label}),{force:!0})):status==="error"&&(region.mode="assertive",region.announce(this.localize("taskListStepFailedAnnounce",void 0,{label:item.label}),{force:!0})))}}this.previousStatusById=nextMap}idsAreUnique(){const ids=new Set;for(const item of this.flattenOneLevel(this.items)){if(item.id.trim().length===0||ids.has(item.id))return!1;ids.add(item.id)}return!0}canReorderItems(){return this.reorderable&&this.idsAreUnique()}siblingItems(parentId){return parentId===null?this.items:this.items.find(item=>item.id===parentId)?.children}requestReorder(item,parentId,delta){if(!this.canReorderItems())return;const siblings=this.siblingItems(parentId);if(!siblings)return;const fromIndex=siblings.findIndex(candidate=>candidate.id===item.id),toIndex=fromIndex+delta;fromIndex<0||toIndex<0||toIndex>=siblings.length||(this.pendingReorder={id:item.id,parentId,originalSiblingIds:siblings.map(candidate=>candidate.id),targetSiblingId:siblings[toIndex].id,fromIndex,toIndex},this.pendingFocusId=null,this.emit("lr-reorder",{taskId:item.id,parentTaskId:parentId,fromIndex,toIndex}))}onItemKeyDown(event,item,parentId){event.composedPath()[0]===event.currentTarget&&(!this.canReorderItems()||!(event.ctrlKey||event.metaKey)||event.key!=="ArrowUp"&&event.key!=="ArrowDown"||(event.preventDefault(),this.requestReorder(item,parentId,event.key==="ArrowDown"?1:-1)))}capturePendingReorderFocus(){const pending=this.pendingReorder;if(!pending)return;const active=activeElementIn(this.shadowRoot);this.pendingFocusId=active instanceof HTMLElement&&active.getAttribute("part")==="item"&&active.dataset.id===pending.id?pending.id:null}confirmPendingReorder(){const pending=this.pendingReorder;if(!pending)return;const siblings=this.siblingItems(pending.parentId);if(!siblings||!this.idsAreUnique()){this.clearPendingReorder();return}const siblingIds=siblings.map(item=>item.id);if(!(siblingIds.length!==pending.originalSiblingIds.length||siblingIds.some((id,index)=>id!==pending.originalSiblingIds[index])))return;this.pendingReorder=void 0;const restoreFocus=this.pendingFocusId===pending.id;if(this.pendingFocusId=null,siblingIds[pending.toIndex]!==pending.id||siblingIds[pending.fromIndex]!==pending.targetSiblingId)return;const moved=siblings[pending.toIndex],region=this.liveRegion;region&&(region.mode="polite",region.announce(this.localize("treeNodeMoved",void 0,{label:moved.label,index:getNumberFormat(this.effectiveLocale).format(pending.toIndex+1),total:getNumberFormat(this.effectiveLocale).format(siblings.length)}),{force:!0})),restoreFocus&&this.focusItem(pending.id)}focusItem(id){[...this.shadowRoot?.querySelectorAll('[part="item"]')??[]].find(candidate=>candidate.dataset.id===id)?.focus()}clearPendingReorder(){this.pendingReorder=void 0,this.pendingFocusId=null}renderItem(item,depth,parentId,canReorder){const status=normalizeTaskStatus(item.status),hasChildren=depth===0&&!!item.children&&item.children.length>0;return html`
|
|
19
19
|
<div
|
|
20
20
|
part="item"
|
|
21
21
|
role="listitem"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./test-results.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_expand,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSkipped,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_testResultsCollapseTest,LYRA_DEFAULT_testResultsCompleteAnnounce,LYRA_DEFAULT_testResultsExpandTest,LYRA_DEFAULT_testResultsFailed,LYRA_DEFAULT_testResultsFilterLabel,LYRA_DEFAULT_testResultsLabel,LYRA_DEFAULT_testResultsLimit,LYRA_DEFAULT_testResultsPassed,LYRA_DEFAULT_testResultsRunning,LYRA_DEFAULT_testResultsSkipped}from"../../../internal/default-strings.generated.js";const STATUSES=["passed","failed","skipped","running"],MAX_RENDERED_TESTS=1e3;function normalizeTestStatus(value){switch(value){case"passed":case"failed":case"skipped":case"running":return value;default:return"skipped"}}const STATUS_COUNT_KEY={passed:"testResultsPassed",failed:"testResultsFailed",skipped:"testResultsSkipped",running:"testResultsRunning"},STATUS_LABEL_KEY={passed:"statusSuccess",failed:"statusError",skipped:"statusSkipped",running:"statusRunning"},STATUS_GLYPH={passed:"\u2713",failed:"\xD7",skipped:"\u2013"};function encodeDetailSlotSegment(value){let encoded="";for(let index=0;index<value.length;){const codePoint=value.codePointAt(index),character=String.fromCodePoint(codePoint);encoded+=codePoint>=55296&&codePoint<=57343?`%u${codePoint.toString(16).toUpperCase().padStart(4,"0")}`:encodeURIComponent(character),index+=character.length}return encoded}function testResultDetailSlotName(suiteId,testId){return`detail-${encodeDetailSlotSegment(suiteId)}:${encodeDetailSlotSegment(testId)}`}class LyraTestResults extends LyraElement{constructor(){super(...arguments),this.suites=[],this.statusFilter=[],this.runId=null,this.runState="idle",this.autoExpandFailures=!0,this.manualExpanded=new Map,this.normalizedSuitesCache=[],this.projectedSuitesCache=[],this.completeStatusCounts={passed:0,failed:0,skipped:0,running:0},this.normalizedTestKeys=new Set,this.detailSlotNames=new Set,this.projectionTruncated=!1,this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.idPrefix=nextId("test-results"),this.pendingCompletionAnnouncement=null}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,expand:LYRA_DEFAULT_expand,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,statusSkipped:LYRA_DEFAULT_statusSkipped,statusSuccess:LYRA_DEFAULT_statusSuccess,testResultsCollapseTest:LYRA_DEFAULT_testResultsCollapseTest,testResultsCompleteAnnounce:LYRA_DEFAULT_testResultsCompleteAnnounce,testResultsExpandTest:LYRA_DEFAULT_testResultsExpandTest,testResultsFailed:LYRA_DEFAULT_testResultsFailed,testResultsFilterLabel:LYRA_DEFAULT_testResultsFilterLabel,testResultsLabel:LYRA_DEFAULT_testResultsLabel,testResultsLimit:LYRA_DEFAULT_testResultsLimit,testResultsPassed:LYRA_DEFAULT_testResultsPassed,testResultsRunning:LYRA_DEFAULT_testResultsRunning,testResultsSkipped:LYRA_DEFAULT_testResultsSkipped}}static{this.ownedCollectionProperties=Object.freeze(["suites","statusFilter"])}static{this.identityCollectionProperties=Object.freeze(["suites"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change"])}connectedCallback(){super.connectedCallback(),this.syncLimitAnnouncementSink(),this.limitAnnouncementInitialized=this.hasUpdated,this.previouslyTruncated=this.projectionTruncated}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}))}willUpdate(changed){if(super.willUpdate(changed),changed.has("suites")){this.rebuildNormalizedSuites();const pruned=new Map([...this.manualExpanded].filter(([key])=>this.normalizedTestKeys.has(key)));pruned.size!==this.manualExpanded.size&&(this.manualExpanded=pruned)}if((changed.has("suites")||changed.has("statusFilter"))&&this.rebuildProjection(),this.rebuildDetailSlotNames(),changed.has("runState")||changed.has("runId")){const previousState=changed.has("runState")?changed.get("runState"):this.runState,previousRunId=changed.has("runId")?changed.get("runId"):this.runId;if(previousState==="running"&&this.runState==="complete"&&this.runId!==null&&previousRunId===this.runId){const number=getNumberFormat(this.effectiveLocale);this.pendingCompletionAnnouncement=this.localize("testResultsCompleteAnnounce",void 0,{passed:number.format(this.countOf("passed")),failed:number.format(this.countOf("failed")),skipped:number.format(this.countOf("skipped"))})}}}rebuildNormalizedSuites(){const normalizedSuites=[],suiteIds=new Set,normalizedTestKeys=new Set,counts={passed:0,failed:0,skipped:0,running:0};for(const suite of Array.isArray(this.suites)?this.suites:[]){if(!suite||typeof suite.id!="string"||suite.id.trim().length===0||suiteIds.has(suite.id))continue;suiteIds.add(suite.id);const testIds=new Set,tests=[];for(const test of Array.isArray(suite.tests)?suite.tests:[]){if(!test||typeof test.id!="string"||test.id.trim().length===0||testIds.has(test.id))continue;testIds.add(test.id);const status=normalizeTestStatus(test.status),normalized={id:test.id,name:typeof test.name=="string"?test.name:"",status,...typeof test.durationMs=="number"?{durationMs:test.durationMs}:{},...typeof test.message=="string"?{message:test.message}:{}};tests.push(normalized),normalizedTestKeys.add(this.testKey(suite.id,normalized.id)),counts[status]++}tests.length>0&&normalizedSuites.push({id:suite.id,name:typeof suite.name=="string"?suite.name:"",tests})}this.normalizedSuitesCache=normalizedSuites,this.normalizedTestKeys=normalizedTestKeys,this.completeStatusCounts=counts}rebuildProjection(){const filteredStatuses=new Set(this.statusFilter),candidates=this.normalizedSuitesCache.flatMap(suite=>suite.tests.filter(test=>filteredStatuses.size===0||filteredStatuses.has(test.status)).map(test=>({suiteId:suite.id,test}))),chosenKeys=new Set,reserve=predicate=>{for(const{suiteId,test}of candidates){if(chosenKeys.size>=MAX_RENDERED_TESTS)break;predicate(suiteId,test)&&chosenKeys.add(this.testKey(suiteId,test.id))}};reserve((suiteId,test)=>this.manualExpanded.get(this.testKey(suiteId,test.id))===!0),reserve((_suiteId,test)=>test.status==="failed"),reserve(()=>!0),this.projectedSuitesCache=this.normalizedSuitesCache.map(suite=>({...suite,tests:suite.tests.filter(test=>chosenKeys.has(this.testKey(suite.id,test.id)))})).filter(suite=>suite.tests.length>0),this.projectionTruncated=chosenKeys.size<candidates.length}updated(changed){if(super.updated(changed),this.pendingCompletionAnnouncement!==null){const text=this.pendingCompletionAnnouncement;this.pendingCompletionAnnouncement=null,this.liveRegion?.announce(text,{force:!0})}this.limitAnnouncementInitialized&&this.projectionTruncated&&!this.previouslyTruncated&&this.limitAnnouncementSink?.announce(this.localize("testResultsLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_TESTS)})),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.projectionTruncated}countOf(status){return this.completeStatusCounts[status]}computeStatusCounts(){return this.completeStatusCounts}testKey(suiteId,testId){return JSON.stringify([suiteId,testId])}scopedDetailSlot(suiteId,testId){return testResultDetailSlotName(suiteId,testId)}rebuildDetailSlotNames(){this.detailSlotNames=new Set([...this.children].map(child=>child.getAttribute("slot")).filter(name=>name!==null))}hasDetail(suiteId,testId){return this.detailSlotNames.has(this.scopedDetailSlot(suiteId,testId))}isExpanded(suiteId,test){const manual=this.manualExpanded.get(this.testKey(suiteId,test.id));return manual!==void 0?manual:this.autoExpandFailures&&test.status==="failed"}toggleFilter(status){const next=this.statusFilter.includes(status)?this.statusFilter.filter(s=>s!==status):[...this.statusFilter,status];this.statusFilter=next,this.emit("lr-filter-change",{statuses:next})}toggleExpanded(suiteId,test){const expanded=!this.isExpanded(suiteId,test),next=new Map(this.manualExpanded);next.set(this.testKey(suiteId,test.id),expanded),this.manualExpanded=next,this.emit("lr-toggle",{suiteId,testId:test.id,expanded})}onDetailSlotChange(){this.requestUpdate()}renderSummary(statusCounts){return html`
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./test-results.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_expand,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSkipped,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_testResultsCollapseTest,LYRA_DEFAULT_testResultsCompleteAnnounce,LYRA_DEFAULT_testResultsExpandTest,LYRA_DEFAULT_testResultsFailed,LYRA_DEFAULT_testResultsFilterLabel,LYRA_DEFAULT_testResultsLabel,LYRA_DEFAULT_testResultsLimit,LYRA_DEFAULT_testResultsPassed,LYRA_DEFAULT_testResultsRunning,LYRA_DEFAULT_testResultsSkipped}from"../../../internal/default-strings.generated.js";const STATUSES=["passed","failed","skipped","running"],MAX_RENDERED_TESTS=1e3;function normalizeTestStatus(value){switch(value){case"passed":case"failed":case"skipped":case"running":return value;default:return"skipped"}}const STATUS_COUNT_KEY={passed:"testResultsPassed",failed:"testResultsFailed",skipped:"testResultsSkipped",running:"testResultsRunning"},STATUS_LABEL_KEY={passed:"statusSuccess",failed:"statusError",skipped:"statusSkipped",running:"statusRunning"},STATUS_GLYPH={passed:"\u2713",failed:"\xD7",skipped:"\u2013"};function encodeDetailSlotSegment(value){let encoded="";for(let index=0;index<value.length;){const codePoint=value.codePointAt(index),character=String.fromCodePoint(codePoint);encoded+=codePoint>=55296&&codePoint<=57343?`%u${codePoint.toString(16).toUpperCase().padStart(4,"0")}`:encodeURIComponent(character),index+=character.length}return encoded}function testResultDetailSlotName(suiteId,testId){return`detail-${encodeDetailSlotSegment(suiteId)}:${encodeDetailSlotSegment(testId)}`}class LyraTestResults extends LyraElement{constructor(){super(...arguments),this.suites=[],this.statusFilter=[],this.runId=null,this.runState="idle",this.autoExpandFailures=!0,this.manualExpanded=new Map,this.normalizedSuitesCache=[],this.projectedSuitesCache=[],this.completeStatusCounts={passed:0,failed:0,skipped:0,running:0},this.normalizedTestKeys=new Set,this.detailSlotNames=new Set,this.projectionTruncated=!1,this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.idPrefix=nextId("test-results"),this.pendingCompletionAnnouncement=null}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,expand:LYRA_DEFAULT_expand,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,statusSkipped:LYRA_DEFAULT_statusSkipped,statusSuccess:LYRA_DEFAULT_statusSuccess,testResultsCollapseTest:LYRA_DEFAULT_testResultsCollapseTest,testResultsCompleteAnnounce:LYRA_DEFAULT_testResultsCompleteAnnounce,testResultsExpandTest:LYRA_DEFAULT_testResultsExpandTest,testResultsFailed:LYRA_DEFAULT_testResultsFailed,testResultsFilterLabel:LYRA_DEFAULT_testResultsFilterLabel,testResultsLabel:LYRA_DEFAULT_testResultsLabel,testResultsLimit:LYRA_DEFAULT_testResultsLimit,testResultsPassed:LYRA_DEFAULT_testResultsPassed,testResultsRunning:LYRA_DEFAULT_testResultsRunning,testResultsSkipped:LYRA_DEFAULT_testResultsSkipped}}static{this.ownedCollectionProperties=Object.freeze(["suites","statusFilter"])}static{this.identityCollectionProperties=Object.freeze(["suites"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change"])}connectedCallback(){super.connectedCallback(),this.syncLimitAnnouncementSink(),this.limitAnnouncementInitialized=this.hasUpdated,this.previouslyTruncated=this.projectionTruncated}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}))}willUpdate(changed){if(super.willUpdate(changed),changed.has("suites")){this.rebuildNormalizedSuites();const pruned=new Map([...this.manualExpanded].filter(([key])=>this.normalizedTestKeys.has(key)));pruned.size!==this.manualExpanded.size&&(this.manualExpanded=pruned)}if((changed.has("suites")||changed.has("statusFilter"))&&this.rebuildProjection(),this.rebuildDetailSlotNames(),changed.has("runState")||changed.has("runId")){const previousState=changed.has("runState")?changed.get("runState"):this.runState,previousRunId=changed.has("runId")?changed.get("runId"):this.runId;if(previousState==="running"&&this.runState==="complete"&&this.runId!==null&&previousRunId===this.runId){const number=getNumberFormat(this.effectiveLocale);this.pendingCompletionAnnouncement=this.localize("testResultsCompleteAnnounce",void 0,{passed:number.format(this.countOf("passed")),failed:number.format(this.countOf("failed")),skipped:number.format(this.countOf("skipped"))})}}}rebuildNormalizedSuites(){const normalizedSuites=[],suiteIds=new Set,normalizedTestKeys=new Set,counts={passed:0,failed:0,skipped:0,running:0};for(const suite of Array.isArray(this.suites)?this.suites:[]){if(!suite||typeof suite.id!="string"||suite.id.trim().length===0||suiteIds.has(suite.id))continue;suiteIds.add(suite.id);const testIds=new Set,tests=[];for(const test of Array.isArray(suite.tests)?suite.tests:[]){if(!test||typeof test.id!="string"||test.id.trim().length===0||testIds.has(test.id))continue;testIds.add(test.id);const status=normalizeTestStatus(test.status),normalized={id:test.id,name:typeof test.name=="string"?test.name:"",status,...typeof test.durationMs=="number"?{durationMs:test.durationMs}:{},...typeof test.message=="string"?{message:test.message}:{}};tests.push(normalized),normalizedTestKeys.add(this.testKey(suite.id,normalized.id)),counts[status]++}tests.length>0&&normalizedSuites.push({id:suite.id,name:typeof suite.name=="string"?suite.name:"",tests})}this.normalizedSuitesCache=normalizedSuites,this.normalizedTestKeys=normalizedTestKeys,this.completeStatusCounts=counts}rebuildProjection(){const filteredStatuses=new Set(this.statusFilter),candidates=this.normalizedSuitesCache.flatMap(suite=>suite.tests.filter(test=>filteredStatuses.size===0||filteredStatuses.has(test.status)).map(test=>({suiteId:suite.id,test}))),chosenKeys=new Set,reserve=predicate=>{for(const{suiteId,test}of candidates){if(chosenKeys.size>=MAX_RENDERED_TESTS)break;predicate(suiteId,test)&&chosenKeys.add(this.testKey(suiteId,test.id))}};reserve((suiteId,test)=>this.manualExpanded.get(this.testKey(suiteId,test.id))===!0),reserve((_suiteId,test)=>test.status==="failed"),reserve(()=>!0),this.projectedSuitesCache=this.normalizedSuitesCache.map(suite=>({...suite,tests:suite.tests.filter(test=>chosenKeys.has(this.testKey(suite.id,test.id)))})).filter(suite=>suite.tests.length>0),this.projectionTruncated=chosenKeys.size<candidates.length}updated(changed){if(super.updated(changed),this.pendingCompletionAnnouncement!==null){const text=this.pendingCompletionAnnouncement;this.pendingCompletionAnnouncement=null,this.liveRegion?.announce(text,{force:!0})}this.limitAnnouncementInitialized&&this.projectionTruncated&&!this.previouslyTruncated&&this.limitAnnouncementSink?.announce(this.localize("testResultsLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(MAX_RENDERED_TESTS)})),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.projectionTruncated}countOf(status){return this.completeStatusCounts[status]}computeStatusCounts(){return this.completeStatusCounts}testKey(suiteId,testId){return JSON.stringify([suiteId,testId])}scopedDetailSlot(suiteId,testId){return testResultDetailSlotName(suiteId,testId)}rebuildDetailSlotNames(){this.detailSlotNames=new Set([...this.children].map(child=>child.getAttribute("slot")).filter(name=>name!==null))}hasDetail(suiteId,testId){return this.detailSlotNames.has(this.scopedDetailSlot(suiteId,testId))}isExpanded(suiteId,test){const manual=this.manualExpanded.get(this.testKey(suiteId,test.id));return manual!==void 0?manual:this.autoExpandFailures&&test.status==="failed"}toggleFilter(status){const next=this.statusFilter.includes(status)?this.statusFilter.filter(s=>s!==status):[...this.statusFilter,status];this.statusFilter=next,this.emit("lr-filter-change",{statuses:next})}toggleExpanded(suiteId,test){const expanded=!this.isExpanded(suiteId,test),next=new Map(this.manualExpanded);next.set(this.testKey(suiteId,test.id),expanded),this.manualExpanded=next,this.emit("lr-toggle",{suiteId,testId:test.id,expanded})}onDetailSlotChange(){this.requestUpdate()}renderSummary(statusCounts){return html`
|
|
2
2
|
<div part="summary">
|
|
3
3
|
${STATUSES.map(status=>{const count=statusCounts[status],formattedCount=getNumberFormat(this.effectiveLocale).format(count);return html`<span part="count" data-status=${status}
|
|
4
4
|
>${this.localize(STATUS_COUNT_KEY[status],void 0,{count:formattedCount})}</span
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styles}from"./thinking-panel.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,
|
|
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{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{styles}from"./thinking-panel.styles.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_thinking,LYRA_DEFAULT_thinkingPanelLabel,LYRA_DEFAULT_thoughtFor}from"../../../internal/default-strings.generated.js";const THINKING_PANEL_MODE=literalSetConverter(["live","post-hoc"],"live"),NEAR_BOTTOM_PX=48;class LyraThinkingPanel extends LyraElement{constructor(){super(...arguments),this.compact=!1,this.frame="card",this.expanded=!1,this._mode="live",this.follow=!0,this.bodyId=nextId("thinking-panel-body"),this.realmGeneration=0,this.onScroll=e=>{const body=e.currentTarget,following=body.scrollHeight-body.scrollTop-body.clientHeight<=NEAR_BOTTOM_PX;following!==this.follow&&(this.follow=following,this.emit("lr-follow-change",{following}))},this.onContentMutated=()=>{if(this.mode!=="live"||!this.expanded||!this.follow||this.scrollRafId!==void 0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const generation=this.realmGeneration,handle=ownerWindow.requestAnimationFrame(()=>{this.scrollRafId!==handle||this.scrollRafOwner!==ownerWindow||this.realmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.scrollRafId=void 0,this.scrollRafOwner=void 0,this.mode==="live"&&this.expanded&&this.follow&&this.scrollToBottom())});this.scrollRafId=handle,this.scrollRafOwner=ownerWindow},this.toggle=()=>{const expanded=!this.expanded;this.emit("lr-toggle-request",{expanded},{cancelable:!0}).defaultPrevented||(this.expanded=expanded,this.emit("lr-toggle",{expanded:this.expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,thinking:LYRA_DEFAULT_thinking,thinkingPanelLabel:LYRA_DEFAULT_thinkingPanelLabel,thoughtFor:LYRA_DEFAULT_thoughtFor}}static{this.styles=[LyraElement.styles,styles]}get mode(){return this._mode}set mode(next){const normalized=THINKING_PANEL_MODE.normalizeReflected(this,"mode",next),old=this._mode;old!==normalized&&(this._mode=normalized,this.requestUpdate("mode",old))}connectedCallback(){super.connectedCallback(),this.armContentObserver()}disconnectedCallback(){super.disconnectedCallback(),this.resetOwnerRealmWork()}adoptedCallback(){super.adoptedCallback(),this.resetOwnerRealmWork()}willUpdate(changed){super.willUpdate(changed),(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live"&&(this.follow=!0)}armContentObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.contentObserver&&this.contentObserverDocument===ownerDocument)return;this.contentObserver?.disconnect(),this.contentObserver=void 0,this.contentObserverDocument=void 0;const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.realmGeneration,observer=new MutationObserverCtor(()=>{this.contentObserver!==observer||this.contentObserverDocument!==ownerDocument||this.realmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.onContentMutated()});this.contentObserver=observer,this.contentObserverDocument=ownerDocument,observer.observe(this,{childList:!0,subtree:!0,characterData:!0})}resetOwnerRealmWork(){this.realmGeneration+=1,this.contentObserver?.disconnect(),this.contentObserver=void 0,this.contentObserverDocument=void 0,this.scrollRafId!==void 0&&this.scrollRafOwner?.cancelAnimationFrame(this.scrollRafId),this.scrollRafId=void 0,this.scrollRafOwner=void 0}updated(changed){super.updated(changed),(changed.has("expanded")||changed.has("mode"))&&this.expanded&&this.mode==="live"&&this.scrollToBottom()}scrollToBottom(){this.follow=!0;const body=this.renderRoot.querySelector('[part="body"]');body&&(body.scrollTop=body.scrollHeight)}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get durationDisplay(){const durationMs=this.safeDurationMs;if(durationMs!=null){const duration=durationMessageValue(durationMs),value=getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value);return{text:this.localize("thoughtFor",void 0,{duration:this.localize(duration.key,void 0,{value})}),pending:!1}}return this.mode==="live"?{text:this.localize("thinking"),pending:!0}:null}render(){const duration=this.durationDisplay,label=this.label==null?this.localize("thinkingPanelLabel"):this.label;return html`
|
|
2
2
|
<div part="base">
|
|
3
3
|
<button
|
|
4
4
|
part="header"
|
|
@@ -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{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{place}from"../../../internal/positioner.js";import{nextId}from"../../../internal/a11y.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.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_open,LYRA_DEFAULT_popover,
|
|
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{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{place}from"../../../internal/positioner.js";import{nextId}from"../../../internal/a11y.js";import{finiteRange}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{durationMessageValue}from"../../../internal/duration.js";import{styles}from"./tool-call-chip.styles.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_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusDenied,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusPending,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusSuccess,LYRA_DEFAULT_toolCall}from"../../../internal/default-strings.generated.js";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"
|
|
@@ -15,7 +15,7 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
|
|
|
15
15
|
<circle cx="12" cy="12" r="9"></circle>
|
|
16
16
|
<line x1="9" y1="9" x2="15" y2="15"></line>
|
|
17
17
|
<line x1="15" y1="9" x2="9" y2="15"></line>
|
|
18
|
-
`)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}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,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,
|
|
18
|
+
`)}function deniedIcon(){return icon(svg`<circle cx="12" cy="12" r="9"></circle><line x1="6" y1="18" x2="18" y2="6"></line>`)}const STATUS_ICON={pending:pendingIcon,running:runningIcon,success:successIcon,error:errorIcon,denied:deniedIcon},STATUS_LABEL={pending:"Pending",running:"Running",success:"Success",error:"Error",denied:"Denied"},STATUS_LABEL_KEY={pending:"statusPending",running:"statusRunning",success:"statusSuccess",error:"statusError",denied:"statusDenied"},STATUS_VALUES=new Set(Object.keys(STATUS_LABEL)),statusConverter={fromAttribute(value){return value!==null&&STATUS_VALUES.has(value)?value:"pending"},toAttribute(value){return value}};class LyraToolCallChip extends LyraElement{constructor(){super(...arguments),this.name="",this.category="",this.status="pending",this.summary="",this.icon="",this.callId="",this.hasDetailSlot=!1,this.tooltipOpen=!1,this.tooltipId=nextId("tool-call-chip-tooltip"),this.hovering=!1,this.focused=!1,this.onDetailSlotChange=e=>{this.hasDetailSlot=this.hasPreviewNodes(e.target.assignedNodes({flatten:!0})),this.hasDetailSlot||this.hideTooltip()},this.onMouseEnter=()=>{this.hovering=!0,this.showTooltip()},this.onMouseLeave=()=>{this.hovering=!1,!this.focused&&this.hideTooltip()},this.onFocus=()=>{this.focused=!0,this.showTooltip()},this.onBlur=()=>{this.focused=!1,!this.hovering&&this.hideTooltip()},this.onKeyDown=e=>{e.key==="Escape"&&this.tooltipOpen&&(e.stopPropagation(),this.hideTooltip())},this.onClick=()=>{this.emit("lr-tool-call-chip-select",{name:this.name,callId:this.callId})}}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,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusDenied:LYRA_DEFAULT_statusDenied,statusError:LYRA_DEFAULT_statusError,statusPending:LYRA_DEFAULT_statusPending,statusRunning:LYRA_DEFAULT_statusRunning,statusSuccess:LYRA_DEFAULT_statusSuccess,toolCall:LYRA_DEFAULT_toolCall}}static{this.styles=[LyraElement.styles,styles]}hasPreviewNodes(nodes){return nodes.some(node=>node.nodeType===3?!!node.textContent?.trim():node.nodeType===1&&!node.hasAttribute("slot"))}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasDetailSlot=this.hasPreviewNodes(Array.from(this.childNodes)))}updated(changed){if(super.updated(changed),changed.has("tooltipOpen")&&(this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen)){const anchor=this.renderRoot.querySelector('[part="base"]'),tooltip=this.renderRoot.querySelector('[part="tooltip"]');anchor&&tooltip&&(this.cleanupPositioner=place(anchor,tooltip,{placement:"top-start"}))}}disconnectedCallback(){super.disconnectedCallback(),this.cleanupPositioner?.(),this.cleanupPositioner=void 0,this.tooltipOpen=!1,this.hovering=!1,this.focused=!1}showTooltip(){!this.hasDetailSlot||this.tooltipOpen||(this.tooltipOpen=!0)}hideTooltip(){this.tooltipOpen&&(this.tooltipOpen=!1)}focus(options){this.baseEl?.focus(options)}blur(){this.baseEl?.blur()}click(){this.baseEl?.click()}get effectiveStatus(){return STATUS_VALUES.has(this.status)?this.status:"pending"}get safeDurationMs(){return this.durationMs!=null&&Number.isFinite(this.durationMs)?finiteRange(this.durationMs,0,0):null}get accessibleLabel(){const parts=[this.name||this.localize("toolCall")];this.summary&&parts.push(this.summary),parts.push(this.localize(STATUS_LABEL_KEY[this.effectiveStatus]));const durationMs=this.safeDurationMs;return durationMs!=null&&parts.push(this.localizedDuration(durationMs)),parts.join(this.localize("accessibleLabelSeparator"))}localizedDuration(ms){const duration=durationMessageValue(ms);return this.localize(duration.key,void 0,{value:getNumberFormat(this.effectiveLocale,{maximumFractionDigits:duration.key==="durationSeconds"?1:0}).format(duration.value)})}render(){const hasCategory=this.category.length>0,hasSummary=this.summary.length>0,durationMs=this.safeDurationMs,hasDuration=durationMs!=null,status=this.effectiveStatus;return html`
|
|
19
19
|
<button
|
|
20
20
|
part="base"
|
|
21
21
|
type="button"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
2
|
import { LyraElement, type LyraEventDetailSnapshot } from '../../../internal/lyra-element.js';
|
|
3
|
+
import '../../../internal/form-control-labels.js';
|
|
3
4
|
import '../../forms/select/select.class.js';
|
|
4
5
|
import '../../forms/combobox/option.class.js';
|
|
5
6
|
import { type FormOwnerValue } from '../../../internal/form-associated.js';
|