@hienlh/ppm 0.13.62 → 0.13.63

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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/audio-preview-D8onaG_2.js +1 -0
  5. package/dist/web/assets/{chat-tab-nNh5rLB2.js → chat-tab-D1n2fmne.js} +7 -7
  6. package/dist/web/assets/code-editor-D3ofpe9P.js +8 -0
  7. package/dist/web/assets/{conflict-editor-B4f2ilts.js → conflict-editor-BaSyowCW.js} +3 -3
  8. package/dist/web/assets/database-viewer-IDG5i3mc.js +1 -0
  9. package/dist/web/assets/diff-viewer-D5SnxW8Y.js +4 -0
  10. package/dist/web/assets/{extension-webview-CUPyfczi.js → extension-webview-BUzklJiG.js} +1 -1
  11. package/dist/web/assets/git-log-panel-CkfQFd6J.js +1 -0
  12. package/dist/web/assets/{glide-data-grid-1rBqhi2J.js → glide-data-grid-BJ3Wn9to.js} +3 -3
  13. package/dist/web/assets/image-preview-CJ8Qqjgt.js +1 -0
  14. package/dist/web/assets/index-Di7q5I27.js +27 -0
  15. package/dist/web/assets/keybindings-store-D9NMYHYK.js +1 -0
  16. package/dist/web/assets/{markdown-renderer-BS-EgLZm.js → markdown-renderer-YnP2OcPh.js} +1 -1
  17. package/dist/web/assets/notification-store-CW0Alosv.js +1 -0
  18. package/dist/web/assets/pdf-preview-D3Y2rNVC.js +1 -0
  19. package/dist/web/assets/port-forwarding-tab-DvoM_j8q.js +1 -0
  20. package/dist/web/assets/{postgres-viewer-BZ7RHn6E.js → postgres-viewer-BN_vFAqs.js} +2 -2
  21. package/dist/web/assets/{settings-tab-B3U6o2Cv.js → settings-tab-B52JczcO.js} +1 -1
  22. package/dist/web/assets/sql-query-editor-XkJZFBl5.js +3 -0
  23. package/dist/web/assets/sqlite-viewer-DR2scYmN.js +1 -0
  24. package/dist/web/assets/system-monitor-tab-QXA7p0VH.js +1 -0
  25. package/dist/web/assets/{terminal-tab-BEGaXjCj.js → terminal-tab-BI9y5tDL.js} +2 -2
  26. package/dist/web/assets/video-preview-EhN6q3Xv.js +1 -0
  27. package/dist/web/index.html +1 -1
  28. package/dist/web/sw.js +1 -1
  29. package/docs/codebase-summary.md +2 -1
  30. package/docs/project-changelog.md +10 -1
  31. package/package.json +1 -1
  32. package/src/web/components/database/database-viewer.tsx +13 -2
  33. package/src/web/components/database/sql-query-editor.tsx +8 -10
  34. package/src/web/components/layout/command-palette-filter-chips.tsx +61 -0
  35. package/src/web/components/layout/command-palette.tsx +54 -7
  36. package/dist/web/assets/audio-preview-B3rIhhbi.js +0 -1
  37. package/dist/web/assets/code-editor-CMSwWKuR.js +0 -8
  38. package/dist/web/assets/database-viewer-D-28-BdV.js +0 -1
  39. package/dist/web/assets/diff-viewer-Bv8DUUIR.js +0 -4
  40. package/dist/web/assets/git-log-panel-CFLQD23g.js +0 -1
  41. package/dist/web/assets/image-preview-DHrZPetH.js +0 -1
  42. package/dist/web/assets/index-CkQX29w3.js +0 -27
  43. package/dist/web/assets/keybindings-store-Bigfs0Ss.js +0 -1
  44. package/dist/web/assets/notification-store-NXr7Mag_.js +0 -1
  45. package/dist/web/assets/pdf-preview-CeN9W7kd.js +0 -1
  46. package/dist/web/assets/port-forwarding-tab-CYUcx2_j.js +0 -1
  47. package/dist/web/assets/sql-query-editor-CfDG3duv.js +0 -3
  48. package/dist/web/assets/sqlite-viewer-ofYBAsHX.js +0 -1
  49. package/dist/web/assets/system-monitor-tab-By-j_TO1.js +0 -1
  50. package/dist/web/assets/video-preview-CHOiQ3I9.js +0 -1
