efficient-shell 5.6.1 → 7.7.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 +270 -64
- package/THIRD_PARTY_NOTICES.md +212 -0
- package/dist/Browser-56LX7FTE.js +43 -0
- package/dist/Calculator-GBKLJHM6.js +29 -0
- package/dist/ConfirmDialog-PS5BXNAT.js +1 -0
- package/dist/CurrencyConverter-ZXY7XNG6.js +21 -0
- package/dist/Documents-SVKR757H.js +52 -0
- package/dist/Files-KSHU7ROB.js +87 -0
- package/dist/Notepad-5GT2GUCJ.js +25 -0
- package/dist/PdfViewer-YVAWFZVH.js +1 -0
- package/dist/PomodoroTimer-GAGDQ4NF.js +91 -0
- package/dist/Preview-YDCDW5NE.js +182 -0
- package/dist/Sidebar-IH6WUPKT.js +44 -0
- package/dist/Spreadsheet-SYR23K4I.js +37 -0
- package/dist/Stock-LH5CR667.js +16 -0
- package/dist/{Weather-RWI6NKB2.js → Weather-MZGIPR2R.js} +35 -35
- package/dist/WorldClock-DLB2RRLI.js +32 -0
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-2ALIPI3D.js +1 -0
- package/dist/{chunk-JXAAZGLJ.js → chunk-2R5RTN5T.js} +1 -1
- package/dist/chunk-43XFZY4K.js +5 -0
- package/dist/chunk-4JGNJYVL.js +10 -0
- package/dist/{chunk-7WC3EOFS.js → chunk-5TOLXFQ6.js} +1 -1
- package/dist/chunk-6SCHK75C.js +108 -0
- package/dist/chunk-7IQ3B77H.js +1 -0
- package/dist/{chunk-TFETN2GI.js → chunk-B4PGVDB6.js} +1 -1
- package/dist/chunk-BUGGBB5J.js +1 -0
- package/dist/chunk-CJHT4VTF.js +91 -0
- package/dist/chunk-CLFUF3BH.js +9 -0
- package/dist/chunk-CQ2DLPPS.js +3 -0
- package/dist/{chunk-X4FJ54PP.js → chunk-FIEA5CGB.js} +1 -1
- package/dist/chunk-G4CTTSAR.js +11 -0
- package/dist/{chunk-YIH6JLMV.js → chunk-HIRMYFOF.js} +2 -2
- package/dist/chunk-JKHXDQEI.js +24 -0
- package/dist/{chunk-KXAUDC3A.js → chunk-JQRIAZDP.js} +35 -35
- package/dist/chunk-KNUR2UEG.js +1 -0
- package/dist/{chunk-WWF2EQXF.js → chunk-KONXUO5I.js} +1 -1
- package/dist/chunk-M4MCXII7.js +6 -0
- package/dist/{chunk-CLPJDJH4.js → chunk-M4TRVJTO.js} +1 -1
- package/dist/chunk-MSGBGLGI.js +29 -0
- package/dist/chunk-N7JTY3LU.js +21 -0
- package/dist/chunk-NODT4F2C.js +13 -0
- package/dist/chunk-OXTM3XZI.js +1 -0
- package/dist/chunk-PJPK2ADX.js +1 -0
- package/dist/chunk-PT4Z3KIA.js +12 -0
- package/dist/chunk-QRCDQPJA.js +1 -0
- package/dist/{chunk-SKB6L53D.js → chunk-QUVE5JZZ.js} +11 -11
- package/dist/{chunk-N3A3GWJI.js → chunk-R2TPTM4O.js} +12 -12
- package/dist/{chunk-GG7AE6OC.js → chunk-RBKIYZ7H.js} +1 -1
- package/dist/chunk-RUHUTZN4.js +1 -0
- package/dist/chunk-TCYS67ND.js +1016 -0
- package/dist/{chunk-AFYQTVZO.js → chunk-UVBK6YSR.js} +1 -1
- package/dist/client-DLm3Fvbc.d.ts +65 -0
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/icons/efficient-looks.d.ts +1 -1
- package/dist/icons/efficient-looks.js +4 -4
- package/dist/icons/efficient.d.ts +3 -3
- package/dist/icons/efficient.js +3 -3
- package/dist/icons/index.d.ts +12 -12
- package/dist/icons/index.js +1 -1
- package/dist/{index-ZI6vl2Wq.d.ts → index-BkBsXpfV.d.ts} +468 -161
- package/dist/index.d.ts +6 -4
- package/dist/index.js +635 -639
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/markup/index.d.ts +460 -36
- package/dist/markup/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{registry-J-TU7zKx.d.ts → registry-Dw6QO2Ch.d.ts} +12 -9
- package/dist/{strings-BVB64Nck.d.ts → strings-BQtq9300.d.ts} +22 -2
- package/dist/telemetry/index.d.ts +39 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/ui/index.d.ts +4 -3
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +110 -75
- package/package.json +7 -21
- package/dist/Browser-RXGEZ77D.js +0 -43
- package/dist/Calculator-MVPKTZZF.js +0 -29
- package/dist/ConfirmDialog-XOYCYFA7.js +0 -1
- package/dist/CurrencyConverter-2IGOOR3I.js +0 -21
- package/dist/Documents-YBLR7WVX.js +0 -52
- package/dist/Files-7XNR5IL2.js +0 -87
- package/dist/Notepad-ZQYQXV75.js +0 -25
- package/dist/PdfViewer-SQVMMA7B.js +0 -1
- package/dist/PomodoroTimer-XIUN4M73.js +0 -91
- package/dist/Preview-YCOA5JPP.js +0 -182
- package/dist/Sidebar-VI7E3EKI.js +0 -44
- package/dist/Spreadsheet-SRAUU3OA.js +0 -37
- package/dist/Stock-7EKOAQ7C.js +0 -16
- package/dist/WorldClock-CEHWDFEO.js +0 -32
- package/dist/chunk-3HJTOINK.js +0 -1
- package/dist/chunk-4SWPNARR.js +0 -5
- package/dist/chunk-5ABLFFC5.js +0 -24
- package/dist/chunk-6LTDJKIL.js +0 -138
- package/dist/chunk-F6B3J3GW.js +0 -6
- package/dist/chunk-HZZNJHRH.js +0 -1
- package/dist/chunk-IMMHJIV5.js +0 -29
- package/dist/chunk-OGXU7QFW.js +0 -12
- package/dist/chunk-P4CIOJHP.js +0 -3
- package/dist/chunk-RBDGN4YU.js +0 -9
- package/dist/chunk-RC2EG6P4.js +0 -1026
- package/dist/chunk-RL626E7Q.js +0 -13
- package/dist/chunk-RMJZOKHY.js +0 -10
- package/dist/chunk-SFCDHHQP.js +0 -1
- package/dist/chunk-TNBCUZVE.js +0 -1
- package/dist/chunk-VWBQ2P5G.js +0 -108
- package/dist/chunk-XWSWYMGM.js +0 -2
- package/dist/chunk-YGC7AX3X.js +0 -11
- package/dist/chunk-Z7D6Y5WA.js +0 -21
- package/dist/icons/heroicons.d.ts +0 -6
- package/dist/icons/heroicons.js +0 -1
- package/dist/icons/lucide.d.ts +0 -6
- package/dist/icons/lucide.js +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useBrowserLayoutEffect as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-
|
|
2
|
-
return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{useBrowserLayoutEffect as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-QRCDQPJA.js";import{useRef as r,useState as o,useEffect as l,useCallback as c,useMemo as a}from"react";import{createPortal as s}from"react-dom";import{jsxs as i,jsx as u,Fragment as d}from"react/jsx-runtime";function h(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function w({text:t,...n}){const r=a(()=>({__html:e(t)}),[t]);/* @__PURE__ */
|
|
2
|
+
return u("div",{...n,dangerouslySetInnerHTML:r})}function g({columns:e,data:g,onChange:m,onColumnsChange:p,fixedRows:f=!1,minRows:y=15,maxHeight:b="260px",cellStyles:v,onFocusChange:x,onSelectionChange:M}){const D=r(null),k=n().grid,[C,E]=o(null);l(()=>{x?.(C)},[C,x]);const[L,S]=o({}),$=r(null),[z,A]=o({}),N=r(null),[O,R]=o(null),[T,K]=o(null),[P,F]=o(null),[I,X]=o(null),[H,Y]=o(null),j=r(null);t(()=>{const e=j.current;if(!e||e.row!==H?.row||e.col!==H?.col)return;j.current=null;const t=D.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[H]);const[q,B]=o(null),[W,J]=o(null);l(()=>{M?.(q&&W?{anchor:q,end:W}:null)},[q,W,M]);const Q=r(!1),[_,U]=o(null),V=r(!1),G=r({a:null,e:null});G.current={a:q,e:W};const Z=q&&W&&(q.row!==W.row||q.col!==W.col),ee=[...g];if(!f)for(;ee.length<y;)ee.push(Array(e.length).fill(""));const te=c((t,n,r)=>{const o=ee.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,m(o)},[ee,e.length,m]),ne=c((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(ee[e]?.[t]||"")){const r=ee.map(e=>[...e]);r[e]&&(r[e][t]=n,m(r))}}Q.current=!0,e.shiftKey&&q||B({row:t,col:n}),J({row:t,col:n})},[ee,m,q]),re=c((e,t)=>{Q.current&&J({row:e,col:t})},[]);l(()=>{const e=()=>{Q.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),l(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!W)return;const t=window.getSelection();if(t&&t.toString().length>0&&!Z)return;const n=Math.min(q.row,W.row),r=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(ee[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,W,ee,Z]),l(()=>{const t=t=>{if(!C)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!D.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=ee.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=C.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=C.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}m(f?l:h(l,e.length)),B({row:C.row,col:C.col}),J({row:Math.min(C.row+o.length-1,l.length-1),col:Math.min(C.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[C,ee,e,m,f]);const oe=c((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=ee.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}m(f?c:h(c,e.length))},[ee,e,m,f]),le=c((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),te(n,r,"")));if(t.preventDefault(),q&&W){const t=Math.min(q.row,W.row),n=Math.max(q.row,W.row),r=Math.min(q.col,W.col),o=Math.max(q.col,W.col),l=ee.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");m(l)}else te(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<ee.length&&l>=0&&l<e.length){const e=D.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),E({row:o,col:l}),Y(null),B({row:o,col:l}),J({row:o,col:l}))}},[e,ee,ee.length,te,q,W,m]),ce=c(t=>{if(!f&&t>=ee.length-2){const t=ee.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));m(t)}},[f,ee,e.length,m]),[ae,se]=o(null);l(()=>{if(!ae)return;const e=()=>se(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[ae]);const ie=c(t=>{const n=ee.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),m(n)},[ee,e.length,m]),ue=c(e=>{if(ee.length<=1)return;const t=ee.filter((t,n)=>n!==e);m(t)},[ee,m]),de=c(e=>{const t=ee.map(t=>{const n=[...t];return n.splice(e,0,""),n});m(t)},[ee,m]),he=c(t=>{if(e.length<=1)return;const n=ee.map(e=>{const n=[...e];return n.splice(t,1),n});m(n)},[ee,e.length,m]),we=c((e,t)=>{e.preventDefault(),f||se({x:e.clientX,y:e.clientY,items:[{label:k.insertRowAbove,onClick:()=>{ie(t),se(null)}},{label:k.insertRowBelow,onClick:()=>{ie(t+1),se(null)}},{label:k.deleteRow(t+1),onClick:()=>{ue(t),se(null)}}]})},[f,ie,ue,k]),ge=c((t,n)=>{t.preventDefault(),f||se({x:t.clientX,y:t.clientY,items:[{label:k.insertColumnLeft,onClick:()=>{de(n),se(null)}},{label:k.insertColumnRight,onClick:()=>{de(n+1),se(null)}},{label:k.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{he(n),se(null)}}]})},[f,e,de,he,k]),me=t=>L[t]??e[t]?.width??150;l(()=>{const t=e=>{if(!$.current)return;const t=e.clientX-$.current.startX,n=Math.max(40,$.current.startW+t);S(e=>({...e,[$.current.col]:n}))},n=()=>{if($.current&&p){const t=e.map((e,t)=>({...e,width:L[t]??e.width}));t[$.current.col]={...t[$.current.col],width:L[$.current.col]??e[$.current.col].width},p(t)}$.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,L,p]);const pe=e=>z[e]??28;l(()=>{const e=e=>{if(!N.current)return;const t=e.clientY-N.current.startY,n=Math.max(20,N.current.startH+t);A(e=>({...e,[N.current.row]:n}))},t=()=>{N.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const fe=c(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of ee){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),p){const n=e.map((e,n)=>({...e,width:n===t?l:L[n]??e.width}));p(n)}},[ee,e,L,p]),ye=c(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),be=c(t=>{const{a:n,e:r}=G.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,d=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?d=t.col:t.col<c&&(u=t.col);const h=l-o+1,w=a-c+1,g=ee.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=d;)e.push("");function p(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=d;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&d===a){const r=p(Array.from({length:h},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%h+h)%h;n=g[o+r]?.[t]??""}}else if(1===h&&s===o&&i===l){const r=p(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%h+h)%h,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}m(g),B({row:s,col:u}),J({row:i,col:d})},[ee,e.length,m]);l(()=>{const e=e=>{if(!V.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);U({row:r,col:o})},t=()=>{V.current&&_&&be(_),V.current=!1,U(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[_,be]);const ve=e=>{e.preventDefault(),e.stopPropagation(),V.current=!0,document.body.style.cursor="crosshair"},xe=r(null),[Me,De]=o(0),[ke,Ce]=o(800);l(()=>{const e=xe.current;if(!e)return;const t=()=>Ce(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Ee=ee.length>100,Le=Ee?Math.max(0,Math.floor(Me/28)-20):0,Se=Ee?Math.min(ee.length,Math.ceil((Me+ke)/28)+20):ee.length,$e=a(()=>ee.slice(Le,Se),[ee,Le,Se]),ze=28*Le,Ae=28*(ee.length-Se),Ne="px-2 py-1.5 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
|
|
3
3
|
return i("div",{ref:xe,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:b,height:b},onScroll:e=>De(e.target.scrollTop),children:[
|
|
4
4
|
/* @__PURE__ */i("table",{ref:D,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+me(e.indexOf(n)),0)},children:[
|
|
5
5
|
/* @__PURE__ */i("colgroup",{children:[
|
|
6
6
|
/* @__PURE__ */u("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */u("col",{style:{width:me(t)}},e.key))]}),
|
|
7
7
|
/* @__PURE__ */u("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */i("tr",{children:[
|
|
8
|
-
/* @__PURE__ */u("th",{className:
|
|
9
|
-
return i("th",{className:`${
|
|
10
|
-
/* @__PURE__ */u("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),$.current={col:t,startX:e.clientX,startW:me(t)},document.body.style.cursor="col-resize"})(e,n),onDoubleClick:e=>{e.stopPropagation(),
|
|
11
|
-
/* @__PURE__ */i("tbody",{children:[
|
|
12
|
-
return i("tr",{style:{height:
|
|
13
|
-
/* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-
|
|
14
|
-
/* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),
|
|
8
|
+
/* @__PURE__ */u("th",{className:Ne+" text-center w-9 cursor-pointer hover:bg-gray-200",onClick:()=>{B({row:0,col:0}),J({row:ee.length-1,col:e.length-1})},title:k.selectAll,children:"#"}),e.map((t,n)=>{const r=q&&W&&Math.min(q.col,W.col)<=n&&n<=Math.max(q.col,W.col)&&0===Math.min(q.row,W.row)&&Math.max(q.row,W.row)===ee.length-1;/* @__PURE__ */
|
|
9
|
+
return i("th",{className:`${Ne} cursor-pointer hover:bg-gray-200 relative${r?" !bg-blue-200":""}${I===n?" !bg-blue-100":""}`,style:{width:me(n)},draggable:!0,onDragStart:()=>(e=>F(e))(n),onDragOver:e=>((e,t)=>{e.preventDefault(),X(t)})(e,n),onDrop:()=>(t=>{if(null===P||P===t)return F(null),void X(null);const n=ee.map(e=>{const n=[...e],[r]=n.splice(P,1);return n.splice(t,0,r),n});if(m(n),p){const n=[...e],[r]=n.splice(P,1);n.splice(t,0,r),p(n)}F(null),X(null)})(n),onDragEnd:()=>{F(null),X(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:n}),J({row:ee.length-1,col:n})},onContextMenu:e=>ge(e,n),children:[t.title,
|
|
10
|
+
/* @__PURE__ */u("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),$.current={col:t,startX:e.clientX,startW:me(t)},document.body.style.cursor="col-resize"})(e,n),onDoubleClick:e=>{e.stopPropagation(),fe(n)},title:k.resize})]},t.key)})]})}),
|
|
11
|
+
/* @__PURE__ */i("tbody",{children:[ze>0&&/* @__PURE__ */u("tr",{style:{height:ze}}),$e.map((t,n)=>{const r=Le+n,o=q&&W&&Math.min(q.row,W.row)<=r&&r<=Math.max(q.row,W.row)&&0===Math.min(q.col,W.col)&&Math.max(q.col,W.col)===e.length-1;/* @__PURE__ */
|
|
12
|
+
return i("tr",{style:{height:pe(r)},children:[
|
|
13
|
+
/* @__PURE__ */i("td",{className:`relative px-1 py-1 text-center text-2xs text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${T===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>R(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),K(t)})(e,r),onDrop:()=>(e=>{if(null===O||O===e)return R(null),void K(null);const t=ee.map(e=>[...e]),[n]=t.splice(O,1);t.splice(e,0,n),m(t),R(null),K(null)})(r),onDragEnd:()=>{R(null),K(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),J({row:r,col:e.length-1})},onContextMenu:e=>we(e,r),children:[r+1,
|
|
14
|
+
/* @__PURE__ */u("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),N.current={row:t,startY:e.clientY,startH:pe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:k.resize})]}),e.map((e,n)=>{const o=q&&W&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,W,r,n),l=H?.row===r&&H?.col===n&&!e.readOnly,c=C?.row===r&&C?.col===n,a=v?.[`${r}:${n}`],s=q&&W?Math.max(q.row,W.row):-1,d=q&&W?Math.max(q.col,W.col):-1,h=q&&W&&r===s&&n===d,g=V.current&&_&&q&&W&&(()=>{const e=Math.min(q.row,W.row),t=Math.max(q.row,W.row),o=Math.min(q.col,W.col),l=Math.max(q.col,W.col);let c=e,a=t,s=o,i=l;return _.row>t?a=_.row:_.row<e&&(c=_.row),_.col>l?i=_.col:_.col<o&&(s=_.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",p=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
|
|
15
15
|
return i("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${g?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){ne(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>re(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||Y({row:r,col:n})},children:[
|
|
16
|
-
/* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${
|
|
16
|
+
/* @__PURE__ */u(w,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${p}`,onMouseDown:e=>ne(e,r,n),onMouseEnter:()=>re(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{E({row:r,col:n}),Q.current||(B({row:r,col:n}),J({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&te(r,n,o),Y(null)},onInput:()=>ce(r),onPaste:e=>oe(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),te(r,n,t.key),j.current={row:r,col:n},void Y({row:r,col:n});le(t,r,n)},text:t[n]||""}),h&&/* @__PURE__ */u("div",{onMouseDown:ve,title:k.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */u("tr",{style:{height:Ae}})]})]}),ae&&s(
|
|
17
17
|
/* @__PURE__ */i(d,{children:[
|
|
18
|
-
/* @__PURE__ */u("div",{className:"fixed inset-0 z-
|
|
19
|
-
/* @__PURE__ */u("div",{className:"fixed z-
|
|
18
|
+
/* @__PURE__ */u("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>se(null)}),
|
|
19
|
+
/* @__PURE__ */u("div",{className:"fixed z-(--z-popup) bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[160px]",style:{left:ae.x,top:ae.y},children:ae.items.map((e,t)=>/* @__PURE__ */u("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{g as EditableGrid,h as withSpareRow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ShellStringsProvider as t}from"./chunk-
|
|
1
|
+
import{ShellStringsProvider as t}from"./chunk-QRCDQPJA.js";import{createContext as e,useEffect as a,useCallback as n,useMemo as r,useContext as l}from"react";import{jsx as o}from"react/jsx-runtime";var g={tag:"en",name:"English",locale:null},c="react-os-shell:language",u=t=>"string"==typeof t?t:t.tag;function i(t){try{const e=new Intl.Locale(t).maximize();return{language:e.language,script:e.script}}catch{return null}}function s(t,e){const a=e.map(u),n=t.toLowerCase(),r=a.find(t=>t.toLowerCase()===n);if(r)return r;const l=i(t);if(!l)return;const o=a.map(t=>({tag:t,parts:i(t)})).filter(t=>t.parts?.language===l.language);return(o.find(t=>t.parts?.script===l.script)??o[0])?.tag}function f(){try{return globalThis.localStorage?.getItem(c)??null}catch{return null}}function m(t){try{return globalThis.localStorage?.setItem(c,t),globalThis.localStorage?.getItem(c)===t}catch{return!1}}function h({offered:t,fallback:e,saved:a=f(),preferred:n=globalThis.navigator?.languages??[]}){const r=e??(t.length>0?u(t[0]):g.tag);if(a){const e=s(a,t);if(e)return e}for(const e of n){const a=s(e,t);if(a)return a}return r}var d=e({language:g.tag,languages:[g],setLanguage:async()=>{}}),p=()=>globalThis.location?.reload();function b({languages:e,language:l,strings:g,onChange:c,reload:u=p,children:i}){const s=e.find(t=>t.tag===l),f=s?void 0===s.locale?s.tag:s.locale??void 0:void 0;a(()=>{const t=globalThis.document?.documentElement;if(!t)return;const e=t.getAttribute("lang");return t.setAttribute("lang",l),()=>{null===e?t.removeAttribute("lang"):t.setAttribute("lang",e)}},[l]);const h=n(async t=>{if(t!==l&&e.some(e=>e.tag===t)){m(t);try{await(c?.(t))}catch{}u&&u()}},[l,e,c,u]),b=r(()=>({language:l,languages:e,setLanguage:h}),[l,e,h]);/* @__PURE__ */
|
|
2
2
|
return o(d.Provider,{value:b,children:/* @__PURE__ */o(t,{value:g,locale:f,children:i})})}function v(){return l(d)}export{g as ENGLISH,c as SHELL_LANGUAGE_STORAGE_KEY,b as ShellLanguageProvider,s as matchShellLanguage,f as readSavedShellLanguage,h as resolveShellLanguage,m as saveShellLanguage,v as useShellLanguage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{currentShellStrings as t}from"./chunk-QRCDQPJA.js";var e="http://www.w3.org/2000/svg",n={},o=/* @__PURE__ */new Map;function s(t,e){let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.className=e,document.body.appendChild(n)),n}var r={success:"M5 13l4 4L19 7",error:"M6 18L18 6M6 6l12 12",warning:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",info:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",loading:"M12 3a9 9 0 019 9",bell:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"};function i(t,n){const o=document.createElementNS(e,"svg");o.setAttribute("class",n),o.setAttribute("fill","none"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","2");const s=document.createElementNS(e,"path");return s.setAttribute("stroke-linecap","round"),"loading"!==t&&s.setAttribute("stroke-linejoin","round"),s.setAttribute("d",r[t]),o.appendChild(s),o}function a(t,e){const n=document.createElement("div");return n.className=t,void 0!==e&&(n.textContent=e),n}function c(t,e,r){const c={...n,...r},l=c.placement??"top",d=c.sticky??!1,u=`${l}|${t}|${e}`;if(c.dedupe){const t=o.get(u);if(t)return t.restart(),{dismiss:t.dismiss}}"loading"!==t&&!1!==c.sound&&import("./sounds-FO772MN2.js").then(e=>{"success"===t?e.playSuccess():"error"===t?e.playError():e.playNotification()}).catch(()=>{});const m="bottom"===l?s("toast-container-bottom","fixed bottom-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col-reverse gap-2 items-center pointer-events-none"):s("toast-container","fixed top-4 left-1/2 -translate-x-1/2 z-(--z-toast) flex flex-col gap-2 items-center pointer-events-none"),p="bottom"===l?"translateY(10px)":"translateY(-10px)",f=a("pointer-events-auto cursor-pointer rosh-toast");f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,f.setAttribute("role","error"===t?"alert":"status"),f.setAttribute("aria-atomic","true"),f.appendChild(i(t,`h-4 w-4 rosh-tone-${t}${"loading"===t?" animate-spin":""}`));const h=document.createElement("span");let y;h.textContent=e,f.appendChild(h),m.appendChild(f),requestAnimationFrame(()=>{f.style.opacity="1",f.style.transform="translateY(0) scale(1)"});let v=!1;const g=()=>{v||(v=!0,y&&clearTimeout(y),o.delete(u),f.style.opacity="0",f.style.transform=`${p} scale(0.95)`,setTimeout(()=>f.remove(),300))},b=c.duration??("info"===t?4500:3e3),x=()=>{y&&clearTimeout(y),d||(y=setTimeout(g,b))};return x(),f.addEventListener("mouseenter",()=>{y&&clearTimeout(y)}),f.addEventListener("mouseleave",()=>{v||x()}),f.addEventListener("click",g),o.set(u,{el:f,restart:x,dismiss:g}),{dismiss:g}}var l={success:(t,e)=>c("success",t,e),error:(t,e)=>c("error",t,e),warning:(t,e)=>c("warning",t,e),info:(t,e)=>c("info",t,e),notify:(e,o)=>function(e,o){!1!==(o?.sound??n.sound)&&import("./sounds-FO772MN2.js").then(t=>t.playNotification()).catch(()=>{});const r=s("notif-container","fixed top-4 right-4 z-(--z-toast) flex flex-col gap-3 items-end pointer-events-none"),c=a("pointer-events-auto cursor-pointer rosh-notif");c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)";const l=a("rosh-notif-badge");l.appendChild(i("bell","h-5 w-5"));const d=a("rosh-notif-body");d.append(a("rosh-notif-title",t().toast.notification),a("notif-msg rosh-notif-msg",e));const u=document.createElement("button");u.className="rosh-notif-close",u.textContent="×",c.append(l,d,u);const m=()=>{c.style.opacity="0",c.style.transform="translateX(30px) scale(0.95)",setTimeout(()=>c.remove(),300)};u.addEventListener("click",t=>{t.stopPropagation(),m()}),c.addEventListener("click",m),r.appendChild(c),requestAnimationFrame(()=>{c.style.opacity="1",c.style.transform="translateX(0) scale(1)"}),setTimeout(m,o?.duration??1e4)}(e,o),promise:(t,e,n)=>{const o=c("loading",e.loading,{...n,sticky:!0});return t.then(t=>{o.dismiss(),c("success","function"==typeof e.success?e.success(t):e.success,n)},t=>{o.dismiss(),c("error","function"==typeof e.error?e.error(t):e.error,n)}),t},configure:t=>{n={...t}}};export{l as toast_default};
|