meshy-node 0.2.2 → 0.2.4

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.
@@ -1,4 +1,4 @@
1
- import{r as c,av as L,as as M,j as e,B as g,a as w,m as P}from"./index-kMP08Pcy.js";import{G as O,C as R,F as _}from"./DashboardPage-B4dS4kx6.js";import{F as B}from"./file-f8EEICoF.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
1
+ import{r as c,av as L,as as M,j as e,B as g,a as w,m as P}from"./index-CxdvKkO7.js";import{G as O,C as R,F as _}from"./DashboardPage-3CEGtmWK.js";import{F as B}from"./file-Bp-JAQYC.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
2
2
  `),n=[];let a=[];const d=()=>{if(a.length===0)return;const l=a.join(`
3
3
  `).trim();if(!l){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:l}),a=[]};for(const l of s)l.startsWith("diff --git ")&&a.length>0&&d(),a.push(l);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((l,i)=>{d=d?`${d}/${l}`:l;const p=i===n.length-1;let m=a.find(b=>b.name===l);m||(m=p?{type:"file",name:l,path:d,item:s}:{type:"folder",name:l,path:d,children:[]},a.push(m)),p||(m.children??(m.children=[]),a=m.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function A(r){return r.map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,l;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return k(t);const s=(l=r.find(i=>i.startsWith("--- ")))==null?void 0:l.slice(4).trim();if(s&&s!=="/dev/null")return k(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?k(a[2]||a[1]||""):null}function k(r){return r.replace(/^[ab]\//,"")}const y={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function ee({taskId:r}){const[t,s]=c.useState(null),[n,a]=c.useState(!0),[d,l]=c.useState(null),[i,p]=c.useState(null),[m,b]=c.useState(null),[T,v]=c.useState(!1),[U,N]=c.useState(null),S=c.useCallback(async()=>{a(!0),l(null),s(null);try{const o=await L(r);s(o)}catch(o){l(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);c.useEffect(()=>{S()},[S]);const F=c.useMemo(()=>D(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),E=c.useMemo(()=>D(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),C=c.useMemo(()=>A((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=c.useMemo(()=>[{section:"staged",items:F},{section:"unstaged",items:E},{section:"untracked",items:C}],[F,E,C]),h=c.useMemo(()=>j.flatMap(o=>o.items),[j]),u=c.useMemo(()=>h.find(o=>o.id===i)??h[0]??null,[h,i]);return c.useEffect(()=>{var o;(!i||!h.some(x=>x.id===i))&&p(((o=h[0])==null?void 0:o.id)??null)},[h,i]),c.useEffect(()=>{if(b(null),N(null),v(!1),!u||u.section!=="untracked")return;if(u.path.endsWith("/")){N("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),M(r,u.path).then(x=>{o||b(x)}).catch(x=>{o||N(x instanceof Error?x.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[u,r]),n?e.jsx(f,{tone:"muted",children:"Loading diff..."}):d?e.jsx(f,{tone:"destructive",children:d}):t!=null&&t.available?h.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[19rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-3 flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[e.jsx(O,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[y[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.jsx("div",{className:"space-y-3",children:j.map(({section:o,items:x})=>e.jsx(V,{section:o,items:x,selectedId:(u==null?void 0:u.id)??null,onSelect:p},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:y[u.section]}),u.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-full",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-full",children:"Diff patch"})]}),e.jsx("div",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:u.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:u.section==="untracked"?e.jsx(q,{loading:T,error:U,content:m}):e.jsx(H,{patch:u.patch??""})})]}):e.jsx(f,{tone:"muted",children:"Select a file to inspect."})})]}):e.jsx(f,{tone:"muted",children:"Working tree is clean."}):e.jsx(f,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function V({section:r,items:t,selectedId:s,onSelect:n}){const a=c.useMemo(()=>I(t),[t]),d=c.useMemo(()=>t.find(i=>i.id===s)??null,[t,s]),l=c.useMemo(()=>new Set(d?G(d.path):[]),[d]);return e.jsxs("section",{className:"rounded-[22px] border border-border/60 bg-background/35",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 px-3 py-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:y[r]}),e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:t.length})]}),e.jsx("div",{className:"p-2",children:a.length>0?e.jsx("div",{className:"space-y-1",children:a.map(i=>e.jsx(W,{node:i,depth:0,selectedId:s,expandedAncestorPaths:l,onSelect:n},`${r}:${i.path}`))}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border/70 bg-background/30 px-3 py-3 text-sm text-muted-foreground",children:"No files."})})]})}function W({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){var d;return r.type==="folder"?e.jsx(z,{node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}):e.jsxs("button",{type:"button",onClick:()=>{r.item&&a(r.item.id)},className:w("flex w-full cursor-pointer items-center gap-2 rounded-[16px] px-2 py-2 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/8 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*14+8}px`},children:[e.jsx(B,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-sm",children:r.name})]})}function z({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,l]=c.useState(!0);return c.useEffect(()=>{n.has(r.path)&&l(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>l(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-2 rounded-[14px] px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*14+8}px`},children:[d?e.jsx(P,{className:"h-4 w-4 shrink-0"}):e.jsx(R,{className:"h-4 w-4 shrink-0"}),e.jsx(_,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-1",children:(r.children??[]).map(i=>e.jsx(W,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
4
4
  `);return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsxs("div",{className:"border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"File diff"}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[t.length," lines"]})]}),e.jsx("div",{className:"font-mono text-xs leading-6",children:t.map((s,n)=>e.jsxs("div",{className:w("grid grid-cols-[56px_minmax(0,1fr)] gap-4 px-4 py-0.5",K(s)),children:[e.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:n+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:s||" "})]},`${n}-${s}`))})]})}function q({loading:r,error:t,content:s}){if(r)return e.jsx(f,{tone:"muted",children:"Loading file content..."});if(t)return e.jsx(f,{tone:"destructive",children:t});if(!s)return e.jsx(f,{tone:"muted",children:"Select an untracked file to preview its content."});if(s.kind==="image"){const n=s.content?`data:${s.mimeType};base64,${s.content}`:s.downloadUrl;return n?e.jsx("div",{className:"flex min-h-[20rem] items-center justify-center rounded-[28px] border border-border/60 bg-background/55 p-4",children:e.jsx("img",{src:n,alt:s.path,className:"max-h-full max-w-full rounded-[20px] object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):e.jsx(f,{tone:"muted",children:"Image preview is not available."})}if(s.kind==="pdf"&&s.downloadUrl)return e.jsx("div",{className:"h-full min-h-[24rem] overflow-hidden rounded-[28px] border border-border/60 bg-background/55",children:e.jsx("iframe",{src:s.downloadUrl,title:s.path,className:"h-full w-full border-0"})});if(s.kind==="json"){let n=s.content;try{n=JSON.stringify(JSON.parse(s.content),null,2)}catch{}return e.jsx($,{content:n,truncated:s.truncated})}return s.kind==="markdown"||s.kind==="text"||s.kind==="html"?e.jsx($,{content:s.content,truncated:s.truncated}):e.jsx(f,{tone:"muted",children:"This file cannot be previewed inline."})}function $({content:r,truncated:t}){return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-5 py-5 font-mono text-xs leading-6 text-foreground",children:r}),t&&e.jsx("div",{className:"border-t border-border/60 px-5 py-3 text-xs text-muted-foreground",children:"Content truncated. Open the Files tab to inspect the full artifact."})]})}function f({children:r,tone:t}){return e.jsx("div",{className:w("flex h-full min-h-[16rem] items-center justify-center rounded-[24px] text-sm",t==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function K(r){return r.startsWith("@@")?"bg-sky-500/10":r.startsWith("+")&&!r.startsWith("+++")?"bg-emerald-500/10":r.startsWith("-")&&!r.startsWith("---")?"bg-destructive/10":r.startsWith("diff ")||r.startsWith("index ")||r.startsWith("---")||r.startsWith("+++")?"bg-muted/45":""}export{ee as DiffTab};
@@ -1,4 +1,4 @@
1
- import{c as Ze,ap as Ot,j as y,r as re,aq as Ar,ar as Qn,as as Pr,B as rn,i as Me,a as Te}from"./index-kMP08Pcy.js";import{F as zr,C as jr}from"./DashboardPage-B4dS4kx6.js";import{F as Lr}from"./file-f8EEICoF.js";/**
1
+ import{c as Ze,ap as Ot,j as y,r as re,aq as Ar,ar as Qn,as as Pr,B as rn,i as Me,a as Te}from"./index-CxdvKkO7.js";import{F as zr,C as jr}from"./DashboardPage-3CEGtmWK.js";import{F as Lr}from"./file-Bp-JAQYC.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as g,r as n,aq as T,at as L,j as e,i,$ as E,B as M,ao as O,D as _,g as D,au as $}from"./index-kMP08Pcy.js";/**
1
+ import{c as g,r as n,aq as T,at as L,j as e,i,$ as E,B as M,ao as O,D as _,g as D,au as $}from"./index-CxdvKkO7.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-kMP08Pcy.js";/**
1
+ import{c as a}from"./index-CxdvKkO7.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.