efficient-shell 7.26.0 → 7.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Browser-3FDTXKE5.js → Browser-CUAQCAZ2.js} +14 -14
- package/dist/Calculator-YQS2NTUZ.js +29 -0
- package/dist/ConfirmDialog-YZCM3HJP.js +1 -0
- package/dist/CurrencyConverter-ZIERKELA.js +21 -0
- package/dist/{Documents-WUZBS5SD.js → Documents-GOOHQYBQ.js} +27 -27
- package/dist/{Files-363VK5RY.js → Files-R4Z3BYJL.js} +43 -43
- package/dist/Notepad-YV4JDSRK.js +25 -0
- package/dist/PdfViewer-JLIMTMVK.js +1 -0
- package/dist/{PomodoroTimer-BMBZ2TTC.js → PomodoroTimer-GYLJIAWS.js} +20 -20
- package/dist/{Preview-KXLUDKH2.js → Preview-K4QOB3J2.js} +8 -8
- package/dist/Sidebar-4RJEWBBN.js +44 -0
- package/dist/Spreadsheet-7WU4NDJP.js +37 -0
- package/dist/{Stock-4LFU53UL.js → Stock-7AOF4PKL.js} +7 -7
- package/dist/{Weather-BIOZMSPH.js → Weather-23SUCMNL.js} +18 -18
- package/dist/{WorldClock-BO6TIFOK.js → WorldClock-ENURKJG6.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-42B7TUEB.js → chunk-3VYANOTN.js} +1 -1
- package/dist/{chunk-6RFXIPCN.js → chunk-4MSDABE3.js} +1 -1
- package/dist/{chunk-56UKP6J6.js → chunk-5TFUQOEM.js} +1 -1
- package/dist/{chunk-5MBF4FPG.js → chunk-76VZ67RK.js} +2 -2
- package/dist/{chunk-RMXUKHVK.js → chunk-7776CT23.js} +1 -1
- package/dist/{chunk-LG3UEPOI.js → chunk-A22D3FXG.js} +4 -4
- package/dist/{chunk-ZXHA3XDM.js → chunk-ABXVRYKR.js} +1 -1
- package/dist/{chunk-H3U47ZEL.js → chunk-AHBO5PKR.js} +11 -11
- package/dist/{chunk-C2PGWIIO.js → chunk-BJN6DNDM.js} +1 -1
- package/dist/{chunk-MEIVZG77.js → chunk-EBTCC5N3.js} +9 -9
- package/dist/chunk-EZ73LTEI.js +1 -0
- package/dist/chunk-FHKJQU3U.js +27 -0
- package/dist/{chunk-DY43MKMT.js → chunk-HCQ7SIGC.js} +1 -1
- package/dist/{chunk-6JVUT3D4.js → chunk-I4GL7BVS.js} +2 -2
- package/dist/{chunk-YJZ4VVDT.js → chunk-ITW5DB2J.js} +13 -13
- package/dist/{chunk-OICSZKUO.js → chunk-IUBESHKK.js} +1 -1
- package/dist/{chunk-F2GDJO2Y.js → chunk-KROUETJQ.js} +16 -16
- package/dist/chunk-KWW5PPQN.js +1 -0
- package/dist/chunk-MQUGCJRS.js +1035 -0
- package/dist/{chunk-2I3Z4UFG.js → chunk-QHL3LL5F.js} +14 -14
- package/dist/chunk-QJ4YAH34.js +108 -0
- package/dist/{chunk-RVPQRXC4.js → chunk-RYBDLJJV.js} +1 -1
- package/dist/chunk-SUXBGACL.js +10 -0
- package/dist/chunk-WOZ36LPR.js +9 -0
- package/dist/{chunk-6AXCLPSI.js → chunk-XTAGVLZJ.js} +1 -1
- package/dist/chunk-XZXMVACA.js +5 -0
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-cfVn8e67.d.ts → index-HJwNWiNU.d.ts} +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/index.js +678 -631
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +8 -8
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-DkffgGGm.d.ts → strings-BuYlsGKG.d.ts} +17 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-HARXMYLM.js +0 -29
- package/dist/ConfirmDialog-VL3YU35U.js +0 -1
- package/dist/CurrencyConverter-KQ5UR4AU.js +0 -21
- package/dist/Notepad-PJUJ5VF2.js +0 -25
- package/dist/PdfViewer-4KFBJ4ZV.js +0 -1
- package/dist/Sidebar-GO32NHGH.js +0 -44
- package/dist/Spreadsheet-XPLYPDLZ.js +0 -37
- package/dist/chunk-CV3XVHWR.js +0 -108
- package/dist/chunk-DBWGMZCY.js +0 -1
- package/dist/chunk-QD22TNW3.js +0 -27
- package/dist/chunk-QKNGN4H4.js +0 -10
- package/dist/chunk-SKDIIPFY.js +0 -1
- package/dist/chunk-SZTKBF3D.js +0 -13
- package/dist/chunk-VROJD5KW.js +0 -1035
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-shell",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0",
|
|
4
4
|
"description": "Desktop-style React UI shell — windows, taskbar, start menu, sticky notes, frosted glass theming, and bundled apps.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-RMXUKHVK.js";import{useWidgetSettings as n}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{Icon as r}from"./chunk-B427NVDP.js";import{useState as l,useRef as c,useCallback as i,useEffect as a}from"react";import{jsxs as o,Fragment as s,jsx as u}from"react/jsx-runtime";var d="calc_appearance";function h(){const[h,m]=l("0"),[k,b]=l(null),[p,g]=l(null),[N,y]=l(!1),[x,f]=l(""),[v,C]=l([]),[$,j]=l(!1),[w,E]=l(()=>e(d)),[S,D]=l(!1),[T,W]=l(w),B=c(null);n(i(()=>{W({...w}),D(!0)},[w]));const F=i(e=>{f(""),m(t=>N||"0"===t?(y(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),K=i(()=>{m("0"),b(null),g(null),y(!1)},[]),M=i((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),G=i(e=>{const t=parseFloat(h);if(null!==k&&p&&!N){const e=M(k,t,p);m(String(e)),b(e),C(n=>[`${k} ${p} ${t} = ${e}`,...n].slice(0,20))}else b(t);g(e),y(!0)},[h,k,p,N,M]),V=i(()=>{if(null===k||!p)return;const e=parseFloat(h),t=M(k,e,p),n=`${k} ${p} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),f(n),m(String(t)),b(null),g(null),y(!0)},[h,k,p,M]),X=i(()=>{m(e=>String(parseFloat(e)/100))},[]),A=i(()=>{m(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);a(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?F(e.key):"."===e.key?F("."):"+"===e.key?G("+"):"-"===e.key?G("-"):"*"===e.key?G("×"):"/"===e.key?(e.preventDefault(),G("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&B.current?.contains(e.target)&&e.preventDefault(),V()):"Escape"===e.key?K():"Backspace"===e.key?m(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&X())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F,G,V,K,X]);const H="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",O=`${H} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,R=`${H} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,L=`${H} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,Q=`${H} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
-
return o(s,{children:[
|
|
3
|
-
/* @__PURE__ */o("div",{ref:B,className:"flex flex-col h-full",style:{opacity:w.activeOpacity/100,backdropFilter:w.activeBlur>0?`blur(${w.activeBlur}px)`:void 0},children:[
|
|
4
|
-
/* @__PURE__ */o("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
|
|
5
|
-
/* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:v.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(x||p&&null!==k)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${k} ${p} ${N?"":h}`}),
|
|
6
|
-
/* @__PURE__ */o("div",{className:"flex items-center gap-2",children:[
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(h),j(!0),setTimeout(()=>j(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,$?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
-
/* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(h)})]})]}),
|
|
9
|
-
/* @__PURE__ */o("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
-
/* @__PURE__ */u("button",{onClick:K,className:L,children:"AC"}),
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:A,className:L,children:"+/−"}),
|
|
12
|
-
/* @__PURE__ */u("button",{onClick:X,className:L,children:"%"}),
|
|
13
|
-
/* @__PURE__ */u("button",{onClick:()=>G("÷"),className:`${R} ${"÷"===p?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
-
/* @__PURE__ */u("button",{onClick:()=>F("7"),className:O,children:"7"}),
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:()=>F("8"),className:O,children:"8"}),
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>F("9"),className:O,children:"9"}),
|
|
17
|
-
/* @__PURE__ */u("button",{onClick:()=>G("×"),className:`${R} ${"×"===p?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
-
/* @__PURE__ */u("button",{onClick:()=>F("4"),className:O,children:"4"}),
|
|
19
|
-
/* @__PURE__ */u("button",{onClick:()=>F("5"),className:O,children:"5"}),
|
|
20
|
-
/* @__PURE__ */u("button",{onClick:()=>F("6"),className:O,children:"6"}),
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>G("-"),className:`${R} ${"-"===p?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:()=>F("1"),className:O,children:"1"}),
|
|
23
|
-
/* @__PURE__ */u("button",{onClick:()=>F("2"),className:O,children:"2"}),
|
|
24
|
-
/* @__PURE__ */u("button",{onClick:()=>F("3"),className:O,children:"3"}),
|
|
25
|
-
/* @__PURE__ */u("button",{onClick:()=>G("+"),className:`${R} ${"+"===p?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
-
/* @__PURE__ */u("button",{onClick:()=>F("0"),className:`${O} col-span-2`,children:"0"}),
|
|
27
|
-
/* @__PURE__ */u("button",{onClick:()=>F("."),className:O,children:"."}),
|
|
28
|
-
/* @__PURE__ */u("button",{onClick:V,className:Q,children:"="})]})]}),
|
|
29
|
-
/* @__PURE__ */u(t,{open:S,onClose:()=>D(!1),title:"Calculator Settings",appearance:T,onAppearanceChange:W,onSave:()=>{E(T),localStorage.setItem(d,JSON.stringify(T)),D(!1)}})]})}export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-F2GDJO2Y.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-FIEA5CGB.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-RMXUKHVK.js";import{useWidgetSettings as r}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import{LoadingSpinner as n}from"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";import{useState as a,useCallback as s,useEffect as o}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",d="currency_appearance",h="currency_rates_cache";function g(e){try{const t=JSON.parse(localStorage.getItem(h)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function f(e,t){try{const r=JSON.parse(localStorage.getItem(h)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(h,JSON.stringify(r))}catch{}}function N(){try{const e=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return u}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function x(){const[u,h]=a(N),[x,b]=a(()=>e(d)),[S,D]=a({}),[k,v]=a(!1),[j,C]=a(!1),[B,U]=a([]),[J,K]=a(x),[R,G]=a("USD"),[H,O]=a("CNY");r(s(()=>{U([...u]),K({...x}),C(!0)},[u,x])),o(()=>{const e=[...new Set(u.map(([e])=>e))];let t=!0;return async function(){v(!0);const r={};for(const t of e){const e=g(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,f(t,n.rates))}catch{}}t&&(D(r),v(!1))}(),()=>{t=!1}},[u]);/* @__PURE__ */
|
|
2
|
-
return c(i,{children:[
|
|
3
|
-
/* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${x.activeOpacity/100})`,backdropFilter:x.activeBlur>0?`blur(${x.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[k&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([e,t],r)=>{const n=S[e]?.[t];/* @__PURE__ */
|
|
4
|
-
return c("button",{onClick:()=>{const e=u.map((e,t)=>t===r?[e[1],e[0]]:e);h(e),localStorage.setItem(p,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
6
|
-
/* @__PURE__ */l("span",{className:"text-base",children:y[e]||""}),
|
|
7
|
-
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e}),
|
|
8
|
-
/* @__PURE__ */l("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
|
|
9
|
-
/* @__PURE__ */l("span",{className:"text-base",children:y[t]||""}),
|
|
10
|
-
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
|
-
/* @__PURE__ */l("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:K,onSave:()=>{if(0===B.length)return;const e=B.slice(0,4);h(e),b(J),localStorage.setItem(p,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */c("div",{children:[
|
|
13
|
-
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",B.length,"/",4,")"]})]}),
|
|
15
|
-
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:B.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
|
-
/* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */l("button",{onClick:()=>U(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),B.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
-
/* @__PURE__ */l("select",{value:R,onChange:e=>G(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
19
|
-
/* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */l("select",{value:H,onChange:e=>O(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
21
|
-
/* @__PURE__ */l("button",{onClick:()=>{R!==H&&B.length<4&&U(e=>[...e,[R,H]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{x as default};
|
package/dist/Notepad-PJUJ5VF2.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-C2PGWIIO.js";import{SidebarLayout as t}from"./chunk-LG3UEPOI.js";import{AboutApp as r}from"./chunk-5MBF4FPG.js";import{useWindowManager as n,client_default as o}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import{toast_default as i}from"./chunk-42B7TUEB.js";import{useShellPrefs as s}from"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SKDIIPFY.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import{Icon as c}from"./chunk-B427NVDP.js";import{useRef as l,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,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 b={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/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=l({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[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})}}_.current=e},[w]);const j=v.notepad_notes||[],[T,C]=p(null),[$,S]=p(""),[W,D]=p(""),[I,K]=p("yellow"),[O,X]=p(!1),[B,G]=p(!1),P=l(null),F=l(),M=j.find(e=>e.id===T);d(()=>{if(!T&&j.length>0){const e=j[0];C(e.id),S(e.title),D(e.content),K(e.color)}},[j.length]);const U=m(e=>{N({notepad_notes:e})},[N]),E=m(()=>{if(!T||!O)return;const e=j.map(e=>e.id===T?{...e,title:$,content:W,color:I,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),X(!1)},[T,O,$,W,I,j,U]);d(()=>{if(O)return F.current&&clearTimeout(F.current),F.current=setTimeout(E,800),()=>{F.current&&clearTimeout(F.current)}},[O,E]),d(()=>()=>{O&&E()},[]);const V=e=>{O&&E(),C(e.id),S(e.title),D(e.content),K(e.color),X(!1),G(!1)},q=e=>{const t=W.slice(0,e),r=W.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=W.slice(e+r[0].length);D(t+n+o),X(!0)},R=async(e,t)=>{const r=_.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?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},H="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.)",Q=/* @__PURE__ */h(y,{children:[
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{O&&E();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];U(t),C(e.id),S(""),D(""),K("yellow"),X(!1),G(!0),setTimeout(()=>P.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
|
|
3
|
-
/* @__PURE__ */g(c,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
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 h("button",{onClick:()=>V(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(T===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
6
|
-
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
|
-
/* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
|
-
/* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(c,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
|
|
9
|
-
/* @__PURE__ */g("p",{className:"text-xs text-gray-400 mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
|
|
10
|
-
/* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:a(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
|
-
return h("div",{className:"h-full",children:[
|
|
12
|
-
/* @__PURE__ */g(r,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */g(t,{sidebar:Q,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:T?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
|
-
/* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
|
-
/* @__PURE__ */g("input",{value:$,onChange:e=>{S(e.target.value),X(!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:()=>{K(e.key),X(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${I===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);U(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(T),title:M?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(M?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(c,{name:"bookmark",className:"h-4 w-4",fill:M?.sticky?"currentColor":"none",strokeWidth:1.5})}),
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(U(t),T===e){const e=t[0];e?V(e):(C(null),S(""),D(""))}})(T),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(c,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),B?/* @__PURE__ */g("textarea",{ref:P,value:W,onChange:e=>{D(e.target.value),X(!0)},onBlur:()=>{G(!1),O&&E()},placeholder:H,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:()=>{G(!0),setTimeout(()=>P.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:W?(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 a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>R(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=l+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>q(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(c,{name:"check",className:"w-3 h-3",strokeWidth:3})},`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 d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
-
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(W):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:H})}),
|
|
20
|
-
/* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
|
|
21
|
-
/* @__PURE__ */g("span",{children:"[] checkbox"}),
|
|
22
|
-
/* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
|
|
23
|
-
/* @__PURE__ */g("span",{className:"ml-auto",children:B?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
|
|
24
|
-
/* @__PURE__ */g(c,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
25
|
-
/* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-YJZ4VVDT.js";import"./chunk-42B7TUEB.js";import"./chunk-NVFKXL52.js";import"./chunk-K7PQXJO7.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.js";
|
package/dist/Sidebar-GO32NHGH.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import{useAuth as e,parseOpenSections as t,readStored as a,RAIL_OPEN_SECTIONS_KEY as r,toggleOpenSection as n,writeStored as i}from"./chunk-S2PS4IOT.js";import{partitionNav as l,BrandMark as s,openGlobalSearch as o,visibleNavChildren as c,visibleSectionItems as d,rowsContainRoute as m}from"./chunk-QD22TNW3.js";import{navSections as h,startMenuCategories as u,TAB_STRIP_H as p,navIcons as b,sectionIcons as g}from"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import{PopupMenu as f,PopupMenuItem as y,PopupMenuDivider as x}from"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import{useShellStrings as N}from"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import{Icon as v}from"./chunk-B427NVDP.js";import{useMemo as k,useState as w,useRef as C,useEffect as j,isValidElement as S,cloneElement as z}from"react";import{jsx as L,jsxs as A}from"react/jsx-runtime";var W="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),$=(e,t)=>["flex h-(--row-height-menu) w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition-colors",t?"justify-center px-0":"",e?"bg-gray-100 text-gray-900":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"].join(" "),I="flex size-[18px] shrink-0 items-center justify-center [&>svg]:size-[18px]";function B({open:e}){/* @__PURE__ */
|
|
2
|
-
return L(v,{name:"chevron-down",className:"size-4 shrink-0 transition-transform "+(e?"rotate-180":""),strokeWidth:2,"aria-hidden":"true"})}function M({dir:e}){/* @__PURE__ */
|
|
3
|
-
return L(v,"left"===e?{name:"chevron-double-left",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"}:{name:"chevron-double-right",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})}function T({className:e}){/* @__PURE__ */
|
|
4
|
-
return L(v,{name:"search",className:e,strokeWidth:2,"aria-hidden":"true"})}function D({width:D,collapsed:K,onToggleCollapsed:R,onOpen:H,activeRoute:O,profile:_,user:P,onLogout:G,onSwitchToDesktop:Q,onReportBug:V,navSections:X=h,navIcons:F=b,sectionIcons:J=g,categories:U=u,productName:Y,productIcon:E,tagline:Z,adaptiveLogo:q=!1,logoHasAlpha:ee=null,logoIsLight:te=null}){const ae=N().layout,{hasAnyPerm:re}=e(),ne=k(()=>l(X,U,re),[X,U,re]),[ie,le]=w(()=>t(a(r))),se=e=>le(t=>{const a=n(t,e);return i(r,JSON.stringify([...a])),a}),[oe,ce]=w(null),[de,me]=w(!1),he=C(null);j(()=>{K||ce(null)},[K]);const ue=(e,t)=>{ce(null),e.onSelect?e.onSelect():H(e.to,!!t&&(e=>e.metaKey||e.ctrlKey||1===e.button)(t))},pe=(e,t)=>{const a=t[e];/* @__PURE__ */
|
|
5
|
-
return L("span",{className:I,"aria-hidden":"true",children:a&&S(a)?z(a,{className:"size-[18px]"}):a})},be=(e,t)=>{const a=c(e,re),r=e.menuLabel??e.label;if(a.length>0){const n=`child:${e.to}`,i=ie.has(n),l=!i&&m(a,O,re);/* @__PURE__ */
|
|
6
|
-
return A("div",{children:[
|
|
7
|
-
/* @__PURE__ */A("button",{type:"button",onClick:()=>se(n),"aria-expanded":i,className:$(l,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&pe(e.to,F),
|
|
8
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:r}),
|
|
9
|
-
/* @__PURE__ */L(B,{open:i})]}),i&&/* @__PURE__ */L("div",{className:"space-y-0.5 pt-0.5",children:a.map(e=>be(e,t+1))}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)}const n=e.to===O;/* @__PURE__ */
|
|
10
|
-
return A("div",{children:[
|
|
11
|
-
/* @__PURE__ */A("button",{type:"button",onClick:t=>ue(e,t),onAuxClick:t=>{1===t.button&&ue(e,t)},"aria-current":n?"page":void 0,className:$(n,!1),style:t>0?{paddingLeft:.75+1.75*t+"rem"}:void 0,children:[0===t&&pe(e.to,F),
|
|
12
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:r})]}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)},ge=(e,t)=>{const a=t?e.items:d(e,re);if(0===a.length)return null;const r="icon"in e&&e.icon?/* @__PURE__ */L("span",{className:I,"aria-hidden":"true",children:e.icon}):pe(e.label,J),n=e.menuLabel??e.label,i=m(a,O,re),l="dividerAfter"in e&&e.dividerAfter;if(K)/* @__PURE__ */
|
|
13
|
-
return A("div",{children:[
|
|
14
|
-
/* @__PURE__ */L("button",{type:"button",title:n,"aria-label":n,"aria-haspopup":"menu","aria-expanded":oe?.label===e.label,onClick:t=>{const r=t.currentTarget.getBoundingClientRect();ce(t=>t?.label===e.label?null:{label:e.label,items:a,top:r.top})},className:$(i||oe?.label===e.label,!0),children:r}),l&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label);const s=ie.has(e.label),o=`rosh-rail-${e.label.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}`;/* @__PURE__ */
|
|
15
|
-
return A("div",{children:[
|
|
16
|
-
/* @__PURE__ */A("button",{type:"button",onClick:()=>se(e.label),"aria-expanded":s,"aria-controls":o,className:$(!s&&i,!1),children:[r,
|
|
17
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate",children:n}),
|
|
18
|
-
/* @__PURE__ */L(B,{open:s})]}),
|
|
19
|
-
/* @__PURE__ */L("div",{id:o,role:"group","aria-label":n,hidden:!s,className:"space-y-0.5 pt-0.5",children:s&&a.map(e=>be(e,1))}),l&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.label)},fe=_?.first_name?`${_.first_name} ${_.last_name||""}`.trim():P?.email||"",ye=(_?.first_name?.charAt(0)||P?.email?.charAt(0)||"?").toUpperCase(),xe=_?.avatar_url?/* @__PURE__ */L("img",{src:_.avatar_url,alt:"",className:"size-8 shrink-0 rounded-full object-cover"}):/* @__PURE__ */L("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-blue-600 text-xs font-semibold text-white",children:ye}),Ne=de?he.current?.getBoundingClientRect():void 0,ve="px-3",ke=ne.erpSections.length>0||ne.systemSections.length>0||ne.virtualSections.length>0;/* @__PURE__ */
|
|
20
|
-
return A("aside",{"aria-label":ae.navLabel,className:"fixed left-0 top-0 z-(--z-sidebar) flex h-dvh flex-col border-r border-gray-200 bg-white text-gray-800",style:{width:D},children:[
|
|
21
|
-
/* @__PURE__ */A("div",{className:"flex shrink-0 items-center border-b border-gray-200 "+(K?"justify-center":"justify-between gap-2 pl-4 pr-2"),style:{height:p},children:[
|
|
22
|
-
/* @__PURE__ */A("span",{className:"flex min-w-0 items-center gap-2",children:[E&&/* @__PURE__ */L(s,{src:E,alt:"",slot:"compact",surface:"light",adaptive:q,hasAlpha:ee,isLight:te,size:28,decorative:!0}),!K&&/* @__PURE__ */A("span",{className:"min-w-0 leading-tight",children:[
|
|
23
|
-
/* @__PURE__ */L("span",{className:"block truncate text-base font-bold tracking-wide text-gray-900",children:Y??"Apps"}),Z&&/* @__PURE__ */L("span",{className:"block truncate text-2xs font-medium text-gray-500",children:Z})]})]}),!K&&/* @__PURE__ */L("button",{type:"button",onClick:R,"aria-label":ae.collapseSidebar,title:`${ae.collapseSidebar} (${W?"⌘":"Ctrl"} .)`,className:"flex size-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900",children:/* @__PURE__ */L(M,{dir:"left"})})]}),
|
|
24
|
-
/* @__PURE__ */L("div",{className:`shrink-0 pt-3 ${ve}`,children:K?/* @__PURE__ */L("button",{type:"button",onClick:o,"aria-label":ae.search,title:`${ae.search} (${W?"⌘K":"Ctrl K"})`,className:$(!1,!0),children:/* @__PURE__ */L(T,{className:"size-[18px]"})}):/* @__PURE__ */A("button",{type:"button",onClick:o,className:"flex h-(--row-height-menu) w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-3 text-left transition-colors hover:bg-gray-100",children:[
|
|
25
|
-
/* @__PURE__ */L(T,{className:"size-3.5 text-gray-500"}),
|
|
26
|
-
/* @__PURE__ */L("span",{className:"min-w-0 flex-1 truncate text-sm text-gray-500",children:ae.search}),
|
|
27
|
-
/* @__PURE__ */L("kbd",{className:"rounded border border-gray-200 bg-gray-100 px-2 py-0.5 font-mono text-2xs font-semibold text-gray-500",children:W?"⌘K":"Ctrl K"})]})}),
|
|
28
|
-
/* @__PURE__ */A("nav",{"aria-label":ae.navLabel,className:`min-h-0 flex-1 overflow-y-auto pb-4 pt-3 ${ve} ${K?"space-y-1":"space-y-0.5"}`,children:[K&&/* @__PURE__ */L("button",{type:"button",onClick:R,"aria-label":ae.expandSidebar,title:`${ae.expandSidebar} (${W?"⌘":"Ctrl"} .)`,className:`${$(!1,!0)} mb-3`,children:/* @__PURE__ */L(M,{dir:"right"})}),ne.topItems.map(e=>{if(!K)return be(e,0);const t=c(e,re),a=e.to===O||m(t,O,re),r=e.menuLabel??e.label;/* @__PURE__ */
|
|
29
|
-
return A("div",{children:[
|
|
30
|
-
/* @__PURE__ */L("button",{type:"button",title:r,"aria-label":r,onClick:a=>{if(0===t.length)return void ue(e,a);const r=a.currentTarget.getBoundingClientRect();ce(a=>a?.label===e.to?null:{label:e.to,items:t,top:r.top})},className:$(a,!0),children:pe(e.to,F)}),e.dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"})]},e.to)}),ne.topItems.length>0&&ke&&!ne.topItems[ne.topItems.length-1].dividerAfter&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ne.erpSections.map(e=>ge(e,!1)),ne.systemSections.map(e=>ge(e,!1)),ne.virtualSections.map(e=>ge(e,!0)),ne.footerSections.length>0&&/* @__PURE__ */L("div",{className:"mx-2 my-2 border-t border-gray-200","aria-hidden":"true"}),ne.footerSections.map(e=>ge(e,!1))]}),
|
|
31
|
-
/* @__PURE__ */L("div",{className:`shrink-0 border-t border-gray-200 py-2 ${ve}`,children:/* @__PURE__ */A("button",{ref:he,type:"button",onClick:()=>me(e=>!e),"aria-haspopup":"menu","aria-expanded":de,"aria-label":K?ae.accountMenu(fe):void 0,className:"flex w-full items-center gap-3 rounded-md hover:bg-gray-100 "+(K?"justify-center py-2":"px-2 py-2"),children:[xe,!K&&/* @__PURE__ */A("span",{className:"min-w-0 flex-1 text-left",children:[
|
|
32
|
-
/* @__PURE__ */L("span",{className:"block truncate text-sm font-semibold text-gray-800",children:fe}),P?.email&&fe!==P.email&&/* @__PURE__ */L("span",{className:"block truncate text-2xs text-gray-500",children:P.email})]})]})}),de&&Ne&&/* @__PURE__ */A(f,{portal:!0,minWidth:224,onClose:()=>me(!1),style:{left:Ne.left,bottom:window.innerHeight-Ne.top+8},children:[K&&/* @__PURE__ */A("div",{className:"border-b border-gray-200 px-3 py-3",children:[
|
|
33
|
-
/* @__PURE__ */L("p",{className:"truncate text-sm font-semibold text-gray-800",children:fe}),P?.email&&/* @__PURE__ */L("p",{className:"truncate text-xs text-gray-500",children:P.email})]}),
|
|
34
|
-
/* @__PURE__ */A(y,{onClick:()=>{me(!1),H("/profile",!1)},children:[
|
|
35
|
-
/* @__PURE__ */L(v,{name:"account",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.profile]}),ne.footerItems.map(e=>/* @__PURE__ */A(y,{onClick:()=>{me(!1),ue(e)},children:[
|
|
36
|
-
/* @__PURE__ */L("span",{className:"h-4 w-4 [&>svg]:size-4","aria-hidden":"true",children:F[e.to]}),e.menuLabel??e.label]},e.to)),V&&/* @__PURE__ */A(y,{onClick:()=>{me(!1),V()},children:[
|
|
37
|
-
/* @__PURE__ */L(v,{name:"error",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.reportIssue]}),
|
|
38
|
-
/* @__PURE__ */L(x,{}),
|
|
39
|
-
/* @__PURE__ */A(y,{onClick:()=>{me(!1),Q()},children:[
|
|
40
|
-
/* @__PURE__ */L(v,{name:"desktop",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.switchToDesktop]}),
|
|
41
|
-
/* @__PURE__ */L(x,{}),
|
|
42
|
-
/* @__PURE__ */A(y,{danger:!0,onClick:()=>{me(!1),G()},children:[
|
|
43
|
-
/* @__PURE__ */L(v,{name:"logout",className:"h-4 w-4",strokeWidth:1.5,"aria-hidden":"true"}),ae.signOut]})]}),oe&&K&&/* @__PURE__ */L(f,{portal:!0,minWidth:220,onClose:()=>ce(null),style:{left:D+6,top:Math.min(oe.top,window.innerHeight-48*Math.min(oe.items.length,10)-16)},children:oe.items.flatMap(e=>{const t=c(e,re);return(t.length>0?t:[e]).map(e=>/* @__PURE__ */A(y,{onClick:()=>ue(e),children:[pe(e.to,F),
|
|
44
|
-
/* @__PURE__ */L("span",{className:e.to===O?"font-semibold":"",children:e.menuLabel??e.label})]},e.to))})})]})}export{D as default};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import{EditableGrid as e}from"./chunk-MEIVZG77.js";import"./chunk-BR22X7E5.js";import"./chunk-RVPQRXC4.js";import{AboutApp as t}from"./chunk-5MBF4FPG.js";import{peekSpreadsheetPreviewStage as r,claimSpreadsheetPreviewStage as n,SPREADSHEET_PREVIEW_UPDATE_EVENT as o}from"./chunk-VTVSMRFX.js";import{WindowTitle as a}from"./chunk-CV3XVHWR.js";import"./chunk-DSSLOQDW.js";import"./chunk-DY43MKMT.js";import"./chunk-QKNGN4H4.js";import"./chunk-5A7MWTXX.js";import"./chunk-NVFKXL52.js";import"./chunk-SZTKBF3D.js";import"./chunk-F2GDJO2Y.js";import"./chunk-GNW45MGV.js";import"./chunk-UVBK6YSR.js";import"./chunk-K7PQXJO7.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-SKDIIPFY.js";import"./chunk-KNUR2UEG.js";import"./chunk-DBWGMZCY.js";import"./chunk-C3QOHMR6.js";import"./chunk-B427NVDP.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),N=(()=>{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,"")}})(),[C,S]=s(N?[N.sheet]:[f("Sheet 1")]),[j,M]=s(0),D=l([]),$=l(C),E=l(!1);c(()=>{E.current?E.current=!1:$.current!==C&&(D.current.push($.current),D.current.length>50&&D.current.shift()),$.current=C},[C]);const U=i(()=>{const e=D.current.pop();e&&(E.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(),U())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[U]);const[A,F]=s(N?.title??"Untitled"),[R,B]=s(()=>g.current?.data.onEmail),K=i(e=>{const t=k(e.csv,"Sheet 1");t&&(S([t]),M(0),F(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),B(()=>e.onEmail))},[]);c(()=>{const e=g.current;null!=e&&(n(e),e.data!==w.current&&K(e.data))},[]),c(()=>{const e=g.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&K(r.data)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const[L,I]=s(!1),[V,G]=s(null),[X,O]=s(""),H=l(null),[P,Q]=s("1"),[T,W]=s("10"),Y=C[j]||C[0],Z=Y.data,z=Y.columns,J=Y.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?J[`${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!==z.length?se({data:e,columns:y(t)}):se({data:e})},[se,z.length]),ie=(e,t)=>{S(r=>r.map((r,n)=>n===e?{...r,name:t}:r)),G(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
|
-
return u("div",{ref:m,className:"flex flex-col h-full",children:[
|
|
3
|
-
/* @__PURE__ */d(a,{title:`${me=A||"Untitled",me.length>24?`${me.slice(0,23)}…`:me} - Spreadsheets`}),
|
|
4
|
-
/* @__PURE__ */d(t,{app:"spreadsheet"}),
|
|
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:[L?/* @__PURE__ */d("input",{type:"text",value:A,onChange:e=>F(e.target.value),onBlur:()=>I(!1),onKeyDown:e=>{"Enter"===e.key&&I(!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:()=>I(!0),className:"text-sm font-medium text-gray-900 hover:text-blue-600 truncate max-w-[200px]",title:"Click to rename",children:A||"Untitled"}),
|
|
6
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
7
|
-
/* @__PURE__ */d("input",{ref:H,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),M(0),F(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}),F(r)}H.current&&(H.current.value="")},className:"hidden"}),
|
|
8
|
-
/* @__PURE__ */d("button",{onClick:()=>H.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
|
-
/* @__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=`${A||"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(),`${A||"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
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
11
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
12
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"50",value:P,onChange:e=>Q(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=z.length+e;se({columns:y(t),data:Z.map(t=>[...t,...Array(e).fill("")])})})(parseInt(P)||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
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:[
|
|
15
|
-
/* @__PURE__ */d("input",{type:"number",min:"1",max:"500",value:T,onChange:e=>W(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(T)||10,void se({data:[...Z,...Array.from({length:e},()=>Array(z.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
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
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
|
-
/* @__PURE__ */d("div",{className:"h-4 w-px bg-gray-300"}),
|
|
20
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",title:le?"":"Click a cell first",children:[
|
|
21
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("bold"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors font-bold ${ae.bold?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"B"}),
|
|
22
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("italic"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors italic ${ae.italic?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"I"}),
|
|
23
|
-
/* @__PURE__ */d("button",{onClick:()=>ne("underline"),disabled:!le,className:`px-2 py-1 text-xs rounded transition-colors underline ${ae.underline?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"U"}),
|
|
24
|
-
/* @__PURE__ */u("select",{value:ae.fontSize??"base",onChange:e=>ne("fontSize",e.target.value),disabled:!le,className:"ml-1 text-xs border border-gray-300 rounded px-1 py-0.5 bg-white disabled:opacity-40 disabled:cursor-not-allowed",children:[
|
|
25
|
-
/* @__PURE__ */d("option",{value:"sm",children:"XS"}),
|
|
26
|
-
/* @__PURE__ */d("option",{value:"base",children:"S"}),
|
|
27
|
-
/* @__PURE__ */d("option",{value:"lg",children:"M"}),
|
|
28
|
-
/* @__PURE__ */d("option",{value:"xl",children:"L"})]})]})]}),
|
|
29
|
-
/* @__PURE__ */d("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */d(e,{columns:z,data:Z,onChange:ce,onColumnsChange:e=>se({columns:e}),cellStyles:J,onFocusChange:q,onSelectionChange:te,minRows:x,maxHeight:"100%"})}),
|
|
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:[C.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>M(t),onDoubleClick:()=>{G(t),O(e.name)},onContextMenu:e=>{e.preventDefault(),C.length>1&&(e=>{C.length<=1||(S(t=>t.filter((t,r)=>r!==e)),j>=e&&j>0&&M(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:V===t?/* @__PURE__ */d("input",{type:"text",value:X,onChange:e=>O(e.target.value),onBlur:()=>ie(t,X||e.name),onKeyDown:r=>{"Enter"===r.key&&ie(t,X||e.name),"Escape"===r.key&&G(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
|
-
/* @__PURE__ */d("button",{onClick:()=>{const e=`Sheet ${C.length+1}`;S(t=>[...t,f(e)]),M(C.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
|
-
/* @__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
|
-
/* @__PURE__ */u("span",{children:[he," cells"]}),de.length>0&&/* @__PURE__ */u(h,{children:[
|
|
35
|
-
/* @__PURE__ */u("span",{children:["Sum: ",de.reduce((e,t)=>e+t,0).toLocaleString(void 0,{maximumFractionDigits:2})]}),
|
|
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:[Z.length," × ",z.length]})]})]})]});var me}export{w as default};
|