zdashboard 2.5.1 → 2.6.2

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 (38) hide show
  1. package/dist/cli.js +160 -23
  2. package/dist/cli.js.map +1 -1
  3. package/dist/web/assets/FileIcon-Bc03q6Gz.js +279 -0
  4. package/dist/web/assets/FilterPills-CSZQenbh.js +1 -0
  5. package/dist/web/assets/ProgressBar-ycyJBwG-.js +1 -0
  6. package/dist/web/assets/Workspace-jCfxaTOM.js +1 -0
  7. package/dist/web/assets/badge-DUO7nDks.js +1 -0
  8. package/dist/web/assets/index-4aiRmNbP.css +1 -0
  9. package/dist/web/assets/{index-DKB8z9I8.js → index-BrvOKJRF.js} +1 -1
  10. package/dist/web/assets/index-Co_rMXPa.js +7816 -0
  11. package/dist/web/assets/web-BKh2HY35.js +2 -0
  12. package/dist/web/assets/web-BNjs9lCy.js +139 -0
  13. package/dist/web/assets/web-BrsVNrGk.js +1 -0
  14. package/dist/web/assets/web-Bt0s1qFE.js +5 -0
  15. package/dist/web/assets/web-CCoznDNk.js +2 -0
  16. package/dist/web/assets/web-DxK2pSVl.js +1 -0
  17. package/dist/web/assets/web-ShIDOvFD.js +1 -0
  18. package/dist/web/index.html +2 -2
  19. package/package.json +2 -1
  20. package/dist/web/assets/FileIcon-CWL_Aew0.js +0 -110
  21. package/dist/web/assets/FilterPills-DfrtQ2BX.js +0 -1
  22. package/dist/web/assets/MdViewer-DoCxNu7A.js +0 -270
  23. package/dist/web/assets/ProgressBar-CIDdp-03.js +0 -1
  24. package/dist/web/assets/Workspace-CsW6-X9a.js +0 -16
  25. package/dist/web/assets/badge-izTmQYbF.js +0 -1
  26. package/dist/web/assets/book-open-CCPWUzhH.js +0 -6
  27. package/dist/web/assets/file-text-DHJKu2eF.js +0 -6
  28. package/dist/web/assets/index-C39_SyD0.css +0 -1
  29. package/dist/web/assets/index-Cu37wtgU.js +0 -161
  30. package/dist/web/assets/vt323-latin-400-normal-Dqn9ZSPj.woff +0 -0
  31. package/dist/web/assets/web-9Iy8fpbv.js +0 -7
  32. package/dist/web/assets/web-C4KehBpT.js +0 -26
  33. package/dist/web/assets/web-CSsoKnCH.js +0 -2
  34. package/dist/web/assets/web-CnZCJ59N.js +0 -25
  35. package/dist/web/assets/web-DjRxK_Na.js +0 -16
  36. package/dist/web/assets/web-DuuJgOy2.js +0 -21
  37. package/dist/web/assets/web-DxAXHOpi.js +0 -16
  38. /package/dist/web/assets/{MdViewer-BTcE7LSd.css → FileIcon-BTcE7LSd.css} +0 -0
