@weapp-vite/dashboard 6.17.1 → 6.17.3
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/dist/assets/AppInsetPanel.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/assets/AppMetricTile.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/assets/AppRuntimeBadge.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/assets/AppSectionHeading.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/assets/activity.js +6 -5
- package/dist/assets/analyze.js +36 -30
- package/dist/assets/clipboard.js +1 -0
- package/dist/assets/css.worker-DBVD8oXr.js +93 -0
- package/dist/assets/echarts.js +4 -11
- package/dist/assets/editor.worker-CdQrwHl8.js +26 -0
- package/dist/assets/html.worker-CwpTb9lJ.js +470 -0
- package/dist/assets/index.css +1 -2
- package/dist/assets/index.js +1 -1
- package/dist/assets/index2.js +2 -0
- package/dist/assets/json.worker-BoL8UZqY.js +58 -0
- package/dist/assets/monaco.css +1 -1
- package/dist/assets/monaco.js +319 -288
- package/dist/assets/tokens.js +1 -1
- package/dist/assets/{ts.worker-B0J26iPs.js → ts.worker-BH9nVgjN.js} +237 -253
- package/dist/assets/vendor.js +8 -1
- package/dist/assets/vue.js +1 -1
- package/package.json +3 -3
- package/dist/assets/AppEmptyState.js +0 -1
- package/dist/assets/AppInsetPanel.js +0 -1
- package/dist/assets/AppMetricTile.js +0 -1
- package/dist/assets/AppRuntimeBadge.js +0 -1
- package/dist/assets/AppSectionHeading.js +0 -1
- package/dist/assets/css.worker-CvXBzhp8.js +0 -89
- package/dist/assets/editor.worker-Cn2oRESe.js +0 -26
- package/dist/assets/html.worker-BO6WuOEO.js +0 -502
- package/dist/assets/json.worker-BkJRGcCJ.js +0 -58
- package/dist/assets/pages.js +0 -2
- package/dist/assets/rolldown-runtime.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as r}from"./index.js";import{d as n,o as t,c as s,n as a,u as c,t as l,g as m,e as d,j as i}from"./vue.js";const p={key:0,class:"text-[11px] uppercase tracking-[0.18em] text-(--dashboard-text-soft)"},b=n({__name:"AppInsetPanel",props:{eyebrow:{}},setup(e){return(o,u)=>(t(),s("div",{class:a(c(r)())},[e.eyebrow?(t(),s("p",p,l(e.eyebrow),1)):m("",!0),d("div",{class:a(e.eyebrow?"mt-3":void 0)},[i(o.$slots,"default")],2)],2))}});export{b as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as s,o,c as r,n,j as l,b as d,w as p,h as b,t,e as i}from"./vue.js";const m=s({__name:"AppMetaLabel",props:{accent:{type:Boolean}},setup(e){return(a,c)=>(o(),r("p",{class:n(["text-[11px] uppercase tracking-[0.18em]",e.accent?"text-(--dashboard-accent)":"text-(--dashboard-text-soft)"])},[l(a.$slots,"default")],2))}}),u={class:"mt-1.5 text-base font-semibold text-(--dashboard-text)"},x="rounded-xl border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-3",h=s({__name:"AppMetricTile",props:{label:{},value:{}},setup(e){return(a,c)=>(o(),r("div",{class:n(x)},[d(m,null,{default:p(()=>[b(t(e.label),1)]),_:1}),i("p",u,t(e.value),1)]))}});export{h as _,m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a}from"./index.js";import{d as t,o as n,c as s,n as o,u as r,t as l}from"./vue.js";const u=t({__name:"AppRuntimeBadge",props:{label:{},tone:{default:"neutral"}},setup(e){return(m,c)=>(n(),s("span",{class:o(r(a)({tone:e.tone}))},l(e.label),3))}});export{u as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as l,_ as m}from"./index.js";import{d,o as s,c as a,n as o,u as x,t as c,g as n,e as t,b as h,j as u}from"./vue.js";const f={key:0,class:"text-[11px] uppercase tracking-[0.22em] text-(--dashboard-accent)"},b={class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-(--dashboard-accent-soft) text-(--dashboard-accent)"},y={class:"h-5 w-5"},g={class:"min-w-0"},p={class:"font-semibold tracking-tight"},k={key:0,class:"mt-1 text-xs uppercase tracking-[0.16em] text-(--dashboard-text-soft)"},_={key:1,class:"mt-2 text-sm leading-6 text-(--dashboard-text-muted)"},j=d({__name:"AppIconFeatureCard",props:{iconName:{},title:{},description:{},eyebrow:{},interactive:{type:Boolean},meta:{}},setup(e){return(i,r)=>(s(),a("div",{class:o(x(l)({interactive:e.interactive}))},[e.eyebrow?(s(),a("p",f,c(e.eyebrow),1)):n("",!0),t("div",{class:o(e.eyebrow?"mt-3 flex items-start gap-3":"flex items-start gap-3")},[t("span",b,[t("span",y,[h(m,{name:e.iconName},null,8,["name"])])]),t("div",g,[t("h3",p,c(e.title),1),e.meta?(s(),a("p",k,c(e.meta),1)):n("",!0),e.description?(s(),a("p",_,c(e.description),1)):n("",!0)])],2)],2))}}),w={class:"space-y-1.5"},v={key:0,class:"text-[11px] uppercase tracking-[0.28em] text-(--dashboard-accent)"},$={class:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between"},N={class:"text-xl font-semibold tracking-tight md:text-2xl"},B={key:0,class:"mt-1 text-sm leading-6 text-(--dashboard-text-muted)"},V=d({__name:"AppSectionHeading",props:{eyebrow:{default:void 0},title:{},description:{default:void 0}},setup(e){return(i,r)=>(s(),a("div",w,[e.eyebrow?(s(),a("p",v,c(e.eyebrow),1)):n("",!0),t("div",$,[t("div",null,[t("h2",N,c(e.title),1),e.description?(s(),a("p",B,c(e.description),1)):n("",!0)]),u(i.$slots,"aside")])]))}});export{j as _,V as a};
|
package/dist/assets/activity.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
`));function l(e){a.value=e,o&&clearTimeout(o),o=setTimeout(()=>{a.value=``,o=null},1800)}async function u(){try{await L(c.value),l(`已复制`)}catch{l(`复制失败`)}}function f(){let e=new Blob([`${JSON.stringify(n.events,null,2)}\n`],{type:`application/json`}),t=URL.createObjectURL(e),r=document.createElement(`a`);r.href=t,r.download=`weapp-vite-dashboard-events.json`,r.click(),URL.revokeObjectURL(t),l(`已导出`)}return v(()=>{o&&clearTimeout(o)}),(n,i)=>(_(),T(`div`,ae,[h(`p`,V,` 匹配 `+p(t.filteredCount)+` / `+p(t.totalCount)+` 条事件 `,1),h(`div`,H,[a.value?(_(),T(`span`,U,p(a.value),1)):S(``,!0),h(`button`,{type:`button`,class:`h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 text-sm text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none disabled:opacity-50`,disabled:t.events.length===0,onClick:u},` 复制事件 `,8,W),h(`button`,{type:`button`,class:`h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 text-sm text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none disabled:opacity-50`,disabled:t.events.length===0,onClick:f},` 导出 JSON `,8,G),e(h(`select`,{"onUpdate:modelValue":i[0]||=e=>r.value=e,class:`h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-2.5 text-sm text-(--dashboard-text) outline-none transition focus:border-(--dashboard-accent)`},[...i[1]||=[h(`option`,{value:`time`},` 按时间 `,-1),h(`option`,{value:`duration`},` 按耗时 `,-1),h(`option`,{value:`severity`},` 按等级 `,-1),h(`option`,{value:`source`},` 按来源 `,-1)]],512),[[y,r.value]])])]))}}),q={class:`flex items-start justify-between gap-3`},J={key:0,class:`text-[11px] uppercase tracking-[0.18em] text-(--dashboard-accent)`},oe={class:`mt-1 text-lg font-semibold tracking-tight`},se={class:`mt-3 text-sm leading-6 text-(--dashboard-text-muted)`},ce={key:0,class:`mt-3 text-[11px] uppercase tracking-[0.18em] text-(--dashboard-text-soft)`},le={key:1,class:`mt-2 text-sm font-medium text-(--dashboard-text)`},ue=t({__name:`AppRuntimeFocusCard`,props:{event:{},eyebrow:{},emptyTitle:{},emptyDetail:{},durationText:{}},setup(e){let t=e,r=g(()=>t.event?M(t.event):null),i=g(()=>t.event?.title??t.emptyTitle??`尚无运行事件`),s=g(()=>t.event?.detail??t.emptyDetail??`当前工作区还没有推入结构化运行事件。`),l=g(()=>t.event?P(t.event):null);return(e,u)=>(_(),T(`div`,{class:x(o(D)())},[h(`div`,q,[h(`div`,null,[t.eyebrow?(_(),T(`p`,J,p(t.eyebrow),1)):S(``,!0),h(`h3`,oe,p(i.value),1)]),r.value?(_(),m(z,a(n({key:0},r.value)),null,16)):S(``,!0)]),h(`p`,se,p(s.value),1),t.event?(_(),T(`p`,ce,p(l.value),1)):S(``,!0),t.durationText?(_(),T(`p`,le,p(t.durationText),1)):S(``,!0),c(e.$slots,`default`)],2))}}),de={key:0,class:`mt-3 flex flex-wrap gap-1.5`},fe={key:1,class:`mt-4 grid gap-3 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-3`},pe={class:`flex min-w-0 items-start justify-between gap-3`},me={class:`min-w-0`},he={key:0,class:`mt-1 truncate font-mono text-xs text-(--dashboard-text-soft)`},ge={key:0,class:`grid gap-2 sm:grid-cols-2`},_e={class:`text-[11px] text-(--dashboard-text-soft)`},ve={class:`mt-1 text-sm font-semibold text-(--dashboard-text)`},ye={key:1,class:`flex flex-wrap gap-1.5`},be={key:2,class:`grid gap-2 text-xs leading-5 text-(--dashboard-text-muted)`},xe={key:0},Se={key:1},Ce=t({__name:`ActivitySelectedEventPanel`,props:{event:{}},setup(e){let t=e,n=g(()=>t.event?.durationMs===void 0?void 0:`耗时 ${N(t.event.durationMs)}`),r=g(()=>{let e=t.event?.profile;return e?[{label:`总耗时`,value:N(e.totalMs)},{label:`构建核心`,value:N(e.buildCoreMs)},{label:`转换`,value:N(e.transformMs)},{label:`写入`,value:N(e.writeMs)},{label:`监听到脏标记`,value:N(e.watchToDirtyMs)},{label:`产物发射`,value:N(e.emitMs)},{label:`共享 chunk`,value:N(e.sharedChunkResolveMs)}].filter(e=>e.value!==`未记录`):[]}),i=g(()=>{let e=t.event?.profile;return e?[{label:`脏入口`,value:e.dirtyCount},{label:`待处理`,value:e.pendingCount},{label:`已发射`,value:e.emittedCount}].filter(e=>typeof e.value==`number`):[]}),a=g(()=>t.event?.profile?.sourceRootFile??t.event?.profile?.relativeFile??t.event?.profile?.file);return(t,o)=>(_(),m(I,{eyebrow:`Selected`,title:`当前事件`,"icon-name":`metric-search`},{default:E(()=>[u(ue,{event:e.event,eyebrow:`focus`,"empty-title":`未选择事件`,"empty-detail":`选择左侧事件后查看详情。`,"duration-text":n.value},{default:E(()=>[e.event?.tags?.length?(_(),T(`div`,de,[(_(!0),T(b,null,s(e.event.tags,e=>(_(),m(z,{key:e,label:e,tone:`neutral`},null,8,[`label`]))),128))])):S(``,!0),e.event?.profile?(_(),T(`div`,fe,[h(`div`,pe,[h(`div`,me,[o[0]||=h(`p`,{class:`text-sm font-semibold text-(--dashboard-text)`},` HMR 阶段明细 `,-1),a.value?(_(),T(`p`,he,p(a.value),1)):S(``,!0)]),e.event.profile.event?(_(),m(z,{key:0,label:e.event.profile.event,tone:`info`},null,8,[`label`])):S(``,!0)]),r.value.length>0?(_(),T(`dl`,ge,[(_(!0),T(b,null,s(r.value,e=>(_(),T(`div`,{key:e.label,class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2`},[h(`dt`,_e,p(e.label),1),h(`dd`,ve,p(e.value),1)]))),128))])):S(``,!0),i.value.length>0?(_(),T(`div`,ye,[(_(!0),T(b,null,s(i.value,e=>(_(),m(z,{key:e.label,label:`${e.label} ${e.value}`,tone:`neutral`},null,8,[`label`]))),128))])):S(``,!0),e.event.profile.dirtyReasonSummary?.length||e.event.profile.pendingReasonSummary?.length?(_(),T(`div`,be,[e.event.profile.dirtyReasonSummary?.length?(_(),T(`p`,xe,` 脏标记:`+p(e.event.profile.dirtyReasonSummary.join(`、`)),1)):S(``,!0),e.event.profile.pendingReasonSummary?.length?(_(),T(`p`,Se,` 待处理:`+p(e.event.profile.pendingReasonSummary.join(`、`)),1)):S(``,!0)])):S(``,!0)])):S(``,!0)]),_:1},8,[`event`,`duration-text`])]),_:1}))}}),we={class:`flex items-start justify-between gap-3`},Te={class:`min-w-0`},Ee={class:`truncate font-medium text-(--dashboard-text)`},De={class:`mt-1 text-[11px] uppercase tracking-[0.16em] text-(--dashboard-text-soft)`},Oe={key:0,class:`mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-(--dashboard-text-soft)`},ke={key:1,class:`mt-3 text-sm text-(--dashboard-text-muted)`},Ae=t({__name:`AppRuntimeSourceCard`,props:{source:{},count:{},errorCount:{},averageDuration:{},latestTimestamp:{},countLabel:{}},setup(e){let t=e,n=g(()=>k(t)),r=g(()=>t.latestTimestamp?`最近事件 ${t.latestTimestamp}`:`${t.count} ${t.countLabel??`条事件`}`),i=g(()=>[{key:`error-count`,label:`错误 ${t.errorCount}`},{key:`average-duration`,label:`平均耗时 ${t.averageDuration}`}]),c=g(()=>`平均耗时 ${t.averageDuration}`);return(e,l)=>(_(),T(`div`,{class:x(o(D)({padding:`sm`}))},[h(`div`,we,[h(`div`,Te,[h(`p`,Ee,p(t.source),1),h(`p`,De,p(r.value),1)]),u(z,a(C(n.value)),null,16)]),t.latestTimestamp?(_(),T(`div`,Oe,[(_(!0),T(b,null,s(i.value,e=>(_(),T(`span`,{key:e.key,class:`rounded-full border border-(--dashboard-border) px-2 py-0.5`},p(e.label),1))),128))])):(_(),T(`p`,ke,p(c.value),1))],2))}}),je={class:`mt-1 text-lg font-semibold`},Me=t({__name:`AppStatCard`,props:{label:{},value:{}},setup(e){let t=D({padding:`sm`});return(n,r)=>(_(),T(`div`,{class:x(o(t))},[u(B,null,{default:E(()=>[w(p(e.label),1)]),_:1}),h(`p`,je,p(e.value),1)],2))}}),Ne={class:`flex shrink-0 items-center gap-2`},Pe={key:0,class:`text-xs font-medium text-(--dashboard-accent)`},Fe={class:`h-3.5 w-3.5`},Ie={class:`grid gap-3`},Le={class:`flex items-start justify-between gap-3`},Re={class:`min-w-0`},ze={class:`text-sm font-semibold text-(--dashboard-text)`},Be={class:`mt-1 text-xs leading-5 text-(--dashboard-text-muted)`},Ve={class:`grid grid-cols-2 gap-2 sm:grid-cols-5 xl:grid-cols-2 2xl:grid-cols-5`},He={key:0,class:`grid max-h-52 gap-2 overflow-y-auto pr-1`},Ue={class:`flex items-start justify-between gap-3`},We={class:`min-w-0`},Ge={class:`truncate text-sm font-medium text-(--dashboard-text)`},Ke={class:`mt-1 truncate text-xs text-(--dashboard-text-soft)`},qe={class:`mt-2 line-clamp-2 text-xs leading-5 text-(--dashboard-text-muted)`},Je=t({__name:`RuntimeIncidentDigestPanel`,props:{digest:{}},setup(e){let t=e,n=d(``),r=null,i=g(()=>t.digest.status===`critical`?`error`:t.digest.status===`warning`?`warning`:`success`);function a(e){return e===`error`?`text-rose-600 dark:text-rose-300`:e===`warning`?`text-amber-600 dark:text-amber-300`:`text-(--dashboard-accent)`}function o(e){return e===`critical`?`border-rose-400/60 bg-(--dashboard-panel-muted)`:e===`warning`?`border-amber-400/60 bg-(--dashboard-panel-muted)`:`border-emerald-400/60 bg-(--dashboard-panel-muted)`}function c(e){n.value=e,r&&clearTimeout(r),r=setTimeout(()=>{n.value=``,r=null},1800)}async function l(){try{await L(t.digest.report),c(`摘要已复制`)}catch{c(`复制失败`)}}return v(()=>{r&&clearTimeout(r)}),(t,r)=>(_(),m(I,{eyebrow:`Incident`,title:`事故摘要`,"icon-name":`metric-quality`},{header:E(()=>[h(`div`,Ne,[n.value?(_(),T(`span`,Pe,p(n.value),1)):S(``,!0),h(`button`,{type:`button`,class:`inline-flex h-8 items-center gap-1.5 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 text-xs text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none`,onClick:l},[h(`span`,Fe,[u(O,{name:`metric-copy`})]),r[0]||=w(` 复制 `,-1)])])]),default:E(()=>[h(`div`,Ie,[h(`div`,{class:x([`rounded-md border px-3 py-2.5`,o(e.digest.status)])},[h(`div`,Le,[h(`div`,Re,[h(`p`,ze,p(e.digest.statusLabel),1),h(`p`,Be,p(e.digest.statusDetail),1)]),u(z,{label:e.digest.statusLabel,tone:i.value},null,8,[`label`,`tone`])])],2),h(`div`,Ve,[(_(!0),T(b,null,s(e.digest.metrics,e=>(_(),m(re,{key:e.label,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),e.digest.incidents.length>0?(_(),T(`div`,He,[(_(!0),T(b,null,s(e.digest.incidents,e=>(_(),T(`article`,{key:e.id,class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5`},[h(`div`,Ue,[h(`div`,We,[h(`p`,Ge,p(e.title),1),h(`p`,Ke,p(e.source)+` · `+p(e.kindLabel)+` · `+p(e.timestamp)+` · `+p(e.duration),1)]),h(`span`,{class:x([`shrink-0 text-xs font-semibold`,a(e.level)])},p(e.levelLabel),3)]),h(`p`,qe,p(e.reason)+` · `+p(e.detail),1)]))),128))])):(_(),m(R,{key:1,compact:``},{default:E(()=>[...r[1]||=[w(` 当前筛选范围内没有需要处理的运行时事件。 `,-1)]]),_:1}))])]),_:1}))}}),Ye={class:`grid min-h-0 content-start gap-3 overflow-y-auto pr-1`},Xe={class:`grid gap-2 sm:grid-cols-2`},Ze={class:`grid max-h-44 gap-2 overflow-y-auto pr-1`},Qe={class:`flex items-start justify-between gap-3`},$e={class:`font-medium`},et={class:`mt-1 text-sm leading-6 text-(--dashboard-text-muted)`},tt={key:0,class:`grid max-h-full gap-2 overflow-y-auto pr-1`},nt=t({__name:`ActivityInsightPanel`,props:{selectedEvent:{},incidentDigest:{},eventSummary:{},filteredEventSummary:{},diagnostics:{},sourceBreakdown:{}},setup(e){return(t,r)=>(_(),T(`div`,Ye,[u(Ce,{event:e.selectedEvent},null,8,[`event`]),u(Je,{digest:e.incidentDigest},null,8,[`digest`]),u(I,{eyebrow:`Runtime`,title:`事件摘要`,"icon-name":`metric-time`},{default:E(()=>[h(`div`,Xe,[(_(!0),T(b,null,s([...e.eventSummary,...e.filteredEventSummary],e=>(_(),m(Me,n({key:e.label},{ref_for:!0},e),null,16))),128))])]),_:1}),u(I,{eyebrow:`Diagnostics`,title:`当前诊断队列`,"icon-name":`metric-health`,"content-class":`min-h-0 overflow-hidden`},{default:E(()=>[h(`ul`,Ze,[(_(!0),T(b,null,s(e.diagnostics,e=>(_(),T(`li`,{key:e.label,class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-4 py-3`},[h(`div`,Qe,[h(`div`,null,[h(`p`,$e,p(e.label),1),h(`p`,et,p(e.detail),1)]),u(z,{label:e.status,tone:`info`},null,8,[`label`])])]))),128))])]),_:1}),u(I,{eyebrow:`Sources`,title:`事件来源`,"icon-name":`hero-system`,"content-class":`min-h-0 overflow-hidden`},{default:E(()=>[e.sourceBreakdown.length>0?(_(),T(`div`,tt,[(_(!0),T(b,null,s(e.sourceBreakdown,e=>(_(),m(Ae,n({key:e.source},{ref_for:!0},e),null,16))),128))])):S(``,!0)]),_:1})]))}}),rt={class:`grid gap-3 xl:grid-cols-[minmax(14rem,0.85fr)_minmax(0,1.15fr)]`},it={for:`dashboard-event-search`},at=[`value`],ot={class:`grid gap-3`},st={class:`mt-2 flex flex-wrap gap-2`},ct=[`onClick`],lt={key:0,class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},ut={class:`grid gap-3 md:grid-cols-3`},dt={class:`mt-2 flex flex-wrap gap-2`},ft=[`onClick`],pt={class:`mt-2 flex flex-wrap gap-2`},mt=[`onClick`],ht={class:`mt-2 flex flex-wrap gap-2`},gt=[`onClick`],_t=t({__name:`AppEventFilterPanel`,props:{searchQuery:{},presetDescription:{},filterPresets:{},eventKindOptions:{},eventLevelOptions:{},eventSourceOptions:{},eventKindFilter:{},eventLevelFilter:{},eventSourceFilter:{}},emits:[`update:searchQuery`,`update:eventKindFilter`,`update:eventLevelFilter`,`update:eventSourceFilter`,`applyPreset`],setup(e,{emit:t}){let n=e,r=t;function i(){return F({kind:`theme`,active:!1})}function a(e,t){return F({kind:`theme`,active:e===t})}return(t,o)=>(_(),m(ie,null,{default:E(()=>[h(`div`,rt,[h(`div`,null,[h(`label`,it,[u(B,null,{default:E(()=>[...o[1]||=[w(` 搜索事件 `,-1)]]),_:1})]),h(`input`,{id:`dashboard-event-search`,value:e.searchQuery,type:`text`,placeholder:`搜索标题、详情、来源或标签`,class:`mt-2 w-full rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2 text-sm text-(--dashboard-text) outline-none transition focus:border-(--dashboard-border-strong)`,onInput:o[0]||=e=>r(`update:searchQuery`,e.target.value)},null,40,at)]),h(`div`,ot,[h(`div`,null,[u(B,null,{default:E(()=>[...o[2]||=[w(` 快速预设 `,-1)]]),_:1}),h(`div`,st,[(_(!0),T(b,null,s(e.filterPresets,e=>(_(),T(`button`,{key:e.key,class:x(i()),onClick:t=>r(`applyPreset`,e.key)},p(e.label),11,ct))),128))]),e.presetDescription?(_(),T(`p`,lt,p(e.presetDescription),1)):S(``,!0)]),h(`div`,ut,[h(`div`,null,[u(B,null,{default:E(()=>[...o[3]||=[w(` 类型过滤 `,-1)]]),_:1}),h(`div`,dt,[(_(!0),T(b,null,s(e.eventKindOptions,e=>(_(),T(`button`,{key:e.value,class:x(a(n.eventKindFilter,e.value)),onClick:t=>r(`update:eventKindFilter`,e.value)},p(e.label),11,ft))),128))])]),h(`div`,null,[u(B,null,{default:E(()=>[...o[4]||=[w(` 等级过滤 `,-1)]]),_:1}),h(`div`,pt,[(_(!0),T(b,null,s(e.eventLevelOptions,e=>(_(),T(`button`,{key:e.value,class:x(a(n.eventLevelFilter,e.value)),onClick:t=>r(`update:eventLevelFilter`,e.value)},p(e.label),11,mt))),128))])]),h(`div`,null,[u(B,null,{default:E(()=>[...o[5]||=[w(` 来源过滤 `,-1)]]),_:1}),h(`div`,ht,[(_(!0),T(b,null,s(e.eventSourceOptions,e=>(_(),T(`button`,{key:e.value,class:x(a(n.eventSourceFilter,e.value)),onClick:t=>r(`update:eventSourceFilter`,e.value)},p(e.label),11,gt))),128))])])])])])]),_:1}))}}),vt={class:`flex items-start justify-between gap-3`},yt={class:`font-medium text-(--dashboard-text)`},bt=t({__name:`AppRuntimeEventListItem`,props:{event:{},selected:{type:Boolean}},setup(e){let t=e,n=g(()=>M(t.event)),r=g(()=>P(t.event)),i=g(()=>t.selected?`border-(--dashboard-border-strong) bg-(--dashboard-panel)`:`border-(--dashboard-border)`);return(e,o)=>(_(),T(`li`,{class:x([`rounded-md border bg-(--dashboard-panel-muted) px-4 py-3 transition`,i.value])},[h(`div`,vt,[h(`div`,null,[h(`p`,yt,p(t.event.title),1),u(B,{class:`mt-1`},{default:E(()=>[w(p(r.value),1)]),_:1})]),u(z,a(C(n.value)),null,16)])],2))}}),xt=1e3,St=5,Y={error:4,warning:3,success:2,info:1};function X(e){let t=Date.parse(e.timestamp);return Number.isFinite(t)?t:0}function Z(e,t){return typeof e.durationMs==`number`&&e.durationMs>=t}function Ct(e,t){return e.level===`error`||e.level===`warning`||Z(e,t)}function wt(e,t){let n=[];return e.level===`error`?n.push(`错误事件`):e.level===`warning`&&n.push(`警告事件`),Z(e,t)&&n.push(`耗时 ${N(e.durationMs)}`),n.join(` · `)||`需要关注`}function Tt(e,t){return{id:e.id,title:e.title,detail:e.detail,level:e.level,levelLabel:j(e.level),kindLabel:A(e.kind),source:e.source??`dashboard`,timestamp:e.timestamp,duration:N(e.durationMs),reason:wt(e,t)}}function Et(e,t,n){return e>0?`critical`:t>0||n>0?`warning`:`healthy`}function Dt(e){return e===`critical`?`需要立即处理`:e===`warning`?`需要关注`:`运行平稳`}function Ot(e,t,n,r){return e===`critical`?`检测到 ${t} 个错误事件,优先排查失败来源。`:e===`warning`?`检测到 ${n} 个警告和 ${r} 个慢事件,建议跟进。`:`当前筛选范围内没有错误、警告或慢事件。`}function kt(e){let t=e.incidents.length>0?e.incidents.map(e=>`- [${e.levelLabel}] ${e.title}(${e.source} · ${e.kindLabel} · ${e.timestamp} · ${e.duration}):${e.detail}`):[`- 当前筛选范围内没有需要处理的事件。`];return[`# dashboard 运行时事故摘要`,``,`状态:${e.statusLabel}`,`说明:${e.statusDetail}`,``,`## 指标`,...e.metrics.map(e=>`- ${e.label}:${e.value}`),``,`## 影响来源`,e.affectedSources.length>0?e.affectedSources.map(e=>`- ${e}`).join(`
|
|
4
|
-
`):`- 无`,``,`## 优先处理`,...t,``].join(`
|
|
5
|
-
`)
|
|
1
|
+
import{d as F,H as ne,p as Y,o as n,c as o,e as s,t as d,g as _,C as re,E as oe,I as ie,k as j,a as h,n as T,u as f,f as M,J as U,K,j as de,w as $,b as g,F as C,r as R,L as Z,h as L,l as ue,G as ce}from"./vue.js";import{c as ee,_ as te}from"./clipboard.js";import{b as V,c as Q,d as D,m as H,e as ae,g as le,a as B,h as ve,_ as me,p as J,i as pe,s as be,u as fe}from"./index.js";import{_ as O}from"./AppRuntimeBadge.vue_vue_type_script_setup_true_lang.js";import{a as N,_ as he}from"./AppMetricTile.vue_vue_type_script_setup_true_lang.js";import{_ as ge}from"./AppInsetPanel.vue_vue_type_script_setup_true_lang.js";import"./vendor.js";import"./monaco.js";const xe={class:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2"},ye={class:"text-xs text-(--dashboard-text-soft)"},_e={class:"flex flex-wrap items-center gap-2"},$e={key:0,class:"text-xs font-medium text-(--dashboard-accent)"},ke=["disabled"],we=["disabled"],Se=F({__name:"ActivityEventSortBar",props:ie({events:{},filteredCount:{},totalCount:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,a=ne(e,"modelValue"),l=j("");let m=null;function v(b){return b.replaceAll("|","\\|").replaceAll(`
|
|
2
|
+
`," ")}const c=h(()=>["# dashboard 事件流","",`事件数量:${t.events.length}`,"","| 时间 | 等级 | 类型 | 来源 | 标题 | 耗时 | 标签 |","| --- | --- | --- | --- | --- | ---: | --- |",...t.events.map(b=>[b.timestamp,V(b.level),Q(b.kind),b.source??"dashboard",b.title,D(b.durationMs),b.tags?.join(", ")||"-"].map(v).join(" | ")).map(b=>`| ${b} |`),""].join(`
|
|
3
|
+
`));function u(b){l.value=b,m&&clearTimeout(m),m=setTimeout(()=>{l.value="",m=null},1800)}async function r(){try{await ee(c.value),u("已复制")}catch{u("复制失败")}}function p(){const b=new Blob([`${JSON.stringify(t.events,null,2)}
|
|
4
|
+
`],{type:"application/json"}),i=URL.createObjectURL(b),y=document.createElement("a");y.href=i,y.download="weapp-vite-dashboard-events.json",y.click(),URL.revokeObjectURL(i),u("已导出")}return Y(()=>{m&&clearTimeout(m)}),(b,i)=>(n(),o("div",xe,[s("p",ye," 匹配 "+d(e.filteredCount)+" / "+d(e.totalCount)+" 条事件 ",1),s("div",_e,[l.value?(n(),o("span",$e,d(l.value),1)):_("",!0),s("button",{type:"button",class:"h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 text-sm text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none disabled:opacity-50",disabled:e.events.length===0,onClick:r}," 复制事件 ",8,ke),s("button",{type:"button",class:"h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 text-sm text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none disabled:opacity-50",disabled:e.events.length===0,onClick:p}," 导出 JSON ",8,we),re(s("select",{"onUpdate:modelValue":i[0]||(i[0]=y=>a.value=y),class:"h-9 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-2.5 text-sm text-(--dashboard-text) outline-none transition focus:border-(--dashboard-accent)"},[...i[1]||(i[1]=[s("option",{value:"time"}," 按时间 ",-1),s("option",{value:"duration"}," 按耗时 ",-1),s("option",{value:"severity"}," 按等级 ",-1),s("option",{value:"source"}," 按来源 ",-1)])],512),[[oe,a.value]])])]))}}),Ce={class:"flex items-start justify-between gap-3"},Re={key:0,class:"text-[11px] uppercase tracking-[0.18em] text-(--dashboard-accent)"},Ee={class:"mt-1 text-lg font-semibold tracking-tight"},Me={class:"mt-3 text-sm leading-6 text-(--dashboard-text-muted)"},De={key:0,class:"mt-3 text-[11px] uppercase tracking-[0.18em] text-(--dashboard-text-soft)"},Le={key:1,class:"mt-2 text-sm font-medium text-(--dashboard-text)"},Te=F({__name:"AppRuntimeFocusCard",props:{event:{},eyebrow:{},emptyTitle:{},emptyDetail:{},durationText:{}},setup(e){const t=e,a=h(()=>t.event?ae(t.event):null),l=h(()=>t.event?.title??t.emptyTitle??"尚无运行事件"),m=h(()=>t.event?.detail??t.emptyDetail??"当前工作区还没有推入结构化运行事件。"),v=h(()=>t.event?le(t.event):null);return(c,u)=>(n(),o("div",{class:T(f(H)())},[s("div",Ce,[s("div",null,[t.eyebrow?(n(),o("p",Re,d(t.eyebrow),1)):_("",!0),s("h3",Ee,d(l.value),1)]),a.value?(n(),M(O,U(K({key:0},a.value)),null,16)):_("",!0)]),s("p",Me,d(m.value),1),t.event?(n(),o("p",De,d(v.value),1)):_("",!0),t.durationText?(n(),o("p",Le,d(t.durationText),1)):_("",!0),de(c.$slots,"default")],2))}}),Fe={key:0,class:"mt-3 flex flex-wrap gap-1.5"},je={key:1,class:"mt-4 grid gap-3 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-3"},Oe={class:"flex min-w-0 items-start justify-between gap-3"},Ne={class:"min-w-0"},Be={key:0,class:"mt-1 truncate font-mono text-xs text-(--dashboard-text-soft)"},Ie={key:0,class:"grid gap-2 sm:grid-cols-2"},Pe={class:"text-[11px] text-(--dashboard-text-soft)"},Ae={class:"mt-1 text-sm font-semibold text-(--dashboard-text)"},Ke={key:1,class:"flex flex-wrap gap-1.5"},Ue={key:2,class:"grid gap-2 text-xs leading-5 text-(--dashboard-text-muted)"},Ve={key:0},Qe={key:1},He=F({__name:"ActivitySelectedEventPanel",props:{event:{}},setup(e){const t=e,a=h(()=>t.event?.durationMs!==void 0?`耗时 ${D(t.event.durationMs)}`:void 0),l=h(()=>{const c=t.event?.profile;return c?[{label:"总耗时",value:D(c.totalMs)},{label:"构建核心",value:D(c.buildCoreMs)},{label:"转换",value:D(c.transformMs)},{label:"写入",value:D(c.writeMs)},{label:"监听到脏标记",value:D(c.watchToDirtyMs)},{label:"产物发射",value:D(c.emitMs)},{label:"共享 chunk",value:D(c.sharedChunkResolveMs)}].filter(u=>u.value!=="未记录"):[]}),m=h(()=>{const c=t.event?.profile;return c?[{label:"脏入口",value:c.dirtyCount},{label:"待处理",value:c.pendingCount},{label:"已发射",value:c.emittedCount}].filter(u=>typeof u.value=="number"):[]}),v=h(()=>t.event?.profile?.sourceRootFile??t.event?.profile?.relativeFile??t.event?.profile?.file);return(c,u)=>(n(),M(B,{eyebrow:"Selected",title:"当前事件","icon-name":"metric-search"},{default:$(()=>[g(Te,{event:e.event,eyebrow:"focus","empty-title":"未选择事件","empty-detail":"选择左侧事件后查看详情。","duration-text":a.value},{default:$(()=>[e.event?.tags?.length?(n(),o("div",Fe,[(n(!0),o(C,null,R(e.event.tags,r=>(n(),M(O,{key:r,label:r,tone:"neutral"},null,8,["label"]))),128))])):_("",!0),e.event?.profile?(n(),o("div",je,[s("div",Oe,[s("div",Ne,[u[0]||(u[0]=s("p",{class:"text-sm font-semibold text-(--dashboard-text)"}," HMR 阶段明细 ",-1)),v.value?(n(),o("p",Be,d(v.value),1)):_("",!0)]),e.event.profile.event?(n(),M(O,{key:0,label:e.event.profile.event,tone:"info"},null,8,["label"])):_("",!0)]),l.value.length>0?(n(),o("dl",Ie,[(n(!0),o(C,null,R(l.value,r=>(n(),o("div",{key:r.label,class:"rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2"},[s("dt",Pe,d(r.label),1),s("dd",Ae,d(r.value),1)]))),128))])):_("",!0),m.value.length>0?(n(),o("div",Ke,[(n(!0),o(C,null,R(m.value,r=>(n(),M(O,{key:r.label,label:`${r.label} ${r.value}`,tone:"neutral"},null,8,["label"]))),128))])):_("",!0),e.event.profile.dirtyReasonSummary?.length||e.event.profile.pendingReasonSummary?.length?(n(),o("div",Ue,[e.event.profile.dirtyReasonSummary?.length?(n(),o("p",Ve," 脏标记:"+d(e.event.profile.dirtyReasonSummary.join("、")),1)):_("",!0),e.event.profile.pendingReasonSummary?.length?(n(),o("p",Qe," 待处理:"+d(e.event.profile.pendingReasonSummary.join("、")),1)):_("",!0)])):_("",!0)])):_("",!0)]),_:1},8,["event","duration-text"])]),_:1}))}}),ze={class:"flex items-start justify-between gap-3"},qe={class:"min-w-0"},Je={class:"truncate font-medium text-(--dashboard-text)"},We={class:"mt-1 text-[11px] uppercase tracking-[0.16em] text-(--dashboard-text-soft)"},Ge={key:0,class:"mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-(--dashboard-text-soft)"},Xe={key:1,class:"mt-3 text-sm text-(--dashboard-text-muted)"},Ye=F({__name:"AppRuntimeSourceCard",props:{source:{},count:{},errorCount:{},averageDuration:{},latestTimestamp:{},countLabel:{}},setup(e){const t=e,a=h(()=>ve(t)),l=h(()=>t.latestTimestamp?`最近事件 ${t.latestTimestamp}`:`${t.count} ${t.countLabel??"条事件"}`),m=h(()=>[{key:"error-count",label:`错误 ${t.errorCount}`},{key:"average-duration",label:`平均耗时 ${t.averageDuration}`}]),v=h(()=>`平均耗时 ${t.averageDuration}`);return(c,u)=>(n(),o("div",{class:T(f(H)({padding:"sm"}))},[s("div",ze,[s("div",qe,[s("p",Je,d(t.source),1),s("p",We,d(l.value),1)]),g(O,U(Z(a.value)),null,16)]),t.latestTimestamp?(n(),o("div",Ge,[(n(!0),o(C,null,R(m.value,r=>(n(),o("span",{key:r.key,class:"rounded-full border border-(--dashboard-border) px-2 py-0.5"},d(r.label),1))),128))])):(n(),o("p",Xe,d(v.value),1))],2))}}),Ze={class:"mt-1 text-lg font-semibold"},et=F({__name:"AppStatCard",props:{label:{},value:{}},setup(e){const t=H({padding:"sm"});return(a,l)=>(n(),o("div",{class:T(f(t))},[g(N,null,{default:$(()=>[L(d(e.label),1)]),_:1}),s("p",Ze,d(e.value),1)],2))}}),tt={class:"flex shrink-0 items-center gap-2"},at={key:0,class:"text-xs font-medium text-(--dashboard-accent)"},lt={class:"h-3.5 w-3.5"},st={class:"grid gap-3"},nt={class:"flex items-start justify-between gap-3"},rt={class:"min-w-0"},ot={class:"text-sm font-semibold text-(--dashboard-text)"},it={class:"mt-1 text-xs leading-5 text-(--dashboard-text-muted)"},dt={class:"grid grid-cols-2 gap-2 sm:grid-cols-5 xl:grid-cols-2 2xl:grid-cols-5"},ut={key:0,class:"grid max-h-52 gap-2 overflow-y-auto pr-1"},ct={class:"flex items-start justify-between gap-3"},vt={class:"min-w-0"},mt={class:"truncate text-sm font-medium text-(--dashboard-text)"},pt={class:"mt-1 truncate text-xs text-(--dashboard-text-soft)"},bt={class:"mt-2 line-clamp-2 text-xs leading-5 text-(--dashboard-text-muted)"},ft=F({__name:"RuntimeIncidentDigestPanel",props:{digest:{}},setup(e){const t=e,a=j("");let l=null;const m=h(()=>t.digest.status==="critical"?"error":t.digest.status==="warning"?"warning":"success");function v(p){return p==="error"?"text-rose-600 dark:text-rose-300":p==="warning"?"text-amber-600 dark:text-amber-300":"text-(--dashboard-accent)"}function c(p){return p==="critical"?"border-rose-400/60 bg-(--dashboard-panel-muted)":p==="warning"?"border-amber-400/60 bg-(--dashboard-panel-muted)":"border-emerald-400/60 bg-(--dashboard-panel-muted)"}function u(p){a.value=p,l&&clearTimeout(l),l=setTimeout(()=>{a.value="",l=null},1800)}async function r(){try{await ee(t.digest.report),u("摘要已复制")}catch{u("复制失败")}}return Y(()=>{l&&clearTimeout(l)}),(p,b)=>(n(),M(B,{eyebrow:"Incident",title:"事故摘要","icon-name":"metric-quality"},{header:$(()=>[s("div",tt,[a.value?(n(),o("span",at,d(a.value),1)):_("",!0),s("button",{type:"button",class:"inline-flex h-8 items-center gap-1.5 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 text-xs text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none",onClick:r},[s("span",lt,[g(me,{name:"metric-copy"})]),b[0]||(b[0]=L(" 复制 ",-1))])])]),default:$(()=>[s("div",st,[s("div",{class:T(["rounded-md border px-3 py-2.5",c(e.digest.status)])},[s("div",nt,[s("div",rt,[s("p",ot,d(e.digest.statusLabel),1),s("p",it,d(e.digest.statusDetail),1)]),g(O,{label:e.digest.statusLabel,tone:m.value},null,8,["label","tone"])])],2),s("div",dt,[(n(!0),o(C,null,R(e.digest.metrics,i=>(n(),M(he,{key:i.label,label:i.label,value:i.value},null,8,["label","value"]))),128))]),e.digest.incidents.length>0?(n(),o("div",ut,[(n(!0),o(C,null,R(e.digest.incidents,i=>(n(),o("article",{key:i.id,class:"rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5"},[s("div",ct,[s("div",vt,[s("p",mt,d(i.title),1),s("p",pt,d(i.source)+" · "+d(i.kindLabel)+" · "+d(i.timestamp)+" · "+d(i.duration),1)]),s("span",{class:T(["shrink-0 text-xs font-semibold",v(i.level)])},d(i.levelLabel),3)]),s("p",bt,d(i.reason)+" · "+d(i.detail),1)]))),128))])):(n(),M(te,{key:1,compact:""},{default:$(()=>[...b[1]||(b[1]=[L(" 当前筛选范围内没有需要处理的运行时事件。 ",-1)])]),_:1}))])]),_:1}))}}),ht={class:"grid min-h-0 content-start gap-3 overflow-y-auto pr-1"},gt={class:"grid gap-2 sm:grid-cols-2"},xt={class:"grid max-h-44 gap-2 overflow-y-auto pr-1"},yt={class:"flex items-start justify-between gap-3"},_t={class:"font-medium"},$t={class:"mt-1 text-sm leading-6 text-(--dashboard-text-muted)"},kt={key:0,class:"grid max-h-full gap-2 overflow-y-auto pr-1"},wt=F({__name:"ActivityInsightPanel",props:{selectedEvent:{},incidentDigest:{},eventSummary:{},filteredEventSummary:{},diagnostics:{},sourceBreakdown:{}},setup(e){return(t,a)=>(n(),o("div",ht,[g(He,{event:e.selectedEvent},null,8,["event"]),g(ft,{digest:e.incidentDigest},null,8,["digest"]),g(B,{eyebrow:"Runtime",title:"事件摘要","icon-name":"metric-time"},{default:$(()=>[s("div",gt,[(n(!0),o(C,null,R([...e.eventSummary,...e.filteredEventSummary],l=>(n(),M(et,K({key:l.label},{ref_for:!0},l),null,16))),128))])]),_:1}),g(B,{eyebrow:"Diagnostics",title:"当前诊断队列","icon-name":"metric-health","content-class":"min-h-0 overflow-hidden"},{default:$(()=>[s("ul",xt,[(n(!0),o(C,null,R(e.diagnostics,l=>(n(),o("li",{key:l.label,class:"rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-4 py-3"},[s("div",yt,[s("div",null,[s("p",_t,d(l.label),1),s("p",$t,d(l.detail),1)]),g(O,{label:l.status,tone:"info"},null,8,["label"])])]))),128))])]),_:1}),g(B,{eyebrow:"Sources",title:"事件来源","icon-name":"hero-system","content-class":"min-h-0 overflow-hidden"},{default:$(()=>[e.sourceBreakdown.length>0?(n(),o("div",kt,[(n(!0),o(C,null,R(e.sourceBreakdown,l=>(n(),M(Ye,K({key:l.source},{ref_for:!0},l),null,16))),128))])):_("",!0)]),_:1})]))}}),St={class:"grid gap-3 xl:grid-cols-[minmax(14rem,0.85fr)_minmax(0,1.15fr)]"},Ct={for:"dashboard-event-search"},Rt=["value"],Et={class:"grid gap-3"},Mt={class:"mt-2 flex flex-wrap gap-2"},Dt=["onClick"],Lt={key:0,class:"mt-2 text-xs leading-5 text-(--dashboard-text-soft)"},Tt={class:"grid gap-3 md:grid-cols-3"},Ft={class:"mt-2 flex flex-wrap gap-2"},jt=["onClick"],Ot={class:"mt-2 flex flex-wrap gap-2"},Nt=["onClick"],Bt={class:"mt-2 flex flex-wrap gap-2"},It=["onClick"],Pt=F({__name:"AppEventFilterPanel",props:{searchQuery:{},presetDescription:{},filterPresets:{},eventKindOptions:{},eventLevelOptions:{},eventSourceOptions:{},eventKindFilter:{},eventLevelFilter:{},eventSourceFilter:{}},emits:["update:searchQuery","update:eventKindFilter","update:eventLevelFilter","update:eventSourceFilter","applyPreset"],setup(e,{emit:t}){const a=e,l=t;function m(){return J({kind:"theme",active:!1})}function v(c,u){return J({kind:"theme",active:c===u})}return(c,u)=>(n(),M(ge,null,{default:$(()=>[s("div",St,[s("div",null,[s("label",Ct,[g(N,null,{default:$(()=>[...u[1]||(u[1]=[L(" 搜索事件 ",-1)])]),_:1})]),s("input",{id:"dashboard-event-search",value:e.searchQuery,type:"text",placeholder:"搜索标题、详情、来源或标签",class:"mt-2 w-full rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2 text-sm text-(--dashboard-text) outline-none transition focus:border-(--dashboard-border-strong)",onInput:u[0]||(u[0]=r=>l("update:searchQuery",r.target.value))},null,40,Rt)]),s("div",Et,[s("div",null,[g(N,null,{default:$(()=>[...u[2]||(u[2]=[L(" 快速预设 ",-1)])]),_:1}),s("div",Mt,[(n(!0),o(C,null,R(e.filterPresets,r=>(n(),o("button",{key:r.key,class:T(m()),onClick:p=>l("applyPreset",r.key)},d(r.label),11,Dt))),128))]),e.presetDescription?(n(),o("p",Lt,d(e.presetDescription),1)):_("",!0)]),s("div",Tt,[s("div",null,[g(N,null,{default:$(()=>[...u[3]||(u[3]=[L(" 类型过滤 ",-1)])]),_:1}),s("div",Ft,[(n(!0),o(C,null,R(e.eventKindOptions,r=>(n(),o("button",{key:r.value,class:T(v(a.eventKindFilter,r.value)),onClick:p=>l("update:eventKindFilter",r.value)},d(r.label),11,jt))),128))])]),s("div",null,[g(N,null,{default:$(()=>[...u[4]||(u[4]=[L(" 等级过滤 ",-1)])]),_:1}),s("div",Ot,[(n(!0),o(C,null,R(e.eventLevelOptions,r=>(n(),o("button",{key:r.value,class:T(v(a.eventLevelFilter,r.value)),onClick:p=>l("update:eventLevelFilter",r.value)},d(r.label),11,Nt))),128))])]),s("div",null,[g(N,null,{default:$(()=>[...u[5]||(u[5]=[L(" 来源过滤 ",-1)])]),_:1}),s("div",Bt,[(n(!0),o(C,null,R(e.eventSourceOptions,r=>(n(),o("button",{key:r.value,class:T(v(a.eventSourceFilter,r.value)),onClick:p=>l("update:eventSourceFilter",r.value)},d(r.label),11,It))),128))])])])])])]),_:1}))}}),At={class:"flex items-start justify-between gap-3"},Kt={class:"font-medium text-(--dashboard-text)"},Ut=F({__name:"AppRuntimeEventListItem",props:{event:{},selected:{type:Boolean}},setup(e){const t=e,a=h(()=>ae(t.event)),l=h(()=>le(t.event)),m=h(()=>t.selected?"border-(--dashboard-border-strong) bg-(--dashboard-panel)":"border-(--dashboard-border)");return(v,c)=>(n(),o("li",{class:T(["rounded-md border bg-(--dashboard-panel-muted) px-4 py-3 transition",m.value])},[s("div",At,[s("div",null,[s("p",Kt,d(t.event.title),1),g(N,{class:"mt-1"},{default:$(()=>[L(d(l.value),1)]),_:1})]),g(O,U(Z(a.value)),null,16)])],2))}}),Vt=1e3,Qt=5,W={error:4,warning:3,success:2,info:1};function G(e){const t=Date.parse(e.timestamp);return Number.isFinite(t)?t:0}function z(e,t){return typeof e.durationMs=="number"&&e.durationMs>=t}function Ht(e,t){return e.level==="error"||e.level==="warning"||z(e,t)}function zt(e,t){const a=[];return e.level==="error"?a.push("错误事件"):e.level==="warning"&&a.push("警告事件"),z(e,t)&&a.push(`耗时 ${D(e.durationMs)}`),a.join(" · ")||"需要关注"}function qt(e,t){return{id:e.id,title:e.title,detail:e.detail,level:e.level,levelLabel:V(e.level),kindLabel:Q(e.kind),source:e.source??"dashboard",timestamp:e.timestamp,duration:D(e.durationMs),reason:zt(e,t)}}function Jt(e,t,a){return e>0?"critical":t>0||a>0?"warning":"healthy"}function Wt(e){return e==="critical"?"需要立即处理":e==="warning"?"需要关注":"运行平稳"}function Gt(e,t,a,l){return e==="critical"?`检测到 ${t} 个错误事件,优先排查失败来源。`:e==="warning"?`检测到 ${a} 个警告和 ${l} 个慢事件,建议跟进。`:"当前筛选范围内没有错误、警告或慢事件。"}function Xt(e){const t=e.incidents.length>0?e.incidents.map(a=>`- [${a.levelLabel}] ${a.title}(${a.source} · ${a.kindLabel} · ${a.timestamp} · ${a.duration}):${a.detail}`):["- 当前筛选范围内没有需要处理的事件。"];return["# dashboard 运行时事故摘要","",`状态:${e.statusLabel}`,`说明:${e.statusDetail}`,"","## 指标",...e.metrics.map(a=>`- ${a.label}:${a.value}`),"","## 影响来源",e.affectedSources.length>0?e.affectedSources.map(a=>`- ${a}`).join(`
|
|
5
|
+
`):"- 无","","## 优先处理",...t,""].join(`
|
|
6
|
+
`)}function Yt(e,t={}){const a=t.slowEventThresholdMs??Vt,l=e.filter(i=>i.level==="error").length,m=e.filter(i=>i.level==="warning").length,v=e.filter(i=>z(i,a)).length,c=e.filter(i=>Ht(i,a)),u=[...new Set(c.map(i=>i.source??"dashboard"))].sort((i,y)=>i.localeCompare(y,"zh-CN")),r=Jt(l,m,v),p=c.toSorted((i,y)=>W[y.level]-W[i.level]||(y.durationMs??-1)-(i.durationMs??-1)||G(y)-G(i)).slice(0,Qt).map(i=>qt(i,a)),b={status:r,statusLabel:Wt(r),statusDetail:Gt(r,l,m,v),metrics:[{label:"事件总数",value:e.length},{label:"错误",value:l},{label:"警告",value:m},{label:"慢事件",value:v},{label:"影响来源",value:u.length}],affectedSources:u,incidents:p};return{...b,report:Xt(b)}}const X={error:4,warning:3,success:2,info:1},Zt=[{value:"all",label:"全部类型"},{value:"command",label:"命令"},{value:"build",label:"构建"},{value:"diagnostic",label:"诊断"},{value:"hmr",label:"HMR"},{value:"system",label:"系统"}],ea=[{value:"all",label:"全部等级"},{value:"info",label:"信息"},{value:"success",label:"成功"},{value:"warning",label:"警告"},{value:"error",label:"错误"}];function ta(e,t){return[e.title,e.detail,e.kind,e.level,e.source??"",...e.tags??[]].join(" ").toLowerCase().includes(t)}function aa(e,t){return[...e].sort((a,l)=>t==="duration"?(l.durationMs??-1)-(a.durationMs??-1)||Date.parse(l.timestamp)-Date.parse(a.timestamp):t==="severity"?X[l.level]-X[a.level]||Date.parse(l.timestamp)-Date.parse(a.timestamp):t==="source"&&(a.source??"dashboard").localeCompare(l.source??"dashboard")||Date.parse(l.timestamp)-Date.parse(a.timestamp))}function la(e){const t=j("all"),a=j("all"),l=j("all"),m=j("time"),v=j(""),c=j(null),u=[{key:"all",label:"查看全部",description:"回到完整事件流",apply(){t.value="all",a.value="all",l.value="all",v.value=""}},{key:"issues",label:"异常优先",description:"只看警告和错误",apply(){t.value="all",a.value="warning",l.value="all",v.value=""}},{key:"commands",label:"命令流",description:"聚焦命令执行事件",apply(){t.value="command",a.value="all",l.value="all",v.value=""}},{key:"hmr",label:"HMR",description:"观察热更新相关事件",apply(){t.value="hmr",a.value="all",l.value="all",v.value=""}}],r=h(()=>{const k=new Set(e.value.map(x=>x.source??"dashboard").filter(Boolean));return[{value:"all",label:"全部来源"},...[...k].sort((x,E)=>x.localeCompare(E,"zh-CN")).map(x=>({value:x,label:x}))]}),p=h(()=>{const k=v.value.trim().toLowerCase(),x=e.value.filter(E=>t.value!=="all"&&E.kind!==t.value||a.value!=="all"&&E.level!==a.value||l.value!=="all"&&(E.source??"dashboard")!==l.value?!1:!k||ta(E,k));return aa(x,m.value)}),b=h(()=>{const k=p.value.filter(E=>typeof E.durationMs=="number"),x=k.length>0?Math.round(k.reduce((E,A)=>E+(A.durationMs??0),0)/k.length):void 0;return[{label:"筛选后事件",value:String(p.value.length)},{label:"当前类型",value:t.value==="all"?"全部":Q(t.value)},{label:"当前等级",value:a.value==="all"?"全部":V(a.value)},{label:"当前来源",value:l.value==="all"?"全部":l.value},{label:"搜索关键字",value:v.value.trim()||"未设置"},{label:"筛选平均耗时",value:D(x)}]}),i=h(()=>pe(be(p.value))),y=h(()=>Yt(p.value)),I=h(()=>p.value.find(k=>k.id===c.value)??p.value[0]??null),P=h(()=>u.find(x=>x.key==="issues"?t.value==="all"&&a.value==="warning"&&l.value==="all"&&v.value==="":x.key==="commands"?t.value==="command"&&a.value==="all"&&l.value==="all"&&v.value==="":x.key==="hmr"?t.value==="hmr"&&a.value==="all"&&l.value==="all"&&v.value==="":t.value==="all"&&a.value==="all"&&l.value==="all"&&v.value==="")?.description??"");return ue(p,k=>{if(k.length===0){c.value=null;return}k.some(x=>x.id===c.value)||(c.value=k[0]?.id??null)},{immediate:!0}),{eventKindFilter:t,eventKindOptions:Zt,eventLevelFilter:a,eventLevelOptions:ea,eventSortMode:m,eventSourceFilter:l,eventSourceOptions:r,filteredEventSummary:b,filteredRuntimeEvents:p,filterPresets:u,incidentDigest:y,presetDescription:P,searchQuery:v,selectedEvent:I,selectedEventId:c,sourceBreakdown:i}}const sa={class:"grid h-full min-h-0 gap-3 overflow-hidden xl:grid-cols-[minmax(0,1.25fr)_minmax(22rem,0.75fr)]"},na={class:"grid h-full min-h-0 grid-rows-[minmax(0,9rem)_auto_minmax(6rem,1fr)] gap-3 overflow-hidden"},ra={class:"grid min-h-0 gap-2 overflow-y-auto pr-1 text-sm leading-6 text-(--dashboard-text-muted)"},fa=F({__name:"activity",setup(e){const{diagnostics:t,eventSummary:a,runtimeEvents:l}=fe(),{eventKindFilter:m,eventKindOptions:v,eventLevelFilter:c,eventLevelOptions:u,eventSortMode:r,eventSourceFilter:p,eventSourceOptions:b,filteredEventSummary:i,filteredRuntimeEvents:y,filterPresets:I,incidentDigest:P,presetDescription:k,searchQuery:x,selectedEvent:E,selectedEventId:A,sourceBreakdown:se}=la(l);return(oa,S)=>(n(),o("div",sa,[g(B,{eyebrow:"Event Feed",title:"事件控制台","icon-name":"hero-commands","content-class":"min-h-0 overflow-hidden"},{default:$(()=>[s("div",na,[g(Pt,{class:"min-h-0 overflow-y-auto","search-query":f(x),"preset-description":f(k),"filter-presets":f(I),"event-kind-options":f(v),"event-level-options":f(u),"event-source-options":f(b),"event-kind-filter":f(m),"event-level-filter":f(c),"event-source-filter":f(p),"onUpdate:searchQuery":S[0]||(S[0]=w=>x.value=w),"onUpdate:eventKindFilter":S[1]||(S[1]=w=>m.value=w),"onUpdate:eventLevelFilter":S[2]||(S[2]=w=>c.value=w),"onUpdate:eventSourceFilter":S[3]||(S[3]=w=>p.value=w),onApplyPreset:S[4]||(S[4]=w=>f(I).find(q=>q.key===w)?.apply())},null,8,["search-query","preset-description","filter-presets","event-kind-options","event-level-options","event-source-options","event-kind-filter","event-level-filter","event-source-filter"]),g(Se,{modelValue:f(r),"onUpdate:modelValue":S[5]||(S[5]=w=>ce(r)?r.value=w:null),events:f(y),"filtered-count":f(y).length,"total-count":f(l).length},null,8,["modelValue","events","filtered-count","total-count"]),f(y).length===0?(n(),M(te,{key:0,as:"p"},{default:$(()=>[...S[6]||(S[6]=[L(" 当前过滤条件下没有匹配事件。 ",-1)])]),_:1})):_("",!0),s("ul",ra,[(n(!0),o(C,null,R(f(y),w=>(n(),M(Ut,{key:w.id,event:w,selected:f(E)?.id===w.id,onClick:q=>A.value=w.id},null,8,["event","selected","onClick"]))),128))])])]),_:1}),g(wt,{"selected-event":f(E),"incident-digest":f(P),"event-summary":f(a),"filtered-event-summary":f(i),diagnostics:f(t),"source-breakdown":f(se)},null,8,["selected-event","incident-digest","event-summary","filtered-event-summary","diagnostics","source-breakdown"])]))}});export{fa as default};
|