zdashboard 2.8.6 → 2.9.0
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 +15 -468
- package/dist/cli.js.map +1 -1
- package/dist/web/assets/CodeViewer-yUtAi1hT.js +307 -0
- package/dist/web/assets/{FileIcon-68etP2t6.js → FileIcon-DCL9OD6I.js} +1 -1
- package/dist/web/assets/{FilterPills-DGfzMpn_.js → FilterPills-BD2vsIx2.js} +1 -1
- package/dist/web/assets/{Sidebar-N0HiMJRK.js → Sidebar-CsmNxVjL.js} +1 -1
- package/dist/web/assets/{Sidebar-D83uLTNy.js → Sidebar-DxeR1Shk.js} +1 -1
- package/dist/web/assets/{Workspace-BpSq60xh.js → Workspace-BGj3n613.js} +1 -1
- package/dist/web/assets/Workspace-CUepnOlM.js +1 -0
- package/dist/web/assets/Workspace-D0rSzljF.js +1 -0
- package/dist/web/assets/{Workspace-DW8xX3Tg.js → Workspace-DUK4Lm-v.js} +1 -1
- package/dist/web/assets/{index-DH1Mqw-g.css → index--t_ijYil.css} +1 -1
- package/dist/web/assets/{index-D_uh-zkI.js → index-veTBv7Qv.js} +12 -12
- package/dist/web/assets/{usePluginData-Bk2M7LNj.js → usePluginData-mjHueOjf.js} +1 -1
- package/dist/web/assets/web-BODcUPmi.js +2 -0
- package/dist/web/assets/web-CsCyTuDw.js +2 -0
- package/dist/web/assets/{web-CEB9kTEr.js → web-D6VGQFbH.js} +2 -2
- package/dist/web/assets/{web-CbW9uGDV.js → web-DIZjnUb4.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/CodeViewer-_jAxbWVL.js +0 -10
- package/dist/web/assets/ImageViewer-ChZdzYPf.js +0 -298
- package/dist/web/assets/Workspace-BE7p2hNz.js +0 -1
- package/dist/web/assets/Workspace-DjL1fdji.js +0 -2
- package/dist/web/assets/Workspace-DrN9--Je.js +0 -1
- package/dist/web/assets/web-BZukfmmT.js +0 -2
- package/dist/web/assets/web-CGvrDSNo.js +0 -2
- package/dist/web/assets/web-CLKkH6eO.js +0 -2
|
@@ -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-D_uh-zkI.js";import{M as I,I as k}from"./ImageViewer-ChZdzYPf.js";import{C as p}from"./CodeViewer-_jAxbWVL.js";import{m as b}from"./web-CLKkH6eO.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(),[n,r]=f.useState([]),[h,m]=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)})}),r(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||!n.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);m(d.target.id)}},{root:t,rootMargin:"-60px 0px -70% 0px",threshold:0});return n.forEach(({id:l})=>{const c=t.querySelector(`#${CSS.escape(l)}`);c&&i.observe(c)}),()=>i.disconnect()},[n,s]);const x=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 n.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:n.map(t=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>x(t.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===t.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(t.level-1)*10},children:t.text||t.id})},t.id))})]}):null}function C(s){const o=s.slice(s.lastIndexOf("/")+1).toLowerCase();if(o==="justfile"||o==="makefile")return p;const n=o.lastIndexOf("."),r=n>=0?o.slice(n):"";return r===".md"||r===".markdown"?I:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(r)?k:[".sql",".txt",".csv",".tsv",".json",".yaml",".yml",".xml",".py",".js",".ts",".java",".go",".rs",".rb",".php",".c",".cpp",".h",".cs",".swift",".kt",".scala",".sh",".bash",".zsh",".fish",".env",".gitignore",".dockerfile"].includes(r)?p:n===-1?p:N}function A({params:s}){const{icon:o}=g(),n=w(b.mode,"h-5 w-5"),r=s.get("file"),h=s.get("wt"),m=f.useRef(null),x=r?C(r):null;return e.jsx(j,{manifest:b,icon:n,breadcrumb:["插件",h??"当前分支",...r?[r]:[]],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:r&&x?e.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[e.jsx("div",{ref:m,className:"flex-1 min-h-0 overflow-auto",children:e.jsx(x,{path:r})}),e.jsx(S,{containerRef:m})]}):e.jsx(y,{icon:o("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式"})})})}export{A as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as p,j as e,d as E,E as j,u as H,a as B,b as U,P as D}from"./index-D_uh-zkI.js";import{F as P}from"./FilterPills-DGfzMpn_.js";import{m as w}from"./web-CGvrDSNo.js";import{C as K}from"./CodeViewer-_jAxbWVL.js";import{u as z}from"./usePluginData-Bk2M7LNj.js";import"./client-Cw4K1Nx3.js";const W="https://cdn.jsdelivr.net/npm/simple-icons@13/icons",Y="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css",J="https://cdn.jsdelivr.net/npm/hover.css@2.3.1/css/hover.css",M=[{key:"logos",label:"Logo"},{key:"motions",label:"动效"},{key:"inspirations",label:"灵感"}];function y(t){return`/__market/proxy?url=${encodeURIComponent(t)}`}function S(t){return`${W}/${t}.svg`}const C={logos:"Logo",motions:"动效",inspirations:"灵感"},V=5,_="zdashboard.market.promptHistory";function G(t){var n;return`为 ${((n=t.subject)==null?void 0:n.trim())||t.name} 设计一个 Logo:单色几何风格、极简、24×24 网格、适配 favicon 与暗色模式;参考 ${t.name} 的造型语言(仅风格参考,不得复制商标)`}function Q(t){return`实现一个 ${t.name} 动效:${t.desc};参考实现:${t.css};要求可自定义时长/缓动,尊重 prefers-reduced-motion`}function X(t){const s=t.tags.filter(Boolean).join(";"),n=t.extra.trim()||"无特殊要求",c=s?`:特征 ${s}`:"";return`设计一个类似 ${t.name}(${t.url})的页面${c};要求 ${n}`}function O(t){if(!t)return[];try{const s=JSON.parse(t);return Array.isArray(s)?s.filter(n=>!!n&&typeof n=="object"):[]}catch{return[]}}function Z(t=localStorage){return O(t.getItem(_))}function q(t,s=localStorage){const n=[{market:t.market,text:t.text,at:Date.now()},...O(s.getItem(_))].slice(0,V);return s.setItem(_,JSON.stringify(n)),n}function L(t){const{data:s,error:n,loading:c}=z(`/__market/catalog/${t}`,async()=>{const r=await fetch(`/__market/catalog/${t}`,{cache:"no-store"});if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()});return{entries:(s==null?void 0:s.entries)??[],loading:c,error:n}}function $({market:t,initial:s}){const[n,c]=p.useState(s),[r,d]=p.useState([]),l=p.useRef(null);p.useEffect(()=>{c(s)},[s]),p.useEffect(()=>{d(Z())},[]);const x=async()=>{var o,f;try{await navigator.clipboard.writeText(n),E.success("已复制到剪贴板"),d(q({market:t,text:n}))}catch{(o=l.current)==null||o.focus(),(f=l.current)==null||f.select(),E.error("复制失败,已选中文本,请按 Ctrl/Cmd+C 手动复制")}};return e.jsxs("section",{"aria-label":"转提示词",className:"border-t border-border px-4 py-3 flex flex-col gap-2 text-xs","data-slot":"prompt-panel",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-foreground",children:["转提示词 · ",C[t]]}),e.jsx("button",{type:"button","aria-label":"复制提示词",onClick:x,className:"ml-auto px-2.5 h-6 rounded-[var(--radius-md)] border border-border bg-background hover:bg-muted transition-colors",children:"复制"})]}),e.jsx("textarea",{ref:l,"aria-label":"提示词",value:n,onChange:o=>c(o.target.value),rows:4,className:"w-full resize-y rounded-[var(--radius-md)] border border-border bg-background px-2.5 py-2 text-xs leading-relaxed focus:outline-none focus:border-primary"}),r.length>0&&e.jsxs("div",{"data-slot":"prompt-history",className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"最近提示词(可回看复用)"}),e.jsx("ul",{className:"flex flex-col gap-1 max-h-28 overflow-auto",children:r.map((o,f)=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>c(o.text),className:"w-full text-left px-2 py-1 rounded-[var(--radius-sm)] hover:bg-muted transition-colors flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"flex-none px-1.5 py-0.5 rounded-[var(--radius-full)] bg-muted text-muted-foreground",children:C[o.market]??o.market}),e.jsx("span",{className:"truncate text-muted-foreground",children:o.text})]})},`${o.at}-${f}`))})]})]})}const ee=["单色","几何造型","24×24 viewBox"];function te({entry:t,onSelect:s,q:n,onSearch:c}){const{entries:r,loading:d,error:l}=L("logos"),[x,o]=p.useState(new Set),[f,i]=p.useState(!1),[g,b]=p.useState(0),h=(n??"").trim().toLowerCase(),N=h?r.filter(u=>u.name.toLowerCase().includes(h)||u.id.includes(h)):r,a=(t?N.find(u=>u.id===t)??r.find(u=>u.id===t):null)??null;p.useEffect(()=>{i(!1)},[a==null?void 0:a.id]);const m=p.useMemo(()=>a?()=>y(S(a.id)):void 0,[a]);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col","data-tab":"logos",children:[a&&e.jsxs("div",{className:"flex-none flex items-start gap-4 border-b px-4 py-3","data-slot":"logo-detail",children:[f?e.jsx("button",{type:"button",onClick:()=>{b(u=>u+1),i(!1)},"data-slot":"logo-detail-fallback",className:"h-24 w-24 grid place-items-center rounded-[var(--radius-lg)] border border-border bg-muted text-xs text-muted-foreground hover:bg-background transition-colors",children:"加载失败,点击重试"}):e.jsx("img",{src:y(S(a.id)),alt:`${a.name} logo`,"data-slot":"logo-detail-img",className:"h-24 w-24",onError:()=>i(!0)},`${a.id}-${g}`),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["类别 ",a.category," · slug ",a.id]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:ee.map(u=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-[var(--radius-full)] bg-muted text-xs text-muted-foreground",children:u},u))})]})]}),a&&m&&e.jsx("div",{className:"flex-none h-44 border-b","data-slot":"logo-source",children:e.jsx(K,{path:`${a.id}.svg`,resolve:m})}),a&&e.jsx($,{market:"logos",initial:G({name:a.name})}),e.jsx("div",{className:"flex-none px-3 pt-3",children:e.jsx("input",{type:"search","aria-label":"搜索 Logo",placeholder:"搜索品牌或 slug…",value:n??"",onChange:u=>c(u.target.value),className:"w-full max-w-xs h-8 px-2.5 rounded-[var(--radius-md)] border border-border bg-background text-xs focus:outline-none focus:border-primary"})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:l?e.jsx(j,{title:"目录加载失败",hint:l}):d?e.jsx(j,{title:"目录加载中…"}):N.length===0?e.jsx(j,{title:h?`无匹配「${n}」的 Logo`:"暂无 Logo 目录",hint:h?"试试更短的关键词":void 0}):e.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-2",children:N.map(u=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>s(u.id===t?null:u.id),"aria-pressed":u.id===t,className:"w-full h-full flex flex-col items-center gap-1.5 rounded-[var(--radius-lg)] border border-border bg-background px-2 py-3 hover:bg-muted transition-colors","data-slot":"logo-card",children:[x.has(u.id)?e.jsx("span",{className:"grid h-8 w-8 place-items-center rounded-[var(--radius-md)] bg-muted text-xs text-muted-foreground",children:u.name.slice(0,2)}):e.jsx("img",{src:y(S(u.id)),alt:`${u.name} logo`,loading:"lazy",className:"h-8 w-8",onError:()=>o(v=>new Set(v).add(u.id))}),e.jsx("span",{className:"text-xs text-foreground/90 truncate max-w-full",children:u.name})]})},u.id))})})]})}const se=/^\d*\.?\d+(ms|s)$/,ne=/^(infinite|\d+)$/;function A(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(t,s){const n=new RegExp(`[^{}]*\\.${A(s)}[^{]*\\{[^}]*\\}`,"g");let c=null,r;for(;r=n.exec(t);){const d=r[0].trim();if(!d.includes("!important"))return d;c??(c=d)}return c}function ae(t,s){const n=new RegExp(`@keyframes\\s+${A(s)}\\s*\\{`).exec(t);if(!n)return null;const c=n.index,r=t.indexOf("{",c);if(r<0)return null;let d=0;for(let l=r;l<t.length;l++)if(t[l]==="{")d++;else if(t[l]==="}"&&(d--,d===0))return t.slice(c,l+1);return null}function I(t){var c,r,d,l;const s={},n=t.match(/animation(?:-name)?:\s*([^;}]+)/);if(n&&!n[0].startsWith("animation-name")){const x=n[1].trim().split(/\s+/);s.duration=x.find(f=>se.test(f));const o=x.find(f=>ne.test(f));o&&(s.iteration=o)}s.duration||(s.duration=((c=t.match(/animation-duration:\s*([^;}]+)/))==null?void 0:c[1].trim())??((r=t.match(/transition-duration:\s*([^;}]+)/))==null?void 0:r[1].trim())),s.iteration||(s.iteration=(d=t.match(/animation-iteration-count:\s*([^;}]+)/))==null?void 0:d[1].trim()),s.easing=(l=t.match(/(?:animation-timing-function|transition-timing-function):\s*([^;}]+)/))==null?void 0:l[1].trim();for(const x of Object.keys(s))s[x]===void 0&&delete s[x];return s}function re(t,s){const n=F(t,s);if(!n)return"";const c=[n],r=n.match(/animation(?:-name)?:\s*([^;!}]+)/);if(r){const d=r[1].trim().split(/\s+/)[0],l=ae(t,d);l&&c.push(l)}return c.join(`
|
|
2
|
-
`)}function oe(t,s){return t==="animate.css"?`animate__animated ${s}`:s}function le(t,s){return t==="animate.css"?["animate__animated",s]:[s]}const ie={"animate.css":Y,"hover.css":J},ce="(离线,源码暂不可用,可稍后重试)",k=new Map;function T(t,s){const[n,c]=p.useState(()=>k.get(t)??null),[r,d]=p.useState(!1);return p.useEffect(()=>{if(!s)return;const l=k.get(t);if(l!==void 0){c(l),d(!1);return}let x=!0;return fetch(y(ie[t]),{cache:"no-store"}).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{x&&(k.set(t,o),c(o))}).catch(()=>{x&&d(!0)}),()=>{x=!1}},[t,s]),{css:n,failed:r}}function de({lib:t,css:s}){return s?e.jsx("style",{dangerouslySetInnerHTML:{__html:s},"data-market-motion-lib":t}):null}function R({m:t,playing:s,large:n}){const[c,r]=p.useState(0),d=p.useRef(null),l=le(t.lib,t.cls),x=()=>{const o=d.current;o&&(o.classList.remove(...l),o.offsetWidth,o.classList.add(...l),r(f=>f+1))};return e.jsx("span",{ref:d,onMouseEnter:x,"data-slot":"motion-demo","data-replays":c,className:`grid ${n?"h-12 w-12":"h-10 w-10"} place-items-center rounded-[var(--radius-md)] bg-muted text-foreground ${s?oe(t.lib,t.cls):""}`,children:e.jsx("span",{className:n?"text-lg":"text-base",children:"A"})})}function ue({entry:t,onSelect:s}){const{entries:n,loading:c,error:r}=L("motions"),d=p.useMemo(()=>[...new Set(n.map(m=>m.lib))],[n]),l=T("animate.css",d.includes("animate.css")),x=T("hover.css",d.includes("hover.css")),o=m=>m==="hover.css"?x:l,f=d.length>0&&d.some(m=>o(m).failed),i=t?n.find(m=>m.id===t)??null:null,g=i==null?void 0:i.lib,b=i?o(i.lib).css:null,h=i&&b?re(b,i.cls):null,a={...g==="animate.css"&&b?I(F(b,"animate__animated")??""):{},...I(h??"")};return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col","data-tab":"motions",children:[d.map(m=>e.jsx(de,{lib:m,css:o(m).css},m)),i&&e.jsxs("div",{className:"flex-none border-b px-4 py-3 flex items-start gap-4","data-slot":"motion-detail",children:[e.jsx(R,{m:i,playing:!!b,large:!0}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.desc}),e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:[i.lib," · ",i.cls]}),h&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5","data-slot":"motion-timing",children:[a.duration,a.iteration,a.easing].filter(Boolean).map(m=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-[var(--radius-full)] bg-muted text-xs text-muted-foreground font-mono",children:m},m))})]})]}),i&&(h?e.jsx("pre",{"data-slot":"motion-source",className:"flex-none max-h-40 overflow-auto m-0 border-b px-4 py-2 text-xs leading-relaxed bg-terminal-bg text-terminal-fg whitespace-pre-wrap",children:h}):e.jsxs("div",{"data-slot":"motion-source-error",className:"flex-none border-b px-4 py-2 text-xs text-muted-foreground",children:["动效源码不可用(",i.lib," CSS 加载失败,可稍后重试)"]})),i&&e.jsx($,{market:"motions",initial:Q({name:i.name,desc:i.desc,css:h??ce})}),f&&e.jsx("p",{className:"flex-none px-4 py-1.5 text-xs text-muted-foreground","data-slot":"motion-css-fallback",children:"动效库 CSS 加载失败,演示不可播放;目录仍可浏览,提示词照常可用。"}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:r?e.jsx(j,{title:"目录加载失败",hint:r}):c?e.jsx(j,{title:"目录加载中…"}):n.length===0?e.jsx(j,{title:"暂无动效目录"}):e.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2",children:n.map(m=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>s(m.id===t?null:m.id),"aria-pressed":m.id===t,className:"w-full h-full flex flex-col gap-2 rounded-[var(--radius-lg)] border border-border bg-background p-3 hover:bg-muted transition-colors","data-slot":"motion-card",children:[e.jsx(R,{m,playing:!!o(m.lib).css}),e.jsx("span",{className:"text-xs font-medium text-foreground text-left",children:m.name}),e.jsx("span",{className:"text-xs text-muted-foreground text-left line-clamp-2",children:m.desc})]})},m.id))})})]})}const me=12;function xe({entry:t,onSelect:s,q:n,onSearch:c}){const{entries:r,loading:d,error:l}=L("inspirations"),[x,o]=p.useState(""),f=(n??"").trim().toLowerCase(),i=f?r.filter(a=>a.name.toLowerCase().includes(f)||a.desc.toLowerCase().includes(f)||a.tags.some(m=>m.toLowerCase().includes(f))):r,g=(t?i.find(a=>a.id===t)??r.find(a=>a.id===t):null)??null;p.useEffect(()=>{o("")},[g==null?void 0:g.id]);const b=p.useMemo(()=>{const a=new Map;for(const u of r)for(const v of u.tags)a.set(v,(a.get(v)??0)+1);const m=[...a.entries()].sort((u,v)=>v[1]-u[1]||u[0].localeCompare(v[0])).slice(0,me).map(([u])=>u);return[{key:"",label:"全部"},...m.map(u=>({key:u,label:u}))]},[r]),h=b.some(a=>a.key!==""&&a.key===n)?n??"":"",N=a=>{c(a===""||a===n?"":a)};return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col","data-tab":"inspirations",children:[e.jsxs("div",{className:"flex-none px-3 pt-3 flex items-center gap-2 flex-wrap",children:[e.jsx("input",{type:"search","aria-label":"搜索灵感",placeholder:"搜索名称/描述/标签…",value:n??"",onChange:a=>c(a.target.value),className:"w-56 h-8 px-2.5 rounded-[var(--radius-md)] border border-border bg-background text-xs focus:outline-none focus:border-primary"}),e.jsx(P,{ariaLabel:"标签过滤",items:b,value:h,onChange:N,className:"min-w-0"})]}),g&&e.jsxs("div",{className:"flex-none border-b px-4 py-3 flex items-start gap-3","data-slot":"inspiration-detail",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:g.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:g.desc}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:g.tags.map(a=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-[var(--radius-full)] bg-muted text-xs text-muted-foreground",children:a},a))})]}),e.jsx("a",{href:g.url,target:"_blank",rel:"noreferrer noopener",className:"flex-none px-2.5 h-6 inline-flex items-center rounded-[var(--radius-md)] border border-border bg-background text-xs hover:bg-muted transition-colors",children:"新窗口打开"})]}),g&&e.jsx("div",{className:"flex-none px-4 pt-3",children:e.jsx("input",{type:"text","aria-label":"补充要求",placeholder:"补充要求(如:暗色模式优先、要求响应式…)",value:x,onChange:a=>o(a.target.value),className:"w-full h-8 px-2.5 rounded-[var(--radius-md)] border border-border bg-background text-xs focus:outline-none focus:border-primary"})}),g&&e.jsx($,{market:"inspirations",initial:X({name:g.name,url:g.url,tags:g.tags,extra:x})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:l?e.jsx(j,{title:"目录加载失败",hint:l}):d?e.jsx(j,{title:"目录加载中…"}):i.length===0?e.jsx(j,{title:f?`无匹配「${n}」的灵感`:"暂无灵感目录",hint:f?"试试其他标签或关键词":void 0}):e.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2",children:i.map(a=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>s(a.id===t?null:a.id),"aria-pressed":a.id===t,className:"w-full h-full flex flex-col gap-1 rounded-[var(--radius-lg)] border border-border bg-background p-3 text-left hover:bg-muted transition-colors","data-slot":"inspiration-card",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:a.name}),e.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:a.desc}),e.jsx("span",{className:"flex flex-wrap gap-1 mt-auto pt-1",children:a.tags.slice(0,3).map(m=>e.jsx("span",{className:"px-1.5 rounded-[var(--radius-full)] bg-muted text-muted-foreground",children:m},m))})]})},a.id))})})]})}function fe(t){return M.some(s=>s.key===t)}function Ne({params:t}){H();const s=B(w.mode,"h-5 w-5"),n=U(),c=t.get("tab"),r=fe(c)?c:"logos",d=t.get("q"),l=t.get("entry"),x=i=>n.navigate({entry:i??null}),o=i=>n.navigate({tab:i,q:null,entry:null}),f=i=>n.navigate({q:i||null},{replace:!0});return e.jsx(D,{manifest:w,icon:s,breadcrumb:["插件",w.mode,C[r],...l?[l]:[]],toolbar:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:e.jsx(P,{ariaLabel:"市场切换",items:M.map(i=>({key:i.key,label:i.label})),value:r,onChange:o})}),children:e.jsxs("div",{className:"mx-auto h-full bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:[r==="logos"&&e.jsx(te,{entry:l,onSelect:x,q:d,onSearch:f}),r==="motions"&&e.jsx(ue,{entry:l,onSelect:x}),r==="inspirations"&&e.jsx(xe,{entry:l,onSelect:x,q:d,onSearch:f})]})})}export{Ne as default};
|
|
@@ -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-D_uh-zkI.js";import{F as S}from"./FilterPills-DGfzMpn_.js";import{M as U,I as L}from"./ImageViewer-ChZdzYPf.js";import{C as E}from"./CodeViewer-_jAxbWVL.js";import{m as v}from"./web-BZukfmmT.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,o]=u.useState(!0);return u.useEffect(()=>{let s=!1;return o(!0),d([]),fetch("/__design/asset?path="+encodeURIComponent(t),{cache:"no-store"}).then(a=>a.text()).then(a=>{if(s)return;const c=a.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){d([]),o(!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),o(!1)}).catch(()=>{s||(d([]),o(!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 a=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}),a?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(U,{path:t,resolve:w})}function M({path:t}){return e.jsx(L,{path:t,resolve:w})}function P({path:t}){return e.jsx(E,{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,o="",s=null;return fetch("/__design/asset?path="+encodeURIComponent(t)).then(a=>a.blob()).then(async a=>{var c;if(!i){if(o=URL.createObjectURL(a),s=new FontFace("zd-font-preview",`url(${o})`),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 a;if(i=!0,s)try{document.fonts.delete(s),(a=s.dispose)==null||a.call(s)}catch{}o&&URL.revokeObjectURL(o)}},[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:o,onH:s}){const{icon:a}=j(),c=[{v:0,icon:a("monitor","h-3.5 w-3.5"),label:"桌面"},{v:768,icon:a("tablet","h-3.5 w-3.5"),label:"768"},{v:375,icon:a("smartphone","h-3.5 w-3.5"),label:"375"},{v:"custom",icon:a("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=>o(Number(n.target.value)),"aria-label":"自定义宽度",className:r}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:i,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:r}),e.jsx("span",{className:"text-sm text-muted-foreground/70",children:"px"})]})]})}function ee({params:t}){const{icon:m}=j(),d=_(v.mode,"h-5 w-5");I();const i=t.get("type")??"",o=t.get("asset"),[s,a]=u.useState(0),[c,r]=u.useState(1024),[n,p]=u.useState(768),x=o?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]:[],...o?[o]:[]],children:e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:o&&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:o}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:f}),e.jsx(q,{mode:s,onMode:a,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:o})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(x,{path:o})})})]}):e.jsx(F,{icon:m("palette","h-6 w-6"),title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新"})})})}export{ee as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Workspace-DrN9--Je.js","assets/index-D_uh-zkI.js","assets/index-DH1Mqw-g.css","assets/FilterPills-DGfzMpn_.js","assets/ImageViewer-ChZdzYPf.js","assets/CodeViewer-_jAxbWVL.js","assets/CodeViewer-BTcE7LSd.css","assets/client-Cw4K1Nx3.js","assets/Sidebar-D83uLTNy.js","assets/FileIcon-68etP2t6.js","assets/usePluginData-Bk2M7LNj.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,_ as o}from"./index-D_uh-zkI.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-DrN9--Je.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),sidebar:e.lazy(()=>o(()=>import("./Sidebar-D83uLTNy.js"),__vite__mapDeps([8,1,2,9,10])))}),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-DjL1fdji.js","assets/index-D_uh-zkI.js","assets/index-DH1Mqw-g.css","assets/FilterPills-DGfzMpn_.js","assets/CodeViewer-_jAxbWVL.js","assets/CodeViewer-BTcE7LSd.css","assets/usePluginData-Bk2M7LNj.js","assets/client-Cw4K1Nx3.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,_ as t}from"./index-D_uh-zkI.js";import{d as o}from"./client-Cw4K1Nx3.js";const r={mode:"market",label:"灵感市场",icon:"✨",description:"Logo / 动效 / 设计灵感浏览 · 转提示词闭环",order:40},i=[{name:"tab",label:"当前市场",type:"string",description:"logos/motions/inspirations"},{name:"q",label:"搜索词",type:"string",description:"当前市场内搜索/过滤"},{name:"entry",label:"选中条目",type:"string",description:"目录项 id,直达详情"}],a=o({manifest:r,params:i,workspace:e.lazy(()=>t(()=>import("./Workspace-DjL1fdji.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])))}),l=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"}));export{r as m,l as w};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Workspace-BE7p2hNz.js","assets/index-D_uh-zkI.js","assets/index-DH1Mqw-g.css","assets/ImageViewer-ChZdzYPf.js","assets/CodeViewer-_jAxbWVL.js","assets/CodeViewer-BTcE7LSd.css","assets/client-Cw4K1Nx3.js","assets/Sidebar-N0HiMJRK.js","assets/FileIcon-68etP2t6.js","assets/usePluginData-Bk2M7LNj.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,_ as t}from"./index-D_uh-zkI.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-BE7p2hNz.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),sidebar:e.lazy(()=>t(()=>import("./Sidebar-N0HiMJRK.js"),__vite__mapDeps([7,1,2,8,9])))}),l=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"}));export{o as m,l as w};
|