efficient-shell 4.179.0 → 4.180.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/README.md +3 -1
- package/dist/{Browser-LZMLL4CZ.js → Browser-RZFOKBSF.js} +12 -12
- package/dist/{Documents-M4HKZAPJ.js → Documents-VD32HWDQ.js} +2 -2
- package/dist/{Files-OY5GKCXA.js → Files-NAY3WK6O.js} +17 -17
- package/dist/{Notepad-JLDNTMVB.js → Notepad-AHRPMF57.js} +8 -8
- package/dist/{Preview-2KHLL6NP.js → Preview-OKR5QRQP.js} +1 -1
- package/dist/{Spreadsheet-B5Z5MSX4.js → Spreadsheet-RME4IQ43.js} +10 -10
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-47VJNVB6.js → chunk-4VTHXNGZ.js} +12 -12
- package/dist/chunk-BSJIBRWC.js +1 -0
- package/dist/{chunk-CZK2VKIO.js → chunk-RQOP5JAJ.js} +2 -2
- package/dist/{index-DcUj0nXY.d.ts → index-HAwjA-hn.d.ts} +11 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -25
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AZURXTRB.js +0 -1
package/README.md
CHANGED
|
@@ -862,7 +862,9 @@ Round 4:
|
|
|
862
862
|
fade: no chevron, never opens, still focusable, `aria-readonly`. It draws the
|
|
863
863
|
desktop field on touch too, since a native `<select>` can only fade.
|
|
864
864
|
`renderValue(chosen)` draws the closed field, given the chosen options in
|
|
865
|
-
the options' order. The label stays the words a screen reader reads
|
|
865
|
+
the options' order. The label stays the words a screen reader reads, unless
|
|
866
|
+
`valueText(chosen)` gives others: for a drawing that says something else than
|
|
867
|
+
the label (a list that offers "No style" under a box that reads "Custom").
|
|
866
868
|
- **`SearchableSelect`**: option groups (`{ label, options }`), `multiple`
|
|
867
869
|
(`value: string[]`, `onChange(string[])`, toggles and stays open, each chosen
|
|
868
870
|
option checked), `disabled` options (greyed, skipped by the arrows, inert to
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-RQOP5JAJ.js";import{WindowTitle as r}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as n}from"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useRef as a,useEffect as i,useState as s}from"react";import{jsxs as l,jsx as c,Fragment as m}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",u="react-os-shell:browser-homepage",h="https://en.wikipedia.org/wiki/Main_Page",p=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function b(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function f(){if("undefined"==typeof window)return p;try{const e=localStorage.getItem(d);if(!e)return p;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return p}function x(){return"undefined"==typeof window?h:localStorage.getItem(u)||h}function w(){const m=a(void 0);void 0===m.current&&(m.current=e()),i(()=>{null!=m.current&&t(m.current)},[]);const h=m.current?b(m.current.url):"",[p,g]=s(x),[k,w]=s(h||p),[N,L]=s(k),[j,C]=s([k]),[z,M]=s(0),[R,S]=s(0),[W,H]=s(f),[A,B]=s(!1),[O,I]=s(null),E=a(null),T=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(W))}catch{}},[W]);const D=e=>{const t=b(e);t&&(w(t),L(t),C(e=>{const o=e.slice(0,z+1);return o.push(t),o}),M(e=>e+1),B(!1))},F=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},J=()=>{const e=O?.trim();e?(H(t=>[...t,{label:e,url:k}]),I(null)):I(null)};i(()=>{if(null===O)return;E.current?.focus(),E.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||I(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==O]);const P=e=>{H(t=>t.filter((t,o)=>o!==e))},X=z>0,Q=z<j.length-1,U=W.some(e=>e.url===k),V="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return l("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */c(r,{title:`Browser - ${v(k)}`}),
|
|
4
4
|
/* @__PURE__ */c(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */l("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(j[e]),L(j[e]),
|
|
7
|
-
/* @__PURE__ */c("button",{onClick:()=>{if(z<j.length-1){const e=z+1;M(e),w(j[e]),L(j[e]),
|
|
8
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */c("button",{onClick:()=>D(p),className:
|
|
6
|
+
/* @__PURE__ */c("button",{onClick:()=>{if(z>0){const e=z-1;M(e),w(j[e]),L(j[e]),B(!1)}},disabled:!X,className:V,title:"Back",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}),
|
|
7
|
+
/* @__PURE__ */c("button",{onClick:()=>{if(z<j.length-1){const e=z+1;M(e),w(j[e]),L(j[e]),B(!1)}},disabled:!Q,className:V,title:"Forward",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),
|
|
8
|
+
/* @__PURE__ */c("button",{onClick:()=>S(e=>e+1),className:V,title:"Refresh",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
|
|
9
|
+
/* @__PURE__ */c("button",{onClick:()=>D(p),className:V,title:"Home",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0l8.954 8.955M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})}),
|
|
10
10
|
/* @__PURE__ */c("form",{onSubmit:e=>{e.preventDefault(),D(N)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */l("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */c("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */c("input",{type:"text",value:N,onChange:e=>L(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),k!==N&&/* @__PURE__ */c("button",{type:"button",onClick:()=>L(k),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */c("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */c("button",{onClick:F,className:
|
|
15
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
13
|
+
/* @__PURE__ */c("button",{"data-bookmark-popover":!0,onClick:()=>U?P(W.findIndex(e=>e.url===k)):void I(v(k)),className:V+" "+(U?"text-yellow-500":""),title:U?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:U?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),
|
|
14
|
+
/* @__PURE__ */c("button",{onClick:F,className:V,title:"Open in new tab",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-7.5-9L21 3m0 0v6m0-6L9.75 14.25"})})}),
|
|
15
|
+
/* @__PURE__ */c("button",{onClick:()=>B(e=>!e),className:V,title:"Embedding help",children:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"})})})]}),null!==O&&/* @__PURE__ */l("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */c("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */c("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
|
|
18
|
-
/* @__PURE__ */c("input",{ref:
|
|
18
|
+
/* @__PURE__ */c("input",{ref:E,type:"text",value:O,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key?J():"Escape"===e.key&&I(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */l("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
20
|
/* @__PURE__ */c("button",{onClick:()=>I(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
-
/* @__PURE__ */c("button",{onClick:
|
|
22
|
-
/* @__PURE__ */l("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */c("button",{onClick:J,disabled:!O.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */l("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===W.length&&/* @__PURE__ */c("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),W.map((e,t)=>/* @__PURE__ */l("button",{onClick:()=>D(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&P(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */c("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */c("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */c("button",{onClick:()=>{g(k);try{localStorage.setItem(u,k)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:R,iframeRef:
|
|
26
|
+
/* @__PURE__ */c("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */c(y,{url:k,iframeKey:R,iframeRef:T,openExternal:F,showHelp:A,dismissHelp:()=>B(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function y({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,u]=s(!1);i(()=>{u(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */c("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */l("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */c("svg",{className:"h-14 w-14 mx-auto text-gray-300 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.2,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728L5.636 5.636m12.728 12.728L21 21M5.636 5.636L3 3m9 9a9 9 0 110-18 9 9 0 010 18z"})}),
|
|
28
28
|
/* @__PURE__ */l("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */l("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-RQOP5JAJ.js";import{WindowTitle as n}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import{toast_default as r}from"./chunk-3DGTIWZP.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as s,useRef as c}from"react";import{jsxs as d,jsx as h}from"react/jsx-runtime";var m=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),u=/* @__PURE__ */new Set(["docx"]),p={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function g(){const[g,x]=s(p),[f,y]=s(!1),[v,b]=s(!1),[k,w]=s(!1),[N,C]=s(null),j=c(null),D=c(null),L=c(null),M=(e,t)=>{L.current?.focus(),document.execCommand(e,!1,t),w(!0)},R=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{L.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),w(!0)},e.readAsDataURL(t)}},U=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",w(!0),C(null))},A=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();y(!0);try{if(m.has(n)||!u.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");x({filename:t.name,kind:"text",content:o,ext:n}),w(!1)}else if(u.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),w(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{y(!1)}},O=g?.filename?(
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});x({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),w(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{y(!1)}},O=g?.filename?(B=g.filename).length>24?`${B.slice(0,23)}…`:B:"Untitled";var B;/* @__PURE__ */
|
|
4
4
|
return d("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),v||b(!0)},onDragLeave:e=>{e.currentTarget===e.target&&b(!1)},onDrop:e=>{e.preventDefault(),b(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?R(t):A(t[0]))},children:[
|
|
5
5
|
/* @__PURE__ */h(n,{title:`${O}${k?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */h(t,{app:"documents"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-NHIGOEZF.js";import{Breadcrumbs as t}from"./chunk-7WZEFHPS.js";import{SidebarLayout as r}from"./chunk-PE4F4MJE.js";import{getFilesDemoTree as a}from"./chunk-ILTSTULF.js";import{AboutApp as n}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-NHIGOEZF.js";import{Breadcrumbs as t}from"./chunk-7WZEFHPS.js";import{SidebarLayout as r}from"./chunk-PE4F4MJE.js";import{getFilesDemoTree as a}from"./chunk-ILTSTULF.js";import{AboutApp as n}from"./chunk-RQOP5JAJ.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as s,FILES_OPEN_DESKTOP_FOLDER_EVENT as l,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-C2A4PIGZ.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as u,WindowTitle as f}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import{toast_default as x}from"./chunk-3DGTIWZP.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as g,prompt as y}from"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{formatBytes as k}from"./chunk-W32SKK3D.js";import"./chunk-YKZHOXI4.js";import{useState as b,useEffect as v,useSyncExternalStore as w,useRef as N,useCallback as L}from"react";import{jsxs as j,jsx as C,Fragment as $}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",T={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function D(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function E(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function A(){const A=M.replace(/\/$/,""),R=null!==a(),[F,P]=b("/"),[S,I]=b([]),[O,W]=b([]),[B,H]=b(null),[V,U]=b(!0),[z,J]=b(!1),[Z,K]=b(null),[Q,X]=b(!1),[_,G]=b(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});v(()=>{o()},[]);const[Y,q]=b([]);v(()=>{const e=()=>{o(),G("trash")},t=e=>{o();const t=e.detail?.folderId;t&&G({desktopFolderId:t})};return window.addEventListener(s,e),window.addEventListener(l,t),()=>{window.removeEventListener(s,e),window.removeEventListener(l,t)}},[]);const ee=w(d,c,c),te="object"==typeof _?_.desktopFolderId:null,re=te?ee?.folders.find(e=>e.id===te)??null:null,ae=te&&ee?.itemsByFolder[te]||[];v(()=>{te&&ee&&!ee.folders.some(e=>e.id===te)&&G("files")},[te,ee]);const ne=N(0),ie=N(null),{openPage:oe,openEntity:se}=u(),le=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>oe(e)}):"page"===t.entityType?oe(t.entityId):se(t.entityType,t.entityId,null,t.label)},de=L((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ce=L(async()=>{try{const e=await de(`${A}/api/quota`);if(e.ok){const t=await e.json();K({used:t.used,limit:t.limit})}}catch{}},[de,A]),me=L(async e=>{if(H(null),R){const t=function(e){const t=a();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return I(t),P(e),J(!1),U(!1),void("/"===e&&W(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}U(!0);try{const t=await de(`${A}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];I(a),P(r.path||e),J(!1),"/"===(r.path||e)&&W(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){J(!0)}finally{U(!1)}ce()},[de,A,ce,R]),he=L(async()=>{if(R)return q([]),void U(!1);U(!0),H(null);try{const e=await de(`${A}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();q(t.entries||[]),J(!1)}catch{J(!0)}finally{U(!1)}ce()},[de,A,ce,R]);v(()=>{"files"===_?me(F):"trash"===_&&he()},[F,_]);const pe=async e=>{const t=D(F,e.name);try{const r=await de(`${A}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void x.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},ue=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const r=await de(`${A}/api/upload?path=${encodeURIComponent(F)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${k(r)} free, ${e.name} is ${k(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}me(F)},fe=()=>{ne.current=0,X(!1)};if(v(()=>{const e=()=>fe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),z)/* @__PURE__ */
|
|
2
2
|
return j("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */C(f,{title:"Files - offline"}),
|
|
4
4
|
/* @__PURE__ */C("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */j("div",{className:"max-w-md",children:[
|
|
@@ -9,20 +9,20 @@ return j("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
9
9
|
/* @__PURE__ */j("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
10
10
|
/* @__PURE__ */C("span",{className:"font-mono",children:A}),". Make sure the server is running — see ",
|
|
11
11
|
/* @__PURE__ */C("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
12
|
-
/* @__PURE__ */C("button",{onClick:()=>me(F),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===F?[]:F.split("/").filter(Boolean),ge=
|
|
12
|
+
/* @__PURE__ */C("button",{onClick:()=>me(F),className:"px-3 py-1.5 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const xe="/"===F?[]:F.split("/").filter(Boolean),ge=Z&&Z.limit>0?Math.min(100,Math.round(Z.used/Z.limit*100)):0,ye=ge>90?"bg-red-500":ge>75?"bg-amber-500":"bg-blue-500",ke=[{label:"My files",onClick:()=>P("/")},...xe.map((e,t)=>({label:e,onClick:()=>P("/"+xe.slice(0,t+1).join("/"))}))],be=e=>"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),ve=e=>/* @__PURE__ */C("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),we=/* @__PURE__ */j("nav",{className:"p-2",children:[
|
|
13
13
|
/* @__PURE__ */C("div",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
14
|
-
/* @__PURE__ */j("button",{onClick:()=>{G("files"),
|
|
15
|
-
/* @__PURE__ */C("span",{className:"truncate",children:e})]},e)),!R&&/* @__PURE__ */j("button",{onClick:()=>G("trash"),className:be("trash"===
|
|
14
|
+
/* @__PURE__ */j("button",{onClick:()=>{G("files"),P("/")},className:be("files"===_&&"/"===F),children:[ve("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),O.map(e=>/* @__PURE__ */j("button",{onClick:()=>{G("files"),P("/"+e)},className:be("files"===_&&F==="/"+e),children:[ve("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
15
|
+
/* @__PURE__ */C("span",{className:"truncate",children:e})]},e)),!R&&/* @__PURE__ */j("button",{onClick:()=>G("trash"),className:be("trash"===_),children:[ve("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),ee&&ee.folders.length>0&&/* @__PURE__ */j($,{children:[
|
|
16
16
|
/* @__PURE__ */C("div",{className:"px-2 pt-3 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ee.folders.map(e=>/* @__PURE__ */j("button",{onClick:()=>G({desktopFolderId:e.id}),className:be(te===e.id),children:[
|
|
17
17
|
/* @__PURE__ */C(m,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
18
18
|
/* @__PURE__ */C("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */C("span",{className:"ml-auto text-[10px] text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
|
|
19
|
-
return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof
|
|
19
|
+
return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{R||"object"==typeof _||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),ne.current++,Q||X(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{ne.current>0&&ne.current--,0===ne.current&&X(!1)},onDrop:e=>{e.preventDefault(),fe(),R||"object"==typeof _||e.dataTransfer.files?.length&&ue(e.dataTransfer.files)},children:[
|
|
20
20
|
/* @__PURE__ */C(f,{title:re?`Files - ${re.name}`:"Files"+("/"===F?"":" - "+F)}),
|
|
21
21
|
/* @__PURE__ */C(n,{app:"files"}),
|
|
22
22
|
/* @__PURE__ */C("input",{ref:ie,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ue(e.target.files),ie.current&&(ie.current.value="")}}),
|
|
23
23
|
/* @__PURE__ */C("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */C(r,{sidebar:we,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */j("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
24
|
-
/* @__PURE__ */j("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */j($,"files"===
|
|
25
|
-
/* @__PURE__ */C("button",{onClick:()=>
|
|
24
|
+
/* @__PURE__ */j("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */j($,"files"===_?{children:[
|
|
25
|
+
/* @__PURE__ */C("button",{onClick:()=>P(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(F)),disabled:"/"===F,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
|
|
26
26
|
/* @__PURE__ */C("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */C(t,{items:ke,maxItems:5})}),
|
|
27
27
|
/* @__PURE__ */C("button",{onClick:()=>me(F),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),!R&&/* @__PURE__ */j($,{children:[
|
|
28
28
|
/* @__PURE__ */j("button",{onClick:()=>G("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
@@ -30,7 +30,7 @@ return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
30
30
|
/* @__PURE__ */j("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void x.error("Folder names cannot contain slashes");const t=D(F,e),r=await de(`${A}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void x.error(e.error||`Create folder failed (${r.status})`)}me(F)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
31
31
|
/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}),"New Folder"]}),
|
|
32
32
|
/* @__PURE__ */j("button",{onClick:()=>ie.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
|
|
33
|
-
/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===
|
|
33
|
+
/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 7.5L12 3m0 0l4.5 4.5M12 3v13.5"})}),"Upload"]})]})]}:"trash"===_?{children:[
|
|
34
34
|
/* @__PURE__ */C("button",{onClick:()=>G("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
|
|
35
35
|
/* @__PURE__ */C("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
36
36
|
/* @__PURE__ */C("button",{onClick:he,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992V4.356M2.985 19.644v-4.992h4.992M3.05 9.348a9 9 0 0114.85-3.36L21.015 9.348m0 5.304a9 9 0 01-14.85 3.36l-3.115-3.36"})})}),
|
|
@@ -38,18 +38,18 @@ return j("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
38
38
|
/* @__PURE__ */C("button",{onClick:()=>G("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */C("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),
|
|
39
39
|
/* @__PURE__ */C(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
40
40
|
/* @__PURE__ */C("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
|
|
41
|
-
/* @__PURE__ */C("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),
|
|
41
|
+
/* @__PURE__ */C("span",{className:"text-[10px] text-gray-400 px-2",children:"Desktop shortcuts"})]}),Z&&/* @__PURE__ */j($,{children:[
|
|
42
42
|
/* @__PURE__ */C("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
43
|
-
/* @__PURE__ */j("div",{className:"flex items-center gap-1.5",title:`${k(
|
|
43
|
+
/* @__PURE__ */j("div",{className:"flex items-center gap-1.5",title:`${k(Z.used)} of ${k(Z.limit)} used`,children:[
|
|
44
44
|
/* @__PURE__ */C("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */C("div",{className:`h-full ${ye} transition-all`,style:{width:`${ge}%`}})}),
|
|
45
|
-
/* @__PURE__ */j("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[k(
|
|
46
|
-
/* @__PURE__ */C("div",{className:"flex-1 overflow-auto",children:"object"==typeof
|
|
45
|
+
/* @__PURE__ */j("span",{className:"text-[10px] text-gray-500 tabular-nums whitespace-nowrap",children:[k(Z.used)," / ",k(Z.limit)]})]})]})]}),
|
|
46
|
+
/* @__PURE__ */C("div",{className:"flex-1 overflow-auto",children:"object"==typeof _?0===ae.length?/* @__PURE__ */C("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
|
|
47
47
|
/* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
|
|
48
48
|
/* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
49
49
|
/* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5 w-28",children:"Type"}),
|
|
50
50
|
/* @__PURE__ */C("th",{className:"w-56"})]})}),
|
|
51
51
|
/* @__PURE__ */C("tbody",{children:ae.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
52
|
-
return j("tr",{onClick:()=>
|
|
52
|
+
return j("tr",{onClick:()=>H(t),onDoubleClick:()=>le(e),className:"cursor-default border-b border-gray-100 "+(B===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
53
53
|
/* @__PURE__ */j("td",{className:"px-3 py-1.5 flex items-center gap-2",children:[
|
|
54
54
|
/* @__PURE__ */C(h,{item:e}),
|
|
55
55
|
/* @__PURE__ */C("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
@@ -57,7 +57,7 @@ return j("tr",{onClick:()=>B(t),onDoubleClick:()=>le(e),className:"cursor-defaul
|
|
|
57
57
|
/* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
|
|
58
58
|
/* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),le(e)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Open"}),
|
|
59
59
|
/* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.moveToDesktop([e])},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Move to desktop"}),
|
|
60
|
-
/* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===
|
|
60
|
+
/* @__PURE__ */C("button",{onClick:t=>{t.stopPropagation(),ee?.removeShortcuts([e])},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Remove"})]})]},t)})})]}):"trash"===_?V&&0===Y.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===Y.length?/* @__PURE__ */C("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
|
|
61
61
|
/* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
|
|
62
62
|
/* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
63
63
|
/* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Original location"}),
|
|
@@ -72,18 +72,18 @@ return j("tr",{onClick:()=>B(t),onDoubleClick:()=>le(e),className:"cursor-defaul
|
|
|
72
72
|
/* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:e.deletedAt?E(e.deletedAt):"—"}),
|
|
73
73
|
/* @__PURE__ */j("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:[
|
|
74
74
|
/* @__PURE__ */C("button",{onClick:()=>(async e=>{const t=await de(`${A}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Restore failed (${t.status})`)}x.success(`Restored "${e.name}"`),he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-[11px]",children:"Restore"}),
|
|
75
|
-
/* @__PURE__ */C("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):V&&0===
|
|
75
|
+
/* @__PURE__ */C("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await de(`${A}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${t.status})`)}he()})(e),className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete forever"})]})]},e.id))})]}):V&&0===S.length?/* @__PURE__ */C("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading…"}):0===S.length?/* @__PURE__ */j("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!R&&/* @__PURE__ */j($,{children:[" Drop files here or click ",
|
|
76
76
|
/* @__PURE__ */C("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */j("table",{className:"w-full text-sm",children:[
|
|
77
77
|
/* @__PURE__ */C("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:/* @__PURE__ */j("tr",{children:[
|
|
78
78
|
/* @__PURE__ */C("th",{className:"text-left font-medium px-3 py-1.5",children:"Name"}),
|
|
79
79
|
/* @__PURE__ */C("th",{className:"text-right font-medium px-3 py-1.5 w-24",children:"Size"}),
|
|
80
80
|
/* @__PURE__ */C("th",{className:"text-right font-medium px-3 py-1.5 w-40",children:"Modified"}),
|
|
81
81
|
/* @__PURE__ */C("th",{className:"w-32"})]})}),
|
|
82
|
-
/* @__PURE__ */C("tbody",{children:
|
|
82
|
+
/* @__PURE__ */C("tbody",{children:S.map(t=>/* @__PURE__ */j("tr",{onClick:()=>H(t.name),onDoubleClick:()=>{"folder"===t.kind?P(D(F,t.name)):(async t=>{if(R)return;const r=D(F,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=T[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>oe(e)}):pe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(B===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
83
83
|
/* @__PURE__ */j("td",{className:"px-3 py-1.5 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */C("svg",{className:"h-4 w-4 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */C("path",{d:"M2.25 7.125A2.25 2.25 0 014.5 4.875h4.504c.61 0 1.193.243 1.624.673l1.494 1.494a.75.75 0 00.53.22h7.098A2.25 2.25 0 0122 9.51v8.366A2.25 2.25 0 0119.75 20.125H4.25A2.25 2.25 0 012 17.875V7.125z"})}):/* @__PURE__ */C("svg",{className:"h-4 w-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */C("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),
|
|
84
84
|
/* @__PURE__ */C("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
85
85
|
/* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":k(t.size)}),
|
|
86
86
|
/* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right text-gray-500 tabular-nums",children:E(t.modifiedAt)}),
|
|
87
87
|
/* @__PURE__ */C("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:!R&&/* @__PURE__ */j($,{children:["file"===t.kind&&/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),pe(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px]",children:"Download"}),
|
|
88
88
|
/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void x.error("Names cannot contain slashes");const r=D(F,e.name),a=D(F,t),n=await de(`${A}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void x.error(e.error||`Rename failed (${n.status})`)}me(F)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-[11px] ml-1",children:"Rename"}),
|
|
89
|
-
/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=D(F,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${r.status})`)}me(F)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),
|
|
89
|
+
/* @__PURE__ */C("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=D(F,e.name),r=await de(`${A}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void x.error(e.error||`Delete failed (${r.status})`)}me(F)})(t)},className:"px-1.5 py-0.5 rounded hover:bg-red-100 text-red-600 text-[11px] ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Q&&/* @__PURE__ */C("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */C("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{A as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-FORN7LG7.js";import{SidebarLayout as t}from"./chunk-PE4F4MJE.js";import{AboutApp as r}from"./chunk-
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */m("button",{onClick:()=>{
|
|
1
|
+
import{getNumberingConfigs as e}from"./chunk-FORN7LG7.js";import{SidebarLayout as t}from"./chunk-PE4F4MJE.js";import{AboutApp as r}from"./chunk-RQOP5JAJ.js";import{useWindowManager as n,client_default as o}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import{toast_default as i}from"./chunk-3DGTIWZP.js";import{useShellPrefs as s}from"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import{timeAgo as l}from"./chunk-W32SKK3D.js";import"./chunk-YKZHOXI4.js";import{useRef as c,useEffect as a,useState as d,useCallback as p}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as m,Fragment as h,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var y={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=n(),{prefs:k,save:v}=s(),{data:N}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=c({});a(()=>{if(!N)return;const e={};for(const t of N){const r=y[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[N]);const j=k.notepad_notes||[],[_,T]=d(null),[C,L]=d(""),[$,S]=d(""),[O,W]=d("yellow"),[X,I]=d(!1),[M,P]=d(!1),B=c(null),F=c(),H=j.find(e=>e.id===_);a(()=>{if(!_&&j.length>0){const e=j[0];T(e.id),L(e.title),S(e.content),W(e.color)}},[j.length]);const A=p(e=>{v({notepad_notes:e})},[v]),D=p(()=>{if(!_||!X)return;const e=j.map(e=>e.id===_?{...e,title:C,content:$,color:O,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);A(e),I(!1)},[_,X,C,$,O,j,A]);a(()=>{if(X)return F.current&&clearTimeout(F.current),F.current=setTimeout(D,800),()=>{F.current&&clearTimeout(F.current)}},[X,D]),a(()=>()=>{X&&D()},[]);const J=e=>{X&&D(),T(e.id),L(e.title),S(e.content),W(e.color),I(!1),P(!1)},R=e=>{const t=$.slice(0,e),r=$.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=$.slice(e+r[0].length);S(t+n+o),I(!0)},K=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},Q="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",V=/* @__PURE__ */m(h,{children:[
|
|
2
|
+
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */m("button",{onClick:()=>{X&&D();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...j];A(t),T(e.id),L(""),S(""),W("yellow"),I(!1),P(!0),setTimeout(()=>B.current?.focus(),50)},className:"w-full flex items-center justify-center gap-1.5 rounded-lg bg-blue-600 text-white px-3 py-1.5 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
|
|
3
3
|
/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Note"]})}),
|
|
4
4
|
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===j.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):j.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
|
|
5
|
-
return m("button",{onClick:()=>
|
|
5
|
+
return m("button",{onClick:()=>J(e),className:"w-full text-left px-3 py-2.5 border-b border-gray-100 transition-colors "+(_===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
6
6
|
/* @__PURE__ */m("div",{className:"flex items-center gap-2",children:[
|
|
7
7
|
/* @__PURE__ */g("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${t.dot}`}),
|
|
8
8
|
/* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g("svg",{className:"h-3 w-3 text-amber-500 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})]}),
|
|
@@ -10,13 +10,13 @@ return m("button",{onClick:()=>K(e),className:"w-full text-left px-3 py-2.5 bord
|
|
|
10
10
|
/* @__PURE__ */g("p",{className:"text-[10px] text-gray-300 mt-0.5 ml-4.5",children:l(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
11
|
return m("div",{className:"h-full",children:[
|
|
12
12
|
/* @__PURE__ */g(r,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */g(t,{sidebar:
|
|
13
|
+
/* @__PURE__ */g(t,{sidebar:V,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */m("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
14
|
/* @__PURE__ */m("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
15
|
/* @__PURE__ */g("input",{value:C,onChange:e=>{L(e.target.value),I(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
|
|
16
|
-
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{
|
|
17
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(
|
|
19
|
-
return g("div",{className:a?"line-through text-gray-400":"",children:n},r)})})($):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:
|
|
16
|
+
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{W(e.key),I(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${O===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
|
|
17
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);A(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(_),title:H?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(H?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:H?.sticky?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})})}),
|
|
18
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(A(t),_===e){const e=t[0];e?J(e):(T(null),L(""),S(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})})})]}),M?/* @__PURE__ */g("textarea",{ref:B,value:$,onChange:e=>{S(e.target.value),I(!0)},onBlur:()=>{P(!1),X&&D()},placeholder:Q,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{P(!0),setTimeout(()=>B.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:$?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let l;for(;null!==(l=s.exec(e));){const e=l[1],t=l[2];if(w.current[e]){const n=l.index,o=l[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>K(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let c=0;for(let e=0;e<r;e++)c+=t[e].length+1;for(;null!==(l=b.exec(e));){const e="x"===l[1]||"X"===l[1],t=l.index,n=c+t;i.push({idx:t,len:l[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>R(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:""},`empty-${r}`));const a=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
+
return g("div",{className:a?"line-through text-gray-400":"",children:n},r)})})($):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:Q})}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"px-4 py-1.5 border-t border-gray-100 flex items-center gap-4 text-[10px] text-gray-400",children:[
|
|
21
21
|
/* @__PURE__ */g("span",{children:"[] checkbox"}),
|
|
22
22
|
/* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-5ZDM6WIC.js";import{ImageAnnotator_default as r}from"./chunk-R7EBJKN2.js";import{AboutApp as i}from"./chunk-
|
|
1
|
+
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-5ZDM6WIC.js";import{ImageAnnotator_default as r}from"./chunk-R7EBJKN2.js";import{AboutApp as i}from"./chunk-RQOP5JAJ.js";import{peekPdfPreviewStage as o,claimPdfPreviewStage as s,PDF_PREVIEW_UPDATE_EVENT as a}from"./chunk-ESL5TDNA.js";import{WindowTitle as l,getActiveModalId as c}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import{toast_default as d}from"./chunk-3DGTIWZP.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import{registerModalEscapeInterceptor as u}from"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{useShellStrings as p,splitAround as m}from"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useRef as h,useState as x,useEffect as y}from"react";import{jsxs as f,jsx as g,Fragment as b}from"react/jsx-runtime";var w=!1;function v(e,t){return e?.url&&e.url!==t.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url),t}function k(){const n=h(void 0);void 0===n.current&&(n.current=o());const[r,u]=x(n.current?.data??null);y(()=>{const e=n.current;null!=e&&(s(e),u(t=>t===e.data?t:v(t,e.data)))},[]),y(()=>{const e=n.current?.token;if(null==e)return;const t=t=>{const n=t.detail;n&&n.token===e&&u(e=>v(e,n.data))};return window.addEventListener(a,t),()=>window.removeEventListener(a,t)},[]);const w=h(void 0);y(()=>{w.current=r?.url},[r?.url]);const k=h(null);y(()=>(null!==k.current&&(clearTimeout(k.current),k.current=null),()=>{const e=w.current;e?.startsWith("blob:")&&(k.current=setTimeout(()=>URL.revokeObjectURL(e),0))}),[]);const L=p().preview,C=r?.filename?(M=r.filename).length>24?`${M.slice(0,23)}…`:M:L.untitled;var M;const E=h(null),S=h(null),[z,j]=x(null),[D,F]=x(!1),H=h(0),B=()=>E.current?.click(),O=()=>{H.current=0,F(!1)},I=e=>{const t=e.closest("[data-modal-id]");return!t||c()===t.dataset.modalId};y(()=>{const e=()=>O(),t=()=>O(),n=e=>{"Escape"===e.key&&O()};return window.addEventListener("dragend",e),window.addEventListener("drop",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",t),window.removeEventListener("keydown",n)}},[]);const P=e=>{const t=(e.name.split(".").pop()||"").toLowerCase(),n="pdf"===t?"pdf":"dxf"===t?"dxf":["jpg","jpeg","png","gif","webp","svg","avif","bmp"].includes(t)?"image":["stp","step","stl","obj","gltf","glb","3mf","iges","igs","ply","fbx"].includes(t)?"3d":void 0;if(!n)return void("dwg"===t?d.error(L.dwgUnsupported):d.error(L.unsupportedType(t)));const r=URL.createObjectURL(e);u(t=>(t?.url?.startsWith("blob:")&&t.url!==r&&URL.revokeObjectURL(t.url),{url:r,filename:e.name,kind:n}))},W=/* @__PURE__ */f("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
2
2
|
/* @__PURE__ */g("input",{ref:E,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&P(t),E.current&&(E.current.value="")},className:"hidden"}),
|
|
3
3
|
/* @__PURE__ */f("button",{onClick:B,className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
4
4
|
/* @__PURE__ */g("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),L.open]}),
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{EditableGrid as e}from"./chunk-T4CFSGSL.js";import"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{EditableGrid as e}from"./chunk-T4CFSGSL.js";import"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-RQOP5JAJ.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-N6STBYXR.js";import"./chunk-DSSLOQDW.js";import"./chunk-KVOFUFPP.js";import"./chunk-BSJIBRWC.js";import"./chunk-CIXQKCFA.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZAE6ROV7.js";import"./chunk-AA4TMQOS.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useRef as l,useState as s,useEffect as c,useCallback as i}from"react";import{jsxs as u,jsx as d,Fragment as h}from"react/jsx-runtime";var m="ABCDEFGHIJKLMNOPQRSTUVWXYZ",p=10,x=30;function g(e){return e<26?m[e]:m[Math.floor(e/26)-1]+m[e%26]}function y(e){return Array.from({length:e},(e,t)=>({key:`col_${t}`,title:g(t),width:100}))}function b(e,t){return Array.from({length:e},()=>Array(t).fill(""))}function f(e){return{id:crypto.randomUUID(),name:e,columns:y(p),data:b(x,p),cellStyles:{}}}function v(e){return e.split("\n").map(e=>{if(e.includes("\t"))return e.split("\t").map(e=>e.trim());const t=[];let r="",n=!1;for(const o of e)'"'!==o?","!==o||n?r+=o:(t.push(r.trim()),r=""):n=!n;return t.push(r.trim()),t}).filter(e=>e.some(e=>e.trim()))}function k(e,t){const r=v(e);if(0===r.length)return null;const n=Math.max(p,r.reduce((e,t)=>Math.max(e,t.length),0)),o=r.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));return{id:crypto.randomUUID(),name:t,columns:y(n),data:o,cellStyles:{}}}function w(){const m=l(null),g=l(void 0);void 0===g.current&&(g.current=r());const w=l(g.current?.data??null),C=(()=>{const e=g.current;if(!e)return null;const t=k(e.data.csv,"Sheet 1");if(!t)return null;return{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}})(),[N,S]=s(C?[C.sheet]:[f("Sheet 1")]),[j,A]=s(0),$=l([]),M=l(N),U=l(!1);c(()=>{U.current?U.current=!1:M.current!==N&&($.current.push(M.current),$.current.length>50&&$.current.shift()),M.current=N},[N]);const E=i(()=>{const e=$.current.pop();e&&(U.current=!0,S(e))},[]);c(()=>{const e=e=>{if(!m.current?.contains(document.activeElement)&&!m.current?.matches(":focus-within"))return;(e.ctrlKey||e.metaKey)&&!e.shiftKey&&("z"===e.key||"Z"===e.key)&&(e.preventDefault(),E())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E]);const[F,L]=s(C?.title??"Untitled"),[R,D]=s(()=>g.current?.data.onEmail),I=i(e=>{const t=k(e.csv,"Sheet 1");t&&(S([t]),A(0),L(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),D(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&I(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&I(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[O,X]=s(!1),[B,H]=s(null),[J,K]=s(""),Q=l(null),[T,P]=s("1"),[V,Z]=s("10"),W=N[j]||N[0],z=W.data,Y=W.columns,G=W.cellStyles??{},[_,q]=s(null),[ee,te]=s(null),re=i(()=>{if(ee){const e=Math.min(ee.anchor.row,ee.end.row),t=Math.max(ee.anchor.row,ee.end.row),r=Math.min(ee.anchor.col,ee.end.col),n=Math.max(ee.anchor.col,ee.end.col),o=[];for(let a=e;a<=t;a++)for(let e=r;e<=n;e++)o.push({row:a,col:e});return o}return _?[_]:[]},[ee,_]),ne=i((e,t)=>{const r=re();0!==r.length&&S(n=>n.map((n,o)=>{if(o!==j)return n;const a={...n.cellStyles??{}},l=`${r[0].row}:${r[0].col}`,s=void 0!==t?t:!(a[l]??{})[e];for(const{row:t,col:n}of r){const r=`${t}:${n}`;a[r]={...a[r]??{},[e]:s}}return{...n,cellStyles:a}}))},[re,j]),oe=ee?{row:ee.anchor.row,col:ee.anchor.col}:_,ae=oe?G[`${oe.row}:${oe.col}`]??{}:{},le=!!oe,se=i(e=>{S(t=>t.map((t,r)=>r===j?{...t,...e}:t))},[j]),ce=i(e=>{const t=e.reduce((e,t)=>Math.max(e,t.length),0);t!==Y.length?se({data:e,columns:y(t)}):se({data:e})},[se,Y.length]),ie=(e,t)=>{S(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),H(null)},ue=()=>z.filter(e=>e.some(e=>e.trim())).map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n"),de=[];z.forEach(e=>e.forEach(e=>{const t=parseFloat(e);!isNaN(t)&&e.trim()&&de.push(t)}));const he=z.reduce((e,t)=>e+t.filter(e=>e.trim()).length,0);/* @__PURE__ */
|
|
2
2
|
return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
3
3
|
/* @__PURE__ */d(a,{title:`${me=F||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
|
|
4
4
|
/* @__PURE__ */d(t,{app:"spreadsheet"}),
|
|
5
5
|
/* @__PURE__ */u("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[O?/* @__PURE__ */d("input",{type:"text",value:F,onChange:e=>L(e.target.value),onBlur:()=>X(!1),onKeyDown:e=>{"Enter"===e.key&&X(!1)},autoFocus:!0,className:"text-sm font-medium text-gray-900 border border-gray-300 rounded px-2 py-0.5 w-40 focus:border-blue-500 focus:ring-blue-500"}):/* @__PURE__ */d("button",{onClick:()=>X(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:F||"Untitled"}),
|
|
6
6
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
7
|
-
/* @__PURE__ */d("input",{ref:
|
|
8
|
-
/* @__PURE__ */d("button",{onClick:()=>
|
|
7
|
+
/* @__PURE__ */d("input",{ref:Q,type:"file",accept:".csv,.tsv,.txt,.xlsx,.xls,.ods",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");if(/\.(xlsx|xls|ods)$/i.test(t.name)){const e=new Uint8Array(await t.arrayBuffer()),n=await(import("xlsx")),o=n.read(e,{type:"array"}),a=o.SheetNames.map(e=>{const t=n.utils.sheet_to_json(o.Sheets[e],{header:1,defval:""}),r=Math.max(p,t.reduce((e,t)=>Math.max(e,t.length),0)),a=t.map(e=>{const t=e.map(e=>String(e??""));for(;t.length<r;)t.push("");return t});for(;a.length<x;)a.push(Array(r).fill(""));return{id:crypto.randomUUID(),name:e,columns:y(r),data:a}});S(a),A(0),L(r)}else{const e=v(await t.text());if(0===e.length)return;const n=Math.max(p,e.reduce((e,t)=>Math.max(e,t.length),0)),o=e.map(e=>{for(;e.length<n;)e.push("");return e});for(;o.length<x;)o.push(Array(n).fill(""));se({columns:y(n),data:o}),L(r)}Q.current&&(Q.current.value="")},className:"hidden"}),
|
|
8
|
+
/* @__PURE__ */d("button",{onClick:()=>Q.current?.click(),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Open"}),
|
|
9
9
|
/* @__PURE__ */d("button",{onClick:()=>{const e=new Blob([ue()],{type:"text/csv"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${F||"spreadsheet"}.csv`,r.click(),URL.revokeObjectURL(t)},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save CSV"}),R&&/* @__PURE__ */d("button",{onClick:()=>R(ue(),`${F||"spreadsheet"}.csv`),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Email"}),
|
|
10
10
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
11
11
|
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
12
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:
|
|
13
|
-
/* @__PURE__ */d("button",{onClick:()=>(e=>{const t=Y.length+e;se({columns:y(t),data:
|
|
12
|
+
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:T,onChange:e=>P(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
13
|
+
/* @__PURE__ */d("button",{onClick:()=>(e=>{const t=Y.length+e;se({columns:y(t),data:z.map(t=>[...t,...Array(e).fill("")])})})(parseInt(T)||1),className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Col"})]}),
|
|
14
14
|
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
15
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:
|
|
16
|
-
/* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(
|
|
15
|
+
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:V,onChange:e=>Z(e.target.value),className:"w-10 text-xs text-center border border-gray-300 rounded px-1 py-0.5 focus:border-blue-500 focus:ring-blue-500"}),
|
|
16
|
+
/* @__PURE__ */d("button",{onClick:()=>{return e=parseInt(V)||10,void se({data:[...z,...Array.from({length:e},()=>Array(Y.length).fill(""))]});var e},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"+ Row"})]}),
|
|
17
17
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
18
18
|
/* @__PURE__ */d("button",{onClick:()=>{se({columns:y(p),data:b(x,p)})},className:"text-xs text-gray-600 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Clear"}),
|
|
19
19
|
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
@@ -26,12 +26,12 @@ return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
|
26
26
|
/* @__PURE__ */d("option",{value:"base",children:"S"}),
|
|
27
27
|
/* @__PURE__ */d("option",{value:"lg",children:"M"}),
|
|
28
28
|
/* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
|
|
29
|
-
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Y,data:
|
|
29
|
+
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:Y,data:z,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:G,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
|
|
30
30
|
/* @__PURE__ */u("div",{className:"flex items-center border-t border-gray-200 bg-gray-50 shrink-0",children:[
|
|
31
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[N.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>A(t),onDoubleClick:()=>{
|
|
31
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5 px-1 py-1 overflow-x-auto flex-1 min-w-0",children:[N.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>A(t),onDoubleClick:()=>{H(t),K(e.name)},onContextMenu:e=>{e.preventDefault(),N.length>1&&(e=>{N.length<=1||(S(t=>t.filter((t,r)=>r!==e)),j>=e&&j>0&&A(j-1))})(t)},className:"px-3 py-1 text-xs font-medium rounded-b whitespace-nowrap transition-colors "+(t===j?"bg-white text-blue-700 border border-t-0 border-gray-300 -mt-px relative z-10":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:B===t?/* @__PURE__ */d("input",{type:"text",value:J,onChange:e=>K(e.target.value),onBlur:()=>ie(t,J||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,J||e.name),"Escape"===r.key&&H(null)},onClick:e=>e.stopPropagation(),autoFocus:!0,className:"w-20 text-xs border border-blue-400 rounded px-1 py-0 focus:ring-0 focus:outline-none"}):e.name},e.id)),
|
|
32
32
|
/* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${N.length+1}`;S(t=>[...t,f(e)]),A(N.length)},className:"px-2 py-1 text-xs text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Add sheet",children:"+"})]}),
|
|
33
33
|
/* @__PURE__ */u("div",{className:"flex items-center gap-4 px-3 py-1 text-xs text-gray-500 shrink-0 border-l border-gray-200",children:[
|
|
34
34
|
/* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
|
|
35
35
|
/* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
|
|
36
36
|
/* @__PURE__ */u("span",{children:["Avg: ",(de.reduce((e,t)=>e+t,0)/de.length).toLocaleString(void 0,{maximumFractionDigits:2})]})]}),
|
|
37
|
-
/* @__PURE__ */u("span",{children:[
|
|
37
|
+
/* @__PURE__ */u("span",{children:[z.length," × ",Y.length]})]})]})]});var me}export{w as default};
|
package/dist/apps/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{openFilesInTrashMode,setFilesDemoTree}from"../chunk-ILTSTULF.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-
|
|
2
|
+
export{openFilesInTrashMode,setFilesDemoTree}from"../chunk-ILTSTULF.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-RQOP5JAJ.js";import"../chunk-C2A4PIGZ.js";import{setPdfPreview as e}from"../chunk-ESL5TDNA.js";export{setPdfPreview}from"../chunk-ESL5TDNA.js";import{setSpreadsheetPreview as t}from"../chunk-VTVSMRFX.js";export{setSpreadsheetPreview}from"../chunk-VTVSMRFX.js";import"../chunk-N6STBYXR.js";import"../chunk-DSSLOQDW.js";import"../chunk-KVOFUFPP.js";import"../chunk-BSJIBRWC.js";import{toast_default as o}from"../chunk-3DGTIWZP.js";import"../chunk-CIXQKCFA.js";import"../chunk-5A7MWTXX.js";import"../chunk-OGXU7QFW.js";import"../chunk-ZAE6ROV7.js";import"../chunk-AA4TMQOS.js";import"../chunk-AFYQTVZO.js";import"../chunk-HZZNJHRH.js";import"../chunk-X4FJ54PP.js";import"../chunk-D65T4H6J.js";import{currentShellStrings as r}from"../chunk-J3LIIIHJ.js";import"../chunk-C3QOHMR6.js";import"../chunk-YKZHOXI4.js";import{lazy as n}from"react";function i(e){const t=/\.([a-z0-9]+)(?:[?#].*)?$/i.exec((e||"").trim());return t?t[1].toLowerCase():""}var s=/* @__PURE__ */new Set(["csv","tsv"]),l=/* @__PURE__ */new Set(["xlsx","xls","xlsm","ods"]),a=/* @__PURE__ */new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]),c=/* @__PURE__ */new Set(["step","stp","stl","obj","gltf","glb","3mf","iges","igs"]);function m(e){const t=i(e);return"pdf"===t?"pdf":"dxf"===t?"dxf":s.has(t)?"csv":a.has(t)?"image":c.has(t)?"3d":null}function p(e){window.open(e,"_blank","noopener,noreferrer")}async function u(e,t,o){if(t.fetchBlob)return(await t.fetchBlob(o)).text();const r=await fetch(e);if(!r.ok)throw new Error(`fetch failed: ${r.status}`);return r.text()}function d(e,t){return(e instanceof Error?e.message:"")||t}async function h(n,s,a={}){const c=r().attachment,h=n?.url||"",f=n?.filename||c.fallbackName;if(!h&&!a.fetchBlob)return void o.error(c.noLink);const j=m(f)??m(h);if("csv"===j){try{t({csv:await u(h,a,n),filename:f}),s("/spreadsheet")}catch{o.error(c.spreadsheetFailed),h&&p(h)}return}if(l.has(i(f)||i(h)))return o.error(c.workbookUnavailable),void(h&&p(h));if(!j)return h?(o.info(c.noViewer),void p(h)):void o.error(c.noLink);if(!a.fetchBlob)return e({url:h,filename:f,kind:j}),void s("/preview");const k=e({filename:f,kind:j,converting:!0,convertingMessage:a.loadingMessage||c.loading});s("/preview");try{const e=await a.fetchBlob(n);k.update({url:URL.createObjectURL(e),filename:f,kind:j})}catch(e){k.update({filename:f,kind:j,converting:!1,convertingMessage:d(e,c.loadFailed)})}}var f=n(()=>import("../Calculator-R5OEHQ67.js")),j=n(()=>import("../Spreadsheet-RME4IQ43.js")),k=n(()=>import("../Weather-APBCG4TO.js")),w=n(()=>import("../CurrencyConverter-AMXUOQR2.js")),g=n(()=>import("../PomodoroTimer-LE6J2KUU.js")),v=n(()=>import("../Notepad-AHRPMF57.js")),b=n(()=>import("../WorldClock-2LMZYKWR.js")),S=n(()=>import("../Stock-GWVG2INU.js")),P=n(()=>import("../Preview-OKR5QRQP.js")),x=n(()=>import("../PdfViewer-3SC3LE4U.js")),T=n(()=>import("../Documents-VD32HWDQ.js")),y=n(()=>import("../Files-NAY3WK6O.js")),F=n(()=>import("../Browser-RZFOKBSF.js")),I={"/calculator":{component:f,label:"Calculator",size:"sm",allowPinOnTop:!0,utility:!0,widget:!0,dimensions:[280,420]},"/spreadsheet":{component:j,label:"Spreadsheets",size:"2xl",appStyle:!0,multiInstance:!0},"/notepad":{component:v,label:"Notepad",size:"lg",allowPinOnTop:!0,flushBody:!0},"/weather":{component:k,label:"Weather",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,400]},"/currency":{component:w,label:"Currency Converter",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/pomodoro":{component:g,label:"Pomodoro Timer",size:"sm",utility:!0,widget:!0,dimensions:[320,600]},"/world-clock":{component:b,label:"World Clock",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/stock":{component:S,label:"Stocks",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,360]}},O={"/preview":{component:P,label:"Preview",size:"2xl",appStyle:!0,multiInstance:!0},"/documents":{component:T,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0},"/files":{component:y,label:"Files",size:"xl",appStyle:!0}},R={"/browser":{component:F,label:"Browser",size:"2xl",appStyle:!0,multiInstance:!0}},C={...I,...O,...R};export{F as Browser,f as Calculator,w as CurrencyConverter,T as Documents,y as Files,v as Notepad,x as PdfViewer,g as PomodoroTimer,P as Preview,j as Spreadsheet,S as Stock,k as Weather,b as WorldClock,m as attachmentKind,C as bundledApps,O as documentApps,h as openAttachment,I as utilityApps,R as webApps};
|