@@ -0,0 +1 @@
1
+ import{u as k,j as t,r as c,E as B,_ as z}from"./index-Co_rMXPa.js";import{C as q,M as J,I as K,F as Q}from"./FileIcon-Bc03q6Gz.js";import"./index-BrvOKJRF.js";function T({path:e}){const{icon:s}=k();return t.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:t.jsxs("div",{children:[s("file-question","h-10 w-10 mx-auto mb-3 opacity-50"),t.jsx("p",{children:"该格式无法预览"}),t.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:e})]})})}let G=null;const $=new Set,y={get:()=>G,set:e=>{G=e,$.forEach(s=>s(e))},subscribe:e=>($.add(e),()=>{$.delete(e)})};function X({containerRef:e}){const{icon:s}=k(),[r,f]=c.useState([]),[h,o]=c.useState(null);c.useEffect(()=>{const i=e.current;if(!i)return;let u=!1;const a=()=>{if(u)return;const l=i.querySelectorAll("h1[id], h2[id], h3[id]"),x=[];l.forEach(b=>{var g;x.push({id:b.id,text:((g=b.textContent)==null?void 0:g.trim())??"",level:parseInt(b.tagName[1],10)})}),f(x)};a();const n=new MutationObserver(a);return n.observe(i,{childList:!0,subtree:!0,characterData:!0}),()=>{u=!0,n.disconnect()}},[e]),c.useEffect(()=>{const i=e.current;if(!i||!r.length)return;const u=new IntersectionObserver(a=>{const n=a.filter(l=>l.isIntersecting);if(n.length){const l=n.reduce((x,b)=>x.boundingClientRect.top<b.boundingClientRect.top?x:b);o(l.target.id)}},{root:i,rootMargin:"-60px 0px -70% 0px",threshold:0});return r.forEach(({id:a})=>{const n=i.querySelector(`#${CSS.escape(a)}`);n&&u.observe(n)}),()=>u.disconnect()},[r,e]);const d=i=>{var a;const u=(a=e.current)==null?void 0:a.querySelector(`#${CSS.escape(i)}`);u==null||u.scrollIntoView({behavior:"smooth",block:"start"})};return r.length?t.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[t.jsxs("div",{className:"flex items-center gap-1 mb-2 text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[s("file-text","h-3 w-3"),t.jsx("span",{children:"大纲"})]}),t.jsx("ul",{className:"space-y-0.5",children:r.map(i=>t.jsx("li",{children:t.jsx("button",{type:"button",onClick:()=>d(i.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===i.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(i.level-1)*10},children:i.text||i.id})},i.id))})]}):null}const Y=2500;function Z(e){const s=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(s==="justfile"||s==="makefile")return q;const r=e.slice(e.lastIndexOf(".")).toLowerCase();return r===".md"||r===".markdown"?J:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(r)?K:[".sql",".txt",".csv",".tsv",".json",".yaml",".yml",".xml",".py",".js",".ts",".java",".go",".rs",".rb",".php",".c",".cpp",".h",".cs",".swift",".kt",".scala",".sh",".bash",".zsh",".fish",".env",".gitignore",".dockerfile"].includes(r)?q:T}function ee(e){const{icon:s}=k(),[r,f]=c.useState(()=>y.get()),[h,o]=c.useState(!1),d=c.useRef(null),i=r?Z(r):null;return c.useEffect(()=>y.subscribe(f),[]),c.useEffect(()=>{const u=d.current;if(!u)return;const a=()=>{var x;const l=((x=u.textContent)==null?void 0:x.length)??0;o(l>Y)};a();const n=new MutationObserver(a);return n.observe(u,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()},[r]),t.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:r&&i?t.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[t.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto",children:t.jsx(i,{path:r})}),h&&t.jsx(X,{containerRef:d})]}):t.jsx(B,{icon:s("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式",tone:"primary"})})}const te=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"}));function re(e,s,r,f){var h=this,o=c.useRef(null),d=c.useRef(0),i=c.useRef(0),u=c.useRef(null),a=c.useRef([]),n=c.useRef(),l=c.useRef(),x=c.useRef(e),b=c.useRef(!0),g=c.useRef(),O=c.useRef();x.current=e;var L=typeof window<"u",N=!s&&s!==0&&L;if(typeof e!="function")throw new TypeError("Expected a function");s=+s||0;var R=!!(r=r||{}).leading,I=!("trailing"in r)||!!r.trailing,S=!!r.flushOnExit&&I,w="maxWait"in r,W="debounceOnServer"in r&&!!r.debounceOnServer,D=w?Math.max(+r.maxWait||0,s):null,A=c.useMemo(function(){var v=function(m){var p=a.current,j=n.current;return a.current=n.current=null,d.current=m,i.current=i.current||m,l.current=x.current.apply(j,p)},E=function(m,p){N&&cancelAnimationFrame(u.current),u.current=N?requestAnimationFrame(m):setTimeout(m,p)},F=function(m){if(!b.current)return!1;var p=m-o.current;return!o.current||p>=s||p<0||w&&m-d.current>=D},P=function(m){return u.current=null,I&&a.current?v(m):(a.current=n.current=null,l.current)},M=function m(){var p=Date.now();if(R&&i.current===d.current&&U(),F(p))return P(p);if(b.current){var j=s-(p-o.current),C=w?Math.min(j,D-(p-d.current)):j;E(m,C)}},U=function(){f&&f({})},_=function(){if(L||W){var m,p=Date.now(),j=F(p);if(a.current=[].slice.call(arguments),n.current=h,o.current=p,S&&!g.current&&(g.current=function(){var C;((C=globalThis.document)==null?void 0:C.visibilityState)==="hidden"&&O.current.flush()},(m=globalThis.document)==null||m.addEventListener==null||m.addEventListener("visibilitychange",g.current)),j){if(!u.current&&b.current)return d.current=o.current,E(M,s),R?v(o.current):l.current;if(w)return E(M,s),v(o.current)}return u.current||E(M,s),l.current}};return _.cancel=function(){var m=u.current;m&&(N?cancelAnimationFrame(u.current):clearTimeout(u.current)),d.current=0,a.current=o.current=n.current=u.current=null,m&&f&&f({})},_.isPending=function(){return!!u.current},_.flush=function(){return u.current?P(Date.now()):l.current},_},[R,w,s,D,I,S,N,L,W,f]);return O.current=A,c.useEffect(function(){return b.current=!0,function(){var v;S&&O.current.flush(),g.current&&((v=globalThis.document)==null||v.removeEventListener==null||v.removeEventListener("visibilitychange",g.current),g.current=null),b.current=!1}},[S]),A}function ne(e,s){return e===s}function se(e,s,r){var f=ne,h=c.useRef(e),o=c.useState({})[1],d=re(c.useCallback(function(u){h.current=u,o({})},[o]),s,r,o),i=c.useRef(e);return f(i.current,e)||(d(e),i.current=e),[h.current,d]}function V(e,s){return!s||e.name.toLowerCase().includes(s)?!0:(e.children??[]).some(r=>V(r,s))}function H({node:e,depth:s,filter:r,current:f,onSelectFile:h}){const o=(e.children??[]).filter(n=>V(n,r)),[d,i]=c.useState(!e.defaultCollapsed),u=r?!0:d;if(!o.length&&r)return null;const{icon:a}=k();return t.jsxs("div",{children:[(()=>{const n=e.name.match(/^([a-z]+)(?: \((\d+)\))?$/),l=n?a(n[1]):void 0;return t.jsxs("button",{onClick:()=>i(x=>!x),className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+s*14,width:"calc(100% - 8px)"},children:[t.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${u?"rotate-90":""}`,children:a("chevron-right")}),l?t.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:l}):t.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:a(u?"folder-open":"folder")}),t.jsx("span",{className:"font-medium truncate",children:n?n[1]:e.name}),(n==null?void 0:n[2])&&t.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-xs font-mono text-muted-foreground",children:n[2]})]})})(),u&&o.map(n=>n.kind==="dir"?t.jsx(H,{node:n,depth:s+1,filter:r,current:f,onSelectFile:h},n.name+s):t.jsxs("button",{onClick:()=>n.path&&h(n.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${f===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+s*14,width:"calc(100% - 8px)"},children:[t.jsx(Q,{name:n.name,active:f===n.path}),t.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function ce({worktrees:e}){const[s,r]=c.useState(!0),{icon:f}=k(),h=o=>{window.dispatchEvent(new CustomEvent("zd-dashboard-nav",{detail:{mode:"apply",wt:o.name}}))};return t.jsxs("div",{className:"mb-1",children:[t.jsxs("button",{onClick:()=>r(o=>!o),className:"w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-muted-foreground tracking-wide hover:text-foreground",children:[t.jsx("span",{className:`h-3 w-3 inline-flex items-center justify-center transition-transform ${s?"rotate-90":""}`,children:f("chevron-right")}),t.jsx("span",{className:"h-3 w-3 inline-flex items-center justify-center",children:f("git-branch")}),t.jsxs("span",{children:["Worktrees (",e.length,")"]})]}),s&&e.map(o=>t.jsxs("button",{onClick:()=>h(o),title:`${o.branch}${o.dirty?" · 有未提交变更":""}`,className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted border-l-2 border-transparent",style:{paddingLeft:14},children:[t.jsx("span",{className:"truncate font-mono text-sm",children:o.branch}),t.jsxs("span",{className:"text-muted-foreground truncate",children:["/",o.name]}),o.dirty&&t.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]},o.name))]})}function oe({navTarget:e}){const s=c.useSyncExternalStore(y.subscribe,y.get),[r,f]=c.useState(null),[h,o]=c.useState(""),[d]=se(h,150),[i,u]=c.useState([]);c.useEffect(()=>{e!=null&&e.filter&&o(e.filter)},[e==null?void 0:e.filter,e==null?void 0:e.navToken]),c.useEffect(()=>{fetch("/__files",{cache:"no-store"}).then(l=>l.json()).then(l=>f(l.tree??[]))},[]),c.useEffect(()=>{fetch("/__worktrees",{cache:"no-store"}).then(l=>l.json()).then(u).catch(()=>u([]))},[]);const a=c.useMemo(()=>r?r.filter(l=>V(l,d)):[],[r,d]),n=i.length>0;return t.jsxs("div",{className:"p-2",children:[t.jsx("input",{value:h,onChange:l=>o(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"}),r?!a.length&&!n?t.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"无匹配"}):t.jsxs("div",{className:"py-1",children:[n&&t.jsx(ce,{worktrees:i}),a.map(l=>t.jsx(H,{node:l,depth:0,filter:d,current:s,onSelectFile:x=>y.set(x)},l.name))]}):t.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"加载中…"})]})}const ue=Object.freeze(Object.defineProperty({__proto__:null,default:oe},Symbol.toStringTag,{value:"Module"})),de={mode:"view",label:"项目浏览",icon:"👁️",description:"openspec / docs / 文档预览",Sidebar:c.lazy(()=>z(()=>Promise.resolve().then(()=>ue),void 0)),Workspace:c.lazy(()=>z(()=>Promise.resolve().then(()=>te),void 0))};export{oe as ViewSidebar,ee as ViewWorkspace,de as default};
@@ -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-Cu37wtgU.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-C39_SyD0.css">
8
+ <script type="module" crossorigin src="/assets/index-Co_rMXPa.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-4aiRmNbP.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.5.1",
3
+ "version": "2.6.2",
4
4
  "description": "ZCode skill dashboard platform — pluggable viewers for zdesign/zview/zreview/zgoal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@fontsource/vt323": "^5.3.0",
25
+ "@phosphor-icons/react": "^2.1.10",
25
26
  "@radix-ui/react-dropdown-menu": "^2.1.24",
26
27
  "@radix-ui/react-scroll-area": "^1.2.0",
27
28
  "@radix-ui/react-separator": "^1.1.0",