zdashboard 2.4.0 → 2.5.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.
Files changed (31) hide show
  1. package/README.md +15 -0
  2. package/dist/cli.js +3 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/web/assets/FileIcon-CWL_Aew0.js +110 -0
  5. package/dist/web/assets/{FilterPills-D_6kvZo5.js → FilterPills-DfrtQ2BX.js} +1 -1
  6. package/dist/web/assets/{MdViewer-WZMpNmB2.js → MdViewer-DoCxNu7A.js} +2 -2
  7. package/dist/web/assets/{ProgressBar-DPJd_uDt.js → ProgressBar-CIDdp-03.js} +1 -1
  8. package/dist/web/assets/{Workspace-MeZD-u22.js → Workspace-CsW6-X9a.js} +1 -1
  9. package/dist/web/assets/{badge-BbN-q0Cc.js → badge-izTmQYbF.js} +1 -1
  10. package/dist/web/assets/{book-open-Dwx5kHtv.js → book-open-CCPWUzhH.js} +1 -1
  11. package/dist/web/assets/{file-text-Co0hTLuo.js → file-text-DHJKu2eF.js} +1 -1
  12. package/dist/web/assets/index-C39_SyD0.css +1 -0
  13. package/dist/web/assets/{index-Dkkxw5Oy.js → index-Cu37wtgU.js} +33 -28
  14. package/dist/web/assets/{index-CHxXM6Fn.js → index-DKB8z9I8.js} +1 -1
  15. package/dist/web/assets/vt323-latin-400-normal-Dqn9ZSPj.woff +0 -0
  16. package/dist/web/assets/vt323-latin-400-normal-wDgJuOC9.woff2 +0 -0
  17. package/dist/web/assets/{web-CMZAKAOi.js → web-9Iy8fpbv.js} +1 -1
  18. package/dist/web/assets/web-C4KehBpT.js +26 -0
  19. package/dist/web/assets/web-CSsoKnCH.js +2 -0
  20. package/dist/web/assets/{web-BoW0qNb8.js → web-CnZCJ59N.js} +3 -3
  21. package/dist/web/assets/web-DjRxK_Na.js +16 -0
  22. package/dist/web/assets/web-DuuJgOy2.js +21 -0
  23. package/dist/web/assets/{web-La5g0ovh.js → web-DxAXHOpi.js} +1 -1
  24. package/dist/web/index.html +2 -2
  25. package/package.json +3 -1
  26. package/dist/web/assets/FileIcon-CDN2wCuK.js +0 -50
  27. package/dist/web/assets/index-o5t5Kpfc.css +0 -1
  28. package/dist/web/assets/web-BYZeHggs.js +0 -56
  29. package/dist/web/assets/web-CkMm3ooW.js +0 -36
  30. package/dist/web/assets/web-Dpd8wclV.js +0 -26
  31. package/dist/web/assets/web-ZM6TYT88.js +0 -2
