@hienlh/ppm 0.13.77 → 0.13.78
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/CHANGELOG.md +5 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{audio-preview-CAkLsTgJ.js → audio-preview-DFrv27cv.js} +1 -1
- package/dist/web/assets/{chat-tab-DNSelhRT.js → chat-tab-DNmhvaZ_.js} +3 -3
- package/dist/web/assets/code-editor-CHwXYDhx.js +10 -0
- package/dist/web/assets/{conflict-editor-CcmoCxAD.js → conflict-editor-DGm0Z6Mc.js} +1 -1
- package/dist/web/assets/{database-viewer-C57quEhw.js → database-viewer-D1nO6a11.js} +1 -1
- package/dist/web/assets/{diff-viewer-1ETGHhmC.js → diff-viewer-Blji3pAc.js} +1 -1
- package/dist/web/assets/{docx-preview-CSIdvMph.js → docx-preview-BRpopR6E.js} +1 -1
- package/dist/web/assets/{extension-webview-DyapNP2E.js → extension-webview-BXeDxyVt.js} +1 -1
- package/dist/web/assets/{git-log-panel-BSNVzOrq.js → git-log-panel-B5n35kot.js} +1 -1
- package/dist/web/assets/{glide-data-grid-CZVrZJpS.js → glide-data-grid-4mwS1Swl.js} +1 -1
- package/dist/web/assets/{image-preview-DprBBsHy.js → image-preview-Bu5XcdqW.js} +1 -1
- package/dist/web/assets/{index-BlRGbnAE.js → index-CuOntRL_.js} +3 -3
- package/dist/web/assets/keybindings-store-Clt4mfff.js +1 -0
- package/dist/web/assets/{markdown-renderer-pJFF8cN8.js → markdown-renderer-Be-gcsCi.js} +1 -1
- package/dist/web/assets/notification-store-B0D4A68q.js +1 -0
- package/dist/web/assets/{pdf-preview-D4iOenvs.js → pdf-preview-hiA6Dkic.js} +1 -1
- package/dist/web/assets/{port-forwarding-tab-Hkq3Oj4T.js → port-forwarding-tab-DTPLT4nk.js} +1 -1
- package/dist/web/assets/{postgres-viewer-BG4CkX-_.js → postgres-viewer-LimIiFby.js} +1 -1
- package/dist/web/assets/{settings-tab-Dwcs9hK5.js → settings-tab-B1wiEtFH.js} +1 -1
- package/dist/web/assets/{sql-query-editor-DRON0V_j.js → sql-query-editor-DGcroNAs.js} +1 -1
- package/dist/web/assets/{sqlite-viewer-BabBjC5D.js → sqlite-viewer-DIfCI2va.js} +1 -1
- package/dist/web/assets/{system-monitor-tab-9fc9tob6.js → system-monitor-tab-CIVm3sgY.js} +1 -1
- package/dist/web/assets/{terminal-tab-c-SljqL9.js → terminal-tab-Dj9xDdbc.js} +1 -1
- package/dist/web/assets/{video-preview-C8lRIJQT.js → video-preview-CnRJmbG8.js} +1 -1
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/web/components/editor/code-editor.tsx +14 -1
- package/dist/web/assets/code-editor-ClG-6IDZ.js +0 -10
- package/dist/web/assets/keybindings-store-CqcGrKcu.js +0 -1
- package/dist/web/assets/notification-store-DQprLwk6.js +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-renderer-pJFF8cN8.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-BlRGbnAE.js","assets/vendor-mermaid-DkqjpqJK.js","assets/vendor-ui-UXCWAcmi.js","assets/vendor-markdown-0Mxgxy0L.js","assets/input-CArJe9WS.js","assets/utils-CSCvNZxE.js","assets/createLucideIcon-BjHrJDVb.js","assets/x-Dx3jsRgu.js","assets/settings-store-DQUFTPk2.js","assets/react-DHBl6KRc.js","assets/api-client-BK4NPNoY.js","assets/eye-off-BacF7RVS.js","assets/chevron-down-CiFNPrfI.js","assets/database-NmqHg29g.js","assets/chevron-right-BzAdxJRG.js","assets/search-BEy08Exr.js","assets/trash-2-D5P4y8p_.js","assets/api-settings-BJTjIG4U.js","assets/panel-store-C9VAhbZz.js","assets/project-store-DlbHpIq0.js","assets/tab-store-CIcbSn0c.js","assets/index-fyMt5gpO.css","assets/csv-preview-asMfgR0r.js","assets/lib-LPmTkMu4.js","assets/arrow-down-D825m4vm.js","assets/arrow-up-Rcw6_KKu.js","assets/csv-parser-D1b_lg2T.js","assets/image-preview-DprBBsHy.js","assets/file-exclamation-point-Baz81y5z.js","assets/use-blob-url-DrPfBQBM.js","assets/pdf-preview-D4iOenvs.js","assets/video-preview-C8lRIJQT.js","assets/audio-preview-CAkLsTgJ.js","assets/docx-preview-CSIdvMph.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
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"./database-NmqHg29g.js";import{t as a}from"./chevron-right-BzAdxJRG.js";import{a as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./input-CArJe9WS.js";import{t as p}from"./code-CuravVys.js";import{i as m,r as h}from"./trash-2-D5P4y8p_.js";import{t as ee}from"./file-exclamation-point-Baz81y5z.js";import{i as g,r as te,t as _}from"./glide-data-grid-CZVrZJpS.js";import{t as ne}from"./shield-check-77W0OMbn.js";import{t as re}from"./shield-off-C_MK1u09.js";import{t as v}from"./table-BzjWcs87.js";import{t as y}from"./text-wrap-DJz9Bgpa.js";import{t as b}from"./x-Dx3jsRgu.js";import{i as ie,t as x}from"./api-client-BK4NPNoY.js";import{n as ae}from"./settings-store-DQUFTPk2.js";import{K as S}from"./vendor-mermaid-DkqjpqJK.js";import{t as C}from"./utils-CSCvNZxE.js";import{t as oe}from"./panel-store-C9VAhbZz.js";import{n as w}from"./project-store-DlbHpIq0.js";import{t as se}from"./tab-store-CIcbSn0c.js";import{C as T,Ct as ce,D as le,Et as ue,O as E,Q as D,R as O,S as k,St as A,_t as j,b as M,bt as N,mt as P,o as de,pt as F,s as fe,st as pe,v as me,vt as he,w as ge,x as _e,xt as I,y as ve,yt as ye}from"./index-BlRGbnAE.js";import"./data-grid-types-DzL5W2em.js";import{n as be,t as xe}from"./use-monaco-theme-BLIgarH5.js";var Se=r(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),L=e(n(),1),R=t(),Ce={ts:I,tsx:I,js:I,jsx:I,py:I,rs:I,go:I,html:I,css:I,scss:I,json:A,md:N,txt:N,yaml:ye,yml:ye};function z(e,t){return t?j:Ce[e.split(`.`).pop()?.toLowerCase()??``]??he}function we(e,t){let n=[],r=e,i=``;for(let e=0;e<t.length;e++){let a=t[e],o=t.slice(0,e+1).join(`/`),s=r.find(e=>e.name===a);if(n.push({name:a,fullPath:o,node:s??null,siblings:r,parentPath:i}),s?.children)i=s.path,r=s.children;else{for(let r=e+1;r<t.length;r++)n.push({name:t[r],fullPath:t.slice(0,r+1).join(`/`),node:null,siblings:[],parentPath:t.slice(0,r).join(`/`)});break}}return n}function B(e){return[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)}function Te({filePath:e,projectName:t,tabId:n,className:r}){let i=O(e=>e.tree),{updateTab:o,openTab:s}=se(le(e=>({updateTab:e.updateTab,openTab:e.openTab}))),c=w(e=>e.projects.find(e=>e.name===t)?.path??``),l=(0,L.useRef)(null),{prefixParts:u,relativePath:d}=(0,L.useMemo)(()=>{let t=e.startsWith(`/`)?e.slice(1):e,n=c.startsWith(`/`)?c.slice(1):c;if(n&&t.startsWith(n+`/`)){let e=t.slice(n.length+1);return{prefixParts:n.split(`/`),relativePath:e}}return{prefixParts:[],relativePath:t}},[e,c]),f=(0,L.useMemo)(()=>we(i,d.split(`/`).filter(Boolean)),[i,d]);(0,L.useEffect)(()=>{l.current&&(l.current.scrollLeft=l.current.scrollWidth)},[f]);function p(e,r){let i=C(e);r.metaKey||r.ctrlKey?s({type:`editor`,title:i,metadata:{filePath:e,projectName:t},projectId:t,closable:!0}):o(n,{title:i,metadata:{filePath:e,projectName:t}})}return(0,R.jsxs)(`div`,{ref:l,className:r,children:[u.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[t>0&&(0,R.jsx)(a,{className:`size-3 text-muted-foreground shrink-0 mx-0.5`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground px-1 py-0.5`,children:e})]},`prefix-${t}`)),f.map((e,n)=>(0,R.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[(n>0||u.length>0)&&(0,R.jsx)(a,{className:`size-3 text-muted-foreground shrink-0 mx-0.5`}),(0,R.jsx)(Ee,{segment:e,isLast:n===f.length-1,projectName:t,onFileClick:p})]},e.fullPath))]})}function Ee({segment:e,isLast:t,projectName:n,onFileClick:r}){let i=O(e=>e.loadChildren),a=O(e=>e.loadedPaths),o=(0,L.useMemo)(()=>B(e.siblings),[e.siblings]),s=a.has(e.parentPath);function c(t){if(t&&!s){let t=e.parentPath.split(`/`).filter(Boolean);(async()=>{for(let e=0;e<=t.length;e++)await i(n,t.slice(0,e).join(`/`))})()}}return(0,R.jsxs)(me,{onOpenChange:c,children:[(0,R.jsx)(ge,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,className:`text-xs px-1 py-0.5 rounded hover:bg-muted transition-colors truncate max-w-[120px] ${t?`text-foreground font-medium`:`text-muted-foreground`}`,children:e.name})}),(0,R.jsx)(ve,{align:`start`,className:`max-h-[300px] p-1`,children:o.length===0?(0,R.jsx)(M,{disabled:!0,className:`text-xs text-muted-foreground`,children:`Loading…`}):o.map(t=>(0,R.jsx)(V,{node:t,projectName:n,activePath:e.fullPath,onFileClick:r},t.path))})]})}function V({node:e,projectName:t,activePath:n,onFileClick:r}){let i=z(e.name,e.type===`directory`),a=e.path===n,o=O(e=>e.loadChildren),s=O(e=>e.loadedPaths);if(e.type===`directory`){let c=e.children??[],l=s.has(e.path);function u(n){n&&!l&&o(t,e.path)}return(0,R.jsxs)(_e,{onOpenChange:u,children:[(0,R.jsxs)(T,{className:`text-xs gap-1.5 ${a?`bg-muted`:``}`,children:[(0,R.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,R.jsx)(k,{className:`max-h-[300px] overflow-y-auto p-1`,children:c.length===0?(0,R.jsx)(M,{disabled:!0,className:`text-xs text-muted-foreground`,children:`Loading…`}):B(c).map(e=>(0,R.jsx)(V,{node:e,projectName:t,activePath:n,onFileClick:r},e.path))})]})}return(0,R.jsxs)(M,{className:`text-xs gap-1.5 cursor-pointer ${a?`bg-muted`:``}`,onSelect:e=>{},onClick:t=>{r(e.path,t)},children:[(0,R.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.name})]})}function H({active:e,onClick:t,icon:n,label:r}){return(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,R.jsx)(n,{className:`size-3`}),(0,R.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function De({ext:e,mdMode:t,onMdModeChange:n,csvMode:r,onCsvModeChange:i,wordWrap:a,onToggleWordWrap:o,filePath:s,projectName:c,className:l}){return(0,R.jsxs)(`div`,{className:l,children:[(e===`md`||e===`mdx`)&&n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{active:t===`edit`,onClick:()=>n(`edit`),icon:p,label:`Edit`}),(0,R.jsx)(H,{active:t===`preview`,onClick:()=>n(`preview`),icon:h,label:`Preview`})]}),e===`csv`&&i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{active:r===`table`,onClick:()=>i(`table`),icon:v,label:`Table`}),(0,R.jsx)(H,{active:r===`raw`,onClick:()=>i(`raw`),icon:p,label:`Raw`})]}),(0,R.jsx)(H,{active:a,onClick:o,icon:y,label:`Wrap`}),s&&c&&(0,R.jsx)(H,{active:!1,onClick:()=>E(c,s),icon:m,label:`Download`})]})}function Oe({open:e,defaultName:t,content:n,onSave:r,onCancel:i}){let[a,p]=(0,L.useState)(t),[m,h]=(0,L.useState)(!1),[ee,g]=(0,L.useState)(``),te=w(e=>e.activeProject),_=(0,L.useCallback)(()=>{let e=a.trim();if(!e){g(`Filename cannot be empty`);return}if(/[/\\]/.test(e)){g(`Filename cannot contain / or \\`);return}g(``),h(!0)},[a]),ne=(0,L.useCallback)(e=>{let t=e.includes(`\\`)?`\\`:`/`;r(e.endsWith(t)?`${e}${a.trim()}`:`${e}${t}${a.trim()}`,n)},[a,n,r]);return m?(0,R.jsx)(fe,{open:!0,mode:`folder`,root:te?.path,title:`Save "${a.trim()}" to...`,onSelect:ne,onCancel:()=>h(!1)}):(0,R.jsx)(c,{open:e,onOpenChange:e=>{e||i()},children:(0,R.jsxs)(u,{className:`sm:max-w-md`,children:[(0,R.jsx)(l,{children:(0,R.jsx)(d,{children:`Save As`})}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,R.jsx)(`label`,{className:`text-sm text-muted-foreground`,children:`Filename`}),(0,R.jsx)(f,{value:a,onChange:e=>{p(e.target.value),g(``)},onKeyDown:e=>{e.key===`Enter`&&_()},placeholder:`e.g. my-file.ts`,autoFocus:!0}),ee&&(0,R.jsx)(`p`,{className:`text-xs text-destructive`,children:ee})]}),(0,R.jsxs)(o,{children:[(0,R.jsx)(s,{variant:`outline`,onClick:i,children:`Cancel`}),(0,R.jsx)(s,{onClick:_,children:`Choose Folder...`})]})]})})}var U=typeof window<`u`&&window.isSecureContext,W=[`(`,`)`,`{`,`}`,`[`,`]`,`<`,`>`,`;`,`:`,`=`,`"`,`'`,"`",`/`,`\\`,`_`,`#`],G=`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,ke=`px-3 py-1.5 rounded text-xs font-mono min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,K=`w-px h-5 bg-border mx-0.5 shrink-0`;function Ae({editorRef:e,readOnly:t}){let n=(0,L.useCallback)(()=>e.current,[e]),r=(0,L.useCallback)(e=>{let t=n();if(!t)return;t.focus();let r=t.getSelection();r&&t.executeEdits(`mobile-toolbar`,[{range:r,text:e}])},[n]),[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=(0,L.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&r(e)}catch{}},[r]),c=(0,L.useCallback)(()=>{a(!0),requestAnimationFrame(()=>o.current?.focus())},[]),l=(0,L.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`);t&&(a(!1),r(t))},[r]),u=(0,L.useCallback)(()=>{let e=n();e&&(e.focus(),e.trigger(`mobile-toolbar`,`undo`,null))},[n]),d=(0,L.useCallback)(()=>{let e=n();e&&(e.focus(),e.trigger(`mobile-toolbar`,`redo`,null))},[n]),f=(0,L.useCallback)(()=>{let e=n();e&&(e.focus(),e.trigger(`mobile-toolbar`,`tab`,null))},[n]);return t?null:(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border bg-surface`,children:[!U&&i&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 border-b border-border bg-muted/50`,children:[(0,R.jsx)(`textarea`,{ref:o,onPaste:l,placeholder:`Long-press here → Paste`,className:`flex-1 h-8 rounded border border-border bg-background text-foreground text-xs px-2 py-1.5 resize-none focus:outline-none focus:ring-1 focus:ring-primary`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>a(!1),className:`p-1.5 rounded text-muted-foreground active:bg-muted transition-colors`,children:(0,R.jsx)(b,{size:14})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 overflow-x-auto`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:U?s:c,className:G,title:`Paste`,children:(0,R.jsx)(ue,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:u,className:G,title:`Undo`,children:(0,R.jsx)(D,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:d,className:G,title:`Redo`,children:(0,R.jsx)(Se,{size:14})}),(0,R.jsx)(`div`,{className:K}),(0,R.jsx)(`button`,{type:`button`,onClick:f,className:ke,children:`Tab`}),(0,R.jsx)(`div`,{className:K}),W.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:ke,children:e},e))]})]})}var q=(0,L.lazy)(()=>S(()=>import(`./markdown-renderer-pJFF8cN8.js`).then(e=>({default:e.MarkdownRenderer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),je=(0,L.lazy)(()=>S(()=>import(`./csv-preview-asMfgR0r.js`).then(e=>({default:e.CsvPreview})),__vite__mapDeps([24,1,4,5,25,26,8,27,28]))),Me=(0,L.lazy)(()=>S(()=>import(`./image-preview-DprBBsHy.js`).then(e=>({default:e.ImagePreview})),__vite__mapDeps([29,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,30,31]))),Ne=(0,L.lazy)(()=>S(()=>import(`./pdf-preview-D4iOenvs.js`).then(e=>({default:e.PdfPreview})),__vite__mapDeps([32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,30]))),Pe=(0,L.lazy)(()=>S(()=>import(`./video-preview-C8lRIJQT.js`).then(e=>({default:e.VideoPreview})),__vite__mapDeps([33,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,30,31]))),Fe=(0,L.lazy)(()=>S(()=>import(`./audio-preview-CAkLsTgJ.js`).then(e=>({default:e.AudioPreview})),__vite__mapDeps([34,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,30,31]))),Ie=(0,L.lazy)(()=>S(()=>import(`./docx-preview-CSIdvMph.js`).then(e=>({default:e.DocxPreview})),__vite__mapDeps([35,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,30]))),Le=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`]),Re=new Set([`mp4`,`webm`,`mov`,`ogg`,`avi`,`mkv`]),ze=new Set([`mp3`,`wav`,`flac`,`aac`,`m4a`,`wma`]),Be=new Set([`db`,`sqlite`,`sqlite3`]);function Ve(e){return e.split(`.`).pop()?.toLowerCase()??``}function He(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`,sql:`sql`}[Ve(e)]??`plaintext`}var Ue=(0,L.memo)(function({metadata:e,tabId:t}){let n=e?.filePath,r=e?.projectName,a=e?.inlineContent,o=e?.inlineLanguage,[s,c]=(0,L.useState)(a??null),[l,u]=(0,L.useState)(`utf-8`),[d,f]=(0,L.useState)(!0),[p,m]=(0,L.useState)(null),[h,_]=(0,L.useState)(!1),v=(0,L.useRef)(null),y=(0,L.useRef)(``),b=(0,L.useRef)(null),{tabs:S,updateTab:w}=se(le(e=>({tabs:e.tabs,updateTab:e.updateTab}))),{wordWrap:T,toggleWordWrap:ce}=ae(le(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap}))),ue=xe(),E=e?.isUntitled===!0,D=e?.unsavedContent,[O,k]=(0,L.useState)(!1),A=S.find(e=>e.id===t),j=n?Ve(n):``,M=Le.has(j),N=j===`pdf`,P=j===`docx`,fe=Re.has(j),me=ze.has(j),he=Be.has(j),ge=j===`md`||j===`mdx`,_e=j===`csv`,I=j===`sql`,[ve,ye]=(0,L.useState)(`preview`),[Se,Ce]=(0,L.useState)(`table`),{connections:z,cachedTables:we,refreshTables:B,updateConnection:Ee}=de(),[V,H]=(0,L.useState)(()=>{if(!I||!n)return null;let e=localStorage.getItem(`ppm:sql-conn:${n}`);return e?Number(e):null}),U=(0,L.useRef)(null),W=(0,L.useRef)(null),G=(0,L.useMemo)(()=>z.find(e=>e.id===V)??null,[z,V]),ke=a!=null&&(o===`json`||o===`xml`),[K,q]=(0,L.useState)(!1),Ue=(0,L.useCallback)(()=>{if(a)if(K)c(a),q(!1);else{let e=a.trimStart();if(o===`json`)try{c(JSON.stringify(JSON.parse(e),null,2)),q(!0)}catch{}else if(o===`xml`){let t=0;c(e.replace(/(>)(<)(\/*)/g,`$1
|
|
3
|
-
$2$3`).split(`
|
|
4
|
-
`).map(e=>{let n=e.trim();n.startsWith(`</`)&&(t=Math.max(0,t-1));let r=` `.repeat(t)+n;return n.startsWith(`<`)&&!n.startsWith(`</`)&&!n.endsWith(`/>`)&&!n.includes(`</`)&&t++,r}).join(`
|
|
5
|
-
`)),q(!0)}}},[a,o,K]),J=(0,L.useCallback)(e=>{H(e),n&&localStorage.setItem(`ppm:sql-conn:${n}`,String(e)),B(e).catch(()=>{})},[n,B]),X=(0,L.useMemo)(()=>{if(!I||!V)return;let e=(we.get(V)??[]).map(e=>({name:e.tableName,schema:e.schemaName}));if(e.length!==0)return{tables:e,getColumns:async(e,t)=>x.get(`/api/db/connections/${V}/schema?table=${encodeURIComponent(e)}${t?`&schema=${encodeURIComponent(t)}`:``}`)}},[I,V,we]);(0,L.useEffect)(()=>{if(!(!U.current||!X))return W.current?.dispose(),te(),W.current=U.current.languages.registerCompletionItemProvider(`sql`,g(U.current,X)),()=>{W.current?.dispose()}},[X]);let Ke=se(e=>e.openTab),[qe,Je]=(0,L.useState)(null),[Ye,Xe]=(0,L.useState)(null),[Ze,Qe]=(0,L.useState)(!1),[$e,et]=(0,L.useState)(``),Z=(0,L.useCallback)(async e=>{if(G){Qe(!0),Xe(null),et(e);try{Je(await x.post(`/api/db/connections/${G.id}/query`,{sql:e}))}catch(e){Xe(e.message),Je(null)}finally{Qe(!1)}}},[G]),tt=(0,L.useCallback)(()=>{!G||!$e||Ke({type:`database`,title:`${G.name} · Query`,projectId:null,closable:!0,metadata:{connectionId:G.id,connectionName:G.name,dbType:G.type,initialSql:$e}})},[G,Ke,$e]),nt=(0,L.useCallback)(()=>{if(!b.current||!G)return;let e=b.current,t=e.getSelection();Z(t&&!t.isEmpty()?e.getModel()?.getValueInRange(t)??e.getValue():e.getValue())},[G,Z]),rt=typeof window<`u`&&`ontouchstart`in window,it=(0,L.useRef)(null),[at,ot]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!rt)return;let e=window.visualViewport;if(!e)return;let t=()=>{let t=it.current;if(!t)return;let n=t.getBoundingClientRect().top;ot(e.height-Math.max(0,n))};return e.addEventListener(`resize`,t),e.addEventListener(`scroll`,t),()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,t)}},[rt]);let Q=(0,L.useRef)([]),st=(0,L.useRef)(Z);st.current=Z,(0,L.useEffect)(()=>()=>{Q.current.forEach(e=>e.dispose()),Q.current=[]},[]),(0,L.useEffect)(()=>{he&&t&&w(t,{type:`sqlite`})},[he,t,w]);let $=n?/^(\/|[A-Za-z]:[/\\])/.test(n):!1;(0,L.useEffect)(()=>{if(a!=null){f(!1);return}if(E){c(D??``),y.current=D??``,f(!1),D&&_(!0);return}if(!n||!$&&!r)return;if(M||N||P||fe||me){f(!1);return}f(!0),m(null);let e=$?`/api/fs/read?path=${encodeURIComponent(n)}`:`${ie(r)}/files/read?path=${encodeURIComponent(n)}`;return x.get(e).then(e=>{c(e.content),e.encoding&&u(e.encoding),y.current=e.content,f(!1)}).catch(e=>{m(e instanceof Error?e.message:`Failed to load file`),f(!1)}),()=>{v.current&&clearTimeout(v.current)}},[n,r,M,N,P,$,E]);let ct=(0,L.useRef)(h);ct.current=h,(0,L.useEffect)(()=>{if(!n||!r||a!=null||E)return;let e=e=>{let t=e.detail;if(t.projectName!==r||t.path!==n||ct.current)return;let i=$?`/api/fs/read?path=${encodeURIComponent(n)}`:`${ie(r)}/files/read?path=${encodeURIComponent(n)}`;x.get(i).then(e=>{e.content!==y.current&&(c(e.content),y.current=e.content,e.encoding&&u(e.encoding))}).catch(()=>{})};return window.addEventListener(`file:changed`,e),()=>window.removeEventListener(`file:changed`,e)},[n,r,$,a,E]),(0,L.useEffect)(()=>{if(!A||a!=null)return;let t=E?`Untitled-${e?.untitledNumber??1}`:n?C(n):`Untitled`,r=h?`${t} \u25CF`:t;A.title!==r&&w(A.id,{title:r})},[h]);let lt=(0,L.useCallback)(async e=>{if(n&&!(!$&&!r))try{$?await x.put(`/api/fs/write`,{path:n,content:e}):await x.put(`${ie(r)}/files/write`,{path:n,content:e}),_(!1)}catch{}},[n,r,$]);function ut(n){let r=n??``;c(r),y.current=r,_(!0),v.current&&clearTimeout(v.current),E?v.current=setTimeout(()=>{t&&w(t,{metadata:{...e,unsavedContent:y.current}})},2e3):v.current=setTimeout(()=>lt(y.current),1e3)}let dt=(0,L.useCallback)(async(e,n)=>{try{if(v.current&&clearTimeout(v.current),await x.put(`/api/fs/write`,{path:e,content:n}),t){let{closeTab:n,openTab:r}=oe.getState();n(t),r({type:`editor`,title:C(e),projectId:null,metadata:{filePath:e},closable:!0})}_(!1),k(!1)}catch{}},[t]),ft=e?.lineNumber,pt=(0,L.useCallback)((e,t)=>{if(b.current=e,U.current=t,ft&&ft>0&&setTimeout(()=>{e.revealLineInCenter(ft),e.setPosition({lineNumber:ft,column:1}),e.focus()},100),E&&e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>k(!0)),e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyZ,()=>ae.getState().toggleWordWrap()),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0}),t.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0}),X&&(W.current?.dispose(),W.current=t.languages.registerCompletionItemProvider(`sql`,g(t,X))),I){Q.current.forEach(e=>e.dispose()),Q.current=[];let n=e.getModel(),r=e.addCommand(0,(e,t)=>{t&&st.current(t)});if(r&&n){let e=t.languages.registerCodeLensProvider(`sql`,{provideCodeLenses:e=>{if(e!==n)return{lenses:[],dispose:()=>{}};let t=[],i=e.getValue().split(`
|
|
6
|
-
`),a=-1,o=[],s=!1,c=/^(BEGIN|COMMIT|ROLLBACK|END)(;|\s|$)/i,l=-1,u=[],d=(e,n,i=`▷ Run`)=>{let a=n.trim();!a||a.startsWith(`--`)||t.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},command:{id:r,title:i,arguments:[a]}})};for(let e=0;e<i.length;e++){let t=i[e].trim();if(a===-1){if(!t||t.startsWith(`--`))continue;a=e+1,o=[]}if(o.push(i[e]),(t.match(/\$\$/g)||[]).length%2==1&&(s=!s),!s&&t.endsWith(`;`)){let e=o.join(`
|
|
7
|
-
`).trim(),t=/^BEGIN(;|\s|$)/i.test(e),n=/^(COMMIT|ROLLBACK|END)(;|\s|$)/i.test(e);l===-1&&t?(l=a,u=[e]):l>-1?(u.push(e),!n&&!c.test(e)&&d(a,e),n&&(d(l,u.join(`
|
|
8
|
-
`),`▷ Run Transaction`),l=-1,u=[])):d(a,e),a=-1,o=[]}}return l>-1&&u.length>1&&d(l,u.join(`
|
|
9
|
-
`),`▷ Run Transaction`),a>0&&o.join(``).trim()&&d(a,o.join(`
|
|
10
|
-
`)),{lenses:t,dispose:()=>{}}}});Q.current.push(e);let i=t.languages.registerFoldingRangeProvider(`sql`,{provideFoldingRanges:e=>{if(e!==n)return[];let r=[],i=e.getLineCount(),a=[];for(let n=1;n<=i;n++){let i=e.getLineContent(n).trim();if(/^BEGIN(;|\s|$)/i.test(i))a.push(n);else if(/^(COMMIT|ROLLBACK|END)(;|\s|$)/i.test(i)&&a.length>0){let e=a.pop();r.push({start:e,end:n,kind:t.languages.FoldingRangeKind.Region})}}return r}});Q.current.push(i)}}},[X]);if(!a&&!E&&(!n||!$&&!r))return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No file selected.`});if(d)return(0,R.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,R.jsx)(F,{className:`size-5 animate-spin`}),(0,R.jsx)(`span`,{className:`text-sm`,children:`Loading file...`})]});if(p)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-error text-sm`,children:p});if(M)return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(Y,{}),children:(0,R.jsx)(Me,{filePath:n,projectName:r})});if(N)return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(Y,{}),children:(0,R.jsx)(Ne,{filePath:n,projectName:r})});if(P)return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(Y,{}),children:(0,R.jsx)(Ie,{filePath:n,projectName:r})});if(fe)return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(Y,{}),children:(0,R.jsx)(Pe,{filePath:n,projectName:r})});if(me)return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(Y,{}),children:(0,R.jsx)(Fe,{filePath:n,projectName:r})});if(l===`base64`)return(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,R.jsx)(ee,{className:`size-10 text-text-subtle`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`This file is a binary format and cannot be displayed.`}),(0,R.jsx)(`p`,{className:`text-xs text-text-subtle`,children:n})]});let mt=I?(0,R.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1 px-2 border-l border-border`,children:[(0,R.jsx)(i,{className:`size-3 text-muted-foreground`}),(0,R.jsxs)(`select`,{value:V??``,onChange:e=>{let t=Number(e.target.value);t&&J(t)},className:`h-5 text-[10px] bg-transparent border border-border rounded px-1 text-foreground outline-none max-w-[140px]`,title:`Select connection for autocomplete`,children:[(0,R.jsx)(`option`,{value:``,children:`Connection…`}),z.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,R.jsx)(`button`,{type:`button`,onClick:nt,disabled:!G,className:`p-0.5 rounded text-muted-foreground hover:text-primary disabled:opacity-30 transition-colors`,title:`Run SQL`,children:(0,R.jsx)(pe,{className:`size-3.5`})}),G&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>Ee(G.id,{readonly:G.readonly?0:1}),className:`flex items-center gap-0.5 px-1 py-0.5 rounded text-[10px] transition-colors ${G.readonly?`text-muted-foreground hover:text-foreground`:`bg-destructive/15 text-destructive`}`,title:G.readonly?`Readonly — click to allow writes`:`WRITE mode — click to enable readonly`,children:G.readonly?(0,R.jsx)(ne,{className:`size-3`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(re,{className:`size-3`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`WRITE`})]})})]}):null;return(0,R.jsxs)(`div`,{ref:it,className:`flex flex-col h-full w-full overflow-hidden`,style:at?{height:`${at}px`,maxHeight:`${at}px`}:void 0,children:[a!=null&&ke&&(0,R.jsx)(`div`,{className:`flex items-center h-7 border-b border-border bg-background shrink-0 px-2 gap-2`,children:(0,R.jsx)(`button`,{type:`button`,onClick:Ue,className:`text-[10px] px-2 py-0.5 rounded border border-border hover:bg-muted transition-colors text-foreground`,children:K?`Raw`:`Beautify`})}),n&&r&&t&&(0,R.jsxs)(`div`,{className:`hidden md:flex items-center h-7 border-b border-border bg-background shrink-0`,children:[(0,R.jsx)(Te,{filePath:n,projectName:r,tabId:t,className:`flex items-center flex-1 min-w-0 overflow-x-auto scrollbar-none px-2 gap-0.5`}),mt,(0,R.jsx)(De,{ext:j,mdMode:ve,onMdModeChange:ye,csvMode:Se,onCsvModeChange:Ce,wordWrap:T,onToggleWordWrap:ce,filePath:n,projectName:r,className:`shrink-0 flex items-center gap-1 px-2`})]}),I&&(!r||!t)&&(0,R.jsxs)(`div`,{className:`hidden md:flex items-center h-7 border-b border-border bg-background shrink-0 px-2`,children:[(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1`,children:n?C(n):`SQL`}),mt]}),_e&&Se===`table`?(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,R.jsx)(F,{className:`size-5 animate-spin text-text-subtle`})}),children:(0,R.jsx)(je,{content:s??``,onContentChange:ut,wordWrap:T})}):ge&&ve===`preview`?(0,R.jsx)(Ge,{content:s??``}):(0,R.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:(0,R.jsx)(be,{height:`100%`,language:o??He(n??``),value:s??``,onChange:a==null?ut:void 0,onMount:pt,theme:ue,options:{fontSize:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:T?`on`:`off`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbers:`on`,folding:!0,bracketPairColorization:{enabled:!0},readOnly:a!=null},loading:(0,R.jsx)(F,{className:`size-5 animate-spin text-text-subtle`})})}),I&&(qe||Ye||Ze)&&(0,R.jsx)(We,{result:qe,error:Ye,loading:Ze,connName:G?.name,onClose:()=>{Je(null),Xe(null),Qe(!1)},onOpenInTab:tt}),rt&&(0,R.jsx)(Ae,{editorRef:b,readOnly:a!=null}),O&&(0,R.jsx)(Oe,{open:O,defaultName:`Untitled-${e?.untitledNumber??1}`,content:y.current,onSave:dt,onCancel:()=>k(!1)})]})}),J=()=>{};function We({result:e,error:t,loading:n,connName:r,onClose:a,onOpenInTab:o}){let s=(0,L.useMemo)(()=>e?.changeType===`select`&&e.rows.length>0?{columns:e.columns,rows:e.rows,total:e.rows.length,limit:e.rows.length}:null,[e]),c=(0,L.useMemo)(()=>(e?.columns??[]).map(e=>({name:e,type:`text`,nullable:!0,pk:!1,defaultValue:null})),[e?.columns]),[l,u]=(0,L.useState)(250),d=(0,L.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=l,r=e=>u(Math.max(80,n+(t-e.clientY))),i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[l]);return(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border flex flex-col`,style:{height:l},children:[(0,R.jsx)(`div`,{onMouseDown:d,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,R.jsx)(P,{className:`size-3 text-muted-foreground/50`})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 bg-muted/50 border-b border-border shrink-0`,children:[(0,R.jsx)(i,{className:`size-3 text-muted-foreground`}),(0,R.jsxs)(`span`,{className:`text-xs font-medium text-foreground truncate flex-1`,children:[r?`${r} · Results`:`Query Results`,e?.executionTimeMs!=null&&(0,R.jsxs)(`span`,{className:`text-muted-foreground ml-1.5 font-normal`,children:[e.executionTimeMs,`ms`]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:o,title:`Open in DB Viewer tab`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,R.jsx)(ce,{className:`size-3`}),(0,R.jsx)(`span`,{className:`hidden sm:inline`,children:`Open in Tab`})]}),(0,R.jsx)(`button`,{type:`button`,onClick:a,title:`Close results`,className:`p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,R.jsx)(b,{className:`size-3`})})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:[n&&(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,R.jsx)(F,{className:`size-4 animate-spin text-muted-foreground`})}),t&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-xs text-destructive bg-destructive/5`,children:t}),e?.changeType===`modify`&&(0,R.jsxs)(`div`,{className:`px-3 py-2 text-xs text-green-500`,children:[e.rowsAffected,` row(s) affected`]}),s&&(0,R.jsx)(_,{columns:s.columns,rows:s.rows,total:s.total,limit:s.limit,schema:c,loading:!1,page:1,onPageChange:J,onCellUpdate:J,orderBy:null,orderDir:`ASC`,onToggleSort:J,connectionName:r}),e?.changeType===`select`&&e.rows.length===0&&(0,R.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`No results`})]})]})}function Y(){return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,R.jsx)(F,{className:`size-5 animate-spin text-text-subtle`})})}function Ge({content:e}){return(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded m-4`}),children:(0,R.jsx)(q,{content:e,className:`flex-1 overflow-auto p-4`})})}export{Ue as CodeEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./vendor-markdown-0Mxgxy0L.js";import"./api-client-BK4NPNoY.js";import{L as e}from"./index-BlRGbnAE.js";export{e as useKeybindingsStore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./vendor-markdown-0Mxgxy0L.js";import"./api-client-BK4NPNoY.js";import{W as e}from"./index-BlRGbnAE.js";export{e as useNotificationStore};
|