@@ -1 +0,0 @@
1
- import"./vendor-markdown-0Mxgxy0L.js";import"./api-client-DiZgVOok.js";import{D as e}from"./index-CkQX29w3.js";export{e as useKeybindingsStore};
@@ -1 +0,0 @@
1
- import"./vendor-markdown-0Mxgxy0L.js";import"./api-client-DiZgVOok.js";import{P as e}from"./index-CkQX29w3.js";export{e as useNotificationStore};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{t as r}from"./file-exclamation-point-B__2Hrd6.js";import{i,r as a}from"./api-client-DiZgVOok.js";import{$ as o,ct as s}from"./index-CkQX29w3.js";var c=e(n(),1),l=t();function u({filePath:e,projectName:t}){let n=(0,c.useRef)(null),[u,d]=(0,c.useState)(!1),[f,p]=(0,c.useState)(!1),m=(0,c.useMemo)(()=>{let n=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/raw?path=${encodeURIComponent(e)}`:`${i(t)}/files/raw?path=${encodeURIComponent(e)}`,r=a();return r?`${n}&token=${encodeURIComponent(r)}`:n},[e,t]);(0,c.useEffect)(()=>{let r=r=>{let i=r.detail;if(!(i.projectName!==t||i.path!==e))try{n.current?.contentWindow?.location.reload()}catch{}};return window.addEventListener(`file:changed`,r),()=>window.removeEventListener(`file:changed`,r)},[e,t]);let h=(0,c.useCallback)(()=>{window.open(m,`_blank`)},[m]);return f?(0,l.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,l.jsx)(r,{className:`size-10 text-text-subtle`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Failed to load PDF.`})]}):(0,l.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!u&&(0,l.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,l.jsx)(o,{className:`size-5 animate-spin text-text-subtle`})}),(0,l.jsxs)(`div`,{className:`flex flex-col h-full ${u?``:`hidden`}`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,l.jsx)(`span`,{className:`text-xs text-text-secondary truncate`,children:e}),(0,l.jsxs)(`button`,{onClick:h,className:`flex items-center gap-1 text-xs text-text-secondary hover:text-text-primary transition-colors`,children:[(0,l.jsx)(s,{className:`size-3`}),` Open in new tab`]})]}),(0,l.jsx)(`iframe`,{ref:n,src:m,title:e,className:`flex-1 w-full border-none`,onLoad:()=>d(!0),onError:()=>p(!0)})]})]})}export{u as PdfPreview};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{n as r,t as i}from"./globe-CQ8NAYvi.js";import{t as a}from"./wifi-LJEyIdXf.js";import{t as o}from"./api-client-DiZgVOok.js";import{$ as s,R as c,W as l,ct as u,lt as d}from"./index-CkQX29w3.js";var f=e(n(),1),p=t();function m(){let[e,t]=(0,f.useState)(``),[n,m]=(0,f.useState)([]),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(null),x=(0,f.useCallback)(async()=>{try{m(await o.get(`/api/preview/tunnels`))}catch(e){console.warn(`[ports] failed to fetch tunnels`,e)}},[]);(0,f.useEffect)(()=>{x();let e=setInterval(x,1e4);return()=>clearInterval(e)},[x]);let S=async e=>{let r=n.find(t=>t.port===e);if(r){window.open(r.url,`_blank`),t(``);return}g(!0),v(null);try{let n=await o.post(`/api/preview/tunnel`,{port:e});window.open(n.url,`_blank`),t(``),await x()}catch(t){v(t.message||`Failed to start tunnel for port ${e}`)}finally{g(!1)}},C=async e=>{try{await o.del(`/api/preview/tunnel/${e}`),await x()}catch(t){c.error(t.message||`Failed to stop tunnel for port ${e}`)}},w=(e,t)=>{navigator.clipboard.writeText(t).then(()=>{b(e),c.success(`URL copied`),setTimeout(()=>b(null),2e3)}).catch(()=>{c.error(`Failed to copy URL`)})};return(0,p.jsxs)(`div`,{className:`flex flex-col h-full w-full bg-background`,children:[(0,p.jsxs)(`div`,{className:`p-4 md:p-6 border-b border-border bg-surface`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,p.jsx)(a,{className:`size-5 text-primary`}),(0,p.jsx)(`h2`,{className:`text-base font-medium text-text-primary`,children:`Port Forwarding`})]}),(0,p.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let n=parseInt(e,10);n>=1&&n<=65535?S(n):v(`Port must be 1-65535`)},className:`flex items-center gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 px-3 py-2.5 rounded-lg bg-background border border-border focus-within:border-primary/50 transition-colors`,children:[(0,p.jsx)(`span`,{className:`text-sm text-text-subtle shrink-0`,children:`localhost:`}),(0,p.jsx)(`input`,{type:`number`,value:e,onChange:e=>{t(e.target.value),v(null)},placeholder:`3000`,min:1,max:65535,className:`flex-1 bg-transparent text-sm text-text-primary outline-none placeholder:text-text-subtle min-w-0 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`})]}),(0,p.jsx)(`button`,{type:`submit`,disabled:h||!e,className:`px-4 py-2.5 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0 min-w-[72px] flex items-center justify-center`,children:h?(0,p.jsx)(s,{className:`size-4 animate-spin`}):`Forward`})]}),_&&(0,p.jsx)(`p`,{className:`text-sm text-red-400 mt-2`,children:_}),h&&(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-text-secondary mt-2`,children:[(0,p.jsx)(s,{className:`size-3.5 animate-spin`}),(0,p.jsx)(`span`,{children:`Starting tunnel...`})]})]}),(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4 md:p-6`,children:n.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,p.jsx)(i,{className:`size-10 text-text-subtle`}),(0,p.jsx)(`p`,{className:`text-sm text-text-secondary max-w-xs`,children:`No active ports. Forward a port to access your local dev server from anywhere.`})]}):(0,p.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>(0,p.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-surface border border-border`,children:[(0,p.jsxs)(`div`,{className:`shrink-0 px-2 py-1 rounded bg-primary/10 text-primary text-xs font-mono font-medium`,children:[`:`,e.port]}),(0,p.jsx)(`span`,{className:`flex-1 text-xs text-text-secondary truncate min-w-0`,children:e.url}),(0,p.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[(0,p.jsx)(`button`,{onClick:()=>window.open(e.url,`_blank`),className:`p-2.5 rounded-md hover:bg-surface-elevated transition-colors`,title:`Open in browser`,children:(0,p.jsx)(u,{className:`size-4 text-text-secondary`})}),(0,p.jsx)(`button`,{onClick:()=>w(e.port,e.url),className:`p-2.5 rounded-md hover:bg-surface-elevated transition-colors`,title:`Copy URL`,children:y===e.port?(0,p.jsx)(r,{className:`size-4 text-green-400`}):(0,p.jsx)(d,{className:`size-4 text-text-secondary`})}),(0,p.jsx)(`button`,{onClick:()=>C(e.port),className:`p-2.5 rounded-md hover:bg-red-500/10 transition-colors`,title:`Stop tunnel`,children:(0,p.jsx)(l,{className:`size-4 text-red-400`})})]})]},e.port))})})]})}export{m as PortForwardingTab};
@@ -1,3 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{i as r,r as i}from"./glide-data-grid-1rBqhi2J.js";import{n as a,t as o}from"./use-monaco-theme-qx6SfVRk.js";var s=e(n(),1),c=t();function l(e,t){let n=e.split(`
2
- `),r=0;for(let e=0;e<n.length;e++){let i=n[e].trim();e<t-1&&i.endsWith(`;`)&&(r=e+1)}let i=n.length-1;for(let e=t-1;e<n.length;e++)if(n[e].trim().endsWith(`;`)){i=e;break}for(;r<=i;){let e=n[r].trim();if(e&&!e.startsWith(`--`))break;r++}return n.slice(r,i+1).join(`
3
- `).trim()}function u({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:u,cacheKey:d}){let f=d?`ppm:sql-query:${d}`:null,[p,m]=(0,s.useState)(()=>{if(f)try{return sessionStorage.getItem(f)??n}catch{}return n}),h=(0,s.useRef)(!1),g=(0,s.useRef)(null),_=(0,s.useRef)(null),v=(0,s.useRef)(null),y=(0,s.useRef)(e);y.current=e;let b=o();(0,s.useEffect)(()=>{if(!(!_.current||!u))return v.current?.dispose(),i(),v.current=_.current.languages.registerCompletionItemProvider(`sql`,r(_.current,u)),()=>{v.current?.dispose()}},[u]);let x=(0,s.useCallback)((e,t)=>{g.current=e,_.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=l(e.getValue(),t.lineNumber);n&&y.current(n)}}),u&&(v.current?.dispose(),v.current=t.languages.registerCompletionItemProvider(`sql`,r(t,u)))},[u]);return(0,s.useEffect)(()=>{h.current||m(n)},[n]),(0,c.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,c.jsx)(a,{height:`100%`,language:`sql`,theme:b,value:p,onChange:e=>{let t=e??``;if(m(t),h.current=!0,f)try{sessionStorage.setItem(f,t)}catch{}},onMount:x,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{u as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./database-Dc8mr-dP.js";import{t as i}from"./glide-data-grid-1rBqhi2J.js";import{t as a}from"./refresh-cw-CRD2qr4U.js";import{t as o}from"./table-2wDtM4_B.js";import{i as s,t as c}from"./api-client-DiZgVOok.js";import"./settings-store-CSDOihqv.js";import"./vendor-mermaid-DCie7hiR.js";import"./panel-store-B1pOXkyS.js";import"./tab-store-DzftzxTL.js";import{$ as l,pt as u}from"./index-CkQX29w3.js";import"./data-grid-types-C29KDkZJ.js";import"./use-monaco-theme-qx6SfVRk.js";import{t as d}from"./sql-query-editor-CfDG3duv.js";var f=e(n(),1);function p(e,t,n){let[r,i]=(0,f.useState)([]),[a,o]=(0,f.useState)(null),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)([]),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(1),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(!1),E=n?`/api/db/connections/${n}`:null,D=E??`${s(e)}/sqlite`,O=E?``:`path=${encodeURIComponent(t)}`,k=(0,f.useCallback)(async()=>{h(!0),_(null);try{let e=E?`?cached=1`:O?`?${O}`:``,t=await c.get(`${D}/tables${e}`);i(t),!E&&t.length>0&&!a&&o(t[0].name)}catch(e){_(e.message)}finally{h(!1)}},[D,O,E]);(0,f.useEffect)(()=>{k()},[k]);let A=(0,f.useCallback)(async()=>{if(a){h(!0);try{let e=O?`${O}&`:``,[t,n]=await Promise.all([c.get(`${D}/data?${e}table=${encodeURIComponent(a)}&page=${v}&limit=100`),c.get(`${D}/schema?${e}table=${encodeURIComponent(a)}`)]);u(t),p(n)}catch(e){_(e.message)}finally{h(!1)}}},[D,O,a,v]);return(0,f.useEffect)(()=>{A()},[A]),{tables:r,selectedTable:a,selectTable:(0,f.useCallback)(e=>{o(e),y(1),x(null)},[]),tableData:l,schema:d,loading:m,error:g,page:v,setPage:y,queryResult:b,queryError:S,queryLoading:w,executeQuery:(0,f.useCallback)(async e=>{T(!0),C(null);try{let n=E?{sql:e}:{path:t,sql:e},r=await c.post(`${D}/query`,n);x(r),r.changeType===`modify`&&A()}catch(e){C(e.message)}finally{T(!1)}},[D,E,t,A]),updateCell:(0,f.useCallback)(async(e,n,r)=>{if(a)try{E?await c.put(`${D}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await c.put(`${D}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),A()}catch(e){_(e.message)}},[D,E,t,a,A]),deleteRow:(0,f.useCallback)(async e=>{if(a)try{E?await c.del(`${D}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await c.del(`${D}/row`,{path:t,table:a,rowid:e}),A(),k()}catch(e){_(e.message)}},[D,E,t,a,A,k]),refreshTables:k,refreshData:A}}var m=t();function h({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,m.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,m.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,m.jsx)(a,{className:`size-3`})})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,m.jsx)(o,{className:`size-3 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,m.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,m.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function g({onExecute:e,loading:t}){return(0,m.jsx)(d,{onExecute:e,loading:t})}function _({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,f.useState)(!1);return i?(0,m.jsx)(v,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0}):!t||!n?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,m.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,m.jsx)(v,{projectName:n,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function v({projectName:e,dbPath:t,connectionId:n,connectionName:a,initialTable:o,queryPanelOpen:s,onToggleQueryPanel:c,hideTableList:d}){let _=p(e,t,n),v=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{o&&!v.current&&_.tables.length>0&&(v.current=!0,_.selectTable(o))},[o,_.tables]),_.error&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,m.jsx)(u,{className:`size-10 text-destructive`}),(0,m.jsx)(`p`,{className:`text-sm`,children:_.error})]}):_.loading&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,m.jsx)(l,{className:`size-5 animate-spin`}),(0,m.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,m.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!d&&(0,m.jsx)(h,{tables:_.tables,selectedTable:_.selectedTable,onSelect:_.selectTable,onRefresh:_.refreshTables}),(0,m.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${d?``:`border-l border-border`}`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,m.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:a??t}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_.selectedTable&&`/ ${_.selectedTable}`}),(0,m.jsx)(`div`,{className:`ml-auto`,children:(0,m.jsx)(`button`,{type:`button`,onClick:c,className:`px-2 py-1 rounded text-xs transition-colors ${s?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,m.jsx)(`div`,{className:`flex-1 overflow-hidden ${s?`max-h-[60%]`:``}`,children:_.tableData?(0,m.jsx)(i,{columns:_.tableData.columns,rows:_.tableData.rows,total:_.tableData.total,limit:_.tableData.limit,schema:_.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:_.loading,page:_.page,onPageChange:_.setPage,onCellUpdate:(e,t,n,r)=>_.updateCell(t,n,r),onRowDelete:(e,t)=>_.deleteRow(t)}):(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:_.loading?(0,m.jsx)(l,{className:`size-4 animate-spin`}):`Select a table`})}),s&&(0,m.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,m.jsx)(g,{onExecute:_.executeQuery,loading:_.queryLoading})})]})]})}export{_ as SqliteViewer};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./createLucideIcon-BjHrJDVb.js";import{t as i}from"./arrow-down-D825m4vm.js";import{t as a}from"./arrow-up-Rcw6_KKu.js";import{n as o,t as s}from"./chevron-down-BMo4cBth.js";import{t as c}from"./chevron-right-CD8e6Aj4.js";import{t as l}from"./wifi-LJEyIdXf.js";import{t as u}from"./x-DfF6D5Js.js";import{t as d}from"./api-client-DiZgVOok.js";import{n as f}from"./utils-E0yyGxXt.js";import{R as p,X as m,a as h,g,q as _,z as v}from"./index-CkQX29w3.js";var y=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),b=r(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),x=e(n(),1),S=t(),C=(0,x.memo)(function({data:e,width:t=120,height:n=24,color:r=`#3b82f6`}){let i=(0,x.useRef)(null),a=(0,x.useRef)(0);return(0,x.useEffect)(()=>{let o=Date.now();if(o-a.current<1e3)return;a.current=o;let s=i.current;if(!s||e.length<2)return;let c=s.getContext(`2d`);if(!c)return;let l=window.devicePixelRatio||1;s.width=t*l,s.height=n*l,c.scale(l,l),c.clearRect(0,0,t,n);let u=Math.max(...e,1),d=t/(e.length-1),f=n-4;c.beginPath(),c.strokeStyle=r,c.lineWidth=1.5,c.lineJoin=`round`;for(let t=0;t<e.length;t++){let n=t*d,r=2+f-e[t]/u*f;t===0?c.moveTo(n,r):c.lineTo(n,r)}c.stroke()},[e,t,n,r]),(0,S.jsx)(`canvas`,{ref:i,style:{width:t,height:n},className:`inline-block`})});function w(e){return e>80?`text-red-500`:e>50?`text-yellow-500`:`text-green-500`}function T(e){return e<1024?`${e.toFixed(0)} MB`:`${(e/1024).toFixed(1)} GB`}var E=(0,x.memo)(function({group:e,Icon:t,isExpanded:n,sparkData:r,isMobile:i,sortKey:a,sortDir:o,onToggle:l,onKill:d}){let p=n?s:c,m=(0,x.useMemo)(()=>a?[...e.processes].sort((e,t)=>{let n=a===`cpu`?e.cpu:e.ramMB,r=a===`cpu`?t.cpu:t.ramMB;return o===`asc`?n-r:r-n}):e.processes,[e.processes,a,o]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`tr`,{className:`hover:bg-surface-hover cursor-pointer transition-colors`,onClick:l,children:[(0,S.jsx)(`td`,{className:`py-1.5 px-3`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(p,{className:`size-3 text-text-subtle shrink-0`}),(0,S.jsx)(t,{className:`size-3.5 text-text-secondary shrink-0`}),(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),(0,S.jsxs)(`span`,{className:`text-text-subtle`,children:[`(`,e.processes.length,`)`]})]})}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`py-1.5 px-2`,children:r.length>1&&(0,S.jsx)(C,{data:r,width:120,height:20})})]}),n&&m.map(e=>(0,S.jsxs)(`tr`,{className:`text-text-subtle group/proc hover:bg-surface-hover transition-colors`,children:[(0,S.jsx)(`td`,{className:`py-1 px-3 pl-10`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,S.jsx)(`span`,{className:`text-text-subtle shrink-0`,children:e.pid}),(0,S.jsx)(`span`,{className:`break-all text-text-secondary`,title:e.command,children:e.command})]})}),(0,S.jsxs)(`td`,{className:`text-right py-1 px-2 align-top`,children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1 px-2 align-top`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`align-top py-1 px-2`,children:(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d(e.pid)},className:`opacity-0 group-hover/proc:opacity-100 p-0.5 rounded hover:bg-red-500/20 hover:text-red-500 transition-all`,title:`End process ${e.pid}`,children:(0,S.jsx)(u,{className:`size-3`})})})]},e.pid))]})});function D({label:e,field:t,activeKey:n,activeDir:r,onClick:o,className:s}){let c=n===t,l=c?r===`asc`?a:i:null;return(0,S.jsx)(`th`,{className:f(`text-right py-1.5 px-2 font-medium cursor-pointer select-none hover:text-text-primary transition-colors`,c&&`text-text-primary`,s),onClick:()=>o(t),children:(0,S.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,S.jsx)(`span`,{children:e}),l&&(0,S.jsx)(l,{className:`size-3`})]})})}var O={server:_,terminal:m,"ai-tool":o,build:b,unknown:y},k=200;function A(e,t,n){return e===n?t===`desc`?[n,`asc`]:[null,`desc`]:[n,`desc`]}function j(e,t,n){return t?[...e].sort((e,r)=>{let i=t===`cpu`?e.cpu:e.ramMB,a=t===`cpu`?r.cpu:r.ramMB;return n===`asc`?i-a:a-i}):e}var M=(0,x.memo)(function(){let{latest:e,history:t,isConnected:n}=h(),[r,i]=(0,x.useState)(()=>new Set([`server`])),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(`desc`),u=g(),m=(0,x.useMemo)(()=>{let e=new Map,n=t.slice(-k);for(let t of n)for(let n of t.groups){let t=`${n.type}:${n.label}`,r=e.get(t)??[];r.push(n.cpu),e.set(t,r)}return e},[t]),_=(0,x.useMemo)(()=>e?j(e.groups,a,s):[],[e,a,s]),b=(0,x.useCallback)(async e=>{try{await d.post(`/api/system/resources/kill/${e}`),p.success(`Sent SIGTERM to PID ${e}`)}catch(t){p.error(t.message||`Failed to kill PID ${e}`)}},[]),C=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=e=>{let[t,n]=A(a,s,e);o(t),c(n)};if(!e)return(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm`,children:n?`Waiting for data...`:`Connecting to resource monitor...`});let N=Math.round((Date.now()-e.timestamp)/1e3);return(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,children:[n?(0,S.jsx)(l,{className:`size-3 text-green-500`}):(0,S.jsx)(v,{className:`size-3 text-red-500`}),(0,S.jsx)(`span`,{children:n?`Updated ${N}s ago`:`Disconnected`})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,S.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-text-subtle border-b border-border`,children:[(0,S.jsx)(`th`,{className:`text-left py-1.5 px-3 font-medium`,children:`Process`}),(0,S.jsx)(D,{label:`CPU`,field:`cpu`,activeKey:a,activeDir:s,onClick:M,className:`w-16`}),(0,S.jsx)(D,{label:`RAM`,field:`ram`,activeKey:a,activeDir:s,onClick:M,className:`w-20`}),!u&&(0,S.jsx)(`th`,{className:`py-1.5 px-2 font-medium w-[130px]`,children:`Trend`})]})}),(0,S.jsx)(`tbody`,{children:_.map(e=>{let t=`${e.type}:${e.label}`;return(0,S.jsx)(E,{group:e,Icon:O[e.type]??y,isExpanded:r.has(t),sparkData:m.get(t)??[],isMobile:u,sortKey:a,sortDir:s,onToggle:()=>C(t),onKill:b},t)})}),(0,S.jsx)(`tfoot`,{children:(0,S.jsxs)(`tr`,{className:`border-t border-border font-medium`,children:[(0,S.jsxs)(`td`,{className:`py-1.5 px-3`,children:[`Total (`,e.total.processCount,` processes)`]}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.total.cpu)),children:[e.total.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.total.ramMB)}),!u&&(0,S.jsx)(`td`,{})]})})]})})]})});export{M as SystemMonitorTab};
@@ -1 +0,0 @@
1
- import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./file-exclamation-point-B__2Hrd6.js";import"./api-client-DiZgVOok.js";import{$ as n}from"./index-CkQX29w3.js";import{t as r}from"./use-blob-url-DCUIEzjB.js";var i=e();function a({filePath:e,projectName:a}){let{blobUrl:o,error:s}=r(e,a);return s?(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,i.jsx)(t,{className:`size-10 text-text-subtle`}),(0,i.jsx)(`p`,{className:`text-sm`,children:`Failed to load video.`})]}):o?(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,i.jsx)(`video`,{src:o,controls:!0,className:`max-w-full max-h-full`})}):(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,i.jsx)(n,{className:`size-5 animate-spin text-text-subtle`})})}export{a as VideoPreview};