@@ -0,0 +1,16 @@
1
+ import{c as D,j as r,r as s,E as T,G as U,F as Z,_ as P}from"./index-Cu37wtgU.js";import{M as J}from"./MdViewer-DoCxNu7A.js";import{C as G,I as K,a as q,u as X,F as Y}from"./FileIcon-CWL_Aew0.js";import{F as ee}from"./file-text-DHJKu2eF.js";import"./index-DKB8z9I8.js";import"./book-open-CCPWUzhH.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 te=D("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"}]]);/**
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 re=D("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"}]]);/**
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=D("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"}]]);function se({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(re,{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 H=null;const M=new Set,y={get:()=>H,set:e=>{H=e,M.forEach(t=>t(e))},subscribe:e=>(M.add(e),()=>{M.delete(e)})};function oe({containerRef:e}){const[t,c]=s.useState([]),[m,i]=s.useState(null);s.useEffect(()=>{const o=e.current;if(!o)return;let a=!1;const u=()=>{if(a)return;const n=o.querySelectorAll("h1[id], h2[id], h3[id]"),l=[];n.forEach(p=>{var b;l.push({id:p.id,text:((b=p.textContent)==null?void 0:b.trim())??"",level:parseInt(p.tagName[1],10)})}),c(l)};u();const f=new MutationObserver(u);return f.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{a=!0,f.disconnect()}},[e]),s.useEffect(()=>{const o=e.current;if(!o||!t.length)return;const a=new IntersectionObserver(u=>{const f=u.filter(n=>n.isIntersecting);if(f.length){const n=f.reduce((l,p)=>l.boundingClientRect.top<p.boundingClientRect.top?l:p);i(n.target.id)}},{root:o,rootMargin:"-60px 0px -70% 0px",threshold:0});return t.forEach(({id:u})=>{const f=o.querySelector(`#${CSS.escape(u)}`);f&&a.observe(f)}),()=>a.disconnect()},[t,e]);const d=o=>{var u;const a=(u=e.current)==null?void 0:u.querySelector(`#${CSS.escape(o)}`);a==null||a.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 ${m===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 ce=2500;function ue(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:se}function le(e){const[t,c]=s.useState(()=>y.get()),[m,i]=s.useState(!1),d=s.useRef(null),o=t?ue(t):null;return s.useEffect(()=>y.subscribe(c),[]),s.useEffect(()=>{const a=d.current;if(!a)return;const u=()=>{var l;const n=((l=a.textContent)==null?void 0:l.length)??0;i(n>ce)};u();const f=new MutationObserver(u);return f.observe(a,{childList:!0,subtree:!0,characterData:!0}),()=>f.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})}),m&&r.jsx(oe,{containerRef:d})]}):r.jsx(T,{icon:te,title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式",tone:"primary"})})}const ie=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));function ae(e,t,c,m){var i=this,d=s.useRef(null),o=s.useRef(0),a=s.useRef(0),u=s.useRef(null),f=s.useRef([]),n=s.useRef(),l=s.useRef(),p=s.useRef(e),b=s.useRef(!0),g=s.useRef(),C=s.useRef();p.current=e;var O=typeof window<"u",k=!t&&t!==0&&O;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var L=!!(c=c||{}).leading,R=!("trailing"in c)||!!c.trailing,N=!!c.flushOnExit&&R,w="maxWait"in c,$="debounceOnServer"in c&&!!c.debounceOnServer,I=w?Math.max(+c.maxWait||0,t):null,A=s.useMemo(function(){var v=function(h){var x=f.current,j=n.current;return f.current=n.current=null,o.current=h,a.current=a.current||h,l.current=p.current.apply(j,x)},S=function(h,x){k&&cancelAnimationFrame(u.current),u.current=k?requestAnimationFrame(h):setTimeout(h,x)},W=function(h){if(!b.current)return!1;var x=h-d.current;return!d.current||x>=t||x<0||w&&h-o.current>=I},z=function(h){return u.current=null,R&&f.current?v(h):(f.current=n.current=null,l.current)},F=function h(){var x=Date.now();if(L&&a.current===o.current&&B(),W(x))return z(x);if(b.current){var j=t-(x-d.current),_=w?Math.min(j,I-(x-o.current)):j;S(h,_)}},B=function(){m&&m({})},E=function(){if(O||$){var h,x=Date.now(),j=W(x);if(f.current=[].slice.call(arguments),n.current=i,d.current=x,N&&!g.current&&(g.current=function(){var _;((_=globalThis.document)==null?void 0:_.visibilityState)==="hidden"&&C.current.flush()},(h=globalThis.document)==null||h.addEventListener==null||h.addEventListener("visibilitychange",g.current)),j){if(!u.current&&b.current)return o.current=d.current,S(F,t),L?v(d.current):l.current;if(w)return S(F,t),v(d.current)}return u.current||S(F,t),l.current}};return E.cancel=function(){var h=u.current;h&&(k?cancelAnimationFrame(u.current):clearTimeout(u.current)),o.current=0,f.current=d.current=n.current=u.current=null,h&&m&&m({})},E.isPending=function(){return!!u.current},E.flush=function(){return u.current?z(Date.now()):l.current},E},[L,w,t,I,R,N,k,O,$,m]);return C.current=A,s.useEffect(function(){return b.current=!0,function(){var v;N&&C.current.flush(),g.current&&((v=globalThis.document)==null||v.removeEventListener==null||v.removeEventListener("visibilitychange",g.current),g.current=null),b.current=!1}},[N]),A}function de(e,t){return e===t}function fe(e,t,c){var m=de,i=s.useRef(e),d=s.useState({})[1],o=ae(s.useCallback(function(u){i.current=u,d({})},[d]),t,c,d),a=s.useRef(e);return m(a.current,e)||(o(e),a.current=e),[i.current,o]}function V(e,t){return!t||e.name.toLowerCase().includes(t)?!0:(e.children??[]).some(c=>V(c,t))}function Q({node:e,depth:t,filter:c,current:m,onSelectFile:i}){const d=(e.children??[]).filter(n=>V(n,c)),[o,a]=s.useState(!e.defaultCollapsed),u=c?!0:o;if(!d.length&&c)return null;const{icon:f}=X();return r.jsxs("div",{children:[(()=>{const n=e.name.match(/^([a-z]+)(?: \((\d+)\))?$/),l=n?f(n[1]):void 0,p=u?Z:ne;return r.jsxs("button",{onClick:()=>a(b=>!b),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(q,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${u?"rotate-90":""}`}),l?r.jsx(l,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):r.jsx(p,{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(Q,{node:n,depth:t+1,filter:c,current:m,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 ${m===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:m===n.path}),r.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function me({worktrees:e}){const[t,c]=s.useState(!0),m=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(q,{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:()=>m(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 he({navTarget:e}){const t=s.useSyncExternalStore(y.subscribe,y.get),[c,m]=s.useState(null),[i,d]=s.useState(""),[o]=fe(i,150),[a,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(l=>l.json()).then(l=>m(l.tree??[]))},[]),s.useEffect(()=>{fetch("/__worktrees",{cache:"no-store"}).then(l=>l.json()).then(u).catch(()=>u([]))},[]);const f=s.useMemo(()=>c?c.filter(l=>V(l,o)):[],[c,o]),n=a.length>0;return r.jsxs("div",{className:"p-2",children:[r.jsx("input",{value:i,onChange:l=>d(l.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?!f.length&&!n?r.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"无匹配"}):r.jsxs("div",{className:"py-1",children:[n&&r.jsx(me,{worktrees:a}),f.map(l=>r.jsx(Q,{node:l,depth:0,filter:o,current:t,onSelectFile:p=>y.set(p)},l.name))]}):r.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"})]})}const xe=Object.freeze(Object.defineProperty({__proto__:null,default:he},Symbol.toStringTag,{value:"Module"})),ye={mode:"view",label:"项目浏览",icon:"👁️",description:"openspec / docs / 文档预览",Sidebar:s.lazy(()=>P(()=>Promise.resolve().then(()=>xe),void 0)),Workspace:s.lazy(()=>P(()=>Promise.resolve().then(()=>ie),void 0))};export{he as ViewSidebar,le as ViewWorkspace,ye as default};
@@ -0,0 +1,21 @@
1
+ import{c as f,r as i,j as e,E as V,P as N,_ as v}from"./index-Cu37wtgU.js";import{M as I}from"./MdViewer-DoCxNu7A.js";import{C,I as F,M as w,T as R,A as E,V as O,S as P,B as U,a as L,F as M}from"./FileIcon-CWL_Aew0.js";import{F as T}from"./FilterPills-DfrtQ2BX.js";import{F as z}from"./file-text-DHJKu2eF.js";import{B as $}from"./book-open-CCPWUzhH.js";import"./index-DKB8z9I8.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 A=f("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"}]]);/**
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 W=f("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"}]]);/**
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 D=f("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 H=f("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"}]]);let k=null;const y=new Set,u={get:()=>k,set:t=>{k=t,y.forEach(r=>r(t))},subscribe:t=>(y.add(t),()=>{y.delete(t)})};function B({path:t}){return e.jsx("iframe",{src:"/"+encodeURI(t),title:"预览",className:"w-full h-full border-0 bg-white"})}function G({path:t}){const[r,l]=i.useState([]),[c,a]=i.useState(!0);return i.useEffect(()=>{let s=!1;return a(!0),l([]),fetch("/"+encodeURI(t),{cache:"no-store"}).then(o=>o.text()).then(o=>{if(s)return;const d=o.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!d.length){l([]),a(!1);return}const n=x=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(x.trim()),m=d.filter(x=>n(x)),p=d.filter(x=>/font|family|type/.test(x.toLowerCase())&&!n(x)),b=d.filter(x=>!m.includes(x)&&!p.includes(x)),g=x=>{const j=x.indexOf(":"),S=x.slice(0,j).trim(),_=x.slice(j+1).trim();return{name:S,value:_}},h=[];m.length&&h.push({label:`配色 · ${m.length}`,items:m.map(g)}),p.length&&h.push({label:`字体 · ${p.length}`,items:p.map(g)}),b.length&&h.push({label:`其他 · ${b.length}`,items:b.map(g)}),l(h),a(!1)}).catch(()=>{s||(l([]),a(!1))}),()=>{s=!0}},[t]),c?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):r.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:r.map(s=>{const o=s.items.some(n=>/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(n.value)),d=s.items.some(n=>/font|family|type/i.test(n.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase text-muted-foreground",children:s.label}),o?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))"},children:s.items.filter(n=>/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(n.value)).map(({name:n,value:m})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[72px] border-b",style:{background:m}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-[11px] break-all",children:n}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:m})]},n))}):d?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))"},children:s.items.map(({name:n,value:m})=>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:m},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-[11px]",children:n})]},n))}):e.jsx("div",{className:"flex flex-col gap-1",children:s.items.map(({name:n,value:m})=>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:n}),e.jsx("span",{className:"text-muted-foreground",children:m})]},n))})]},s.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}function q({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[r,l]=i.useState("");return i.useEffect(()=>{let c=!1,a="",s=null;return fetch("/"+encodeURI(t)).then(o=>o.blob()).then(async o=>{var d;if(!c){if(a=URL.createObjectURL(o),s=new FontFace("zd-font-preview",`url(${a})`),await s.load(),c){(d=s.dispose)==null||d.call(s);return}document.fonts.add(s),l(t.split("/").pop()??t)}}).catch(()=>{c||l(t.split("/").pop()??t)}),()=>{var o;if(c=!0,s)try{document.fonts.delete(s),(o=s.dispose)==null||o.call(s)}catch{}a&&URL.revokeObjectURL(a)}},[t]),e.jsxs("div",{className:"h-full overflow-auto p-8 grid gap-6 place-content-center text-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:t}),e.jsx("div",{className:"text-5xl",style:{fontFamily:r?"'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(A,{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:B,icon:F,token:G,md:I,video:q,audio:Z,pdf:J,component:C,font:K};function Y(t){return X[t]??Q}function ee({mode:t,onMode:r,w:l,h:c,onW:a,onH:s}){const o=[{v:0,icon:e.jsx(w,{className:"h-3.5 w-3.5"}),label:"桌面"},{v:768,icon:e.jsx(H,{className:"h-3.5 w-3.5"}),label:"768"},{v:375,icon:e.jsx(D,{className:"h-3.5 w-3.5"}),label:"375"},{v:"custom",icon:e.jsx(W,{className:"h-3.5 w-3.5"}),label:"自定义"}],d="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(T,{items:o.map(n=>({key:String(n.v),label:n.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[n.icon,e.jsx("span",{className:"hidden sm:inline",children:n.label})]})})),value:String(t),onChange:n=>r(n==="0"?0:n==="custom"?"custom":Number(n)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:l,min:280,max:3e3,step:8,onChange:n=>a(Number(n.target.value)),"aria-label":"自定义宽度",className:d}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:c,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:d}),e.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"px"})]})]})}function te(){const[t,r]=i.useState(()=>u.get()),[l,c]=i.useState(0),[a,s]=i.useState(1024),[o,d]=i.useState(768);i.useEffect(()=>u.subscribe(r),[]);const n=t?Y(t.type):null,m=l===0?"桌面":l==="custom"?`${a} × ${o}`:`${l}px`;return e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:t&&n?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:m}),e.jsx(ee,{mode:l,onMode:c,w:a,h:o,onW:s,onH:d})]}),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:l===0?void 0:l==="custom"?a:l,height:l==="custom"?o:"100%"},children:e.jsx(n,{path:t.path})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(n,{path:t.path})})})]}):e.jsx(V,{icon:N,title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新",tone:"primary"})})}const se=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),ne={page:w,component:U,icon:P,token:N,md:$,video:O,audio:E,pdf:z,font:R},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:"字体"}];function le(){const t=i.useSyncExternalStore(u.subscribe,u.get),[r,l]=i.useState(null);i.useEffect(()=>{fetch("/__design/assets",{cache:"no-store"}).then(a=>a.json()).then(l)},[]);const c=i.useMemo(()=>r?ae.map(a=>({...a,items:r[a.key]??[]})).filter(a=>a.items.length>0):[],[r]);return r?e.jsxs("div",{children:[e.jsxs("div",{className:"p-3 text-xs text-muted-foreground",children:[c.reduce((a,s)=>a+s.items.length,0)," 个资产"]}),c.map(a=>e.jsx(re,{group:a,current:t},a.key))]}):e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"})}function re({group:t,current:r}){const[l,c]=i.useState(!0),a=ne[t.key];return e.jsxs("div",{className:"mb-1.5",children:[e.jsxs("button",{onClick:()=>c(s=>!s),className:"w-full flex items-center gap-1.5 mx-1 px-2 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground rounded-md",style:{width:"calc(100% - 8px)"},children:[e.jsx(L,{className:`h-3 w-3 shrink-0 transition-transform ${l?"rotate-90":""}`}),a&&e.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:t.label}),e.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-muted px-1.5 font-mono text-[10px] font-normal",children:t.items.length})]}),l&&t.items.map(s=>e.jsxs("button",{onClick:()=>u.set({path:s.path,type:s.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 ${(r==null?void 0:r.path)===s.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{width:"calc(100% - 8px)"},children:[e.jsx(M,{name:s.name,active:(r==null?void 0:r.path)===s.path}),e.jsx("span",{className:"truncate",children:s.name}),s.ext&&e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:s.ext})]},s.path))]})}const oe=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"})),he={mode:"design",label:"设计资产",icon:"🎨",description:"设计资产分类浏览 · zdesign",Sidebar:i.lazy(()=>v(()=>Promise.resolve().then(()=>oe),void 0)),Workspace:i.lazy(()=>v(()=>Promise.resolve().then(()=>se),void 0))};export{le as DesignSidebar,te as DesignWorkspace,he as default};
@@ -1,4 +1,4 @@
1
- import{c,r as l,j as e,B as p,E as g,_ as f}from"./index-Dkkxw5Oy.js";import{B as h}from"./badge-BbN-q0Cc.js";import{F as y}from"./FilterPills-D_6kvZo5.js";/**
1
+ import{c,r as l,j as e,B as p,E as g,_ as f}from"./index-Cu37wtgU.js";import{B as h}from"./badge-izTmQYbF.js";import{F as y}from"./FilterPills-DfrtQ2BX.js";/**
2
2
  * @license lucide-react v0.460.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -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-Dkkxw5Oy.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-o5t5Kpfc.css">
8
+ <script type="module" crossorigin src="/assets/index-Cu37wtgU.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-C39_SyD0.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zdashboard",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "description": "ZCode skill dashboard platform — pluggable viewers for zdesign/zview/zreview/zgoal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  "preview": "vite preview"
22
22
  },
23
23
  "dependencies": {
24
+ "@fontsource/vt323": "^5.3.0",
24
25
  "@radix-ui/react-dropdown-menu": "^2.1.24",
25
26
  "@radix-ui/react-scroll-area": "^1.2.0",
26
27
  "@radix-ui/react-separator": "^1.1.0",
@@ -39,6 +40,7 @@
39
40
  "ky": "^1.7.0",
40
41
  "lodash-es": "^4.17.21",
41
42
  "lucide-react": "^0.460.0",
43
+ "pixelarticons": "^2.4.1",
42
44
  "react": "^18.3.1",
43
45
  "react-dom": "^18.3.1",
44
46
  "react-error-boundary": "^5.0.0",