zdashboard 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +312 -212
- package/dist/cli.js.map +1 -1
- package/dist/web/assets/{web-BnZ_68eg.js → FileIcon-CA7j6xAr.js} +36 -11
- package/dist/web/assets/FilterPills-CT9_aiMo.js +1 -0
- package/dist/web/assets/{katex.min-D_D1u30F.js → MdViewer-C-qU08GL.js} +24 -24
- package/dist/web/assets/ProgressBar-CyYoGfrt.js +1 -0
- package/dist/web/assets/Workspace-CqK1Sdtv.js +16 -0
- package/dist/web/assets/badge-CsNeQaUt.js +1 -0
- package/dist/web/assets/book-open-DgUv7g0V.js +6 -0
- package/dist/web/assets/file-text-AM0snHQm.js +6 -0
- package/dist/web/assets/{index-6FGn10zY.js → index-BF1XYOKG.js} +1 -1
- package/dist/web/assets/index-C9nEYrn8.css +1 -0
- package/dist/web/assets/index-Dcz2Myaf.js +111 -0
- package/dist/web/assets/web-4IVEiPQ7.js +36 -0
- package/dist/web/assets/web-4pvyVYqE.js +31 -0
- package/dist/web/assets/web-B8iKfUHX.js +2 -0
- package/dist/web/assets/web-BOZwX-p2.js +56 -0
- package/dist/web/assets/web-CPCrz28U.js +25 -0
- package/dist/web/assets/web-DJnenbT2.js +7 -0
- package/dist/web/assets/web-WH-i-efe.js +16 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/MdViewer-qvXbO8IA.js +0 -1
- package/dist/web/assets/Workspace-D96dCoOA.js +0 -1
- package/dist/web/assets/git-branch-DJLd5kDE.js +0 -11
- package/dist/web/assets/index-15cLfCw4.js +0 -90
- package/dist/web/assets/index-CYqm3unP.css +0 -1
- package/dist/web/assets/web-BUNysAkV.js +0 -7
- package/dist/web/assets/web-BeuJXCg2.js +0 -26
- package/dist/web/assets/web-C-O8qmKu.js +0 -31
- package/dist/web/assets/web-CJq1r_vk.js +0 -11
- package/dist/web/assets/web-DP_CBpB2.js +0 -2
- package/dist/web/assets/web-Xpqif6fn.js +0 -32
- /package/dist/web/assets/{katex-BTcE7LSd.css → MdViewer-BTcE7LSd.css} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{c as g,j as r,r as s,E as Q,G as U,F as Z,_ as W}from"./index-Dcz2Myaf.js";import{M as J}from"./MdViewer-C-qU08GL.js";import{C as G,I as K,P as X,F as Y}from"./FileIcon-CA7j6xAr.js";import{F as ee}from"./file-text-AM0snHQm.js";import{B as te}from"./book-open-DgUv7g0V.js";import"./index-BF1XYOKG.js";/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const re=g("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
7
|
+
* @license lucide-react v0.460.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const H=g("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
12
|
+
* @license lucide-react v0.460.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ne=g("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
17
|
+
* @license lucide-react v0.460.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const se=g("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
|
|
22
|
+
* @license lucide-react v0.460.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const oe=g("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
27
|
+
* @license lucide-react v0.460.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const ce=g("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
32
|
+
* @license lucide-react v0.460.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const ue=g("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);function ae({path:e}){return r.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:r.jsxs("div",{children:[r.jsx(se,{className:"h-10 w-10 mx-auto mb-3 opacity-50"}),r.jsx("p",{children:"该格式无法预览"}),r.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:e})]})})}let q=null;const V=new Set,k={get:()=>q,set:e=>{q=e,V.forEach(t=>t(e))},subscribe:e=>(V.add(e),()=>{V.delete(e)})};function ie({containerRef:e}){const[t,c]=s.useState([]),[f,i]=s.useState(null);s.useEffect(()=>{const o=e.current;if(!o)return;let l=!1;const u=()=>{if(l)return;const h=o.querySelectorAll("h1[id], h2[id], h3[id]"),a=[];h.forEach(x=>{var b;a.push({id:x.id,text:((b=x.textContent)==null?void 0:b.trim())??"",level:parseInt(x.tagName[1],10)})}),c(a)};u();const n=new MutationObserver(u);return n.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{l=!0,n.disconnect()}},[e]),s.useEffect(()=>{const o=e.current;if(!o||!t.length)return;const l=new IntersectionObserver(u=>{const n=u.filter(h=>h.isIntersecting);if(n.length){const h=n.reduce((a,x)=>a.boundingClientRect.top<x.boundingClientRect.top?a:x);i(h.target.id)}},{root:o,rootMargin:"-60px 0px -70% 0px",threshold:0});return t.forEach(({id:u})=>{const n=o.querySelector(`#${CSS.escape(u)}`);n&&l.observe(n)}),()=>l.disconnect()},[t,e]);const d=o=>{var u;const l=(u=e.current)==null?void 0:u.querySelector(`#${CSS.escape(o)}`);l==null||l.scrollIntoView({behavior:"smooth",block:"start"})};return t.length?r.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[r.jsx(ee,{className:"h-3 w-3"}),r.jsx("span",{children:"大纲"})]}),r.jsx("ul",{className:"space-y-0.5",children:t.map(o=>r.jsx("li",{children:r.jsx("button",{type:"button",onClick:()=>d(o.id),className:`w-full text-left text-[11px] leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${f===o.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(o.level-1)*10},children:o.text||o.id})},o.id))})]}):null}const le=2500;function de(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(t==="justfile"||t==="makefile")return G;const c=e.slice(e.lastIndexOf(".")).toLowerCase();return c===".md"||c===".markdown"?J:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(c)?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(c)?G:ae}function fe(e){const[t,c]=s.useState(()=>k.get()),[f,i]=s.useState(!1),d=s.useRef(null),o=t?de(t):null;return s.useEffect(()=>k.subscribe(c),[]),s.useEffect(()=>{const l=d.current;if(!l)return;const u=()=>{var a;const h=((a=l.textContent)==null?void 0:a.length)??0;i(h>le)};u();const n=new MutationObserver(u);return n.observe(l,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()},[t]),r.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:t&&o?r.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[r.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto",children:r.jsx(o,{path:t})}),f&&r.jsx(ie,{containerRef:d})]}):r.jsx(Q,{icon:ne,title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式",tone:"primary"})})}const he=Object.freeze(Object.defineProperty({__proto__:null,default:fe},Symbol.toStringTag,{value:"Module"}));function me(e,t,c,f){var i=this,d=s.useRef(null),o=s.useRef(0),l=s.useRef(0),u=s.useRef(null),n=s.useRef([]),h=s.useRef(),a=s.useRef(),x=s.useRef(e),b=s.useRef(!0),y=s.useRef(),O=s.useRef();x.current=e;var L=typeof window<"u",N=!t&&t!==0&&L;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var M=!!(c=c||{}).leading,R=!("trailing"in c)||!!c.trailing,S=!!c.flushOnExit&&R,j="maxWait"in c,z="debounceOnServer"in c&&!!c.debounceOnServer,I=j?Math.max(+c.maxWait||0,t):null,A=s.useMemo(function(){var v=function(m){var p=n.current,w=h.current;return n.current=h.current=null,o.current=m,l.current=l.current||m,a.current=x.current.apply(w,p)},E=function(m,p){N&&cancelAnimationFrame(u.current),u.current=N?requestAnimationFrame(m):setTimeout(m,p)},P=function(m){if(!b.current)return!1;var p=m-d.current;return!d.current||p>=t||p<0||j&&m-o.current>=I},$=function(m){return u.current=null,R&&n.current?v(m):(n.current=h.current=null,a.current)},F=function m(){var p=Date.now();if(M&&l.current===o.current&&T(),P(p))return $(p);if(b.current){var w=t-(p-d.current),_=j?Math.min(w,I-(p-o.current)):w;E(m,_)}},T=function(){f&&f({})},C=function(){if(L||z){var m,p=Date.now(),w=P(p);if(n.current=[].slice.call(arguments),h.current=i,d.current=p,S&&!y.current&&(y.current=function(){var _;((_=globalThis.document)==null?void 0:_.visibilityState)==="hidden"&&O.current.flush()},(m=globalThis.document)==null||m.addEventListener==null||m.addEventListener("visibilitychange",y.current)),w){if(!u.current&&b.current)return o.current=d.current,E(F,t),M?v(d.current):a.current;if(j)return E(F,t),v(d.current)}return u.current||E(F,t),a.current}};return C.cancel=function(){var m=u.current;m&&(N?cancelAnimationFrame(u.current):clearTimeout(u.current)),o.current=0,n.current=d.current=h.current=u.current=null,m&&f&&f({})},C.isPending=function(){return!!u.current},C.flush=function(){return u.current?$(Date.now()):a.current},C},[M,j,t,I,R,S,N,L,z,f]);return O.current=A,s.useEffect(function(){return b.current=!0,function(){var v;S&&O.current.flush(),y.current&&((v=globalThis.document)==null||v.removeEventListener==null||v.removeEventListener("visibilitychange",y.current),y.current=null),b.current=!1}},[S]),A}function pe(e,t){return e===t}function xe(e,t,c){var f=pe,i=s.useRef(e),d=s.useState({})[1],o=me(s.useCallback(function(u){i.current=u,d({})},[d]),t,c,d),l=s.useRef(e);return f(l.current,e)||(o(e),l.current=e),[i.current,o]}function D(e,t){return!t||e.name.toLowerCase().includes(t)?!0:(e.children??[]).some(c=>D(c,t))}const be={changes:ce,archive:re,specs:ue,docs:te,other:X};function B({node:e,depth:t,filter:c,current:f,onSelectFile:i}){const d=(e.children??[]).filter(n=>D(n,c)),[o,l]=s.useState(!e.defaultCollapsed),u=c?!0:o;return!d.length&&c?null:r.jsxs("div",{children:[(()=>{const n=e.name.match(/^([a-z]+)(?: \((\d+)\))?$/),h=n?be[n[1]]:void 0,a=u?Z:oe;return r.jsxs("button",{onClick:()=>l(x=>!x),className:"w-full flex items-center gap-1.5 px-2 py-1 text-xs text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+t*14,width:"calc(100% - 8px)"},children:[r.jsx(H,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${u?"rotate-90":""}`}),h?r.jsx(h,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):r.jsx(a,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-colors"}),r.jsx("span",{className:"font-medium truncate",children:n?n[1]:e.name}),(n==null?void 0:n[2])&&r.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-[10px] font-mono text-muted-foreground",children:n[2]})]})})(),u&&d.map(n=>n.kind==="dir"?r.jsx(B,{node:n,depth:t+1,filter:c,current:f,onSelectFile:i},n.name+t):r.jsxs("button",{onClick:()=>n.path&&i(n.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-xs hover:bg-muted rounded-md mx-1 ${f===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+t*14,width:"calc(100% - 8px)"},children:[r.jsx(Y,{name:n.name,active:f===n.path}),r.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function ve({worktrees:e}){const[t,c]=s.useState(!0),f=i=>{window.dispatchEvent(new CustomEvent("zd-dashboard-nav",{detail:{mode:"apply",wt:i.name}}))};return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{onClick:()=>c(i=>!i),className:"w-full flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium text-muted-foreground tracking-wide hover:text-foreground",children:[r.jsx(H,{className:`h-3 w-3 transition-transform ${t?"rotate-90":""}`}),r.jsx(U,{className:"h-3 w-3"}),r.jsxs("span",{children:["Worktrees (",e.length,")"]})]}),t&&e.map(i=>r.jsxs("button",{onClick:()=>f(i),title:`${i.branch}${i.dirty?" · 有未提交变更":""}`,className:"w-full flex items-center gap-1.5 px-2 py-1 text-xs text-foreground hover:bg-muted border-l-2 border-transparent",style:{paddingLeft:14},children:[r.jsx("span",{className:"truncate font-mono text-[11px]",children:i.branch}),r.jsxs("span",{className:"text-muted-foreground truncate",children:["/",i.name]}),i.dirty&&r.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]},i.name))]})}function ge({navTarget:e}){const t=s.useSyncExternalStore(k.subscribe,k.get),[c,f]=s.useState(null),[i,d]=s.useState(""),[o]=xe(i,150),[l,u]=s.useState([]);s.useEffect(()=>{e!=null&&e.filter&&d(e.filter)},[e==null?void 0:e.filter,e==null?void 0:e.navToken]),s.useEffect(()=>{fetch("/__files",{cache:"no-store"}).then(a=>a.json()).then(a=>f(a.tree??[]))},[]),s.useEffect(()=>{fetch("/__worktrees",{cache:"no-store"}).then(a=>a.json()).then(u).catch(()=>u([]))},[]);const n=s.useMemo(()=>c?c.filter(a=>D(a,o)):[],[c,o]),h=l.length>0;return r.jsxs("div",{className:"p-2",children:[r.jsx("input",{value:i,onChange:a=>d(a.target.value.toLowerCase()),placeholder:"过滤…",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:border-primary"}),c?!n.length&&!h?r.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"无匹配"}):r.jsxs("div",{className:"py-1",children:[h&&r.jsx(ve,{worktrees:l}),n.map(a=>r.jsx(B,{node:a,depth:0,filter:o,current:t,onSelectFile:x=>k.set(x)},a.name))]}):r.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"})]})}const ye=Object.freeze(Object.defineProperty({__proto__:null,default:ge},Symbol.toStringTag,{value:"Module"})),Ce={mode:"view",label:"项目浏览",icon:"👁️",description:"openspec / docs / 文档预览",Sidebar:s.lazy(()=>W(()=>Promise.resolve().then(()=>ye),void 0)),Workspace:s.lazy(()=>W(()=>Promise.resolve().then(()=>he),void 0))};export{ge as ViewSidebar,fe as ViewWorkspace,Ce as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{c as p,r as a,u as $,j as e,_ as A}from"./index-Dcz2Myaf.js";import{M as I}from"./MdViewer-C-qU08GL.js";import{P as F}from"./ProgressBar-CyYoGfrt.js";import{F as L}from"./FilterPills-CT9_aiMo.js";import"./index-BF1XYOKG.js";/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const _=p("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
7
|
+
* @license lucide-react v0.460.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const U=p("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
12
|
+
* @license lucide-react v0.460.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const V=p("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
17
|
+
* @license lucide-react v0.460.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const X=p("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
22
|
+
* @license lucide-react v0.460.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const q=p("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
27
|
+
* @license lucide-react v0.460.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const C=p("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),W={draft:"bg-zinc-500 text-white",reviewing:"bg-amber-500 text-white",passed:"bg-emerald-600 text-white",rejected:"bg-red-500 text-white"},B={draft:"草案",reviewing:"评审中",passed:"已通过",rejected:"未通过"},G=[{key:"all",label:"全部"},{key:"open",label:"待处理"},{key:"answered",label:"已答复"},{key:"accepted",label:"已采纳"},{key:"dismissed",label:"已驳回"}],T={high:"bg-red-500",medium:"bg-amber-500",low:"bg-sky-500"},J={high:"高",medium:"中",low:"低"},E={open:"bg-red-500/15 text-red-600 dark:text-red-400 border-red-500/30",answered:"bg-sky-500/15 text-sky-600 dark:text-sky-400 border-sky-500/30",accepted:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border-emerald-500/30",dismissed:"bg-muted text-muted-foreground border-border"},M={open:"待处理",answered:"已答复",accepted:"已采纳",dismissed:"已驳回"};function H({item:t,token:u,onUpdated:w}){const[m,h]=a.useState(t.answer??"");a.useEffect(()=>h(t.answer??""),[t.id,t.answer]);const l=async o=>{const i=await fetch("/__review/item",{method:"POST",headers:{"x-stop-token":u,"Content-Type":"application/json"},body:JSON.stringify({id:t.id,...o})});i.ok&&w(await i.json())},c=o=>o==="open"?{state:o,answer:m}:o==="answered"?{state:o,answer:m}:{state:o,answer:m||t.answer},b=t.state==="accepted"||t.state==="dismissed",f=b?t.state==="accepted"?"已采纳 — 可撤销后重新处理":"已驳回 — 可撤销后重新处理":t.state==="open"?"答复后可采纳或驳回,或直接采纳/驳回":"确认答复后采纳,或驳回 / 撤销";return e.jsxs("div",{className:"rounded-lg border bg-background shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 pt-2.5 text-[11px] text-muted-foreground",children:[t.severity&&e.jsx("span",{className:`h-2 w-2 rounded-full ${T[t.severity]??"bg-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:t.category??"通用"}),t.severity&&e.jsx("span",{children:J[t.severity]??t.severity}),e.jsx("span",{className:`ml-auto px-1.5 py-0.5 rounded border text-[10px] font-medium ${E[t.state]??""}`,children:M[t.state]})]}),e.jsx("p",{className:"px-3 py-2 text-sm leading-relaxed",children:t.question}),e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2",children:[e.jsx("textarea",{value:m,onChange:o=>h(o.target.value),placeholder:"答复 / 补充说明…",rows:2,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs focus:outline-none focus:border-primary resize-y"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[t.state==="accepted"?e.jsxs("span",{className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 text-xs font-medium",children:[e.jsx(_,{className:"h-3 w-3"}),"已采纳"]}):t.state==="dismissed"?e.jsxs("span",{className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-muted text-muted-foreground text-xs font-medium",children:[e.jsx(C,{className:"h-3 w-3"}),"已驳回"]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>l(c("answered")),className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-sky-600 hover:bg-sky-500 text-white text-xs",children:[e.jsx(q,{className:"h-3 w-3"}),t.state==="answered"?"更新答复":"答复"]}),e.jsxs("button",{onClick:()=>l(c("accepted")),className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-emerald-600 hover:bg-emerald-500 text-white text-xs",children:[e.jsx(_,{className:"h-3 w-3"}),"采纳"]}),e.jsxs("button",{onClick:()=>l(c("dismissed")),className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-muted hover:bg-muted/70 text-xs",children:[e.jsx(C,{className:"h-3 w-3"}),"驳回"]})]}),b&&e.jsxs("button",{onClick:()=>l(c("open")),className:"inline-flex items-center gap-1 h-7 px-2.5 rounded bg-muted hover:bg-muted/70 text-xs",children:[e.jsx(X,{className:"h-3 w-3"}),"撤销"]}),e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:f})]})]})]})}function K(){const[t,u]=a.useState(null),[w,m]=a.useState([]),[h,l]=a.useState(null),[c,b]=a.useState(null),[f,o]=a.useState(""),[i,O]=a.useState("all"),[g,k]=a.useState(!0),[v,y]=a.useState("");a.useRef(!1);const N=()=>{fetch("/__review",{cache:"no-store"}).then(s=>s.json()).then(u),fetch("/__docs",{cache:"no-store"}).then(s=>s.json()).then(s=>{m(s),l(r=>r&&s.includes(r)?r:s[0]??null)})};a.useEffect(()=>{N(),fetch("/__config").then(s=>s.json()).then(s=>o(s.stopToken??""))},[]),$(()=>{},N);const d={all:0,open:0,answered:0,accepted:0,dismissed:0};for(const s of(t==null?void 0:t.items)??[])d.all++,d[s.state]++;const S=a.useMemo(()=>{const s=new Map;for(const n of(t==null?void 0:t.items)??[]){if(i!=="all"&&n.state!==i)continue;const x=n.doc??null;s.has(x)||s.set(x,[]),s.get(x).push(n)}const r=n=>n??"(未关联文档)";return[...s.entries()].sort((n,x)=>r(n[0]).localeCompare(r(x[0]))).map(([n,x])=>({doc:n,label:r(n),items:x.sort((P,R)=>({high:0,medium:1,low:2})[P.severity??"medium"]-{high:0,medium:1,low:2}[R.severity??"medium"])}))},[t,i]),j=((t==null?void 0:t.items)??[]).find(s=>s.id===c)??null,z=s=>{b(s.id),l(s.doc??null)},D=async()=>{y("");const s=await fetch("/__review/status",{method:"POST",headers:{"x-stop-token":f,"Content-Type":"application/json"},body:'{"status":"passed"}'});s.ok?u(await s.json()):y((await s.json()).error??"failed")};return e.jsxs("div",{className:"mx-auto h-full max-w-6xl bg-background border rounded-lg shadow-sm overflow-hidden flex",children:[e.jsxs("aside",{className:"w-[240px] flex-none border-r bg-background overflow-auto",children:[e.jsx("div",{className:"px-3 pt-3 pb-2 border-b",children:(()=>{const s=d.all,r=s-d.open,n=s===0?0:Math.round(r/s*100);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] mb-1.5",children:[e.jsx("span",{className:"text-muted-foreground",children:"处理进度"}),e.jsxs("span",{className:"font-mono",children:[r,"/",s," · ",n,"%"]})]}),e.jsx(F,{value:n,className:"h-1.5"})]})})()}),e.jsx(L,{items:G.map(s=>({key:String(s.key),label:`${s.label} ${d[s.key]}`})),value:i,onChange:s=>O(s),ariaLabel:"评审项筛选"}),e.jsx("div",{className:"px-3 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"文档 · 评审项"}),S.length===0&&e.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"无评审项"}),S.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1 text-[11px] font-medium text-muted-foreground flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate",children:s.label}),e.jsx("span",{className:"ml-auto font-mono text-[10px]",children:s.items.length})]}),s.items.map(r=>e.jsxs("button",{onClick:()=>z(r),className:`w-full text-left px-3 py-1.5 text-xs border-l-2 flex items-center gap-1.5 hover:bg-muted ${c===r.id?"bg-muted font-medium border-primary":"border-transparent text-muted-foreground"}`,children:[r.severity&&e.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${T[r.severity]??""}`}),e.jsx("span",{className:"truncate",children:r.question}),e.jsx("span",{className:`ml-auto shrink-0 text-[9px] px-1 rounded ${E[r.state]??""}`,children:M[r.state]})]},r.id))]},s.doc??"(none)"))]}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsxs("div",{className:"flex-none flex items-center gap-2 px-3.5 border-b bg-background",children:[t&&e.jsx("span",{className:`px-2 py-0.5 rounded text-[11px] font-medium ${W[t.status]??""}`,children:B[t.status]??t.status}),d.open>0&&e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["还有 ",d.open," 项待处理"]}),e.jsx("button",{onClick:D,disabled:!t||t.status==="passed"||d.open>0,className:"ml-auto h-7 px-3 rounded bg-emerald-600 hover:bg-emerald-500 disabled:opacity-50 disabled:cursor-not-allowed text-white text-xs",children:"通过"})]}),v&&e.jsx("div",{className:"bg-red-500/10 text-red-600 dark:text-red-400 text-xs px-3.5 py-1.5 border-b border-red-500/20",children:v}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[g&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto border-b bg-background relative",children:[e.jsx("button",{onClick:()=>k(!1),title:"收起文档",className:"absolute right-2 top-2 z-10 h-6 px-2 rounded border border-border bg-background/80 text-xs hover:bg-muted",children:e.jsx(U,{className:"h-3.5 w-3.5"})}),h?e.jsx(I,{path:h}):e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"在左侧选择评审项"})]}),e.jsxs("div",{className:g?"flex-none h-[42%] border-b overflow-auto p-3 flex flex-col gap-3":"flex-1 min-h-0 overflow-auto p-3 flex flex-col gap-3",style:g?void 0:{backgroundImage:"radial-gradient(circle at 1px 1px, hsl(var(--border)) 1px, transparent 0)",backgroundSize:"20px 20px"},children:[!g&&e.jsxs("button",{onClick:()=>k(!0),title:"展开文档",className:"self-start inline-flex items-center gap-1 h-6 px-2 rounded border border-border bg-background text-xs hover:bg-muted",children:[e.jsx(V,{className:"h-3.5 w-3.5"}),"展开文档"]}),j?e.jsx(H,{item:j,token:f,onUpdated:u},j.id):e.jsx("p",{className:"text-xs text-muted-foreground text-center pt-6",children:"在左侧选择一个评审项"})]})]})]})]})}function Q(){return e.jsx(K,{})}const Y=Object.freeze(Object.defineProperty({__proto__:null,default:Q},Symbol.toStringTag,{value:"Module"})),ae={mode:"review",label:"文档评审",icon:"✅",description:"评审项状态流转 · zreview",Workspace:a.lazy(()=>A(()=>Promise.resolve().then(()=>Y),void 0))};export{Q as ReviewWorkspace,ae as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Workspace-CqK1Sdtv.js","assets/index-Dcz2Myaf.js","assets/index-C9nEYrn8.css","assets/ProgressBar-CyYoGfrt.js","assets/file-text-AM0snHQm.js","assets/book-open-DgUv7g0V.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as o,_ as t}from"./index-Dcz2Myaf.js";const a={mode:"stats",label:"项目统计",icon:"📊",description:"项目文件统计 · 扫描生成",Workspace:o.lazy(()=>t(()=>import("./Workspace-CqK1Sdtv.js"),__vite__mapDeps([0,1,2,3,4,5])))};export{a as default};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import{c as u,r as o,j as e,E as V,_ as j}from"./index-Dcz2Myaf.js";import{M}from"./MdViewer-C-qU08GL.js";import{C,I,P,F}from"./FileIcon-CA7j6xAr.js";import{F as L}from"./FilterPills-CT9_aiMo.js";import{F as E}from"./file-text-AM0snHQm.js";import{B as R}from"./book-open-DgUv7g0V.js";import"./index-BF1XYOKG.js";/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const z=u("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/**
|
|
7
|
+
* @license lucide-react v0.460.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const O=u("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/**
|
|
12
|
+
* @license lucide-react v0.460.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const U=u("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/**
|
|
17
|
+
* @license lucide-react v0.460.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const N=u("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
22
|
+
* @license lucide-react v0.460.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const w=u("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
27
|
+
* @license lucide-react v0.460.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const T=u("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
|
|
32
|
+
* @license lucide-react v0.460.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const A=u("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
|
|
37
|
+
* @license lucide-react v0.460.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const $=u("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
|
|
42
|
+
* @license lucide-react v0.460.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const W=u("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/**
|
|
47
|
+
* @license lucide-react v0.460.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const D=u("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
52
|
+
* @license lucide-react v0.460.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const H=u("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);let v=null;const g=new Set,p={get:()=>v,set:t=>{v=t,g.forEach(i=>i(t))},subscribe:t=>(g.add(t),()=>{g.delete(t)})};function q({path:t}){return e.jsx("iframe",{src:"/"+encodeURI(t),title:"预览",className:"w-full h-full border-0 bg-white"})}function B({path:t}){const[i,r]=o.useState([]),[d,a]=o.useState(!0);return o.useEffect(()=>{let n=!1;return a(!0),r([]),fetch("/"+encodeURI(t),{cache:"no-store"}).then(l=>l.text()).then(l=>{if(n)return;const c=l.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){r([]),a(!1);return}const s=m=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(m.trim()),x=c.filter(m=>s(m)),h=c.filter(m=>/font|family|type/.test(m.toLowerCase())&&!s(m)),y=c.filter(m=>!x.includes(m)&&!h.includes(m)),b=m=>{const k=m.indexOf(":"),S=m.slice(0,k).trim(),_=m.slice(k+1).trim();return{name:S,value:_}},f=[];x.length&&f.push({label:`配色 · ${x.length}`,items:x.map(b)}),h.length&&f.push({label:`字体 · ${h.length}`,items:h.map(b)}),y.length&&f.push({label:`其他 · ${y.length}`,items:y.map(b)}),r(f),a(!1)}).catch(()=>{n||(r([]),a(!1))}),()=>{n=!0}},[t]),d?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):i.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:i.map(n=>{const l=n.items.some(s=>/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(s.value)),c=n.items.some(s=>/font|family|type/i.test(s.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase text-muted-foreground",children:n.label}),l?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))"},children:n.items.filter(s=>/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(s.value)).map(({name:s,value:x})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[72px] border-b",style:{background:x}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-[11px] break-all",children:s}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:x})]},s))}):c?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))"},children:n.items.map(({name:s,value:x})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"grid h-[72px] place-items-center text-2xl",style:{fontFamily:x},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-[11px]",children:s})]},s))}):e.jsx("div",{className:"flex flex-col gap-1",children:n.items.map(({name:s,value:x})=>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:s}),e.jsx("span",{className:"text-muted-foreground",children:x})]},s))})]},n.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}function G({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("video",{src:"/"+encodeURI(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:"/"+encodeURI(t),controls:!0,className:"w-full max-w-2xl"})})}function J({path:t}){return e.jsx("div",{className:"grid place-items-center p-8 h-full",children:e.jsx("iframe",{src:"/"+encodeURI(t),title:"PDF",className:"w-full h-full max-h-[80vh] rounded border bg-white"})})}function K({path:t}){const[i,r]=o.useState("");return o.useEffect(()=>{let d=!1,a="",n=null;return fetch("/"+encodeURI(t)).then(l=>l.blob()).then(async l=>{var c;if(!d){if(a=URL.createObjectURL(l),n=new FontFace("zd-font-preview",`url(${a})`),await n.load(),d){(c=n.dispose)==null||c.call(n);return}document.fonts.add(n),r(t.split("/").pop()??t)}}).catch(()=>{d||r(t.split("/").pop()??t)}),()=>{var l;if(d=!0,n)try{document.fonts.delete(n),(l=n.dispose)==null||l.call(n)}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:i?"'zd-font-preview', serif":"serif"},children:"Aa 字体预览 0123"})]})}function Q({path:t}){return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[e.jsx(U,{className:"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 X={page:q,icon:I,token:B,md:M,video:G,audio:Z,pdf:J,component:C,font:K};function Y(t){return X[t]??Q}function ee({mode:t,onMode:i,w:r,h:d,onW:a,onH:n}){const l=[{v:0,icon:e.jsx(N,{className:"h-3.5 w-3.5"}),label:"桌面"},{v:768,icon:e.jsx(W,{className:"h-3.5 w-3.5"}),label:"768"},{v:375,icon:e.jsx($,{className:"h-3.5 w-3.5"}),label:"375"},{v:"custom",icon:e.jsx(A,{className:"h-3.5 w-3.5"}),label:"自定义"}],c="w-[50px] 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(L,{items:l.map(s=>({key:String(s.v),label:s.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[s.icon,e.jsx("span",{className:"hidden sm:inline",children:s.label})]})})),value:String(t),onChange:s=>i(s==="0"?0:s==="custom"?"custom":Number(s)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:r,min:280,max:3e3,step:8,onChange:s=>a(Number(s.target.value)),"aria-label":"自定义宽度",className:c}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:d,min:400,max:3e3,step:8,onChange:s=>n(Number(s.target.value)),"aria-label":"自定义高度",className:c}),e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"px"})]})]})}function te(){const[t,i]=o.useState(()=>p.get()),[r,d]=o.useState(0),[a,n]=o.useState(1024),[l,c]=o.useState(768);o.useEffect(()=>p.subscribe(i),[]);const s=t?Y(t.type):null,x=r===0?"桌面":r==="custom"?`${a} × ${l}`:`${r}px`;return e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:t&&s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[38px] 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:t.path}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:x}),e.jsx(ee,{mode:r,onMode:d,w:a,h:l,onW:n,onH:c})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:t.type==="page"?e.jsx("div",{className:"mx-auto bg-background overflow-hidden",style:{maxWidth:r===0?void 0:r==="custom"?a:r,height:r==="custom"?l:"100%"},children:e.jsx(s,{path:t.path})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(s,{path:t.path})})})]}):e.jsx(V,{icon:w,title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新",tone:"primary"})})}const se=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),ne={page:N,component:O,icon:T,token:w,md:R,video:H,audio:z,pdf:E,font:D,other:P},ae=[{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:"字体"},{key:"other",label:"其他"}];function le(){const t=o.useSyncExternalStore(p.subscribe,p.get),[i,r]=o.useState(null);o.useEffect(()=>{fetch("/__design/assets",{cache:"no-store"}).then(a=>a.json()).then(r)},[]);const d=o.useMemo(()=>i?ae.map(a=>({...a,items:i[a.key]??[]})).filter(a=>a.items.length>0):[],[i]);return i?e.jsxs("div",{children:[e.jsxs("div",{className:"p-3 text-xs text-muted-foreground",children:[d.reduce((a,n)=>a+n.items.length,0)," 个资产"]}),d.map(a=>{const n=ne[a.key];return e.jsxs("div",{className:"mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[n&&e.jsx(n,{className:"h-3.5 w-3.5"}),a.label,e.jsx("span",{className:"ml-auto rounded-full bg-muted px-1.5 font-mono text-[10px] font-normal",children:a.items.length})]}),a.items.map(l=>e.jsxs("button",{onClick:()=>p.set({path:l.path,type:l.type}),className:`w-full text-left flex items-center gap-2 mx-1 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${(t==null?void 0:t.path)===l.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{width:"calc(100% - 8px)"},children:[e.jsx(F,{name:l.name,active:(t==null?void 0:t.path)===l.path}),e.jsx("span",{className:"truncate",children:l.name}),l.ext&&e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:l.ext})]},l.path))]},a.key)})]}):e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"})}const re=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"})),pe={mode:"design",label:"设计资产",icon:"🎨",description:"设计资产分类浏览 · zdesign",Sidebar:o.lazy(()=>j(()=>Promise.resolve().then(()=>re),void 0)),Workspace:o.lazy(()=>j(()=>Promise.resolve().then(()=>se),void 0))};export{le as DesignSidebar,te as DesignWorkspace,pe as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{c as L,r as C,d as w,j as _,B as O,e as pe,_ as me}from"./index-Dcz2Myaf.js";import{F as xe}from"./FilterPills-CT9_aiMo.js";function g(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 $(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function De(t,e){const r=g(t);return isNaN(e)?$(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function Fe(t,e){const r=g(t);if(isNaN(e))return $(t,NaN);if(!e)return r;const n=r.getDate(),s=$(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const c=s.getDate();return n>=c?s:(r.setFullYear(s.getFullYear(),s.getMonth(),n),r)}function M(t,e){const{years:r=0,months:n=0,weeks:s=0,days:c=0,hours:i=0,minutes:u=0,seconds:l=0}=e,o=g(t),d=n||r?Fe(o,n+r*12):o,a=c||s?De(d,c+s*7):d,p=u+i*60,x=(l+p*60)*1e3;return $(t,a.getTime()+x)}const ye=864e5,be=6e4,ve=36e5;function V(t){const e=g(t);return e.setHours(0,0,0,0),e}function K(t){const e=g(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Ee(t,e){const r=V(t),n=V(e),s=+r-K(r),c=+n-K(n);return Math.round((s-c)/ye)}function S(t,e){const r=g(t),n=g(e),s=r.getTime()-n.getTime();return s<0?-1:s>0?1:s}function Ce(t,e){const r=g(t),n=g(e),s=r.getFullYear()-n.getFullYear(),c=r.getMonth()-n.getMonth();return s*12+c}function Ae(t,e){const r=g(t),n=g(e);return r.getFullYear()-n.getFullYear()}function ze(t,e){const r=g(t),n=g(e),s=Q(r,n),c=Math.abs(Ee(r,n));r.setDate(r.getDate()-s*c);const i=+(Q(r,n)===-s),u=s*(c-i);return u===0?0:u}function Q(t,e){const r=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 r<0?-1:r>0?1:r}function J(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function G(t,e){return+g(t)-+g(e)}function je(t,e,r){const n=G(t,e)/ve;return J(r==null?void 0:r.roundingMethod)(n)}function we(t,e,r){const n=G(t,e)/be;return J(r==null?void 0:r.roundingMethod)(n)}function ke(t){const e=g(t);return e.setHours(23,59,59,999),e}function Ne(t){const e=g(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function Re(t){const e=g(t);return+ke(e)==+Ne(e)}function Oe(t,e){const r=g(t),n=g(e),s=S(r,n),c=Math.abs(Ce(r,n));let i;if(c<1)i=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-s*c);let u=S(r,n)===-s;Re(g(t))&&c===1&&S(t,n)===1&&(u=!1),i=s*(c-Number(u))}return i===0?0:i}function Me(t,e,r){const n=G(t,e)/1e3;return J(r==null?void 0:r.roundingMethod)(n)}function Se(t,e){const r=g(t),n=g(e),s=S(r,n),c=Math.abs(Ae(r,n));r.setFullYear(1584),n.setFullYear(1584);const i=S(r,n)===-s,u=s*(c-+i);return u===0?0:u}function $e(t){const e=g(t.start),r=g(t.end),n={},s=Se(r,e);s&&(n.years=s);const c=M(e,{years:n.years}),i=Oe(r,c);i&&(n.months=i);const u=M(c,{months:n.months}),l=ze(r,u);l&&(n.days=l);const o=M(u,{days:n.days}),d=je(r,o);d&&(n.hours=d);const a=M(o,{hours:n.hours}),p=we(r,a);p&&(n.minutes=p);const b=M(a,{minutes:n.minutes}),x=Me(r,b);return x&&(n.seconds=x),n}/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ie=L("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
|
|
7
|
+
* @license lucide-react v0.460.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Le=L("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
12
|
+
* @license lucide-react v0.460.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const X=L("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
17
|
+
* @license lucide-react v0.460.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const ee=L("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var _e={};const z=[[{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"}]],Te=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;class R{static escapeForHtml(e){return new R().escapeForHtml(e)}static linkify(e){return new R().linkify(e)}static ansiToHtml(e,r){return new R().ansiToHtml(e,r)}static ansiToJson(e,r){return new R().ansiToJson(e,r)}static ansiToText(e){return new R().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 s=0;s<2;++s)for(let c=0;c<8;++c)this.PALETTE_COLORS.push(z[s][c].color);let e=[0,95,135,175,215,255],r=(s,c,i)=>e[s]+", "+e[c]+", "+e[i];for(let s=0;s<6;++s)for(let c=0;c<6;++c)for(let i=0;i<6;++i)this.PALETTE_COLORS.push(r(s,c,i));let n=8;for(let s=0;s<24;++s,n+=10)this.PALETTE_COLORS.push(n+", "+n+", "+n)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,r=>r=="&"?"&":r=='"'?""":r=="<"?"<":r==">"?">":"")}linkify(e){return e.replace(Te,r=>`<a href="${r}">${r}</a>`)}ansiToHtml(e,r){return this.process(e,r,!0)}ansiToJson(e,r){return r=r||{},r.json=!0,r.clearLine=!1,this.process(e,r,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,r,n){let s=this,c=e.split(/\033\[/),i=c.shift();r==null&&(r={}),r.clearLine=/\r/.test(e);let u=c.map(l=>this.processChunk(l,r,n));if(r&&r.json){let l=s.processChunkJson("");return l.content=i,l.clearLine=r.clearLine,u.unshift(l),r.remove_empty&&(u=u.filter(o=>!o.isEmpty())),u}else u.unshift(i);return u.join("")}processChunkJson(e,r,n){r=typeof r>"u"?{}:r;let s=r.use_classes=typeof r.use_classes<"u"&&r.use_classes,c=r.key=s?"class":"color",i={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:r.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!i.content},u=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!u)return i;i.content=u[4];let l=u[2].split(";");if(u[1]!==""||u[3]!=="m"||!n)return i;let o=this;for(;l.length>0;){let d=l.shift(),a=parseInt(d);if(isNaN(a)||a===0)o.fg=o.bg=null,o.decorations=[];else if(a===1)o.decorations.push("bold");else if(a===2)o.decorations.push("dim");else if(a===3)o.decorations.push("italic");else if(a===4)o.decorations.push("underline");else if(a===5)o.decorations.push("blink");else if(a===7)o.decorations.push("reverse");else if(a===8)o.decorations.push("hidden");else if(a===9)o.decorations.push("strikethrough");else if(a===21)o.removeDecoration("bold");else if(a===22)o.removeDecoration("bold"),o.removeDecoration("dim");else if(a===23)o.removeDecoration("italic");else if(a===24)o.removeDecoration("underline");else if(a===25)o.removeDecoration("blink");else if(a===27)o.removeDecoration("reverse");else if(a===28)o.removeDecoration("hidden");else if(a===29)o.removeDecoration("strikethrough");else if(a===39)o.fg=null;else if(a===49)o.bg=null;else if(a>=30&&a<38)o.fg=z[0][a%10][c];else if(a>=90&&a<98)o.fg=z[1][a%10][c];else if(a>=40&&a<48)o.bg=z[0][a%10][c];else if(a>=100&&a<108)o.bg=z[1][a%10][c];else if(a===38||a===48){let p=a===38;if(l.length>=1){let b=l.shift();if(b==="5"&&l.length>=1){let x=parseInt(l.shift());if(x>=0&&x<=255)if(!s)this.PALETTE_COLORS||o.setupPalette(),p?o.fg=this.PALETTE_COLORS[x]:o.bg=this.PALETTE_COLORS[x];else{let F=x>=16?"ansi-palette-"+x:z[x>7?1:0][x%8].class;p?o.fg=F:o.bg=F}}else if(b==="2"&&l.length>=3){let x=parseInt(l.shift()),F=parseInt(l.shift()),k=parseInt(l.shift());if(x>=0&&x<=255&&F>=0&&F<=255&&k>=0&&k<=255){let N=x+", "+F+", "+k;s?p?(o.fg="ansi-truecolor",o.fg_truecolor=N):(o.bg="ansi-truecolor",o.bg_truecolor=N):p?o.fg=N:o.bg=N}}}}}return o.fg===null&&o.bg===null&&o.decorations.length===0||(i.fg=o.fg,i.bg=o.bg,i.fg_truecolor=o.fg_truecolor,i.bg_truecolor=o.bg_truecolor,i.decorations=o.decorations,i.decoration=o.decorations.slice(-1).pop()||null,i.was_processed=!0),i}processChunk(e,r,n){r=r||{};let s=this.processChunkJson(e,r,n),c=r.use_classes;if(s.decorations=s.decorations.filter(a=>{if(a==="reverse"){s.fg||(s.fg=z[0][7][c?"class":"color"]),s.bg||(s.bg=z[0][0][c?"class":"color"]);let p=s.fg;s.fg=s.bg,s.bg=p;let b=s.fg_truecolor;return s.fg_truecolor=s.bg_truecolor,s.bg_truecolor=b,s.isInverted=!0,!1}return!0}),r.json)return s;if(s.isEmpty())return"";if(!s.was_processed)return s.content;let i=[],u=[],l=[],o={},d=a=>{let p=[],b;for(b in a)a.hasOwnProperty(b)&&p.push("data-"+b+'="'+this.escapeForHtml(a[b])+'"');return p.length>0?" "+p.join(" "):""};return s.isInverted&&(o["ansi-is-inverted"]="true"),s.fg&&(c?(i.push(s.fg+"-fg"),s.fg_truecolor!==null&&(o["ansi-truecolor-fg"]=s.fg_truecolor,s.fg_truecolor=null)):i.push("color:rgb("+s.fg+")")),s.bg&&(c?(i.push(s.bg+"-bg"),s.bg_truecolor!==null&&(o["ansi-truecolor-bg"]=s.bg_truecolor,s.bg_truecolor=null)):i.push("background-color:rgb("+s.bg+")")),s.decorations.forEach(a=>{if(c){u.push("ansi-"+a);return}a==="bold"?u.push("font-weight:bold"):a==="dim"?u.push("opacity:0.5"):a==="italic"?u.push("font-style:italic"):a==="hidden"?u.push("visibility:hidden"):a==="strikethrough"?l.push("line-through"):l.push(a)}),l.length&&u.push("text-decoration:"+l.join(" ")),c?'<span class="'+i.concat(u).join(" ")+'"'+d(o)+">"+s.content+"</span>":'<span style="'+i.concat(u).join(";")+'"'+d(o)+">"+s.content+"</span>"}removeDecoration(e){const r=this.decorations.indexOf(e);r>=0&&this.decorations.splice(r,1)}}var Be=R,T={exports:{}};function U(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,`
|
|
22
|
+
`);/\r./.test(t);)t=t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,r,n){return n+r.slice(n.length)});return t}function Pe(t){for(var e=0,r=0;r<t.length;r++)t[e].length<=t[r].length&&(e=r);return e}function te(t){if(!/\r/.test(t))return t;for(var e=t.split("\r"),r=[];e.length>0;){var n=Pe(e);r.push(e[n]),e=e.slice(n+1)}return r.join("\r")}function Ze(t){if(!t)return"";if(!/\r/.test(t))return t;if(!/\n/.test(t))return te(t);t=t.replace(/\r+\n/gm,`
|
|
23
|
+
`);var e=t.lastIndexOf(`
|
|
24
|
+
`);return U(t.slice(0,e))+`
|
|
25
|
+
`+te(t.slice(e+1))}T.exports=U;T.exports.escapeCarriageReturn=U;T.exports.escapeCarriageReturnSafe=Ze;var qe=T.exports,P,re;function He(){return re||(re=1,P=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),P}var Z,ne;function Ye(){return ne||(ne=1,Z=/[\0-\x1F\x7F-\x9F]/),Z}var q,se;function We(){return se||(se=1,q=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),q}var H,ie;function Je(){return ie||(ie=1,H=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),H}var Y,oe;function Ge(){return oe||(oe=1,Y=function(t){var e={};e.src_Any=He().source,e.src_Cc=Ye().source,e.src_Z=We().source,e.src_P=Je().source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var r="[><|]";return e.src_pseudo_letter="(?:(?!"+r+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+r+"|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+").|;(?!"+e.src_ZCc+").|\\!+(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}),Y}function W(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(r){r&&Object.keys(r).forEach(function(n){t[n]=r[n]})}),t}function B(t){return Object.prototype.toString.call(t)}function Ue(t){return B(t)==="[object String]"}function Ve(t){return B(t)==="[object Object]"}function Ke(t){return B(t)==="[object RegExp]"}function ue(t){return B(t)==="[object Function]"}function Qe(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var fe={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Xe(t){return Object.keys(t||{}).reduce(function(e,r){return e||fe.hasOwnProperty(r)},!1)}var et={"http:":{validate:function(t,e,r){var n=t.slice(e);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,r){var n=t.slice(e);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,r){var n=t.slice(e);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},tt="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",rt="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function nt(t){t.__index__=-1,t.__text_cache__=""}function st(t){return function(e,r){var n=e.slice(r);return t.test(n)?n.match(t)[0].length:0}}function ce(){return function(t,e){e.normalize(t)}}function I(t){var e=t.re=Ge()(t.__opts__),r=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||r.push(tt),r.push(e.src_xn),e.src_tlds=r.join("|");function n(u){return u.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");var s=[];t.__compiled__={};function c(u,l){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+l)}Object.keys(t.__schemas__).forEach(function(u){var l=t.__schemas__[u];if(l!==null){var o={validate:null,link:null};if(t.__compiled__[u]=o,Ve(l)){Ke(l.validate)?o.validate=st(l.validate):ue(l.validate)?o.validate=l.validate:c(u,l),ue(l.normalize)?o.normalize=l.normalize:l.normalize?c(u,l):o.normalize=ce();return}if(Ue(l)){s.push(u);return}c(u,l)}}),s.forEach(function(u){t.__compiled__[t.__schemas__[u]]&&(t.__compiled__[u].validate=t.__compiled__[t.__schemas__[u]].validate,t.__compiled__[u].normalize=t.__compiled__[t.__schemas__[u]].normalize)}),t.__compiled__[""]={validate:null,normalize:ce()};var i=Object.keys(t.__compiled__).filter(function(u){return u.length>0&&t.__compiled__[u]}).map(Qe).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+i+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+i+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),nt(t)}function it(t,e){var r=t.__index__,n=t.__last_index__,s=t.__text_cache__.slice(r,n);this.schema=t.__schema__.toLowerCase(),this.index=r+e,this.lastIndex=n+e,this.raw=s,this.text=s,this.url=s}function ae(t,e){var r=new it(t,e);return t.__compiled__[r.schema].normalize(r,t),r}function E(t,e){if(!(this instanceof E))return new E(t,e);e||Xe(t)&&(e=t,t={}),this.__opts__=W({},fe,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=W({},et,t),this.__compiled__={},this.__tlds__=rt,this.__tlds_replaced__=!1,this.re={},I(this)}E.prototype.add=function(e,r){return this.__schemas__[e]=r,I(this),this};E.prototype.set=function(e){return this.__opts__=W(this.__opts__,e),this};E.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,n,s,c,i,u,l,o,d;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(r=l.exec(e))!==null;)if(c=this.testSchemaAt(e,r[2],l.lastIndex),c){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+c;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(o=e.search(this.re.host_fuzzy_test),o>=0&&(this.__index__<0||o<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(i=n.index+n[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=e.indexOf("@"),d>=0&&(s=e.match(this.re.email_fuzzy))!==null&&(i=s.index+s[1].length,u=s.index+s[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&u>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=u))),this.__index__>=0};E.prototype.pretest=function(e){return this.re.pretest.test(e)};E.prototype.testSchemaAt=function(e,r,n){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,n,this):0};E.prototype.match=function(e){var r=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(ae(this,r)),r=this.__last_index__);for(var s=r?e.slice(r):e;this.test(s);)n.push(ae(this,r)),s=s.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};E.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,s,c){return n!==c[s-1]}).reverse(),I(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,I(this),this)};E.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};E.prototype.onCompile=function(){};var ot=E,ut=w&&w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ct=w&&w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),at=w&&w.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[n.length]=s);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),s=0;s<n.length;s++)n[s]!=="default"&&ut(r,e,n[s]);return ct(r,e),r}}(),he=w&&w.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_e,"__esModule",{value:!0});var lt=_e.default=Ft;const _t=he(Be),ft=qe,ht=he(ot),j=at(C);function dt(t,e=!1){return t=(0,ft.escapeCarriageReturn)(yt(t)),_t.default.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function gt(t){let e="";return t.bg&&(e+=`${t.bg}-bg `),t.fg&&(e+=`${t.fg}-fg `),t.decoration&&(e+=`ansi-${t.decoration} `),e===""?null:(e=e.substring(0,e.length-1),e)}function pt(t){const e={};switch(t.bg&&(e.backgroundColor=`rgb(${t.bg})`),t.fg&&(e.color=`rgb(${t.fg})`),t.decoration){case"bold":e.fontWeight="bold";break;case"dim":e.opacity="0.5";break;case"italic":e.fontStyle="italic";break;case"hidden":e.visibility="hidden";break;case"strikethrough":e.textDecoration="line-through";break;case"underline":e.textDecoration="underline";break;case"blink":e.textDecoration="blink";break}return e}function mt(t,e,r,n){const s=e?null:pt(r),c=e?gt(r):null;return t?t==="fuzzy"?Dt(r,n,s,c):xt(r,n,s,c):j.createElement("span",{style:s,key:n,className:c},r.content)}function xt(t,e,r,n){const s=[],c=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;let i=0,u;for(;(u=c.exec(t.content))!==null;){const[,l,o]=u,d=u.index+l.length;d>i&&s.push(t.content.substring(i,d));const a=o.startsWith("www.")?`http://${o}`:o;s.push(j.createElement("a",{key:i,href:a,target:"_blank"},`${o}`)),i=c.lastIndex}return i<t.content.length&&s.push(t.content.substring(i)),j.createElement("span",{style:r,key:e,className:n},s)}function Dt(t,e,r,n){var s;const c=(0,ht.default)({fuzzyEmail:!1}).tlds(["io"],!0);if(!c.pretest(t.content))return j.createElement("span",{style:r,key:e,className:n},t.content);const i=c.match(t.content);if(!i)return j.createElement("span",{style:r,key:e,className:n},t.content);const u=[t.content.substring(0,(s=i[0])===null||s===void 0?void 0:s.index)];return i.forEach((l,o)=>{var d;u.push(j.createElement("a",{href:l.url,target:"_blank",key:o},t.content.substring(l.index,l.lastIndex))),i[o+1]&&u.push(t.content.substring(i[o].lastIndex,(d=i[o+1])===null||d===void 0?void 0:d.index))}),i[i.length-1].lastIndex!==t.content.length&&u.push(t.content.substring(i[i.length-1].lastIndex,t.content.length)),j.createElement("span",{style:r,key:e,className:n},u)}function Ft(t){const{className:e,useClasses:r,children:n,linkify:s}=t;return j.createElement("code",{className:e},dt(n??"",r??!1).map(mt.bind(null,s??!1,r??!1)))}function yt(t){let e=t;do t=e,e=t.replace(/[^\n]\x08/gm,"");while(e.length<t.length);return t}function bt(t){return/^\[(ERROR|FATAL)\]/.test(t)||/^ERROR\b/.test(t)?"text-red-400":/^\[(WARN|WARNING)\]/.test(t)||/^WARN(ING)?\b/.test(t)?"text-amber-400":/^\[DEBUG\]/.test(t)||/^DEBUG\b/.test(t)?"text-sky-400":/^\[(INFO|DOWNLOAD|PROGRESS)\]/.test(t)||/^INFO\b/.test(t)?"text-emerald-400":"text-zinc-200"}function le(t){const e=$e({start:0,end:t}),r=e.hours??0,n=e.minutes??0,s=e.seconds??0;return r===0&&n===0?`${s}s`:r===0?`${n}m${s}s`:`${r}h${n}m`}function vt(){const[t,e]=C.useState([]),[r,n]=C.useState({}),[s,c]=C.useState({}),[i,u]=C.useState(null),l=C.useRef(""),[,o]=C.useState(0),d=C.useRef(null),a=i?s[i]??[]:[];C.useEffect(()=>{fetch("/__just/recipes",{cache:"no-store"}).then(y=>y.json()).then(e).catch(()=>e([])),fetch("/__config").then(y=>y.json()).then(y=>{l.current=y.stopToken??""}).catch(()=>{});const h=new EventSource("/__just/logs");let f=!0;h.onopen=()=>{if(f){f=!1;return}c({}),n({})},h.onmessage=y=>{try{const m=JSON.parse(y.data);m.type==="log"?c(v=>{const A=[...v[m.recipe]??[],m.text];return{...v,[m.recipe]:A.length>1e3?A.slice(-1e3):A}}):m.type==="clear"?c(v=>({...v,[m.recipe]:[]})):m.type==="state"&&(n(v=>{var A;return{...v,[m.recipe]:{state:m.state,code:m.code,signal:m.signal,startedAt:m.startedAt??((A=v[m.recipe])==null?void 0:A.startedAt)??Date.now()}}}),m.state==="running"&&u(m.recipe))}catch{}},h.onerror=()=>{};const D=setInterval(()=>o(y=>y+1),1e3);return()=>{h.close(),clearInterval(D)}},[]),C.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[a.length,i]);const p=(h,f)=>{fetch(`/__just/${h}`,{method:"POST",headers:{"x-stop-token":l.current,"Content-Type":"application/json"},body:JSON.stringify({recipe:f})}).catch(()=>pe.error(`just ${h} 动作失败`))},b=t.map(h=>({...h,task:r[h.name]})),x=b.filter(h=>{var f;return((f=h.task)==null?void 0:f.state)==="running"}).length,F=i?r[i]:void 0,k=(F==null?void 0:F.state)==="running",N=(h,f,D)=>h?"bg-emerald-500 animate-pulse":f?D!=null&&D.signal?"bg-muted-foreground":D!=null&&D.code?"bg-red-500":"bg-emerald-500/60":"bg-muted-foreground/30",de={key:"__console__",label:"",badge:_.jsx("span",{className:"font-mono opacity-80",children:x>0?x:""}),className:i===null?"":"border-border text-muted-foreground hover:text-foreground"},ge=t.map(h=>{const f=r[h.name],D=(f==null?void 0:f.state)==="running",y=(f==null?void 0:f.state)==="exited",m=i===h.name;return{key:h.name,label:h.name,className:m?"":D?"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 hover:bg-emerald-500/20":"",renderLabel:()=>_.jsxs(_.Fragment,{children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N(D,y,f)}`}),_.jsx("span",{children:h.name})]}),renderExtra:()=>y&&!m?_.jsx("span",{className:`text-[10px] ${f!=null&&f.signal?"opacity-60":f!=null&&f.code?"text-red-500":"text-emerald-600 dark:text-emerald-400"}`,children:f!=null&&f.signal?"停":f==null?void 0:f.code}):void 0}});return _.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"flex-none flex items-center gap-1.5 flex-wrap px-3 py-2 border-b bg-background",children:_.jsx(xe,{items:[de,...ge],value:i??"__console__",onChange:h=>u(h==="__console__"?null:h),ariaLabel:"任务筛选"})}),i===null?_.jsxs("div",{className:"flex-1 min-h-0 overflow-auto p-3 grid gap-2.5 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 content-start",children:[b.length===0&&_.jsx("p",{className:"text-xs text-muted-foreground col-span-full p-4 text-center",children:"未发现 justfile recipes"}),b.map(h=>{const f=h.task,D=(f==null?void 0:f.state)==="running",y=(f==null?void 0:f.state)==="exited",m=(s[h.name]??[]).slice(-3).map(v=>v.replace(/\r?\n$/,"").replace(/\x1b\[[0-9;]*m/g,""));return _.jsxs("div",{onClick:()=>u(h.name),className:"group rounded-lg border bg-card p-3 cursor-pointer hover:border-muted-foreground/40 transition-colors",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-full flex-none ${N(D,y,f)}`}),_.jsx("span",{className:"font-mono font-medium",children:h.name}),D&&_.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 font-mono",children:le(Date.now()-f.startedAt)}),y&&_.jsx("span",{className:`font-mono ${f.signal?"text-muted-foreground":f.code?"text-red-500":"text-emerald-600 dark:text-emerald-400"}`,children:f.signal?"已停止":`exit ${f.code}`}),!f&&_.jsx("span",{className:"text-muted-foreground/60",children:"未运行"}),_.jsx("span",{className:"ml-auto flex items-center gap-1",onClick:v=>v.stopPropagation(),children:D?_.jsxs(O,{variant:"ghost",className:"h-6 gap-1 px-2 text-[11px]",onClick:()=>p("stop",h.name),children:[_.jsx(ee,{className:"h-2.5 w-2.5"}),"停止"]}):_.jsxs(O,{variant:"ghost",className:"h-6 gap-1 px-2 text-[11px]",onClick:()=>p("start",h.name),children:[y?_.jsx(X,{className:"h-2.5 w-2.5"}):_.jsx(Le,{className:"h-2.5 w-2.5"}),y?"重跑":"启动"]})})]}),h.description&&_.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70 truncate",children:h.description}),_.jsx("div",{className:"mt-2 rounded bg-[#0d1117] px-2 py-1.5 font-mono text-[10px] leading-relaxed text-zinc-400 min-h-[3.4em]",children:m.length?m.map((v,A)=>_.jsx("div",{className:"truncate",children:v},A)):_.jsxs("span",{className:"text-zinc-600",children:["$ just ",h.name," …"]})})]},h.name)})]}):_.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"flex-none flex items-center gap-2 px-3.5 h-8 border-b bg-background text-[11px]",children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k?"bg-emerald-500 animate-pulse":"bg-muted-foreground"}`}),_.jsx("span",{className:"font-mono font-medium",children:i}),_.jsx("span",{className:"text-muted-foreground font-mono",children:k?`running · ${le(Date.now()-F.startedAt)}`:F!=null&&F.signal?"已停止":F?`exit ${F.code}`:"未运行"}),_.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[k?_.jsxs(O,{variant:"ghost",className:"h-6 gap-1 px-2 text-[11px]",onClick:()=>p("stop",i),children:[_.jsx(ee,{className:"h-2.5 w-2.5"}),"停止"]}):_.jsxs(O,{variant:"ghost",className:"h-6 gap-1 px-2 text-[11px]",onClick:()=>p("start",i),children:[_.jsx(X,{className:"h-2.5 w-2.5"}),F?"重跑":"启动"]}),_.jsxs(O,{variant:"ghost",className:"h-6 gap-1 px-2 text-[11px]",onClick:()=>p("clear",i),disabled:!a.length,children:[_.jsx(Ie,{className:"h-2.5 w-2.5"}),"清屏"]}),_.jsxs("span",{className:"text-muted-foreground font-mono ml-1",children:[a.length," 行"]})]})]}),_.jsxs("div",{ref:d,className:"flex-1 min-h-0 overflow-auto bg-[#0d1117] p-3.5 font-mono text-xs leading-relaxed text-zinc-200",children:[a.length===0&&_.jsxs("p",{className:"text-zinc-500",children:["$ just ",i," · 等待输出…"]}),a.map((h,f)=>{const D=h.replace(/\r?\n$/,"");return _.jsx("div",{className:"whitespace-pre-wrap break-all min-h-[1.25rem]",children:/\x1b\[/.test(D)?_.jsx(lt,{children:D}):_.jsx("span",{className:bt(D),children:D})},f)})]})]})]})}function Et(){return _.jsx("div",{className:"mx-auto h-full max-w-6xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:_.jsx(vt,{})})}const Ct=Object.freeze(Object.defineProperty({__proto__:null,default:Et},Symbol.toStringTag,{value:"Module"})),jt={mode:"just",label:"Just Runner",icon:"📜",description:"Just 任务日志与执行",Workspace:C.lazy(()=>me(()=>Promise.resolve().then(()=>Ct),void 0))};export{Et as JustWorkspace,jt as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as P,r as c,u as W,j as e,E as O,G as C,F as $,_ as B}from"./index-Dcz2Myaf.js";import{B as m}from"./badge-CsNeQaUt.js";import{P as F}from"./ProgressBar-CyYoGfrt.js";import{F as p}from"./file-text-AM0snHQm.js";import{M as b,r as k}from"./index-BF1XYOKG.js";/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const M=P("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]),N=/^\s*-\s*\[([ xX])\]\s*(.*)$/;function R(s){return s.split(`
|
|
7
|
+
`).filter(t=>N.test(t)).map(t=>{const r=t.match(N);return{text:((r==null?void 0:r[2])??t).trim(),checked:(r==null?void 0:r[1])!==" "}})}function y(s,t){return t===0?0:Math.round(s/t*100)}function w({done:s,total:t}){const r=y(s,t),a=r===100?"success":r>0?"warning":"neutral";return e.jsxs(m,{variant:a,children:[s,"/",t," · ",r,"%"]})}function v(){return e.jsx(m,{variant:"info",children:"worktree 执行中"})}function G(){return e.jsx(m,{variant:"info",children:"含测试策略"})}function I({name:s,pending:t}){const r=t?"neutral":"success";return e.jsx(m,{variant:r,children:t?`${s} · 等待前置`:s})}function L({tasks:s}){const t=R(s);if(!t.length)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"无 tasks.md"});const r=t.findIndex(a=>!a.checked);return e.jsx("ul",{className:"space-y-1 text-xs",children:t.map((a,i)=>{const d=i===r;return e.jsxs("li",{className:`flex items-start gap-2 rounded px-1.5 -mx-1.5 py-0.5 ${d?"bg-amber-500/10 border-l-2 border-amber-500":""} ${a.checked?"text-foreground":"text-muted-foreground"}`,children:[a.checked?e.jsx("span",{className:"mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full bg-emerald-500 text-white flex items-center justify-center text-[8px]",children:"✓"}):e.jsx("span",{className:`mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full border ${d?"border-amber-500":"border-muted-foreground/50"}`}),e.jsx("span",{children:a.text}),d&&e.jsx("span",{className:"ml-auto flex-none text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"← 下一步"})]},i)})})}function A({item:s,onSelect:t}){return e.jsxs("button",{type:"button",onClick:t,className:"w-full text-left rounded-lg border bg-card p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx($,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium font-mono truncate",children:s.name}),e.jsx(w,{done:s.done,total:s.total}),s.inWorktree&&e.jsx(v,{})]}),e.jsx(F,{value:y(s.done,s.total),className:"h-1 mb-2"}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:s.hasProposal?"text-foreground":"",children:"proposal"}),e.jsx("span",{className:s.hasDesign?"text-foreground":"",children:"design"})]})]})}function z({refreshKey:s}){const[t,r]=c.useState([]);return c.useEffect(()=>{fetch("/__worktrees",{cache:"no-store"}).then(a=>a.json()).then(r).catch(()=>r([]))},[s]),t.length?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(C,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-[11px] text-muted-foreground mr-1",children:"Worktree:"}),t.map(a=>e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-[10px] font-mono bg-sky-500/10 text-sky-600 border-sky-500/30",title:a.head,children:[a.name,"@",a.branch||"detached"]},a.name))]}):null}function D({navTarget:s}){const[t,r]=c.useState([]),[a,i]=c.useState(0);c.useRef(!1),W(()=>{},()=>i(n=>n+1));const[d,S]=c.useState(null),[l,_]=c.useState(null),[h,x]=c.useState(!0),[f,j]=c.useState(null),[H,E]=c.useState(!1),g=c.useCallback(()=>{x(!0),fetch("/__apply",{cache:"no-store"}).then(n=>n.json()).then(r).catch(n=>j(n.message)).finally(()=>x(!1))},[]);c.useEffect(()=>{g()},[g,a]);const u=c.useCallback(n=>{x(!0),S(n),E(!0),fetch(`/__apply/change?name=${encodeURIComponent(n)}`,{cache:"no-store"}).then(o=>o.json()).then(_).catch(o=>j(o.message)).finally(()=>x(!1))},[]);return c.useEffect(()=>{if(!(s!=null&&s.wt)||!t.length)return;const n=t.find(o=>o.name===s.wt);n&&u(n.name)},[s==null?void 0:s.wt,s==null?void 0:s.navToken,t,u]),h&&!t.length?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-3.5 grid h-14 w-14 place-items-center rounded-[14px] bg-primary text-primary-foreground text-2xl font-bold animate-pulse",children:"⚙️"}),e.jsx("p",{children:"加载执行进度…"})]})}):f?e.jsx("div",{className:"flex h-full items-center justify-center text-destructive",children:e.jsx("p",{children:f})}):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.jsxs("div",{className:"flex-none px-4 py-3 border-b flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"OpenSpec 执行进度"}),e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"openspec/changes/"})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto p-4 space-y-4",children:[e.jsx(z,{refreshKey:a}),t.length?e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:t.map(n=>e.jsx(A,{item:n,onSelect:()=>u(n.name)},n.name))}):e.jsx(O,{icon:M,title:"没有进行中的 change",hint:"在 openspec/changes/ 下创建 change 后会显示在这里"}),d&&l&&!h&&e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium",children:l.name}),e.jsx(w,{done:l.done,total:l.total}),l.inWorktree&&e.jsx(v,{}),l.hasTestStrategy&&e.jsx(G,{})]}),l.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:"依赖:"}),l.dependsOn.map(n=>e.jsx(I,{name:n,pending:t.some(o=>o.name===n)},n))]}),l.proposal&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(p,{className:"h-3 w-3"})," proposal.md"]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs border rounded-lg p-3 bg-card",children:e.jsx(b,{remarkPlugins:[k],children:l.proposal})})]}),l.design&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(p,{className:"h-3 w-3"})," design.md"]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs border rounded-lg p-3 bg-card",children:e.jsx(b,{remarkPlugins:[k],children:l.design})})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(p,{className:"h-3 w-3"})," tasks.md"]}),e.jsx("div",{className:"border rounded-lg p-3 bg-card",children:e.jsx(L,{tasks:l.tasks})})]})]})]})]})}function K({navTarget:s}){return e.jsx(D,{navTarget:s})}const V=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"})),Y={mode:"apply",label:"执行进度",icon:"⚙️",description:"OpenSpec change 执行进度 · zapply",Workspace:c.lazy(()=>B(()=>Promise.resolve().then(()=>V),void 0))};export{K as ApplyWorkspace,Y as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c,r as l,j as e,B as p,E as g,_ as f}from"./index-Dcz2Myaf.js";import{B as h}from"./badge-CsNeQaUt.js";import{F as y}from"./FilterPills-CT9_aiMo.js";/**
|
|
2
|
+
* @license lucide-react v0.460.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const v=c("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
|
|
7
|
+
* @license lucide-react v0.460.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const k=c("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
12
|
+
* @license lucide-react v0.460.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const j=c("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),b=[{key:"mine",label:"我的"},{key:"all",label:"全部"},{key:"active",label:"active"},{key:"resolved",label:"resolved"},{key:"closed",label:"closed"}];function w({status:s}){const a=s==="active"?"destructive":s==="resolved"?"success":"neutral";return e.jsx(h,{variant:a,children:s})}function N({severity:s}){const a=Number(s),r=a<=1?"destructive":a===2||a===3?"warning":"neutral";return e.jsxs(h,{variant:r,children:["S",a]})}function M(){const[s,a]=l.useState(null),[r,i]=l.useState(!1),[n,x]=l.useState("mine"),o=l.useCallback(()=>{i(!0),fetch("/__bugs",{cache:"no-store"}).then(t=>t.json()).then(a).finally(()=>i(!1))},[]);l.useEffect(o,[o]);const m=t=>n==="all"?!0:n==="mine"?t.mine:t.status===n,d=s!=null&&s.ok?s.bugs.filter(m):[],u=s!=null&&s.ok?{mine:s.bugs.filter(t=>t.mine).length,all:s.bugs.length,active:s.bugs.filter(t=>t.status==="active").length,resolved:s.bugs.filter(t=>t.status==="resolved").length,closed:s.bugs.filter(t=>t.status==="closed").length}:null;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.jsxs("div",{className:"flex-none flex items-center gap-2 px-3 py-2 border-b",children:[e.jsx(y,{items:b.map(t=>({key:t.key,label:t.label,badge:u?String(u[t.key]):void 0})),value:n,onChange:x,ariaLabel:"状态筛选"}),e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"禅道 · 只读"}),e.jsx(p,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:o,title:"刷新",children:e.jsx(j,{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`})})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:s?s.ok?d.length?e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-background border-b",children:e.jsxs("tr",{className:"text-left text-muted-foreground",children:[e.jsx("th",{className:"px-3 py-2 font-medium w-16",children:"#"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"标题"}),e.jsx("th",{className:"px-3 py-2 font-medium w-14",children:"严重度"}),e.jsx("th",{className:"px-3 py-2 font-medium w-20",children:"状态"}),e.jsx("th",{className:"px-3 py-2 font-medium w-20",children:"指派"})]})}),e.jsx("tbody",{children:d.map(t=>e.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/40 transition-colors",children:[e.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:t.id}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{className:"text-left hover:text-primary hover:underline flex items-center gap-1",onClick:()=>window.open(`${s.url}/bug-view-${t.id}.html`,"_blank","noopener"),title:"在禅道打开",children:[e.jsx("span",{className:"truncate max-w-[420px]",children:t.title}),e.jsx(k,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(N,{severity:t.severity})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(w,{status:t.status})}),e.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:t.assignedTo||"—"})]},t.id))})]}):e.jsx(g,{icon:v,title:n==="mine"?"没有指派给你的 bug":"该状态下无 bug",hint:"🎉"}):e.jsx("p",{className:"p-4 text-xs text-destructive",children:s.error}):e.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"加载中…"})})]})}function _(){return e.jsx(M,{})}const S=Object.freeze(Object.defineProperty({__proto__:null,default:_},Symbol.toStringTag,{value:"Module"})),C={mode:"bugs",label:"禅道 Bugs",icon:"🎯",description:"只读 bug 列表 · zgoal",Workspace:l.lazy(()=>f(()=>Promise.resolve().then(()=>S),void 0))};export{_ as BugWorkspace,C as default};
|
package/dist/web/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<link rel="icon" href="/__app/favicon.svg" type="image/svg+xml" />
|
|
7
7
|
<title>zdashboard · 项目洞察</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Dcz2Myaf.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C9nEYrn8.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as r}from"./index-15cLfCw4.js";import{r as d,a as u,b as m,c as x,d as h,e as g,f}from"./katex.min-D_D1u30F.js";import{M as b,r as y}from"./index-6FGn10zY.js";function j({children:n}){const t=c.useRef(null),[i,s]=c.useState(!1),a=async()=>{var e;const p=((e=t.current)==null?void 0:e.innerText)??"";try{await navigator.clipboard.writeText(p),s(!0),setTimeout(()=>s(!1),1500)}catch(o){console.error("[zdashboard] clipboard copy failed:",o)}};return r.jsxs("div",{className:"not-prose relative my-4 group",children:[r.jsx("button",{onClick:a,className:"absolute right-2 top-2 z-10 px-2 py-0.5 rounded border border-border bg-background/80 text-[11px] opacity-0 group-hover:opacity-100 transition-opacity",children:i?"已复制":"复制"}),r.jsx("pre",{ref:t,className:"overflow-auto rounded-md border bg-[#0d1117] p-3 text-xs leading-relaxed",children:n})]})}function N({path:n}){const[t,i]=c.useState(null);if(c.useEffect(()=>{let e=!0;return fetch("/"+encodeURI(n),{cache:"no-store"}).then(o=>o.text()).then(o=>{e&&i(o)}).catch(()=>{e&&i("")}),()=>{e=!1}},[n]),t===null)return r.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"});const s=t.match(/^---\n([\s\S]*?)\n---\n?/),a=(s==null?void 0:s[1])??null,p=a?t.slice(s[0].length):t;return r.jsxs("div",{className:"prose dark:prose-invert mx-auto max-w-3xl p-8 prose-headings:scroll-mt-4 prose-pre:bg-transparent prose-pre:p-0 prose-pre:m-0",children:[a&&r.jsxs("details",{className:"not-prose mb-4 rounded border p-3 text-sm",children:[r.jsx("summary",{className:"cursor-pointer font-medium",children:"YAML frontmatter"}),r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-xs",children:a})]}),r.jsx(b,{remarkPlugins:[y,g,f],rehypePlugins:[d,u,[m,{behavior:"wrap",properties:{className:["no-underline"]}}],[x,{detect:!0,ignoreMissing:!0}],[h,{strict:!1}]],components:{pre:({children:e})=>r.jsx(j,{children:e}),a:({href:e,children:o})=>{const l=e==null?void 0:e.startsWith("http");return r.jsx("a",{href:e,target:l?"_blank":void 0,rel:l?"noreferrer noopener":void 0,children:o})}},children:p})]})}export{N as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as t}from"./index-15cLfCw4.js";function f(m){const[s,o]=l.useState(null),[r,d]=l.useState(null);if(l.useEffect(()=>{fetch("/__stats/data",{cache:"no-store"}).then(e=>e.json()).then(o).catch(e=>d(e.message))},[]),r)return t.jsx("div",{className:"flex h-full items-center justify-center text-destructive",children:t.jsxs("p",{children:["加载失败: ",r]})});if(!s)return t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"加载中…"})});const n=(s.totalSize/1024/1024).toFixed(2),i=Math.max(...s.byExt.map(e=>e.count),1),c=[{label:"文件",value:s.files,mode:null,filter:null},{label:"目录",value:s.dirs,mode:null,filter:null},{label:"总大小",value:`${n} MB`,mode:null,filter:null},{label:"Markdown",value:s.markdown,mode:"view",filter:".md"},{label:"变更 进行/归档",value:`${s.openspec.active}/${s.openspec.archived}`,mode:"apply",filter:null}],u=(e,a)=>{e&&window.dispatchEvent(new CustomEvent("zd-dashboard-nav",{detail:{mode:e,...a?{filter:a}:{}}}))};return 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("h1",{className:"text-lg font-semibold mb-1",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:c.map(e=>t.jsxs("button",{type:"button",onClick:()=>u(e.mode,e.filter),disabled:!e.mode,title:e.mode?`点击跳转至 ${e.label}`:void 0,className:`rounded-lg border bg-background p-4 text-left transition-colors ${e.mode?"hover:bg-muted/70 cursor-pointer":"cursor-default opacity-80"}`,children:[t.jsx("div",{className:"text-xl font-bold",children:e.value}),t.jsx("div",{className:"text-[11px] 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("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:`${(e.count/i*100).toFixed(1)}%`}})}),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 ${s.hasJust?"text-emerald-600 border-emerald-500/30 bg-emerald-500/10":"text-muted-foreground border-border"}`,children:["justfile ",s.hasJust?"✓":"✗"]}),t.jsxs("span",{className:"text-muted-foreground",children:["root: ",s.root]})]})]})}export{f as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./index-15cLfCw4.js";/**
|
|
2
|
-
* @license lucide-react v0.460.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const c=e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
7
|
-
* @license lucide-react v0.460.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const t=e("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);export{c as F,t as G};
|