zdashboard 2.8.2 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cli.js +19 -14
  2. package/dist/cli.js.map +1 -1
  3. package/dist/web/assets/BatchView-pClKtVa8.js +2 -0
  4. package/dist/web/assets/{CheckpointViewer-DDDL4LLT.js → CheckpointViewer-CAbXbMti.js} +1 -1
  5. package/dist/web/assets/{CodeViewer-JhnG7iUT.js → CodeViewer-Cs0mG1h6.js} +1 -1
  6. package/dist/web/assets/{DependencyGraph-D0WgxxUF.js → DependencyGraph-Czdg00AM.js} +1 -1
  7. package/dist/web/assets/{FileIcon-BmaRn48o.js → FileIcon-1KBdrfw3.js} +1 -1
  8. package/dist/web/assets/{FilterPills-Dh6YBt2R.js → FilterPills-CCubROoX.js} +1 -1
  9. package/dist/web/assets/{ProgressBar-BmnZnTYq.js → ProgressBar-DVfldtzq.js} +1 -1
  10. package/dist/web/assets/{Sidebar-CYyRqUZe.js → Sidebar-D4sJtPI_.js} +1 -1
  11. package/dist/web/assets/{Sidebar-ZYBrFJIk.js → Sidebar-DE0UBp9b.js} +1 -1
  12. package/dist/web/assets/{SingleChangeView-E0xbfiWi.js → SingleChangeView-BYcaGOyR.js} +1 -1
  13. package/dist/web/assets/{ViewHeader-BGjZ06RN.js → ViewHeader-DPfbaJmK.js} +1 -1
  14. package/dist/web/assets/Workspace-B7MhdnwY.js +2 -0
  15. package/dist/web/assets/{Workspace-VaSVbceB.js → Workspace-CAcrVL-m.js} +1 -1
  16. package/dist/web/assets/{Workspace-FTeTEgcv.js → Workspace-CvG5lIPT.js} +1 -1
  17. package/dist/web/assets/{Workspace-CpKx4uWV.js → Workspace-DWHHR42N.js} +1 -1
  18. package/dist/web/assets/{Workspace-DSphvDjC.js → Workspace-cXLWoMNL.js} +1 -1
  19. package/dist/web/assets/{index-BFfqeozW.js → index-Co7MWSFf.js} +2 -2
  20. package/dist/web/assets/index-CwS-KyOV.css +1 -0
  21. package/dist/web/assets/{index-cqcRCemV.js → index-D6EJRHBV.js} +1 -1
  22. package/dist/web/assets/{usePluginData-l4OWrSnb.js → usePluginData-IoRqReIJ.js} +1 -1
  23. package/dist/web/assets/{web-Dzj4gVNk.js → web-BZSTgldm.js} +2 -2
  24. package/dist/web/assets/web-CX1FEFxC.js +2 -0
  25. package/dist/web/assets/{web-BeTYyAG8.js → web-DLwxO4fO.js} +2 -2
  26. package/dist/web/assets/{web-Di4EgMTa.js → web-DOEmlI8d.js} +2 -2
  27. package/dist/web/assets/{web-DwX6rkMl.js → web-DxbVzGf3.js} +2 -2
  28. package/dist/web/index.html +2 -2
  29. package/package.json +1 -1
  30. package/dist/web/assets/BatchView-BG4mP3YP.js +0 -2
  31. package/dist/web/assets/Workspace-BwGBjSAY.js +0 -2
  32. package/dist/web/assets/index-B5TwQO_C.css +0 -1
  33. package/dist/web/assets/web-gL1eNZ2l.js +0 -2
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DependencyGraph-Czdg00AM.js","assets/index-Co7MWSFf.js","assets/index-CwS-KyOV.css","assets/CheckpointViewer-CAbXbMti.js"])))=>i.map(i=>d[i]);
2
+ import{b as $,a as C,r as o,j as e,C as V,E as A,_}from"./index-Co7MWSFf.js";import{V as B,B as I}from"./ViewHeader-DPfbaJmK.js";import{u as f}from"./usePluginData-IoRqReIJ.js";import{M as S,t as R}from"./index-D6EJRHBV.js";const z=o.lazy(()=>_(()=>import("./DependencyGraph-Czdg00AM.js"),__vite__mapDeps([0,1,2]))),P=o.lazy(()=>_(()=>import("./CheckpointViewer-CAbXbMti.js"),__vite__mapDeps([3,1,2]))),T=["graph","checkpoint"],D={graph:"依赖图",checkpoint:"进度"},L={idle:"neutral",analyzing:"info","pending-approval":"warning",running:"info",paused:"warning",completed:"success",failed:"destructive"};function U(a){return a==="error"?"text-destructive":a==="warn"?"text-warning":"text-muted-foreground"}function O(a){const r=a?`?run=${encodeURIComponent(a)}`:"",i=f(`apply:/__apply/batch${r}`,()=>fetch(`/__apply/batch${r}`,{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}),x=f(`apply:/__apply/batch/graph${r}`,()=>fetch(`/__apply/batch/graph${r}`,{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}),b=f(`apply:/__apply/batch/logs${r}`,()=>fetch(`/__apply/batch/logs${r}`,{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}),c=f(`apply:/__apply/batch/plan${r}`,()=>fetch(`/__apply/batch/plan${r}`,{cache:"no-store"}).then(n=>n.ok?n.json().then(d=>d.plan):null).catch(()=>null),{subscribe:"files"});return{snapshot:i,graph:x,logs:b,plan:c}}function G({run:a,hasError:r}){return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6 gap-2",children:[e.jsx(A,{title:"暂无批量执行数据",hint:"在 zapply batch 中启动批量执行后,状态会出现在这里"}),e.jsxs("div",{className:"text-center text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["状态文件:",e.jsx("code",{className:"font-mono",children:".zdev/apply/runs/<runId>/state.json"}),"(由 zapply 写入,本页只读)"]}),a!==null&&e.jsx("p",{children:"CURRENT 指向的 run 状态缺失或损坏(历史 run 只读)"}),r&&e.jsx("p",{children:"数据加载失败,请稍后重试或刷新页面"})]})]})}function H({onStatus:a}={}){var y,v;const{icon:r}=$(),i=C(),x=i.params.get("sel"),b=i.params.get("run"),[c,n]=o.useState("graph"),[d,N]=o.useState(!0),{snapshot:p,graph:w,logs:k,plan:g}=O(b),t=((y=p.data)==null?void 0:y.state)??null,u=((v=p.data)==null?void 0:v.run)??null,h=Array.isArray(t==null?void 0:t.changes)?t==null?void 0:t.changes:[],l={completed:h.filter(s=>s.status==="completed").length,failed:h.filter(s=>s.status==="failed").length,parked:h.filter(s=>s.status==="parked").length,running:h.filter(s=>s.status==="running").length},m=h.length;if(o.useEffect(()=>{a==null||a(m?{label:`${l.completed+l.failed}/${m}`,tone:l.failed?"warning":"info"}:void 0)},[m,l.completed,l.failed,a]),!t)return e.jsx("div",{"data-testid":"batch-view",className:"h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:p.data===null&&!p.error?e.jsx("div",{className:"flex items-center justify-center h-full",children:"加载中..."}):e.jsx(G,{run:u,hasError:!!p.error})});const j=s=>i.navigate({sel:s});return e.jsxs("div",{"data-testid":"batch-view",className:"h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:[e.jsx(B,{title:"zapply batch"}),e.jsxs("div",{"data-testid":"batch-overview",className:"flex-none px-4 py-2 border-b border-border flex items-center gap-3 text-sm text-muted-foreground flex-wrap",children:[e.jsx(I,{variant:L[t.status]??"default",children:t.status}),e.jsxs("span",{children:["第 ",Number(t.currentBatchIndex??0)+1,"/",(Array.isArray(t.batches)?t.batches.length:0)||"?"," 批"]}),e.jsxs("span",{children:[l.completed,"/",m," 完成"]}),Number.isFinite(Number(t.parallelism))&&e.jsxs("span",{children:["并行度: ",t.parallelism]}),e.jsxs("span",{children:["🔄 ",l.running," 运行中"]}),e.jsxs("span",{children:["❌ ",l.failed," 失败"]}),e.jsxs("span",{children:["⏸️ ",l.parked," parked"]}),g.data&&e.jsx("button",{type:"button","aria-pressed":d,onClick:()=>N(s=>!s),className:`px-2 py-0.5 text-xs rounded-md border transition-colors ${d?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-accent"}`,children:"执行计划"}),e.jsxs("span",{className:"ml-auto inline-flex items-center gap-1.5 text-xs font-mono",children:[t.front&&e.jsx(V,{tone:"info",children:e.jsx("span",{className:"max-w-40 truncate",title:t.front,children:t.front})}),e.jsxs("span",{children:["run: ",(u==null?void 0:u.id)??"-"," · 只读"]})]})]}),e.jsx("div",{className:"flex-none px-4 py-1.5 border-b border-border flex items-center gap-2",children:T.map(s=>e.jsx("button",{type:"button",onClick:()=>n(s),className:`px-3 py-1 text-xs rounded-md ${c===s?"bg-primary text-primary-foreground":"border border-border hover:bg-accent"}`,children:D[s]},s))}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",children:"加载中..."}),children:e.jsxs("div",{"data-testid":`batch-subview-${c}`,className:"h-full",children:[c==="graph"&&e.jsx(z,{graph:w.data??{changes:[],batches:[],conflicts:[]},selectedChange:x,onSelectChange:j}),c==="checkpoint"&&e.jsx(P,{state:t,selectedChange:x,onSelectChange:j})]})})}),g.data&&d&&e.jsxs("div",{className:"flex-none border-t border-border px-6 py-3 max-h-48 overflow-y-auto",children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[r("file-text","h-3 w-3")," 执行计划 plan.md(只读)"]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs bg-card border rounded-lg p-3",children:e.jsx(S,{remarkPlugins:[R],children:g.data})})]}),e.jsx("footer",{"data-testid":"batch-logs",className:"h-48 shrink-0 overflow-auto border-t border-border px-6 py-2",children:e.jsx("div",{className:"text-xs font-mono space-y-1",children:(k.data??[]).slice(-20).reverse().map((s,E)=>e.jsxs("div",{className:U(s.level),children:[e.jsxs("span",{className:"text-muted-foreground/60",children:["[",new Date(s.timestamp).toLocaleTimeString(),"]"]}),s.changeName&&e.jsxs("span",{className:"text-info ml-2",children:["[",s.changeName,"]"]}),e.jsx("span",{className:"ml-2",children:s.message})]},E))})})]})}export{H as default};
@@ -1 +1 @@
1
- import{j as e}from"./index-BFfqeozW.js";function x({state:c,selectedChange:r,onSelectChange:a}){const t=c.changes.filter(s=>s.checkpoint&&s.status==="running");return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"执行中的变更"}),e.jsxs("div",{className:"space-y-2",children:[t.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无执行中的变更"}),t.map(s=>e.jsxs("div",{onClick:()=>a(r===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${r===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsx("div",{className:"font-medium text-sm",children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[s.checkpoint.completedTasks,"/",s.checkpoint.totalTasks," 任务"]})]},s.name))]})]}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:r&&t.find(s=>s.name===r)?e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:r}),e.jsx("div",{className:"space-y-3",children:Array.from({length:t.find(s=>s.name===r).checkpoint.totalTasks}).map((s,n)=>{const d=t.find(l=>l.name===r),i=n<d.checkpoint.completedTasks,o=n===d.checkpoint.currentTaskIndex;return e.jsx("div",{className:`p-4 rounded-lg border ${i?"border-success/30 bg-success/5":o?"border-info/30 bg-info/5":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs ${i?"bg-success text-success-foreground":o?"bg-info text-info-foreground":"bg-muted text-muted-foreground"}`,children:i?"✓":o?"↻":n+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`text-sm ${i?"line-through text-muted-foreground":"font-medium"}`,children:o?d.checkpoint.currentTask:`任务 #${n+1}`}),o&&e.jsx("div",{className:"text-xs text-info mt-1",children:"执行中..."})]})]})},n)})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"选择一个变更查看任务进度"})})]})}export{x as default};
1
+ import{j as e}from"./index-Co7MWSFf.js";function x({state:c,selectedChange:r,onSelectChange:a}){const t=c.changes.filter(s=>s.checkpoint&&s.status==="running");return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"执行中的变更"}),e.jsxs("div",{className:"space-y-2",children:[t.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无执行中的变更"}),t.map(s=>e.jsxs("div",{onClick:()=>a(r===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${r===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsx("div",{className:"font-medium text-sm",children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[s.checkpoint.completedTasks,"/",s.checkpoint.totalTasks," 任务"]})]},s.name))]})]}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:r&&t.find(s=>s.name===r)?e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:r}),e.jsx("div",{className:"space-y-3",children:Array.from({length:t.find(s=>s.name===r).checkpoint.totalTasks}).map((s,n)=>{const d=t.find(l=>l.name===r),i=n<d.checkpoint.completedTasks,o=n===d.checkpoint.currentTaskIndex;return e.jsx("div",{className:`p-4 rounded-lg border ${i?"border-success/30 bg-success/5":o?"border-info/30 bg-info/5":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs ${i?"bg-success text-success-foreground":o?"bg-info text-info-foreground":"bg-muted text-muted-foreground"}`,children:i?"✓":o?"↻":n+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`text-sm ${i?"line-through text-muted-foreground":"font-medium"}`,children:o?d.checkpoint.currentTask:`任务 #${n+1}`}),o&&e.jsx("div",{className:"text-xs text-info mt-1",children:"执行中..."})]})]})},n)})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"选择一个变更查看任务进度"})})]})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{g as Wl,r as At,j as Ie,f as $g}from"./index-BFfqeozW.js";import{o as $t,l as Kg,f as dn,m as Rt,a as _n,e as Qg,b as $l,p as Gc,c as Yc,n as Hc,h as Qn,s as an,d as Xg,g as Zg,i as _r,v as Xn,j as rp,k as Sl,S as Mn,q as Jg,r as jg,M as ef,t as tf}from"./index-cqcRCemV.js";const qc={}.hasOwnProperty;function np(t,e){const r=e||{};function n(a,...i){let s=n.invalid;const o=n.handlers;if(a&&qc.call(a,t)){const l=String(a[t]);s=qc.call(o,l)?o[l]:n.unknown}if(s)return s.call(this,a,...i)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}function rf(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:a,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:o,mathText:s,mathTextData:o}};function t(l){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function e(){this.buffer()}function r(){const l=this.resume(),u=this.stack[this.stack.length-1];$t(u.type==="math"),u.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function a(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];$t(d.type==="math"),this.exit(l),d.value=u;const p=d.data.hChildren[0];$t(p.type==="element"),$t(p.tagName==="code"),p.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function s(l){const u=this.resume(),d=this.stack[this.stack.length-1];$t(d.type==="inlineMath"),this.exit(l),d.value=u,d.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function nf(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),n.peek=a,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
1
+ import{g as Wl,r as At,j as Ie,f as $g}from"./index-Co7MWSFf.js";import{o as $t,l as Kg,f as dn,m as Rt,a as _n,e as Qg,b as $l,p as Gc,c as Yc,n as Hc,h as Qn,s as an,d as Xg,g as Zg,i as _r,v as Xn,j as rp,k as Sl,S as Mn,q as Jg,r as jg,M as ef,t as tf}from"./index-D6EJRHBV.js";const qc={}.hasOwnProperty;function np(t,e){const r=e||{};function n(a,...i){let s=n.invalid;const o=n.handlers;if(a&&qc.call(a,t)){const l=String(a[t]);s=qc.call(o,l)?o[l]:n.unknown}if(s)return s.call(this,a,...i)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}function rf(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:a,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:o,mathText:s,mathTextData:o}};function t(l){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function e(){this.buffer()}function r(){const l=this.resume(),u=this.stack[this.stack.length-1];$t(u.type==="math"),u.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function a(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];$t(d.type==="math"),this.exit(l),d.value=u;const p=d.data.hChildren[0];$t(p.type==="element"),$t(p.tagName==="code"),p.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function s(l){const u=this.resume(),d=this.stack[this.stack.length-1];$t(d.type==="inlineMath"),this.exit(l),d.value=u,d.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function nf(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),n.peek=a,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
2
2
  `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(i,s,o,l){const u=i.value||"",d=o.createTracker(l),p="$".repeat(Math.max(Kg(u,"$")+1,2)),E=o.enter("mathFlow");let g=d.move(p);if(i.meta){const S=o.enter("mathFlowMeta");g+=d.move(o.safe(i.meta,{after:`
3
3
  `,before:g,encode:["$"],...d.current()})),S()}return g+=d.move(`
4
4
  `),u&&(g+=d.move(u+`
@@ -1 +1 @@
1
- import{r as u,j as e}from"./index-BFfqeozW.js";const a={pending:"bg-muted text-muted-foreground",running:"bg-info/20 text-info",completed:"bg-success/20 text-success",failed:"bg-destructive/20 text-destructive",parked:"bg-warning/20 text-warning",skipped:"bg-muted text-muted-foreground line-through"};function h({graph:t,selectedChange:d,onSelectChange:l}){const[i,o]=u.useState("all"),m=t.changes.filter(s=>i==="all"||s.status===i),c=t.batches.reduce((s,r)=>{const n=t.changes.filter(x=>x.batchIndex===r.index);return n.length&&(s[r.index]=n),s},{});return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-sm font-medium",children:"状态筛选"}),e.jsxs("select",{value:i,onChange:s=>o(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm",children:[e.jsx("option",{value:"all",children:"全部"}),e.jsx("option",{value:"pending",children:"待执行"}),e.jsx("option",{value:"running",children:"执行中"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"failed",children:"失败"}),e.jsx("option",{value:"parked",children:"已暂停"})]})]}),e.jsx("div",{className:"space-y-2",children:m.map(s=>e.jsxs("div",{onClick:()=>l(d===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${d===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:s.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[s.status]||a.pending}`,children:s.status})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["批次 ",s.batchIndex," · 依赖 ",s.dependencies.length," 个"]})]},s.name))})]}),e.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[t.conflicts.length>0&&e.jsxs("div",{className:"mb-6 p-4 rounded-lg border border-warning bg-warning/10",children:[e.jsx("h3",{className:"font-medium text-warning mb-2",children:"⚠️ 文件冲突检测"}),e.jsx("div",{className:"space-y-2",children:t.conflicts.map((s,r)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:s.changeA}),e.jsx("span",{className:"text-muted-foreground",children:" 与 "}),e.jsx("span",{className:"font-medium",children:s.changeB}),e.jsx("span",{className:"text-muted-foreground",children:" 冲突于: "}),e.jsx("code",{className:"text-xs bg-background/50 px-1 rounded",children:s.files.join(", ")})]},r))})]}),e.jsx("div",{className:"space-y-6",children:Object.entries(c).sort(([s],[r])=>Number(s)-Number(r)).map(([s,r])=>e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:["批次 ",s,e.jsxs("span",{className:"ml-2 text-xs",children:["(",r.filter(n=>n.status==="completed").length,"/",r.length," 完成)"]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:r.map(n=>e.jsxs("div",{onClick:()=>l(d===n.name?null:n.name),className:`p-4 rounded-lg border transition-colors ${d===n.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[n.status]||a.pending}`,children:n.status})]}),n.dependencies.length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["依赖: ",n.dependencies.join(", ")]})]},n.name))})]},s))})]})]})}export{h as default};
1
+ import{r as u,j as e}from"./index-Co7MWSFf.js";const a={pending:"bg-muted text-muted-foreground",running:"bg-info/20 text-info",completed:"bg-success/20 text-success",failed:"bg-destructive/20 text-destructive",parked:"bg-warning/20 text-warning",skipped:"bg-muted text-muted-foreground line-through"};function h({graph:t,selectedChange:d,onSelectChange:l}){const[i,o]=u.useState("all"),m=t.changes.filter(s=>i==="all"||s.status===i),c=t.batches.reduce((s,r)=>{const n=t.changes.filter(x=>x.batchIndex===r.index);return n.length&&(s[r.index]=n),s},{});return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-sm font-medium",children:"状态筛选"}),e.jsxs("select",{value:i,onChange:s=>o(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm",children:[e.jsx("option",{value:"all",children:"全部"}),e.jsx("option",{value:"pending",children:"待执行"}),e.jsx("option",{value:"running",children:"执行中"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"failed",children:"失败"}),e.jsx("option",{value:"parked",children:"已暂停"})]})]}),e.jsx("div",{className:"space-y-2",children:m.map(s=>e.jsxs("div",{onClick:()=>l(d===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${d===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:s.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[s.status]||a.pending}`,children:s.status})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["批次 ",s.batchIndex," · 依赖 ",s.dependencies.length," 个"]})]},s.name))})]}),e.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[t.conflicts.length>0&&e.jsxs("div",{className:"mb-6 p-4 rounded-lg border border-warning bg-warning/10",children:[e.jsx("h3",{className:"font-medium text-warning mb-2",children:"⚠️ 文件冲突检测"}),e.jsx("div",{className:"space-y-2",children:t.conflicts.map((s,r)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:s.changeA}),e.jsx("span",{className:"text-muted-foreground",children:" 与 "}),e.jsx("span",{className:"font-medium",children:s.changeB}),e.jsx("span",{className:"text-muted-foreground",children:" 冲突于: "}),e.jsx("code",{className:"text-xs bg-background/50 px-1 rounded",children:s.files.join(", ")})]},r))})]}),e.jsx("div",{className:"space-y-6",children:Object.entries(c).sort(([s],[r])=>Number(s)-Number(r)).map(([s,r])=>e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:["批次 ",s,e.jsxs("span",{className:"ml-2 text-xs",children:["(",r.filter(n=>n.status==="completed").length,"/",r.length," 完成)"]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:r.map(n=>e.jsxs("div",{onClick:()=>l(d===n.name?null:n.name),className:`p-4 rounded-lg border transition-colors ${d===n.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[n.status]||a.pending}`,children:n.status})]}),n.dependencies.length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["依赖: ",n.dependencies.join(", ")]})]},n.name))})]},s))})]})]})}export{h as default};
@@ -1 +1 @@
1
- import{b as o,j as c}from"./index-BFfqeozW.js";const m={".md":"md",".markdown":"md",".mdx":"md",".ts":"ts",".tsx":"tsx",".js":"js",".jsx":"jsx",".mjs":"mjs",".cjs":"mjs",".mts":"mjs",".cts":"mjs",".css":"css",".scss":"css",".less":"css",".html":"html",".htm":"html",".json":"json",".yaml":"json",".yml":"json",".toml":"json",".csv":"csv",".tsv":"csv",".sh":"sh",".bash":"sh",".zsh":"sh",".sql":"sh",".py":"py",".go":"py",".rs":"py",".java":"py",".svg":"svg",".png":"svg",".jpg":"svg",".jpeg":"svg",".gif":"svg",".webp":"svg",".ico":"svg"};function r(s){const t=s.toLowerCase();if(t==="justfile"||t==="makefile")return t;const n=s.lastIndexOf("."),e=n>=0?s.slice(n).toLowerCase():"";return m[e]??"unknown"}function i({name:s,active:t}){const{icon:n}=o(),e=n(r(s));return e?c.jsx("span",{className:`h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center ${t?"text-primary":"text-muted-foreground"}`,children:e}):null}export{i as F};
1
+ import{b as o,j as c}from"./index-Co7MWSFf.js";const m={".md":"md",".markdown":"md",".mdx":"md",".ts":"ts",".tsx":"tsx",".js":"js",".jsx":"jsx",".mjs":"mjs",".cjs":"mjs",".mts":"mjs",".cts":"mjs",".css":"css",".scss":"css",".less":"css",".html":"html",".htm":"html",".json":"json",".yaml":"json",".yml":"json",".toml":"json",".csv":"csv",".tsv":"csv",".sh":"sh",".bash":"sh",".zsh":"sh",".sql":"sh",".py":"py",".go":"py",".rs":"py",".java":"py",".svg":"svg",".png":"svg",".jpg":"svg",".jpeg":"svg",".gif":"svg",".webp":"svg",".ico":"svg"};function r(s){const t=s.toLowerCase();if(t==="justfile"||t==="makefile")return t;const n=s.lastIndexOf("."),e=n>=0?s.slice(n).toLowerCase():"";return m[e]??"unknown"}function i({name:s,active:t}){const{icon:n}=o(),e=n(r(s));return e?c.jsx("span",{className:`h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center ${t?"text-primary":"text-muted-foreground"}`,children:e}):null}export{i as F};
@@ -1 +1 @@
1
- import{j as e,e as n}from"./index-BFfqeozW.js";function b({items:l,value:d,onChange:c,ariaLabel:p,renderExtra:a,renderLabel:o,className:t,...u}){return e.jsx("div",{role:"group","aria-label":p,className:n("inline-flex items-center gap-1.5 flex-wrap",t),...u,children:l.map(r=>{const s=r.key===d;return e.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>c(r.key),className:n("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[var(--radius-full)] border text-xs transition-colors",s?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",r.className),children:[r.renderLabel?r.renderLabel(r):o?o(r):e.jsx("span",{children:r.label}),r.badge&&e.jsx("span",{className:"opacity-80",children:r.badge}),r.renderExtra?r.renderExtra(r):a==null?void 0:a(r)]},r.key)})})}export{b as F};
1
+ import{j as e,e as n}from"./index-Co7MWSFf.js";function b({items:l,value:d,onChange:c,ariaLabel:p,renderExtra:a,renderLabel:o,className:t,...u}){return e.jsx("div",{role:"group","aria-label":p,className:n("inline-flex items-center gap-1.5 flex-wrap",t),...u,children:l.map(r=>{const s=r.key===d;return e.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>c(r.key),className:n("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[var(--radius-full)] border text-xs transition-colors",s?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",r.className),children:[r.renderLabel?r.renderLabel(r):o?o(r):e.jsx("span",{children:r.label}),r.badge&&e.jsx("span",{className:"opacity-80",children:r.badge}),r.renderExtra?r.renderExtra(r):a==null?void 0:a(r)]},r.key)})})}export{b as F};
@@ -1 +1 @@
1
- import{j as r,e as i}from"./index-BFfqeozW.js";function t({value:e,className:s}){const a=Math.max(0,Math.min(100,e));return r.jsx("div",{className:i("rounded-[var(--radius-full)] bg-muted overflow-hidden",s),role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuetext":`${a}%`,children:r.jsx("div",{className:"h-full rounded-[var(--radius-full)] bg-primary transition-all",style:{width:`${a}%`}})})}export{t as P};
1
+ import{j as r,e as i}from"./index-Co7MWSFf.js";function t({value:e,className:s}){const a=Math.max(0,Math.min(100,e));return r.jsx("div",{className:i("rounded-[var(--radius-full)] bg-muted overflow-hidden",s),role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuetext":`${a}%`,children:r.jsx("div",{className:"h-full rounded-[var(--radius-full)] bg-primary transition-all",style:{width:`${a}%`}})})}export{t as P};
@@ -1 +1 @@
1
- import{a as W,b as S,r as v,j as e}from"./index-BFfqeozW.js";import{F as D}from"./FileIcon-BmaRn48o.js";import{u as I}from"./usePluginData-l4OWrSnb.js";function h(r,s){return!s||r.name.toLowerCase().includes(s)?!0:(r.children??[]).some(o=>h(o,s))}async function E(){const r=await fetch("/__worktrees",{cache:"no-store"}).then(a=>a.json()).catch(()=>[]),s={};await Promise.all(r.map(async a=>{try{const l=await fetch(`/__files?wt=${encodeURIComponent(a.path)}`,{cache:"no-store"}).then(i=>i.json());s[a.path]=l.tree??[]}catch{s[a.path]=[]}}));const o=await fetch("/__files",{cache:"no-store"}).then(a=>a.json()).then(a=>a.tree??[]).catch(()=>[]);return{worktrees:r,wtTrees:s,rootTree:o}}function y({node:r,depth:s,filter:o,current:a,onSelectFile:l}){const{icon:i}=S(),c=r.children??[],f=!!o&&r.name.toLowerCase().includes(o)?c:c.filter(n=>h(n,o)),[x,b]=v.useState(!r.defaultCollapsed),d=o?!0:x;return!f.length&&o?null:e.jsxs("div",{children:[(()=>{const n=r.name.match(/^([a-z]+)(?: \((\d+)\))?$/),p=n?i(n[1]):void 0;return e.jsxs("button",{onClick:()=>b(m=>!m),className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+s*14,width:"calc(100% - 8px)"},children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${d?"rotate-90":""}`,children:i("chevron-right")}),p?e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:p}):e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:i(d?"folder-open":"folder")}),e.jsx("span",{className:"font-medium truncate",children:n?n[1]:r.name}),(n==null?void 0:n[2])&&e.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-xs font-mono text-muted-foreground",children:n[2]})]})})(),d&&f.map(n=>n.kind==="dir"?e.jsx(y,{node:n,depth:s+1,filter:o,current:a,onSelectFile:l},n.name+s):e.jsxs("button",{onClick:()=>n.path&&l(n.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${a===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+s*14,width:"calc(100% - 8px)"},children:[e.jsx(D,{name:n.name,active:a===n.path}),e.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function O(){var N,k,C;const r=W(),s=r.params,o=s.get("file"),a=s.get("wt"),l=(s.get("filter")??"").toLowerCase(),i=s.get("card")==="dirty",{icon:c}=S(),[w,f]=v.useState(new Set),[x,b]=v.useState(!1),d=I("view:sidebar-trees",E,{subscribe:"files"}),n=((N=d.data)==null?void 0:N.worktrees)??[],p=((k=d.data)==null?void 0:k.wtTrees)??{},m=((C=d.data)==null?void 0:C.rootTree)??[],R=t=>{f(g=>{const u=new Set(g);return u.has(t)?u.delete(t):u.add(t),u})},_=()=>b(t=>!t),$=t=>{r.navigate({filter:t.trim()?t:null},{replace:!0})},F=n.length>0;return e.jsx("div",{className:"p-2 flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsx("input",{value:l,onChange:t=>$(t.target.value),placeholder:"过滤…","data-testid":"view-filter-input",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:border-primary"}),e.jsxs("div",{className:"py-1 flex-1 min-h-0 overflow-auto","data-testid":"view-tree-scroller",children:[F&&n.map(t=>{const u=(p[t.path]??[]).filter(j=>h(j,l));if(!u.length&&l)return null;const T=i&&t.dirty;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>R(t.path),"data-drill-dirty":T?"true":void 0,className:`w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md ${T?"bg-warning/10 ring-1 ring-warning":""}`,children:[e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform",children:c("chevron-right",w.has(t.path)?"":"rotate-90")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:c("git-branch")}),e.jsx("span",{className:"truncate",children:t.branch}),t.dirty&&e.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]}),!w.has(t.path)&&e.jsx("div",{className:"ml-2",children:u.map(j=>e.jsx(y,{node:j,depth:1,filter:l,current:a===t.path?o:null,onSelectFile:L=>r.navigate({wt:t.path,file:L})},j.name))})]},t.path)}),m.length>0&&(!l||m.some(t=>h(t,l)))&&e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:_,className:"w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${x?"":"rotate-90"}`,children:c("chevron-right")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:c("git-branch")}),e.jsx("span",{children:"当前分支"})]}),!x&&e.jsx("div",{className:"ml-2",children:m.filter(t=>h(t,l)).map(t=>e.jsx(y,{node:t,depth:1,filter:l,current:a?null:o,onSelectFile:g=>r.navigate({wt:null,file:g})},t.name))})]})]})]})})}export{O as default};
1
+ import{a as W,b as S,r as v,j as e}from"./index-Co7MWSFf.js";import{F as D}from"./FileIcon-1KBdrfw3.js";import{u as I}from"./usePluginData-IoRqReIJ.js";function h(r,s){return!s||r.name.toLowerCase().includes(s)?!0:(r.children??[]).some(o=>h(o,s))}async function E(){const r=await fetch("/__worktrees",{cache:"no-store"}).then(a=>a.json()).catch(()=>[]),s={};await Promise.all(r.map(async a=>{try{const l=await fetch(`/__files?wt=${encodeURIComponent(a.path)}`,{cache:"no-store"}).then(i=>i.json());s[a.path]=l.tree??[]}catch{s[a.path]=[]}}));const o=await fetch("/__files",{cache:"no-store"}).then(a=>a.json()).then(a=>a.tree??[]).catch(()=>[]);return{worktrees:r,wtTrees:s,rootTree:o}}function y({node:r,depth:s,filter:o,current:a,onSelectFile:l}){const{icon:i}=S(),c=r.children??[],f=!!o&&r.name.toLowerCase().includes(o)?c:c.filter(n=>h(n,o)),[x,b]=v.useState(!r.defaultCollapsed),d=o?!0:x;return!f.length&&o?null:e.jsxs("div",{children:[(()=>{const n=r.name.match(/^([a-z]+)(?: \((\d+)\))?$/),p=n?i(n[1]):void 0;return e.jsxs("button",{onClick:()=>b(m=>!m),className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+s*14,width:"calc(100% - 8px)"},children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${d?"rotate-90":""}`,children:i("chevron-right")}),p?e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:p}):e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:i(d?"folder-open":"folder")}),e.jsx("span",{className:"font-medium truncate",children:n?n[1]:r.name}),(n==null?void 0:n[2])&&e.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-xs font-mono text-muted-foreground",children:n[2]})]})})(),d&&f.map(n=>n.kind==="dir"?e.jsx(y,{node:n,depth:s+1,filter:o,current:a,onSelectFile:l},n.name+s):e.jsxs("button",{onClick:()=>n.path&&l(n.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${a===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+s*14,width:"calc(100% - 8px)"},children:[e.jsx(D,{name:n.name,active:a===n.path}),e.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function O(){var N,k,C;const r=W(),s=r.params,o=s.get("file"),a=s.get("wt"),l=(s.get("filter")??"").toLowerCase(),i=s.get("card")==="dirty",{icon:c}=S(),[w,f]=v.useState(new Set),[x,b]=v.useState(!1),d=I("view:sidebar-trees",E,{subscribe:"files"}),n=((N=d.data)==null?void 0:N.worktrees)??[],p=((k=d.data)==null?void 0:k.wtTrees)??{},m=((C=d.data)==null?void 0:C.rootTree)??[],R=t=>{f(g=>{const u=new Set(g);return u.has(t)?u.delete(t):u.add(t),u})},_=()=>b(t=>!t),$=t=>{r.navigate({filter:t.trim()?t:null},{replace:!0})},F=n.length>0;return e.jsx("div",{className:"p-2 flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsx("input",{value:l,onChange:t=>$(t.target.value),placeholder:"过滤…","data-testid":"view-filter-input",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:border-primary"}),e.jsxs("div",{className:"py-1 flex-1 min-h-0 overflow-auto","data-testid":"view-tree-scroller",children:[F&&n.map(t=>{const u=(p[t.path]??[]).filter(j=>h(j,l));if(!u.length&&l)return null;const T=i&&t.dirty;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>R(t.path),"data-drill-dirty":T?"true":void 0,className:`w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md ${T?"bg-warning/10 ring-1 ring-warning":""}`,children:[e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform",children:c("chevron-right",w.has(t.path)?"":"rotate-90")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:c("git-branch")}),e.jsx("span",{className:"truncate",children:t.branch}),t.dirty&&e.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]}),!w.has(t.path)&&e.jsx("div",{className:"ml-2",children:u.map(j=>e.jsx(y,{node:j,depth:1,filter:l,current:a===t.path?o:null,onSelectFile:L=>r.navigate({wt:t.path,file:L})},j.name))})]},t.path)}),m.length>0&&(!l||m.some(t=>h(t,l)))&&e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:_,className:"w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${x?"":"rotate-90"}`,children:c("chevron-right")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:c("git-branch")}),e.jsx("span",{children:"当前分支"})]}),!x&&e.jsx("div",{className:"ml-2",children:m.filter(t=>h(t,l)).map(t=>e.jsx(y,{node:t,depth:1,filter:l,current:a?null:o,onSelectFile:g=>r.navigate({wt:null,file:g})},t.name))})]})]})]})})}export{O as default};
@@ -1 +1 @@
1
- import{a as x,b as d,r as m,j as s}from"./index-BFfqeozW.js";import{F as f}from"./FileIcon-BmaRn48o.js";import{u as h}from"./usePluginData-l4OWrSnb.js";const b={page:"monitor",component:"blocks",icon:"shapes",token:"palette",md:"book-open",video:"video",audio:"audio-lines",pdf:"file-text",font:"type"},k=[{key:"page",label:"页面"},{key:"component",label:"组件"},{key:"icon",label:"图标"},{key:"token",label:"Tokens"},{key:"md",label:"文档"},{key:"video",label:"视频"},{key:"audio",label:"音频"},{key:"pdf",label:"PDF"},{key:"font",label:"字体"}];function N(){const n=x(),o=n.params,l=o.get("asset"),c=o.get("type"),a=o.get("folder");d();const r=h("design:/__design/assets",()=>fetch("/__design/assets",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),i=m.useMemo(()=>{const t=r.data;return t?k.map(u=>({...u,items:(t[u.key]??[]).filter(p=>!a||p.path.startsWith(a))})).filter(u=>u.items.length>0):[]},[r.data,a]),e=t=>n.navigate({type:t.type,asset:t.path});return s.jsxs("div",{children:[s.jsx("div",{className:"p-3 text-xs text-muted-foreground truncate",children:"设计资产"}),i.map(t=>s.jsx(g,{group:t,current:l&&c===t.key?l:null,onSelect:e},t.key))]})}function g({group:n,current:o,onSelect:l}){const[c,a]=m.useState(!0),{icon:r}=d(),i=b[n.key];return s.jsxs("div",{className:"mb-1.5 px-1",children:[s.jsxs("button",{onClick:()=>a(e=>!e),className:"w-full flex items-center gap-1.5 pt-2 pb-1 text-sm font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground rounded-md",children:[r("chevron-right",`h-3 w-3 shrink-0 transition-transform ${c?"rotate-90":""}`),i&&r(i,"h-3.5 w-3.5 shrink-0"),s.jsx("span",{className:"truncate",children:n.label}),s.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-muted px-1.5 font-mono text-xs font-normal",children:n.items.length})]}),c&&n.items.map(e=>s.jsxs("button",{onClick:()=>l(e),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${o===e.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,children:[s.jsx(f,{name:e.name,active:o===e.path}),s.jsx("span",{className:"truncate",children:e.name}),e.ext&&s.jsx("span",{className:"ml-auto font-mono text-xs text-muted-foreground/60",children:e.ext})]},e.path))]})}export{N as default};
1
+ import{a as x,b as d,r as m,j as s}from"./index-Co7MWSFf.js";import{F as f}from"./FileIcon-1KBdrfw3.js";import{u as h}from"./usePluginData-IoRqReIJ.js";const b={page:"monitor",component:"blocks",icon:"shapes",token:"palette",md:"book-open",video:"video",audio:"audio-lines",pdf:"file-text",font:"type"},k=[{key:"page",label:"页面"},{key:"component",label:"组件"},{key:"icon",label:"图标"},{key:"token",label:"Tokens"},{key:"md",label:"文档"},{key:"video",label:"视频"},{key:"audio",label:"音频"},{key:"pdf",label:"PDF"},{key:"font",label:"字体"}];function N(){const n=x(),o=n.params,l=o.get("asset"),c=o.get("type"),a=o.get("folder");d();const r=h("design:/__design/assets",()=>fetch("/__design/assets",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),i=m.useMemo(()=>{const t=r.data;return t?k.map(u=>({...u,items:(t[u.key]??[]).filter(p=>!a||p.path.startsWith(a))})).filter(u=>u.items.length>0):[]},[r.data,a]),e=t=>n.navigate({type:t.type,asset:t.path});return s.jsxs("div",{children:[s.jsx("div",{className:"p-3 text-xs text-muted-foreground truncate",children:"设计资产"}),i.map(t=>s.jsx(g,{group:t,current:l&&c===t.key?l:null,onSelect:e},t.key))]})}function g({group:n,current:o,onSelect:l}){const[c,a]=m.useState(!0),{icon:r}=d(),i=b[n.key];return s.jsxs("div",{className:"mb-1.5 px-1",children:[s.jsxs("button",{onClick:()=>a(e=>!e),className:"w-full flex items-center gap-1.5 pt-2 pb-1 text-sm font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground rounded-md",children:[r("chevron-right",`h-3 w-3 shrink-0 transition-transform ${c?"rotate-90":""}`),i&&r(i,"h-3.5 w-3.5 shrink-0"),s.jsx("span",{className:"truncate",children:n.label}),s.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-muted px-1.5 font-mono text-xs font-normal",children:n.items.length})]}),c&&n.items.map(e=>s.jsxs("button",{onClick:()=>l(e),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${o===e.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,children:[s.jsx(f,{name:e.name,active:o===e.path}),s.jsx("span",{className:"truncate",children:e.name}),e.ext&&s.jsx("span",{className:"ml-auto font-mono text-xs text-muted-foreground/60",children:e.ext})]},e.path))]})}export{N as default};
@@ -1 +1 @@
1
- import{b as m,a as _,r as $,j as e,S as g,E as h}from"./index-BFfqeozW.js";import{V as C,B as c}from"./ViewHeader-BGjZ06RN.js";import{P as E}from"./ProgressBar-BmnZnTYq.js";import{u}from"./usePluginData-l4OWrSnb.js";import{M as P,t as B}from"./index-cqcRCemV.js";const p=/^\s*-\s*\[([ xX])\]\s*(.*)$/,I="🔧[人工]";function b(s){return s.split(/\r?\n/).filter(r=>p.test(r)).map(r=>{const t=r.match(p),n=((t==null?void 0:t[2])??r).trim();return{text:n,checked:(t==null?void 0:t[1])!==" ",manual:n.startsWith(I)}})}function T(s){const r=b(s),t=r.filter(n=>!n.manual);return{total:t.length,done:t.filter(n=>n.checked).length,manual:r.length-t.length}}function w(s,r){return r===0?0:Math.round(s/r*100)}function k({done:s,total:r}){const t=w(s,r),n=t===100?"success":t>0?"warning":"neutral";return e.jsxs(c,{variant:n,children:[s,"/",r," · ",t,"%"]})}function v(){return e.jsx(c,{variant:"info",children:"worktree 执行中"})}function W(){return e.jsx(c,{variant:"info",children:"含测试策略"})}function M({count:s}){return e.jsxs(c,{variant:"warning",children:["🔧[人工] ",s]})}function R({name:s,pending:r}){const t=r?"neutral":"success";return e.jsx(c,{variant:t,children:r?`${s} · 等待前置`:s})}function j({label:s,content:r}){const{icon:t}=m();return e.jsxs("details",{className:"border rounded-lg bg-card",children:[e.jsxs("summary",{className:"px-3 py-2 text-xs font-medium text-muted-foreground cursor-pointer select-none flex items-center gap-1",children:[t("file-text","h-3 w-3")," ",s]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs px-3 pb-3",children:e.jsx(P,{remarkPlugins:[B],children:r})})]})}function D({tasks:s}){const r=b(s);if(!r.length)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"无 tasks.md"});const t=r.findIndex(n=>!n.checked&&!n.manual);return e.jsx("ul",{className:"space-y-1 text-xs",children:r.map((n,d)=>{const l=d===t,i=n.manual?"text-muted-foreground":n.checked?"text-foreground":"text-muted-foreground";return e.jsxs("li",{className:`flex items-start gap-2 rounded px-1.5 -mx-1.5 py-0.5 ${l?"bg-warning/10 border-l-2 border-warning":""} ${i}`,children:[n.checked?e.jsx("span",{className:"mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full bg-success text-white flex items-center justify-center text-xs",children:"✓"}):e.jsx("span",{className:`mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full border ${l?"border-warning":"border-muted-foreground/50"}`}),e.jsx("span",{children:n.text}),l&&e.jsx("span",{className:"ml-auto flex-none text-xs font-medium text-warning",children:"← 下一步"})]},d)})})}function S({item:s,selected:r,manualCount:t,onSelect:n}){const{icon:d}=m();return e.jsxs("button",{type:"button",onClick:n,"aria-current":r||void 0,className:`w-full text-left rounded-lg border p-3 transition-colors ${r?"border-primary bg-muted/50":"border-border bg-card hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[d("folder-open","h-3.5 w-3.5 text-muted-foreground shrink-0"),e.jsx("span",{className:"text-sm font-medium font-mono truncate min-w-0",title:s.name,children:s.name}),e.jsx("span",{className:"ml-auto flex-none",children:e.jsx(k,{done:s.done,total:s.total})})]}),e.jsx(E,{value:w(s.done,s.total),className:"h-1 mb-1.5"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.hasProposal&&e.jsx(c,{variant:"outline",children:"proposal"}),s.hasDesign&&e.jsx(c,{variant:"info",children:"design"}),s.inWorktree&&e.jsx(v,{}),t!=null&&t>0&&e.jsx(M,{count:t})]})]})}function A(){const{icon:s}=m(),t=u("apply:/__worktrees",()=>fetch("/__worktrees",{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}).data??[];return t.length?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s("git-branch","h-3.5 w-3.5 text-muted-foreground"),e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Worktree:"}),t.map(n=>e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs font-mono bg-info/10 text-info border-info/30",title:n.head,children:[n.name,"@",n.branch||"detached"]},n.name))]}):null}function X({onStatus:s}){const{icon:r}=m(),t=_(),n=t.params.get("change"),d=u("apply:/__apply",()=>fetch("/__apply",{cache:"no-store"}).then(a=>a.json()),{subscribe:"files"}),l=u(`apply:change:${n??""}`,()=>n?fetch(`/__apply/change?name=${encodeURIComponent(n)}`,{cache:"no-store"}).then(a=>a.json()).then(a=>{if(a&&a.error)throw new Error(a.error);return a}):Promise.resolve(null),{subscribe:"files"}),i=d.data??[],o=l.data&&l.data.name===n?l.data:null,{total:f,manual:x}=T((o==null?void 0:o.tasks)??"");$.useEffect(()=>{s==null||s(i.length?{label:`${i.length} 个进行中`,tone:"info"}:void 0)},[i.length,s]);const N=a=>t.navigate({change:a});return e.jsxs("div",{className:"mx-auto h-full max-w-6xl flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:[e.jsx(C,{title:"进行中的 change",actions:e.jsx(A,{})}),d.loading&&!i.length?e.jsx("div",{className:"p-4",children:e.jsx(g,{rows:4})}):i.length?e.jsxs("div",{"data-testid":"single-split",className:"flex-1 min-h-0 flex flex-col lg:flex-row overflow-y-auto lg:overflow-hidden",children:[e.jsx("aside",{"data-testid":"change-list-pane",className:"flex-none lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-border p-3 space-y-2 lg:overflow-y-auto",children:i.map(a=>e.jsx(S,{item:a,selected:a.name===n,manualCount:a.name===n&&x>0?x:null,onSelect:()=>N(a.name)},a.name))}),e.jsx("section",{"data-testid":"change-detail-pane",className:"flex-1 min-w-0 min-h-0 lg:overflow-y-auto p-4 space-y-4",children:n&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium",children:o.name}),e.jsx(k,{done:o.done,total:o.total}),x>0&&e.jsxs(c,{variant:"warning",children:["待人工 ",x," 项"]}),o.inWorktree&&e.jsx(v,{}),o.hasTestStrategy&&e.jsx(W,{})]}),o.dependsOn.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"依赖:"}),o.dependsOn.map(a=>e.jsx(R,{name:a,pending:i.some(y=>y.name===a)},a))]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[r("file-text","h-3 w-3")," tasks.md",f>0&&e.jsxs("span",{className:"font-mono",children:["(",f," 项)"]})]}),e.jsx("div",{className:"border rounded-lg p-3 bg-card",children:e.jsx(D,{tasks:o.tasks})})]}),o.proposal&&e.jsx(j,{label:"proposal.md",content:o.proposal}),o.design&&e.jsx(j,{label:"design.md",content:o.design})]}):n&&l.error?e.jsx(h,{title:`未找到 change「${n}」`,hint:l.error}):n?e.jsx("div",{"data-testid":"detail-loading",className:"p-4",children:e.jsx(g,{rows:4})}):e.jsx(h,{title:"未选择 change",hint:"从左侧列表选择 change 查看详情"})})]}):e.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4",children:e.jsx(h,{icon:r("folder-git-2","h-6 w-6"),title:"没有进行中的 change",hint:"在 openspec/changes/ 下创建 change 后会显示在这里"})})]})}export{X as default};
1
+ import{b as m,a as _,r as $,j as e,S as g,E as h}from"./index-Co7MWSFf.js";import{V as C,B as c}from"./ViewHeader-DPfbaJmK.js";import{P as E}from"./ProgressBar-DVfldtzq.js";import{u}from"./usePluginData-IoRqReIJ.js";import{M as P,t as B}from"./index-D6EJRHBV.js";const p=/^\s*-\s*\[([ xX])\]\s*(.*)$/,I="🔧[人工]";function b(s){return s.split(/\r?\n/).filter(r=>p.test(r)).map(r=>{const t=r.match(p),n=((t==null?void 0:t[2])??r).trim();return{text:n,checked:(t==null?void 0:t[1])!==" ",manual:n.startsWith(I)}})}function T(s){const r=b(s),t=r.filter(n=>!n.manual);return{total:t.length,done:t.filter(n=>n.checked).length,manual:r.length-t.length}}function w(s,r){return r===0?0:Math.round(s/r*100)}function k({done:s,total:r}){const t=w(s,r),n=t===100?"success":t>0?"warning":"neutral";return e.jsxs(c,{variant:n,children:[s,"/",r," · ",t,"%"]})}function v(){return e.jsx(c,{variant:"info",children:"worktree 执行中"})}function W(){return e.jsx(c,{variant:"info",children:"含测试策略"})}function M({count:s}){return e.jsxs(c,{variant:"warning",children:["🔧[人工] ",s]})}function R({name:s,pending:r}){const t=r?"neutral":"success";return e.jsx(c,{variant:t,children:r?`${s} · 等待前置`:s})}function j({label:s,content:r}){const{icon:t}=m();return e.jsxs("details",{className:"border rounded-lg bg-card",children:[e.jsxs("summary",{className:"px-3 py-2 text-xs font-medium text-muted-foreground cursor-pointer select-none flex items-center gap-1",children:[t("file-text","h-3 w-3")," ",s]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs px-3 pb-3",children:e.jsx(P,{remarkPlugins:[B],children:r})})]})}function D({tasks:s}){const r=b(s);if(!r.length)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"无 tasks.md"});const t=r.findIndex(n=>!n.checked&&!n.manual);return e.jsx("ul",{className:"space-y-1 text-xs",children:r.map((n,d)=>{const l=d===t,i=n.manual?"text-muted-foreground":n.checked?"text-foreground":"text-muted-foreground";return e.jsxs("li",{className:`flex items-start gap-2 rounded px-1.5 -mx-1.5 py-0.5 ${l?"bg-warning/10 border-l-2 border-warning":""} ${i}`,children:[n.checked?e.jsx("span",{className:"mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full bg-success text-white flex items-center justify-center text-xs",children:"✓"}):e.jsx("span",{className:`mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full border ${l?"border-warning":"border-muted-foreground/50"}`}),e.jsx("span",{children:n.text}),l&&e.jsx("span",{className:"ml-auto flex-none text-xs font-medium text-warning",children:"← 下一步"})]},d)})})}function S({item:s,selected:r,manualCount:t,onSelect:n}){const{icon:d}=m();return e.jsxs("button",{type:"button",onClick:n,"aria-current":r||void 0,className:`w-full text-left rounded-lg border p-3 transition-colors ${r?"border-primary bg-muted/50":"border-border bg-card hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[d("folder-open","h-3.5 w-3.5 text-muted-foreground shrink-0"),e.jsx("span",{className:"text-sm font-medium font-mono truncate min-w-0",title:s.name,children:s.name}),e.jsx("span",{className:"ml-auto flex-none",children:e.jsx(k,{done:s.done,total:s.total})})]}),e.jsx(E,{value:w(s.done,s.total),className:"h-1 mb-1.5"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.hasProposal&&e.jsx(c,{variant:"outline",children:"proposal"}),s.hasDesign&&e.jsx(c,{variant:"info",children:"design"}),s.inWorktree&&e.jsx(v,{}),t!=null&&t>0&&e.jsx(M,{count:t})]})]})}function A(){const{icon:s}=m(),t=u("apply:/__worktrees",()=>fetch("/__worktrees",{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}).data??[];return t.length?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s("git-branch","h-3.5 w-3.5 text-muted-foreground"),e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Worktree:"}),t.map(n=>e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs font-mono bg-info/10 text-info border-info/30",title:n.head,children:[n.name,"@",n.branch||"detached"]},n.name))]}):null}function X({onStatus:s}){const{icon:r}=m(),t=_(),n=t.params.get("change"),d=u("apply:/__apply",()=>fetch("/__apply",{cache:"no-store"}).then(a=>a.json()),{subscribe:"files"}),l=u(`apply:change:${n??""}`,()=>n?fetch(`/__apply/change?name=${encodeURIComponent(n)}`,{cache:"no-store"}).then(a=>a.json()).then(a=>{if(a&&a.error)throw new Error(a.error);return a}):Promise.resolve(null),{subscribe:"files"}),i=d.data??[],o=l.data&&l.data.name===n?l.data:null,{total:f,manual:x}=T((o==null?void 0:o.tasks)??"");$.useEffect(()=>{s==null||s(i.length?{label:`${i.length} 个进行中`,tone:"info"}:void 0)},[i.length,s]);const N=a=>t.navigate({change:a});return e.jsxs("div",{className:"h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:[e.jsx(C,{title:"进行中的 change",actions:e.jsx(A,{})}),d.loading&&!i.length?e.jsx("div",{className:"p-4",children:e.jsx(g,{rows:4})}):i.length?e.jsxs("div",{"data-testid":"single-split",className:"flex-1 min-h-0 flex flex-col lg:flex-row overflow-y-auto lg:overflow-hidden",children:[e.jsx("aside",{"data-testid":"change-list-pane",className:"flex-none lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-border p-3 space-y-2 lg:overflow-y-auto",children:i.map(a=>e.jsx(S,{item:a,selected:a.name===n,manualCount:a.name===n&&x>0?x:null,onSelect:()=>N(a.name)},a.name))}),e.jsx("section",{"data-testid":"change-detail-pane",className:"flex-1 min-w-0 min-h-0 lg:overflow-y-auto p-4 space-y-4",children:n&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium",children:o.name}),e.jsx(k,{done:o.done,total:o.total}),x>0&&e.jsxs(c,{variant:"warning",children:["待人工 ",x," 项"]}),o.inWorktree&&e.jsx(v,{}),o.hasTestStrategy&&e.jsx(W,{})]}),o.dependsOn.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"依赖:"}),o.dependsOn.map(a=>e.jsx(R,{name:a,pending:i.some(y=>y.name===a)},a))]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[r("file-text","h-3 w-3")," tasks.md",f>0&&e.jsxs("span",{className:"font-mono",children:["(",f," 项)"]})]}),e.jsx("div",{className:"border rounded-lg p-3 bg-card",children:e.jsx(D,{tasks:o.tasks})})]}),o.proposal&&e.jsx(j,{label:"proposal.md",content:o.proposal}),o.design&&e.jsx(j,{label:"design.md",content:o.design})]}):n&&l.error?e.jsx(h,{title:`未找到 change「${n}」`,hint:l.error}):n?e.jsx("div",{"data-testid":"detail-loading",className:"p-4",children:e.jsx(g,{rows:4})}):e.jsx(h,{title:"未选择 change",hint:"从左侧列表选择 change 查看详情"})})]}):e.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4",children:e.jsx(h,{icon:r("folder-git-2","h-6 w-6"),title:"没有进行中的 change",hint:"在 openspec/changes/ 下创建 change 后会显示在这里"})})]})}export{X as default};
@@ -1 +1 @@
1
- import{r as n,j as e,e as d,h as o}from"./index-BFfqeozW.js";const i=o("inline-flex items-center rounded-[var(--radius-sm)] border px-1.5 py-0.5 text-xs font-mono font-medium transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",success:"border-success/30 bg-success/15 text-success",warning:"border-warning/30 bg-warning/15 text-warning",info:"border-info/30 bg-info/15 text-info",outline:"border-border bg-background text-foreground",neutral:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/30 bg-destructive/15 text-destructive"}},defaultVariants:{variant:"default"}}),c=n.forwardRef(({className:r,variant:t,...a},s)=>e.jsx("div",{ref:s,className:d(i({variant:t}),r),...a}));c.displayName="Badge";function x({title:r,actions:t}){return e.jsxs("div",{"data-testid":"view-header",className:"flex-none flex items-center gap-2 px-4 py-2 border-b border-border",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate min-w-0",children:r}),e.jsx("div",{"data-testid":"view-header-actions",className:"ml-auto flex items-center gap-1.5 flex-none min-w-0",children:t??null})]})}export{c as B,x as V};
1
+ import{r as n,j as e,e as d,h as o}from"./index-Co7MWSFf.js";const i=o("inline-flex items-center rounded-[var(--radius-sm)] border px-1.5 py-0.5 text-xs font-mono font-medium transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",success:"border-success/30 bg-success/15 text-success",warning:"border-warning/30 bg-warning/15 text-warning",info:"border-info/30 bg-info/15 text-info",outline:"border-border bg-background text-foreground",neutral:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/30 bg-destructive/15 text-destructive"}},defaultVariants:{variant:"default"}}),c=n.forwardRef(({className:r,variant:t,...a},s)=>e.jsx("div",{ref:s,className:d(i({variant:t}),r),...a}));c.displayName="Badge";function x({title:r,actions:t}){return e.jsxs("div",{"data-testid":"view-header",className:"flex-none flex items-center gap-2 px-4 py-2 border-b border-border",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate min-w-0",children:r}),e.jsx("div",{"data-testid":"view-header-actions",className:"ml-auto flex items-center gap-1.5 flex-none min-w-0",children:t??null})]})}export{c as B,x as V};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SingleChangeView-BYcaGOyR.js","assets/index-Co7MWSFf.js","assets/index-CwS-KyOV.css","assets/ViewHeader-DPfbaJmK.js","assets/ProgressBar-DVfldtzq.js","assets/usePluginData-IoRqReIJ.js","assets/index-D6EJRHBV.js","assets/BatchView-pClKtVa8.js"])))=>i.map(i=>d[i]);
2
+ import{u as g,a as h,r as t,j as e,P as _,S as f,_ as l}from"./index-Co7MWSFf.js";import{m as r}from"./web-CX1FEFxC.js";import"./client-Cw4K1Nx3.js";const b=t.lazy(()=>l(()=>import("./SingleChangeView-BYcaGOyR.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),j=t.lazy(()=>l(()=>import("./BatchView-pClKtVa8.js"),__vite__mapDeps([7,1,2,3,5,6]))),d=["single","batch"],S={single:"单 change",batch:"批量驾驶舱"};function E(n){return d.includes(n??"")?n:"single"}function y(n){const u=g(r.mode,"h-5 w-5"),o=h(),a=E(o.params.get("view")),i=o.params.get("change"),m=["插件",r.mode,...a==="single"&&i?[i]:[]],[p,x]=t.useState(void 0),c=t.useCallback(s=>x(s),[]);return e.jsx(_,{manifest:r,icon:u,breadcrumb:m,status:p,children:e.jsxs("div",{className:"h-full flex flex-col gap-3",children:[e.jsx("div",{className:"flex-none flex items-center gap-2",children:d.map(s=>e.jsx("button",{type:"button","aria-pressed":a===s,onClick:()=>o.navigate({view:s}),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${a===s?"bg-primary text-primary-foreground":"border border-border hover:bg-accent"}`,children:S[s]},s))}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(t.Suspense,{fallback:e.jsx(f,{rows:6}),children:a==="single"?e.jsx(b,{onStatus:c}):e.jsx(j,{onStatus:c})})})]})})}export{y as default};
@@ -1 +1 @@
1
- import{b as g,u as b,a as h,j as t,f as p,P as j}from"./index-BFfqeozW.js";import{P as N}from"./ProgressBar-BmnZnTYq.js";import{u as i}from"./usePluginData-l4OWrSnb.js";import{m as l}from"./web-BeTYyAG8.js";import"./client-Cw4K1Nx3.js";function S(v){var o,n;const{icon:d}=g(),c=b(l.mode,"h-5 w-5"),u=h(),r=i("stats:/__stats/data",()=>fetch("/__stats/data",{cache:"no-store"}).then(e=>e.json()),{subscribe:"files"}),a=i("stats:/__detect",()=>fetch("/__detect",{cache:"no-store"}).then(e=>e.json()));if(r.error)return t.jsx("div",{className:"flex h-full items-center justify-center text-destructive",children:t.jsxs("p",{children:["加载失败: ",r.error]})});if(!r.data)return t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"加载中…"})});const s=r.data,m=Math.max(...s.byExt.map(e=>e.count),1),x=[{label:"文件",value:String(s.files),iconName:"file-text",drill:null},{label:"目录",value:String(s.dirs),iconName:"folder-tree",drill:null},{label:"总大小",value:p(s.totalSize),iconName:null,drill:null},{label:"Worktree",value:String(s.worktrees),iconName:"git-branch",drill:"worktree"},{label:"未提交",value:String(s.dirty??0),iconName:null,drill:"dirty"}],f=e=>u.navigate({p:"view",card:e});return t.jsx(j,{manifest:l,icon:c,breadcrumb:["插件",l.mode],children:t.jsxs("div",{className:"mx-auto h-full max-w-6xl overflow-auto rounded-lg border bg-background p-6 shadow-sm",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-5",children:"后端 fs 扫描 + 前端渲染 · 改文件即时刷新 · 点击卡片跳转"}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6",children:x.map(e=>t.jsxs("button",{type:"button",onClick:()=>e.drill&&f(e.drill),disabled:!e.drill,title:e.drill?`点击跳转至 ${e.label}`:void 0,className:`rounded-lg border bg-background p-4 text-left transition-colors ${e.drill?"hover:bg-muted/70 cursor-pointer":"cursor-default opacity-80"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-xl font-bold",children:e.value}),e.iconName&&d(e.iconName,"h-4 w-4 text-muted-foreground/50")]}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e.label})]},e.label))}),t.jsx("h2",{className:"text-xs font-medium text-muted-foreground mb-3",children:"文件类型 Top 10"}),t.jsx("div",{className:"space-y-2",children:s.byExt.map(e=>t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsx("span",{className:"w-16 font-mono text-foreground truncate",children:e.ext}),t.jsx(N,{value:parseFloat((e.count/m*100).toFixed(1)),className:"flex-1 h-2"}),t.jsx("span",{className:"w-8 text-right font-mono text-muted-foreground",children:e.count})]},e.ext))}),t.jsxs("div",{className:"mt-5 flex items-center gap-2 text-xs",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${(o=a.data)!=null&&o.hasJust?"text-success border-success/30 bg-success/10":"text-muted-foreground border-border"}`,children:["justfile ",(n=a.data)!=null&&n.hasJust?"✓":"✗"]}),typeof s.dirty=="number"&&t.jsx("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${s.dirty?"text-warning border-warning/30 bg-warning/10":"text-success border-success/30 bg-success/10"}`,children:s.dirty?`${s.dirty} 未提交`:"clean"}),t.jsxs("span",{className:"text-muted-foreground",children:["root: ",s.root]})]})]})})}export{S as default};
1
+ import{b as g,u as b,a as h,j as t,f as p,P as j}from"./index-Co7MWSFf.js";import{P as N}from"./ProgressBar-DVfldtzq.js";import{u as i}from"./usePluginData-IoRqReIJ.js";import{m as l}from"./web-DLwxO4fO.js";import"./client-Cw4K1Nx3.js";function S(v){var o,n;const{icon:d}=g(),c=b(l.mode,"h-5 w-5"),u=h(),r=i("stats:/__stats/data",()=>fetch("/__stats/data",{cache:"no-store"}).then(e=>e.json()),{subscribe:"files"}),a=i("stats:/__detect",()=>fetch("/__detect",{cache:"no-store"}).then(e=>e.json()));if(r.error)return t.jsx("div",{className:"flex h-full items-center justify-center text-destructive",children:t.jsxs("p",{children:["加载失败: ",r.error]})});if(!r.data)return t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"加载中…"})});const s=r.data,m=Math.max(...s.byExt.map(e=>e.count),1),x=[{label:"文件",value:String(s.files),iconName:"file-text",drill:null},{label:"目录",value:String(s.dirs),iconName:"folder-tree",drill:null},{label:"总大小",value:p(s.totalSize),iconName:null,drill:null},{label:"Worktree",value:String(s.worktrees),iconName:"git-branch",drill:"worktree"},{label:"未提交",value:String(s.dirty??0),iconName:null,drill:"dirty"}],f=e=>u.navigate({p:"view",card:e});return t.jsx(j,{manifest:l,icon:c,breadcrumb:["插件",l.mode],children:t.jsxs("div",{className:"mx-auto h-full max-w-6xl overflow-auto rounded-lg border bg-background p-6 shadow-sm",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-5",children:"后端 fs 扫描 + 前端渲染 · 改文件即时刷新 · 点击卡片跳转"}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6",children:x.map(e=>t.jsxs("button",{type:"button",onClick:()=>e.drill&&f(e.drill),disabled:!e.drill,title:e.drill?`点击跳转至 ${e.label}`:void 0,className:`rounded-lg border bg-background p-4 text-left transition-colors ${e.drill?"hover:bg-muted/70 cursor-pointer":"cursor-default opacity-80"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-xl font-bold",children:e.value}),e.iconName&&d(e.iconName,"h-4 w-4 text-muted-foreground/50")]}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e.label})]},e.label))}),t.jsx("h2",{className:"text-xs font-medium text-muted-foreground mb-3",children:"文件类型 Top 10"}),t.jsx("div",{className:"space-y-2",children:s.byExt.map(e=>t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsx("span",{className:"w-16 font-mono text-foreground truncate",children:e.ext}),t.jsx(N,{value:parseFloat((e.count/m*100).toFixed(1)),className:"flex-1 h-2"}),t.jsx("span",{className:"w-8 text-right font-mono text-muted-foreground",children:e.count})]},e.ext))}),t.jsxs("div",{className:"mt-5 flex items-center gap-2 text-xs",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${(o=a.data)!=null&&o.hasJust?"text-success border-success/30 bg-success/10":"text-muted-foreground border-border"}`,children:["justfile ",(n=a.data)!=null&&n.hasJust?"✓":"✗"]}),typeof s.dirty=="number"&&t.jsx("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${s.dirty?"text-warning border-warning/30 bg-warning/10":"text-success border-success/30 bg-success/10"}`,children:s.dirty?`${s.dirty} 未提交`:"clean"}),t.jsxs("span",{className:"text-muted-foreground",children:["root: ",s.root]})]})]})})}export{S as default};
@@ -1,4 +1,4 @@
1
- import{r as z,c as R,b as Fe,j as _,B as S,d as be,u as ve,a as ye,P as Ce}from"./index-BFfqeozW.js";import{F as Ee}from"./FilterPills-Dh6YBt2R.js";import{u as Ae}from"./usePluginData-l4OWrSnb.js";import{m as Y}from"./web-Di4EgMTa.js";import"./client-Cw4K1Nx3.js";function d(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function L(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function je(t,e){const s=d(t);return isNaN(e)?L(t,NaN):(e&&s.setDate(s.getDate()+e),s)}function ze(t,e){const s=d(t);if(isNaN(e))return L(t,NaN);if(!e)return s;const n=s.getDate(),r=L(t,s.getTime());r.setMonth(s.getMonth()+e+1,0);const u=r.getDate();return n>=u?r:(s.setFullYear(r.getFullYear(),r.getMonth(),n),s)}function I(t,e){const{years:s=0,months:n=0,weeks:r=0,days:u=0,hours:o=0,minutes:c=0,seconds:l=0}=e,i=d(t),g=n||s?ze(i,n+s*12):i,a=u||r?je(g,u+r*7):g,D=c+o*60,x=(l+D*60)*1e3;return L(t,a.getTime()+x)}const we=864e5,ke=6e4,Ne=36e5;function se(t){const e=d(t);return e.setHours(0,0,0,0),e}function ne(t){const e=d(t),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+t-+s}function Re(t,e){const s=se(t),n=se(e),r=+s-ne(s),u=+n-ne(n);return Math.round((r-u)/we)}function $(t,e){const s=d(t),n=d(e),r=s.getTime()-n.getTime();return r<0?-1:r>0?1:r}function Oe(t,e){const s=d(t),n=d(e),r=s.getFullYear()-n.getFullYear(),u=s.getMonth()-n.getMonth();return r*12+u}function Me(t,e){const s=d(t),n=d(e);return s.getFullYear()-n.getFullYear()}function Se(t,e){const s=d(t),n=d(e),r=re(s,n),u=Math.abs(Re(s,n));s.setDate(s.getDate()-r*u);const o=+(re(s,n)===-r),c=r*(u-o);return c===0?0:c}function re(t,e){const s=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return s<0?-1:s>0?1:s}function K(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Q(t,e){return+d(t)-+d(e)}function Ie(t,e,s){const n=Q(t,e)/Ne;return K(s==null?void 0:s.roundingMethod)(n)}function $e(t,e,s){const n=Q(t,e)/ke;return K(s==null?void 0:s.roundingMethod)(n)}function Le(t){const e=d(t);return e.setHours(23,59,59,999),e}function Te(t){const e=d(t),s=e.getMonth();return e.setFullYear(e.getFullYear(),s+1,0),e.setHours(23,59,59,999),e}function Be(t){const e=d(t);return+Le(e)==+Te(e)}function Pe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Oe(s,n));let o;if(u<1)o=0;else{s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-r*u);let c=$(s,n)===-r;Be(d(t))&&u===1&&$(t,n)===1&&(c=!1),o=r*(u-Number(c))}return o===0?0:o}function Ze(t,e,s){const n=Q(t,e)/1e3;return K(s==null?void 0:s.roundingMethod)(n)}function qe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Me(s,n));s.setFullYear(1584),n.setFullYear(1584);const o=$(s,n)===-r,c=r*(u-+o);return c===0?0:c}function Ye(t){const e=d(t.start),s=d(t.end),n={},r=qe(s,e);r&&(n.years=r);const u=I(e,{years:n.years}),o=Pe(s,u);o&&(n.months=o);const c=I(u,{months:n.months}),l=Se(s,c);l&&(n.days=l);const i=I(c,{days:n.days}),g=Ie(s,i);g&&(n.hours=g);const a=I(i,{hours:n.hours}),D=$e(s,a);D&&(n.minutes=D);const F=I(a,{minutes:n.minutes}),x=Ze(s,F);return x&&(n.seconds=x),n}var ge={};const k=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]],He=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;class O{static escapeForHtml(e){return new O().escapeForHtml(e)}static linkify(e){return new O().linkify(e)}static ansiToHtml(e,s){return new O().ansiToHtml(e,s)}static ansiToJson(e,s){return new O().ansiToJson(e,s)}static ansiToText(e){return new O().ansiToText(e)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let r=0;r<2;++r)for(let u=0;u<8;++u)this.PALETTE_COLORS.push(k[r][u].color);let e=[0,95,135,175,215,255],s=(r,u,o)=>e[r]+", "+e[u]+", "+e[o];for(let r=0;r<6;++r)for(let u=0;u<6;++u)for(let o=0;o<6;++o)this.PALETTE_COLORS.push(s(r,u,o));let n=8;for(let r=0;r<24;++r,n+=10)this.PALETTE_COLORS.push(n+", "+n+", "+n)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,s=>s=="&"?"&amp;":s=='"'?"&quot;":s=="<"?"&lt;":s==">"?"&gt;":"")}linkify(e){return e.replace(He,s=>`<a href="${s}">${s}</a>`)}ansiToHtml(e,s){return this.process(e,s,!0)}ansiToJson(e,s){return s=s||{},s.json=!0,s.clearLine=!1,this.process(e,s,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,s,n){let r=this,u=e.split(/\033\[/),o=u.shift();s==null&&(s={}),s.clearLine=/\r/.test(e);let c=u.map(l=>this.processChunk(l,s,n));if(s&&s.json){let l=r.processChunkJson("");return l.content=o,l.clearLine=s.clearLine,c.unshift(l),s.remove_empty&&(c=c.filter(i=>!i.isEmpty())),c}else c.unshift(o);return c.join("")}processChunkJson(e,s,n){s=typeof s>"u"?{}:s;let r=s.use_classes=typeof s.use_classes<"u"&&s.use_classes,u=s.key=r?"class":"color",o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:s.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},c=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!c)return o;o.content=c[4];let l=c[2].split(";");if(c[1]!==""||c[3]!=="m"||!n)return o;let i=this;for(;l.length>0;){let g=l.shift(),a=parseInt(g);if(isNaN(a)||a===0)i.fg=i.bg=null,i.decorations=[];else if(a===1)i.decorations.push("bold");else if(a===2)i.decorations.push("dim");else if(a===3)i.decorations.push("italic");else if(a===4)i.decorations.push("underline");else if(a===5)i.decorations.push("blink");else if(a===7)i.decorations.push("reverse");else if(a===8)i.decorations.push("hidden");else if(a===9)i.decorations.push("strikethrough");else if(a===21)i.removeDecoration("bold");else if(a===22)i.removeDecoration("bold"),i.removeDecoration("dim");else if(a===23)i.removeDecoration("italic");else if(a===24)i.removeDecoration("underline");else if(a===25)i.removeDecoration("blink");else if(a===27)i.removeDecoration("reverse");else if(a===28)i.removeDecoration("hidden");else if(a===29)i.removeDecoration("strikethrough");else if(a===39)i.fg=null;else if(a===49)i.bg=null;else if(a>=30&&a<38)i.fg=k[0][a%10][u];else if(a>=90&&a<98)i.fg=k[1][a%10][u];else if(a>=40&&a<48)i.bg=k[0][a%10][u];else if(a>=100&&a<108)i.bg=k[1][a%10][u];else if(a===38||a===48){let D=a===38;if(l.length>=1){let F=l.shift();if(F==="5"&&l.length>=1){let x=parseInt(l.shift());if(x>=0&&x<=255)if(!r)this.PALETTE_COLORS||i.setupPalette(),D?i.fg=this.PALETTE_COLORS[x]:i.bg=this.PALETTE_COLORS[x];else{let y=x>=16?"ansi-palette-"+x:k[x>7?1:0][x%8].class;D?i.fg=y:i.bg=y}}else if(F==="2"&&l.length>=3){let x=parseInt(l.shift()),y=parseInt(l.shift()),j=parseInt(l.shift());if(x>=0&&x<=255&&y>=0&&y<=255&&j>=0&&j<=255){let C=x+", "+y+", "+j;r?D?(i.fg="ansi-truecolor",i.fg_truecolor=C):(i.bg="ansi-truecolor",i.bg_truecolor=C):D?i.fg=C:i.bg=C}}}}}return i.fg===null&&i.bg===null&&i.decorations.length===0||(o.fg=i.fg,o.bg=i.bg,o.fg_truecolor=i.fg_truecolor,o.bg_truecolor=i.bg_truecolor,o.decorations=i.decorations,o.decoration=i.decorations.slice(-1).pop()||null,o.was_processed=!0),o}processChunk(e,s,n){s=s||{};let r=this.processChunkJson(e,s,n),u=s.use_classes;if(r.decorations=r.decorations.filter(a=>{if(a==="reverse"){r.fg||(r.fg=k[0][7][u?"class":"color"]),r.bg||(r.bg=k[0][0][u?"class":"color"]);let D=r.fg;r.fg=r.bg,r.bg=D;let F=r.fg_truecolor;return r.fg_truecolor=r.bg_truecolor,r.bg_truecolor=F,r.isInverted=!0,!1}return!0}),s.json)return r;if(r.isEmpty())return"";if(!r.was_processed)return r.content;let o=[],c=[],l=[],i={},g=a=>{let D=[],F;for(F in a)a.hasOwnProperty(F)&&D.push("data-"+F+'="'+this.escapeForHtml(a[F])+'"');return D.length>0?" "+D.join(" "):""};return r.isInverted&&(i["ansi-is-inverted"]="true"),r.fg&&(u?(o.push(r.fg+"-fg"),r.fg_truecolor!==null&&(i["ansi-truecolor-fg"]=r.fg_truecolor,r.fg_truecolor=null)):o.push("color:rgb("+r.fg+")")),r.bg&&(u?(o.push(r.bg+"-bg"),r.bg_truecolor!==null&&(i["ansi-truecolor-bg"]=r.bg_truecolor,r.bg_truecolor=null)):o.push("background-color:rgb("+r.bg+")")),r.decorations.forEach(a=>{if(u){c.push("ansi-"+a);return}a==="bold"?c.push("font-weight:bold"):a==="dim"?c.push("opacity:0.5"):a==="italic"?c.push("font-style:italic"):a==="hidden"?c.push("visibility:hidden"):a==="strikethrough"?l.push("line-through"):l.push(a)}),l.length&&c.push("text-decoration:"+l.join(" ")),u?'<span class="'+o.concat(c).join(" ")+'"'+g(i)+">"+r.content+"</span>":'<span style="'+o.concat(c).join(";")+'"'+g(i)+">"+r.content+"</span>"}removeDecoration(e){const s=this.decorations.indexOf(e);s>=0&&this.decorations.splice(s,1)}}var We=O,B={exports:{}};function X(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,`
1
+ import{r as z,c as R,b as Fe,j as _,B as S,d as be,u as ve,a as ye,P as Ce}from"./index-Co7MWSFf.js";import{F as Ee}from"./FilterPills-CCubROoX.js";import{u as Ae}from"./usePluginData-IoRqReIJ.js";import{m as Y}from"./web-DOEmlI8d.js";import"./client-Cw4K1Nx3.js";function d(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function L(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function je(t,e){const s=d(t);return isNaN(e)?L(t,NaN):(e&&s.setDate(s.getDate()+e),s)}function ze(t,e){const s=d(t);if(isNaN(e))return L(t,NaN);if(!e)return s;const n=s.getDate(),r=L(t,s.getTime());r.setMonth(s.getMonth()+e+1,0);const u=r.getDate();return n>=u?r:(s.setFullYear(r.getFullYear(),r.getMonth(),n),s)}function I(t,e){const{years:s=0,months:n=0,weeks:r=0,days:u=0,hours:o=0,minutes:c=0,seconds:l=0}=e,i=d(t),g=n||s?ze(i,n+s*12):i,a=u||r?je(g,u+r*7):g,D=c+o*60,x=(l+D*60)*1e3;return L(t,a.getTime()+x)}const we=864e5,ke=6e4,Ne=36e5;function se(t){const e=d(t);return e.setHours(0,0,0,0),e}function ne(t){const e=d(t),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+t-+s}function Re(t,e){const s=se(t),n=se(e),r=+s-ne(s),u=+n-ne(n);return Math.round((r-u)/we)}function $(t,e){const s=d(t),n=d(e),r=s.getTime()-n.getTime();return r<0?-1:r>0?1:r}function Oe(t,e){const s=d(t),n=d(e),r=s.getFullYear()-n.getFullYear(),u=s.getMonth()-n.getMonth();return r*12+u}function Me(t,e){const s=d(t),n=d(e);return s.getFullYear()-n.getFullYear()}function Se(t,e){const s=d(t),n=d(e),r=re(s,n),u=Math.abs(Re(s,n));s.setDate(s.getDate()-r*u);const o=+(re(s,n)===-r),c=r*(u-o);return c===0?0:c}function re(t,e){const s=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return s<0?-1:s>0?1:s}function K(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Q(t,e){return+d(t)-+d(e)}function Ie(t,e,s){const n=Q(t,e)/Ne;return K(s==null?void 0:s.roundingMethod)(n)}function $e(t,e,s){const n=Q(t,e)/ke;return K(s==null?void 0:s.roundingMethod)(n)}function Le(t){const e=d(t);return e.setHours(23,59,59,999),e}function Te(t){const e=d(t),s=e.getMonth();return e.setFullYear(e.getFullYear(),s+1,0),e.setHours(23,59,59,999),e}function Be(t){const e=d(t);return+Le(e)==+Te(e)}function Pe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Oe(s,n));let o;if(u<1)o=0;else{s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-r*u);let c=$(s,n)===-r;Be(d(t))&&u===1&&$(t,n)===1&&(c=!1),o=r*(u-Number(c))}return o===0?0:o}function Ze(t,e,s){const n=Q(t,e)/1e3;return K(s==null?void 0:s.roundingMethod)(n)}function qe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Me(s,n));s.setFullYear(1584),n.setFullYear(1584);const o=$(s,n)===-r,c=r*(u-+o);return c===0?0:c}function Ye(t){const e=d(t.start),s=d(t.end),n={},r=qe(s,e);r&&(n.years=r);const u=I(e,{years:n.years}),o=Pe(s,u);o&&(n.months=o);const c=I(u,{months:n.months}),l=Se(s,c);l&&(n.days=l);const i=I(c,{days:n.days}),g=Ie(s,i);g&&(n.hours=g);const a=I(i,{hours:n.hours}),D=$e(s,a);D&&(n.minutes=D);const F=I(a,{minutes:n.minutes}),x=Ze(s,F);return x&&(n.seconds=x),n}var ge={};const k=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]],He=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;class O{static escapeForHtml(e){return new O().escapeForHtml(e)}static linkify(e){return new O().linkify(e)}static ansiToHtml(e,s){return new O().ansiToHtml(e,s)}static ansiToJson(e,s){return new O().ansiToJson(e,s)}static ansiToText(e){return new O().ansiToText(e)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let r=0;r<2;++r)for(let u=0;u<8;++u)this.PALETTE_COLORS.push(k[r][u].color);let e=[0,95,135,175,215,255],s=(r,u,o)=>e[r]+", "+e[u]+", "+e[o];for(let r=0;r<6;++r)for(let u=0;u<6;++u)for(let o=0;o<6;++o)this.PALETTE_COLORS.push(s(r,u,o));let n=8;for(let r=0;r<24;++r,n+=10)this.PALETTE_COLORS.push(n+", "+n+", "+n)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,s=>s=="&"?"&amp;":s=='"'?"&quot;":s=="<"?"&lt;":s==">"?"&gt;":"")}linkify(e){return e.replace(He,s=>`<a href="${s}">${s}</a>`)}ansiToHtml(e,s){return this.process(e,s,!0)}ansiToJson(e,s){return s=s||{},s.json=!0,s.clearLine=!1,this.process(e,s,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,s,n){let r=this,u=e.split(/\033\[/),o=u.shift();s==null&&(s={}),s.clearLine=/\r/.test(e);let c=u.map(l=>this.processChunk(l,s,n));if(s&&s.json){let l=r.processChunkJson("");return l.content=o,l.clearLine=s.clearLine,c.unshift(l),s.remove_empty&&(c=c.filter(i=>!i.isEmpty())),c}else c.unshift(o);return c.join("")}processChunkJson(e,s,n){s=typeof s>"u"?{}:s;let r=s.use_classes=typeof s.use_classes<"u"&&s.use_classes,u=s.key=r?"class":"color",o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:s.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},c=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!c)return o;o.content=c[4];let l=c[2].split(";");if(c[1]!==""||c[3]!=="m"||!n)return o;let i=this;for(;l.length>0;){let g=l.shift(),a=parseInt(g);if(isNaN(a)||a===0)i.fg=i.bg=null,i.decorations=[];else if(a===1)i.decorations.push("bold");else if(a===2)i.decorations.push("dim");else if(a===3)i.decorations.push("italic");else if(a===4)i.decorations.push("underline");else if(a===5)i.decorations.push("blink");else if(a===7)i.decorations.push("reverse");else if(a===8)i.decorations.push("hidden");else if(a===9)i.decorations.push("strikethrough");else if(a===21)i.removeDecoration("bold");else if(a===22)i.removeDecoration("bold"),i.removeDecoration("dim");else if(a===23)i.removeDecoration("italic");else if(a===24)i.removeDecoration("underline");else if(a===25)i.removeDecoration("blink");else if(a===27)i.removeDecoration("reverse");else if(a===28)i.removeDecoration("hidden");else if(a===29)i.removeDecoration("strikethrough");else if(a===39)i.fg=null;else if(a===49)i.bg=null;else if(a>=30&&a<38)i.fg=k[0][a%10][u];else if(a>=90&&a<98)i.fg=k[1][a%10][u];else if(a>=40&&a<48)i.bg=k[0][a%10][u];else if(a>=100&&a<108)i.bg=k[1][a%10][u];else if(a===38||a===48){let D=a===38;if(l.length>=1){let F=l.shift();if(F==="5"&&l.length>=1){let x=parseInt(l.shift());if(x>=0&&x<=255)if(!r)this.PALETTE_COLORS||i.setupPalette(),D?i.fg=this.PALETTE_COLORS[x]:i.bg=this.PALETTE_COLORS[x];else{let y=x>=16?"ansi-palette-"+x:k[x>7?1:0][x%8].class;D?i.fg=y:i.bg=y}}else if(F==="2"&&l.length>=3){let x=parseInt(l.shift()),y=parseInt(l.shift()),j=parseInt(l.shift());if(x>=0&&x<=255&&y>=0&&y<=255&&j>=0&&j<=255){let C=x+", "+y+", "+j;r?D?(i.fg="ansi-truecolor",i.fg_truecolor=C):(i.bg="ansi-truecolor",i.bg_truecolor=C):D?i.fg=C:i.bg=C}}}}}return i.fg===null&&i.bg===null&&i.decorations.length===0||(o.fg=i.fg,o.bg=i.bg,o.fg_truecolor=i.fg_truecolor,o.bg_truecolor=i.bg_truecolor,o.decorations=i.decorations,o.decoration=i.decorations.slice(-1).pop()||null,o.was_processed=!0),o}processChunk(e,s,n){s=s||{};let r=this.processChunkJson(e,s,n),u=s.use_classes;if(r.decorations=r.decorations.filter(a=>{if(a==="reverse"){r.fg||(r.fg=k[0][7][u?"class":"color"]),r.bg||(r.bg=k[0][0][u?"class":"color"]);let D=r.fg;r.fg=r.bg,r.bg=D;let F=r.fg_truecolor;return r.fg_truecolor=r.bg_truecolor,r.bg_truecolor=F,r.isInverted=!0,!1}return!0}),s.json)return r;if(r.isEmpty())return"";if(!r.was_processed)return r.content;let o=[],c=[],l=[],i={},g=a=>{let D=[],F;for(F in a)a.hasOwnProperty(F)&&D.push("data-"+F+'="'+this.escapeForHtml(a[F])+'"');return D.length>0?" "+D.join(" "):""};return r.isInverted&&(i["ansi-is-inverted"]="true"),r.fg&&(u?(o.push(r.fg+"-fg"),r.fg_truecolor!==null&&(i["ansi-truecolor-fg"]=r.fg_truecolor,r.fg_truecolor=null)):o.push("color:rgb("+r.fg+")")),r.bg&&(u?(o.push(r.bg+"-bg"),r.bg_truecolor!==null&&(i["ansi-truecolor-bg"]=r.bg_truecolor,r.bg_truecolor=null)):o.push("background-color:rgb("+r.bg+")")),r.decorations.forEach(a=>{if(u){c.push("ansi-"+a);return}a==="bold"?c.push("font-weight:bold"):a==="dim"?c.push("opacity:0.5"):a==="italic"?c.push("font-style:italic"):a==="hidden"?c.push("visibility:hidden"):a==="strikethrough"?l.push("line-through"):l.push(a)}),l.length&&c.push("text-decoration:"+l.join(" ")),u?'<span class="'+o.concat(c).join(" ")+'"'+g(i)+">"+r.content+"</span>":'<span style="'+o.concat(c).join(";")+'"'+g(i)+">"+r.content+"</span>"}removeDecoration(e){const s=this.decorations.indexOf(e);s>=0&&this.decorations.splice(s,1)}}var We=O,B={exports:{}};function X(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,`
2
2
  `);/\r./.test(t);)t=t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,s,n){return n+s.slice(n.length)});return t}function Je(t){for(var e=0,s=0;s<t.length;s++)t[e].length<=t[s].length&&(e=s);return e}function ie(t){if(!/\r/.test(t))return t;for(var e=t.split("\r"),s=[];e.length>0;){var n=Je(e);s.push(e[n]),e=e.slice(n+1)}return s.join("\r")}function Ge(t){if(!t)return"";if(!/\r/.test(t))return t;if(!/\n/.test(t))return ie(t);t=t.replace(/\r+\n/gm,`
3
3
  `);var e=t.lastIndexOf(`
4
4
  `);return X(t.slice(0,e))+`
@@ -1 +1 @@
1
- import{j as e,r as u,b as j,u as _,a as I,P as R,E as F}from"./index-BFfqeozW.js";import{F as S}from"./FilterPills-Dh6YBt2R.js";import{C as U,M as L,I as E}from"./CodeViewer-JhnG7iUT.js";import{m as v}from"./web-Dzj4gVNk.js";import"./index-cqcRCemV.js";import"./client-Cw4K1Nx3.js";function $({path:t}){return e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"预览",className:"w-full h-full border-0 bg-white"})}const k=/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i,y=/font|family|type/i;function A({path:t}){const[m,d]=u.useState([]),[i,a]=u.useState(!0);return u.useEffect(()=>{let s=!1;return a(!0),d([]),fetch("/__design/asset?path="+encodeURIComponent(t),{cache:"no-store"}).then(o=>o.text()).then(o=>{if(s)return;const c=o.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){d([]),a(!1);return}const r=l=>{const N=l.indexOf(":"),V=l.slice(0,N).trim(),C=l.slice(N+1).trim();return{name:V,value:C}},n=l=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(l),p=l=>y.test(l),x=c.map(r),f=x.filter(l=>n(l.value)),g=x.filter(l=>!n(l.value)&&p(l.name)),b=x.filter(l=>!n(l.value)&&!p(l.name)),h=[];f.length&&h.push({label:`配色 · ${f.length}`,items:f}),g.length&&h.push({label:`字体 · ${g.length}`,items:g}),b.length&&h.push({label:`其他 · ${b.length}`,items:b}),d(h),a(!1)}).catch(()=>{s||(d([]),a(!1))}),()=>{s=!0}},[t]),i?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):m.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:m.map(s=>{const o=s.items.some(r=>k.test(r.value)),c=s.items.some(r=>y.test(r.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-sm font-semibold uppercase text-muted-foreground",children:s.label}),o?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.filter(r=>k.test(r.value)).map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[var(--design-preview-h)] border-b",style:{background:n}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-sm break-all",children:r}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:n})]},r))}):c?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"grid h-[var(--design-preview-h)] place-items-center text-2xl",style:{fontFamily:n},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-sm",children:r})]},r))}):e.jsx("div",{className:"flex flex-col gap-1",children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"flex justify-between gap-3 px-2.5 py-1.5 rounded border bg-background text-xs",children:[e.jsx("span",{className:"font-mono",children:r}),e.jsx("span",{className:"text-muted-foreground",children:n})]},r))})]},s.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}const w=t=>"/__design/asset?path="+encodeURIComponent(t);function O({path:t}){return e.jsx(L,{path:t,resolve:w})}function M({path:t}){return e.jsx(E,{path:t,resolve:w})}function P({path:t}){return e.jsx(U,{path:t,resolve:w})}function W({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("video",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"max-w-full max-h-[80vh] rounded border"})})}function z({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("audio",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"w-full max-w-2xl"})})}function T({path:t}){return e.jsx("div",{className:"grid place-items-center p-8 h-full",children:e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"PDF",className:"w-full h-full max-h-[80vh] rounded border bg-white"})})}function D({path:t}){const[m,d]=u.useState("");return u.useEffect(()=>{let i=!1,a="",s=null;return fetch("/__design/asset?path="+encodeURIComponent(t)).then(o=>o.blob()).then(async o=>{var c;if(!i){if(a=URL.createObjectURL(o),s=new FontFace("zd-font-preview",`url(${a})`),await s.load(),i){(c=s.dispose)==null||c.call(s);return}document.fonts.add(s),d(t.split("/").pop()??t)}}).catch(()=>{i||d(t.split("/").pop()??t)}),()=>{var o;if(i=!0,s)try{document.fonts.delete(s),(o=s.dispose)==null||o.call(s)}catch{}a&&URL.revokeObjectURL(a)}},[t]),e.jsxs("div",{className:"h-full overflow-auto p-8 grid gap-6 place-content-center text-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:t}),e.jsx("div",{className:"text-5xl",style:{fontFamily:m?"'zd-font-preview', serif":"serif"},children:"Aa 字体预览 0123"})]})}function H({path:t}){const{icon:m}=j();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[m("image-off","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:t})]})})}const K={page:$,icon:M,token:A,md:O,video:W,audio:z,pdf:T,component:P,font:D};function Z(t){return K[t]??H}function q({mode:t,onMode:m,w:d,h:i,onW:a,onH:s}){const{icon:o}=j(),c=[{v:0,icon:o("monitor","h-3.5 w-3.5"),label:"桌面"},{v:768,icon:o("tablet","h-3.5 w-3.5"),label:"768"},{v:375,icon:o("smartphone","h-3.5 w-3.5"),label:"375"},{v:"custom",icon:o("sliders-horizontal","h-3.5 w-3.5"),label:"自定义"}],r="w-[var(--design-input-w)] h-7 px-1 text-center text-xs rounded border border-border bg-background text-foreground [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none focus:outline-none focus:border-primary";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5 bg-muted",children:e.jsx(S,{items:c.map(n=>({key:String(n.v),label:n.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[n.icon,e.jsx("span",{className:"hidden sm:inline",children:n.label})]})})),value:String(t),onChange:n=>m(n==="0"?0:n==="custom"?"custom":Number(n)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:d,min:280,max:3e3,step:8,onChange:n=>a(Number(n.target.value)),"aria-label":"自定义宽度",className:r}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:i,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:r}),e.jsx("span",{className:"text-sm text-muted-foreground/70",children:"px"})]})]})}function ee({params:t}){const{icon:m}=j(),d=_(v.mode,"h-5 w-5");I();const i=t.get("type")??"",a=t.get("asset"),[s,o]=u.useState(0),[c,r]=u.useState(1024),[n,p]=u.useState(768),x=a?Z(i):null,f=s===0?"桌面":s==="custom"?`${c} × ${n}`:`${s}px`;return e.jsx(R,{manifest:v,icon:d,breadcrumb:["插件",v.mode,...i?[i]:[],...a?[a]:[]],children:e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:a&&x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[var(--design-toolbar-h)] flex-none flex items-center justify-between px-3.5 border-b bg-background text-xs",children:[e.jsx("span",{className:"font-mono truncate",children:a}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:f}),e.jsx(q,{mode:s,onMode:o,w:c,h:n,onW:r,onH:p})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:i==="page"?e.jsx("div",{className:"mx-auto bg-background overflow-hidden",style:{maxWidth:s===0?void 0:s==="custom"?c:s,height:s==="custom"?n:"100%"},children:e.jsx(x,{path:a})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(x,{path:a})})})]}):e.jsx(F,{icon:m("palette","h-6 w-6"),title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新"})})})}export{ee as default};
1
+ import{j as e,r as u,b as j,u as _,a as I,P as R,E as F}from"./index-Co7MWSFf.js";import{F as S}from"./FilterPills-CCubROoX.js";import{C as U,M as L,I as E}from"./CodeViewer-Cs0mG1h6.js";import{m as v}from"./web-BZSTgldm.js";import"./index-D6EJRHBV.js";import"./client-Cw4K1Nx3.js";function $({path:t}){return e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"预览",className:"w-full h-full border-0 bg-white"})}const k=/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i,y=/font|family|type/i;function A({path:t}){const[m,d]=u.useState([]),[i,a]=u.useState(!0);return u.useEffect(()=>{let s=!1;return a(!0),d([]),fetch("/__design/asset?path="+encodeURIComponent(t),{cache:"no-store"}).then(o=>o.text()).then(o=>{if(s)return;const c=o.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){d([]),a(!1);return}const r=l=>{const N=l.indexOf(":"),V=l.slice(0,N).trim(),C=l.slice(N+1).trim();return{name:V,value:C}},n=l=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(l),p=l=>y.test(l),x=c.map(r),f=x.filter(l=>n(l.value)),g=x.filter(l=>!n(l.value)&&p(l.name)),b=x.filter(l=>!n(l.value)&&!p(l.name)),h=[];f.length&&h.push({label:`配色 · ${f.length}`,items:f}),g.length&&h.push({label:`字体 · ${g.length}`,items:g}),b.length&&h.push({label:`其他 · ${b.length}`,items:b}),d(h),a(!1)}).catch(()=>{s||(d([]),a(!1))}),()=>{s=!0}},[t]),i?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):m.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:m.map(s=>{const o=s.items.some(r=>k.test(r.value)),c=s.items.some(r=>y.test(r.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-sm font-semibold uppercase text-muted-foreground",children:s.label}),o?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.filter(r=>k.test(r.value)).map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[var(--design-preview-h)] border-b",style:{background:n}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-sm break-all",children:r}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:n})]},r))}):c?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"grid h-[var(--design-preview-h)] place-items-center text-2xl",style:{fontFamily:n},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-sm",children:r})]},r))}):e.jsx("div",{className:"flex flex-col gap-1",children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"flex justify-between gap-3 px-2.5 py-1.5 rounded border bg-background text-xs",children:[e.jsx("span",{className:"font-mono",children:r}),e.jsx("span",{className:"text-muted-foreground",children:n})]},r))})]},s.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}const w=t=>"/__design/asset?path="+encodeURIComponent(t);function O({path:t}){return e.jsx(L,{path:t,resolve:w})}function M({path:t}){return e.jsx(E,{path:t,resolve:w})}function P({path:t}){return e.jsx(U,{path:t,resolve:w})}function W({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("video",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"max-w-full max-h-[80vh] rounded border"})})}function z({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("audio",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"w-full max-w-2xl"})})}function T({path:t}){return e.jsx("div",{className:"grid place-items-center p-8 h-full",children:e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"PDF",className:"w-full h-full max-h-[80vh] rounded border bg-white"})})}function D({path:t}){const[m,d]=u.useState("");return u.useEffect(()=>{let i=!1,a="",s=null;return fetch("/__design/asset?path="+encodeURIComponent(t)).then(o=>o.blob()).then(async o=>{var c;if(!i){if(a=URL.createObjectURL(o),s=new FontFace("zd-font-preview",`url(${a})`),await s.load(),i){(c=s.dispose)==null||c.call(s);return}document.fonts.add(s),d(t.split("/").pop()??t)}}).catch(()=>{i||d(t.split("/").pop()??t)}),()=>{var o;if(i=!0,s)try{document.fonts.delete(s),(o=s.dispose)==null||o.call(s)}catch{}a&&URL.revokeObjectURL(a)}},[t]),e.jsxs("div",{className:"h-full overflow-auto p-8 grid gap-6 place-content-center text-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:t}),e.jsx("div",{className:"text-5xl",style:{fontFamily:m?"'zd-font-preview', serif":"serif"},children:"Aa 字体预览 0123"})]})}function H({path:t}){const{icon:m}=j();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[m("image-off","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:t})]})})}const K={page:$,icon:M,token:A,md:O,video:W,audio:z,pdf:T,component:P,font:D};function Z(t){return K[t]??H}function q({mode:t,onMode:m,w:d,h:i,onW:a,onH:s}){const{icon:o}=j(),c=[{v:0,icon:o("monitor","h-3.5 w-3.5"),label:"桌面"},{v:768,icon:o("tablet","h-3.5 w-3.5"),label:"768"},{v:375,icon:o("smartphone","h-3.5 w-3.5"),label:"375"},{v:"custom",icon:o("sliders-horizontal","h-3.5 w-3.5"),label:"自定义"}],r="w-[var(--design-input-w)] h-7 px-1 text-center text-xs rounded border border-border bg-background text-foreground [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none focus:outline-none focus:border-primary";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5 bg-muted",children:e.jsx(S,{items:c.map(n=>({key:String(n.v),label:n.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[n.icon,e.jsx("span",{className:"hidden sm:inline",children:n.label})]})})),value:String(t),onChange:n=>m(n==="0"?0:n==="custom"?"custom":Number(n)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:d,min:280,max:3e3,step:8,onChange:n=>a(Number(n.target.value)),"aria-label":"自定义宽度",className:r}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:i,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:r}),e.jsx("span",{className:"text-sm text-muted-foreground/70",children:"px"})]})]})}function ee({params:t}){const{icon:m}=j(),d=_(v.mode,"h-5 w-5");I();const i=t.get("type")??"",a=t.get("asset"),[s,o]=u.useState(0),[c,r]=u.useState(1024),[n,p]=u.useState(768),x=a?Z(i):null,f=s===0?"桌面":s==="custom"?`${c} × ${n}`:`${s}px`;return e.jsx(R,{manifest:v,icon:d,breadcrumb:["插件",v.mode,...i?[i]:[],...a?[a]:[]],children:e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:a&&x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[var(--design-toolbar-h)] flex-none flex items-center justify-between px-3.5 border-b bg-background text-xs",children:[e.jsx("span",{className:"font-mono truncate",children:a}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:f}),e.jsx(q,{mode:s,onMode:o,w:c,h:n,onW:r,onH:p})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:i==="page"?e.jsx("div",{className:"mx-auto bg-background overflow-hidden",style:{maxWidth:s===0?void 0:s==="custom"?c:s,height:s==="custom"?n:"100%"},children:e.jsx(x,{path:a})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(x,{path:a})})})]}):e.jsx(F,{icon:m("palette","h-6 w-6"),title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新"})})})}export{ee as default};
@@ -1 +1 @@
1
- import{b as p,j as e,r as f,u as w,P as j,E as y}from"./index-BFfqeozW.js";import{C as b,M as I,I as k}from"./CodeViewer-JhnG7iUT.js";import{m as v}from"./web-DwX6rkMl.js";import"./index-cqcRCemV.js";import"./client-Cw4K1Nx3.js";function N({path:s}){const{icon:i}=p();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[i("file-question","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:s})]})})}function C({containerRef:s}){const{icon:i}=p(),[r,l]=f.useState([]),[h,m]=f.useState(null);f.useEffect(()=>{const t=s.current;if(!t)return;let n=!1;const o=()=>{if(n)return;const d=t.querySelectorAll("h1[id], h2[id], h3[id]"),u=[];d.forEach(a=>{var g;u.push({id:a.id,text:((g=a.textContent)==null?void 0:g.trim())??"",level:parseInt(a.tagName[1],10)})}),l(u)};o();const c=new MutationObserver(o);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{n=!0,c.disconnect()}},[s]),f.useEffect(()=>{const t=s.current;if(!t||!r.length)return;const n=new IntersectionObserver(o=>{const c=o.filter(d=>d.isIntersecting);if(c.length){const d=c.reduce((u,a)=>u.boundingClientRect.top<a.boundingClientRect.top?u:a);m(d.target.id)}},{root:t,rootMargin:"-60px 0px -70% 0px",threshold:0});return r.forEach(({id:o})=>{const c=t.querySelector(`#${CSS.escape(o)}`);c&&n.observe(c)}),()=>n.disconnect()},[r,s]);const x=t=>{var o;const n=(o=s.current)==null?void 0:o.querySelector(`#${CSS.escape(t)}`);n==null||n.scrollIntoView({behavior:"smooth",block:"start"})};return r.length?e.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[i("file-text","h-3 w-3"),e.jsx("span",{children:"大纲"})]}),e.jsx("ul",{className:"space-y-0.5",children:r.map(t=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>x(t.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===t.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(t.level-1)*10},children:t.text||t.id})},t.id))})]}):null}function S(s){const i=s.slice(s.lastIndexOf("/")+1).toLowerCase();if(i==="justfile"||i==="makefile")return b;const r=s.slice(s.lastIndexOf(".")).toLowerCase();return r===".md"||r===".markdown"?I:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(r)?k:[".sql",".txt",".csv",".tsv",".json",".yaml",".yml",".xml",".py",".js",".ts",".java",".go",".rs",".rb",".php",".c",".cpp",".h",".cs",".swift",".kt",".scala",".sh",".bash",".zsh",".fish",".env",".gitignore",".dockerfile"].includes(r)?b:N}function L({params:s}){const{icon:i}=p(),r=w(v.mode,"h-5 w-5"),l=s.get("file"),h=s.get("wt"),m=f.useRef(null),x=l?S(l):null;return e.jsx(j,{manifest:v,icon:r,breadcrumb:["插件",h??"当前分支",...l?[l]:[]],children:e.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:l&&x?e.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[e.jsx("div",{ref:m,className:"flex-1 min-h-0 overflow-auto",children:e.jsx(x,{path:l})}),e.jsx(C,{containerRef:m})]}):e.jsx(y,{icon:i("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式"})})})}export{L as default};
1
+ import{b as p,j as e,r as f,u as w,P as j,E as y}from"./index-Co7MWSFf.js";import{C as b,M as I,I as k}from"./CodeViewer-Cs0mG1h6.js";import{m as v}from"./web-DxbVzGf3.js";import"./index-D6EJRHBV.js";import"./client-Cw4K1Nx3.js";function N({path:s}){const{icon:i}=p();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[i("file-question","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:s})]})})}function C({containerRef:s}){const{icon:i}=p(),[r,l]=f.useState([]),[h,m]=f.useState(null);f.useEffect(()=>{const t=s.current;if(!t)return;let n=!1;const o=()=>{if(n)return;const d=t.querySelectorAll("h1[id], h2[id], h3[id]"),u=[];d.forEach(a=>{var g;u.push({id:a.id,text:((g=a.textContent)==null?void 0:g.trim())??"",level:parseInt(a.tagName[1],10)})}),l(u)};o();const c=new MutationObserver(o);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{n=!0,c.disconnect()}},[s]),f.useEffect(()=>{const t=s.current;if(!t||!r.length)return;const n=new IntersectionObserver(o=>{const c=o.filter(d=>d.isIntersecting);if(c.length){const d=c.reduce((u,a)=>u.boundingClientRect.top<a.boundingClientRect.top?u:a);m(d.target.id)}},{root:t,rootMargin:"-60px 0px -70% 0px",threshold:0});return r.forEach(({id:o})=>{const c=t.querySelector(`#${CSS.escape(o)}`);c&&n.observe(c)}),()=>n.disconnect()},[r,s]);const x=t=>{var o;const n=(o=s.current)==null?void 0:o.querySelector(`#${CSS.escape(t)}`);n==null||n.scrollIntoView({behavior:"smooth",block:"start"})};return r.length?e.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[i("file-text","h-3 w-3"),e.jsx("span",{children:"大纲"})]}),e.jsx("ul",{className:"space-y-0.5",children:r.map(t=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>x(t.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===t.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(t.level-1)*10},children:t.text||t.id})},t.id))})]}):null}function S(s){const i=s.slice(s.lastIndexOf("/")+1).toLowerCase();if(i==="justfile"||i==="makefile")return b;const r=s.slice(s.lastIndexOf(".")).toLowerCase();return r===".md"||r===".markdown"?I:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(r)?k:[".sql",".txt",".csv",".tsv",".json",".yaml",".yml",".xml",".py",".js",".ts",".java",".go",".rs",".rb",".php",".c",".cpp",".h",".cs",".swift",".kt",".scala",".sh",".bash",".zsh",".fish",".env",".gitignore",".dockerfile"].includes(r)?b:N}function L({params:s}){const{icon:i}=p(),r=w(v.mode,"h-5 w-5"),l=s.get("file"),h=s.get("wt"),m=f.useRef(null),x=l?S(l):null;return e.jsx(j,{manifest:v,icon:r,breadcrumb:["插件",h??"当前分支",...l?[l]:[]],children:e.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:l&&x?e.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[e.jsx("div",{ref:m,className:"flex-1 min-h-0 overflow-auto",children:e.jsx(x,{path:l})}),e.jsx(C,{containerRef:m})]}):e.jsx(y,{icon:i("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式"})})})}export{L as default};