zdashboard 2.8.5 → 2.8.6
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 +468 -15
- package/dist/cli.js.map +1 -1
- package/dist/web/assets/CodeViewer-_jAxbWVL.js +10 -0
- package/dist/web/assets/{FileIcon-FyROY2Qe.js → FileIcon-68etP2t6.js} +1 -1
- package/dist/web/assets/{FilterPills-DwCH0Z96.js → FilterPills-DGfzMpn_.js} +1 -1
- package/dist/web/assets/ImageViewer-ChZdzYPf.js +298 -0
- package/dist/web/assets/{Sidebar-Cz3W5MP6.js → Sidebar-D83uLTNy.js} +1 -1
- package/dist/web/assets/{Sidebar-BUi2jDuu.js → Sidebar-N0HiMJRK.js} +1 -1
- package/dist/web/assets/Workspace-BE7p2hNz.js +1 -0
- package/dist/web/assets/{Workspace-ICT0FTaI.js → Workspace-BpSq60xh.js} +1 -1
- package/dist/web/assets/{Workspace-Db4r4oQO.js → Workspace-DW8xX3Tg.js} +1 -1
- package/dist/web/assets/Workspace-DjL1fdji.js +2 -0
- package/dist/web/assets/Workspace-DrN9--Je.js +1 -0
- package/dist/web/assets/{index--t_ijYil.css → index-DH1Mqw-g.css} +1 -1
- package/dist/web/assets/{index-BAFFLjYP.js → index-D_uh-zkI.js} +12 -12
- package/dist/web/assets/{usePluginData-DEpAv1Yl.js → usePluginData-Bk2M7LNj.js} +1 -1
- package/dist/web/assets/web-BZukfmmT.js +2 -0
- package/dist/web/assets/{web-D0z_1kb8.js → web-CEB9kTEr.js} +2 -2
- package/dist/web/assets/web-CGvrDSNo.js +2 -0
- package/dist/web/assets/web-CLKkH6eO.js +2 -0
- package/dist/web/assets/{web-S85uEYzf.js → web-CbW9uGDV.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/CodeViewer-BrquqtDE.js +0 -307
- package/dist/web/assets/Workspace-CafALYiK.js +0 -1
- package/dist/web/assets/Workspace-D-n83gau.js +0 -1
- package/dist/web/assets/web-BP-QGcd3.js +0 -2
- package/dist/web/assets/web-CE86ahqk.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as u,u as j,a as _,b as I,P as R,E as F}from"./index-BAFFLjYP.js";import{F as S}from"./FilterPills-DwCH0Z96.js";import{C as U,M as L,I as E}from"./CodeViewer-BrquqtDE.js";import{m as v}from"./web-BP-QGcd3.js";import"./client-Cw4K1Nx3.js";function $({path:t}){return e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"预览",className:"w-full h-full border-0 bg-white"})}const k=/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i,y=/font|family|type/i;function A({path:t}){const[m,d]=u.useState([]),[i,a]=u.useState(!0);return u.useEffect(()=>{let s=!1;return a(!0),d([]),fetch("/__design/asset?path="+encodeURIComponent(t),{cache:"no-store"}).then(o=>o.text()).then(o=>{if(s)return;const c=o.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){d([]),a(!1);return}const r=l=>{const N=l.indexOf(":"),V=l.slice(0,N).trim(),C=l.slice(N+1).trim();return{name:V,value:C}},n=l=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(l),p=l=>y.test(l),x=c.map(r),f=x.filter(l=>n(l.value)),g=x.filter(l=>!n(l.value)&&p(l.name)),b=x.filter(l=>!n(l.value)&&!p(l.name)),h=[];f.length&&h.push({label:`配色 · ${f.length}`,items:f}),g.length&&h.push({label:`字体 · ${g.length}`,items:g}),b.length&&h.push({label:`其他 · ${b.length}`,items:b}),d(h),a(!1)}).catch(()=>{s||(d([]),a(!1))}),()=>{s=!0}},[t]),i?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):m.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:m.map(s=>{const o=s.items.some(r=>k.test(r.value)),c=s.items.some(r=>y.test(r.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-sm font-semibold uppercase text-muted-foreground",children:s.label}),o?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.filter(r=>k.test(r.value)).map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[var(--design-preview-h)] border-b",style:{background:n}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-sm break-all",children:r}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:n})]},r))}):c?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"grid h-[var(--design-preview-h)] place-items-center text-2xl",style:{fontFamily:n},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-sm",children:r})]},r))}):e.jsx("div",{className:"flex flex-col gap-1",children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"flex justify-between gap-3 px-2.5 py-1.5 rounded border bg-background text-xs",children:[e.jsx("span",{className:"font-mono",children:r}),e.jsx("span",{className:"text-muted-foreground",children:n})]},r))})]},s.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}const w=t=>"/__design/asset?path="+encodeURIComponent(t);function O({path:t}){return e.jsx(L,{path:t,resolve:w})}function M({path:t}){return e.jsx(E,{path:t,resolve:w})}function P({path:t}){return e.jsx(U,{path:t,resolve:w})}function W({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("video",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"max-w-full max-h-[80vh] rounded border"})})}function z({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("audio",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"w-full max-w-2xl"})})}function T({path:t}){return e.jsx("div",{className:"grid place-items-center p-8 h-full",children:e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"PDF",className:"w-full h-full max-h-[80vh] rounded border bg-white"})})}function D({path:t}){const[m,d]=u.useState("");return u.useEffect(()=>{let i=!1,a="",s=null;return fetch("/__design/asset?path="+encodeURIComponent(t)).then(o=>o.blob()).then(async o=>{var c;if(!i){if(a=URL.createObjectURL(o),s=new FontFace("zd-font-preview",`url(${a})`),await s.load(),i){(c=s.dispose)==null||c.call(s);return}document.fonts.add(s),d(t.split("/").pop()??t)}}).catch(()=>{i||d(t.split("/").pop()??t)}),()=>{var o;if(i=!0,s)try{document.fonts.delete(s),(o=s.dispose)==null||o.call(s)}catch{}a&&URL.revokeObjectURL(a)}},[t]),e.jsxs("div",{className:"h-full overflow-auto p-8 grid gap-6 place-content-center text-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:t}),e.jsx("div",{className:"text-5xl",style:{fontFamily:m?"'zd-font-preview', serif":"serif"},children:"Aa 字体预览 0123"})]})}function H({path:t}){const{icon:m}=j();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[m("image-off","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:t})]})})}const K={page:$,icon:M,token:A,md:O,video:W,audio:z,pdf:T,component:P,font:D};function Z(t){return K[t]??H}function q({mode:t,onMode:m,w:d,h:i,onW:a,onH:s}){const{icon:o}=j(),c=[{v:0,icon:o("monitor","h-3.5 w-3.5"),label:"桌面"},{v:768,icon:o("tablet","h-3.5 w-3.5"),label:"768"},{v:375,icon:o("smartphone","h-3.5 w-3.5"),label:"375"},{v:"custom",icon:o("sliders-horizontal","h-3.5 w-3.5"),label:"自定义"}],r="w-[var(--design-input-w)] h-7 px-1 text-center text-xs rounded border border-border bg-background text-foreground [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none focus:outline-none focus:border-primary";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5 bg-muted",children:e.jsx(S,{items:c.map(n=>({key:String(n.v),label:n.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[n.icon,e.jsx("span",{className:"hidden sm:inline",children:n.label})]})})),value:String(t),onChange:n=>m(n==="0"?0:n==="custom"?"custom":Number(n)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:d,min:280,max:3e3,step:8,onChange:n=>a(Number(n.target.value)),"aria-label":"自定义宽度",className:r}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:i,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:r}),e.jsx("span",{className:"text-sm text-muted-foreground/70",children:"px"})]})]})}function Y({params:t}){const{icon:m}=j(),d=_(v.mode,"h-5 w-5");I();const i=t.get("type")??"",a=t.get("asset"),[s,o]=u.useState(0),[c,r]=u.useState(1024),[n,p]=u.useState(768),x=a?Z(i):null,f=s===0?"桌面":s==="custom"?`${c} × ${n}`:`${s}px`;return e.jsx(R,{manifest:v,icon:d,breadcrumb:["插件",v.mode,...i?[i]:[],...a?[a]:[]],children:e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:a&&x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[var(--design-toolbar-h)] flex-none flex items-center justify-between px-3.5 border-b bg-background text-xs",children:[e.jsx("span",{className:"font-mono truncate",children:a}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:f}),e.jsx(q,{mode:s,onMode:o,w:c,h:n,onW:r,onH:p})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:i==="page"?e.jsx("div",{className:"mx-auto bg-background overflow-hidden",style:{maxWidth:s===0?void 0:s==="custom"?c:s,height:s==="custom"?n:"100%"},children:e.jsx(x,{path:a})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(x,{path:a})})})]}):e.jsx(F,{icon:m("palette","h-6 w-6"),title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新"})})})}export{Y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as g,j as e,r as f,a as w,P as j,E as y}from"./index-BAFFLjYP.js";import{C as p,M as I,I as k}from"./CodeViewer-BrquqtDE.js";import{m as b}from"./web-CE86ahqk.js";import"./client-Cw4K1Nx3.js";function N({path:s}){const{icon:o}=g();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[o("file-question","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:s})]})})}function S({containerRef:s}){const{icon:o}=g(),[r,n]=f.useState([]),[h,x]=f.useState(null);f.useEffect(()=>{const t=s.current;if(!t)return;let i=!1;const l=()=>{if(i)return;const d=t.querySelectorAll("h1[id], h2[id], h3[id]"),u=[];d.forEach(a=>{var v;u.push({id:a.id,text:((v=a.textContent)==null?void 0:v.trim())??"",level:parseInt(a.tagName[1],10)})}),n(u)};l();const c=new MutationObserver(l);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{i=!0,c.disconnect()}},[s]),f.useEffect(()=>{const t=s.current;if(!t||!r.length)return;const i=new IntersectionObserver(l=>{const c=l.filter(d=>d.isIntersecting);if(c.length){const d=c.reduce((u,a)=>u.boundingClientRect.top<a.boundingClientRect.top?u:a);x(d.target.id)}},{root:t,rootMargin:"-60px 0px -70% 0px",threshold:0});return r.forEach(({id:l})=>{const c=t.querySelector(`#${CSS.escape(l)}`);c&&i.observe(c)}),()=>i.disconnect()},[r,s]);const m=t=>{var l;const i=(l=s.current)==null?void 0:l.querySelector(`#${CSS.escape(t)}`);i==null||i.scrollIntoView({behavior:"smooth",block:"start"})};return r.length?e.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[o("file-text","h-3 w-3"),e.jsx("span",{children:"大纲"})]}),e.jsx("ul",{className:"space-y-0.5",children:r.map(t=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>m(t.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===t.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(t.level-1)*10},children:t.text||t.id})},t.id))})]}):null}function C(s){const o=s.slice(s.lastIndexOf("/")+1).toLowerCase();if(o==="justfile"||o==="makefile")return p;const r=o.lastIndexOf("."),n=r>=0?o.slice(r):"";return n===".md"||n===".markdown"?I:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(n)?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(n)?p:r===-1?p:N}function O({params:s}){const{icon:o}=g(),r=w(b.mode,"h-5 w-5"),n=s.get("file"),h=s.get("wt"),x=f.useRef(null),m=n?C(n):null;return e.jsx(j,{manifest:b,icon:r,breadcrumb:["插件",h??"当前分支",...n?[n]:[]],children:e.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:n&&m?e.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[e.jsx("div",{ref:x,className:"flex-1 min-h-0 overflow-auto",children:e.jsx(m,{path:n})}),e.jsx(S,{containerRef:x})]}):e.jsx(y,{icon:o("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式"})})})}export{O as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Workspace-CafALYiK.js","assets/index-BAFFLjYP.js","assets/index--t_ijYil.css","assets/FilterPills-DwCH0Z96.js","assets/CodeViewer-BrquqtDE.js","assets/CodeViewer-BTcE7LSd.css","assets/client-Cw4K1Nx3.js","assets/Sidebar-Cz3W5MP6.js","assets/FileIcon-FyROY2Qe.js","assets/usePluginData-DEpAv1Yl.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,_ as o}from"./index-BAFFLjYP.js";import{d as t}from"./client-Cw4K1Nx3.js";const r={mode:"design",label:"设计资产",icon:"🎨",description:"设计资产分类浏览 · zdesign",order:30},i=[{name:"type",label:"资产类型",type:"string",description:"page/component/icon/token/md/video/audio/pdf/font"},{name:"asset",label:"选中资产",type:"string",description:"资产相对路径"},{name:"folder",label:"当前文件夹",type:"string",description:"限定展示的资产路径前缀"}],n=t({manifest:r,params:i,workspace:e.lazy(()=>o(()=>import("./Workspace-CafALYiK.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),sidebar:e.lazy(()=>o(()=>import("./Sidebar-Cz3W5MP6.js"),__vite__mapDeps([7,1,2,8,9])))}),d=Object.freeze(Object.defineProperty({__proto__:null,default:n},Symbol.toStringTag,{value:"Module"}));export{r as m,d as w};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Workspace-D-n83gau.js","assets/index-BAFFLjYP.js","assets/index--t_ijYil.css","assets/CodeViewer-BrquqtDE.js","assets/CodeViewer-BTcE7LSd.css","assets/client-Cw4K1Nx3.js","assets/Sidebar-BUi2jDuu.js","assets/FileIcon-FyROY2Qe.js","assets/usePluginData-DEpAv1Yl.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,_ as t}from"./index-BAFFLjYP.js";import{d as r}from"./client-Cw4K1Nx3.js";const o={mode:"view",label:"项目浏览",icon:"👁️",description:"openspec / docs / 文档预览",order:20},i=[{name:"wt",label:"Worktree 路径",type:"string",description:"worktree 绝对路径"},{name:"file",label:"文件路径",type:"string",description:"预览文件相对路径"},{name:"filter",label:"过滤词",type:"string",description:"文件树过滤词"}],a=r({manifest:o,params:i,workspace:e.lazy(()=>t(()=>import("./Workspace-D-n83gau.js"),__vite__mapDeps([0,1,2,3,4,5]))),sidebar:e.lazy(()=>t(()=>import("./Sidebar-BUi2jDuu.js"),__vite__mapDeps([6,1,2,7,8])))}),l=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"}));export{o as m,l as w};
|