efficient-shell 5.0.0 → 5.1.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 +29 -2
- package/dist/{Browser-5F5LWXYQ.js → Browser-WUVL7ZSM.js} +18 -18
- package/dist/Calculator-E2CBADVF.js +29 -0
- package/dist/ConfirmDialog-ZM364NPI.js +1 -0
- package/dist/{CurrencyConverter-QEG6RFAS.js → CurrencyConverter-LF2WHJW4.js} +7 -7
- package/dist/{Documents-6DEUZVVA.js → Documents-MB4TJGNY.js} +26 -26
- package/dist/Files-JQYIBZEP.js +87 -0
- package/dist/{Notepad-KNJRTYXR.js → Notepad-UQSG5BE3.js} +11 -11
- package/dist/PdfViewer-4VGNBBED.js +1 -0
- package/dist/{PomodoroTimer-T6YAQFIE.js → PomodoroTimer-XARF7DO3.js} +50 -50
- package/dist/{Preview-KEIDYSHF.js → Preview-LETK6AJS.js} +126 -126
- package/dist/Sidebar-VR4QYFQU.js +44 -0
- package/dist/{Spreadsheet-HKXSYD5B.js → Spreadsheet-RCHOM2RE.js} +13 -13
- package/dist/{Stock-BZFC2ROU.js → Stock-25FQMI2G.js} +3 -3
- package/dist/{Weather-S3N5OWYF.js → Weather-KLQ55R64.js} +17 -17
- package/dist/{WorldClock-ACC3S6OA.js → WorldClock-RMPU7D2M.js} +6 -6
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-2DX65GOO.js → chunk-2KTBZE5F.js} +1 -1
- package/dist/{chunk-PQLVWCUI.js → chunk-2TP4GK53.js} +5 -5
- package/dist/chunk-3JK2LSFU.js +1 -0
- package/dist/{chunk-R7EBJKN2.js → chunk-4KLBITSY.js} +28 -28
- package/dist/{chunk-5IWSOLLY.js → chunk-5LCZFVE4.js} +2 -2
- package/dist/{chunk-GMMTTWHB.js → chunk-6TCHOT4R.js} +1 -1
- package/dist/{chunk-3DGTIWZP.js → chunk-DBB4DB7J.js} +1 -1
- package/dist/{chunk-KDRAU4XQ.js → chunk-DXNCJBGY.js} +7 -7
- package/dist/{chunk-WNEO7TSP.js → chunk-FA6E75W5.js} +1 -1
- package/dist/{chunk-TKUNR5KP.js → chunk-GPNNQIRY.js} +2 -2
- package/dist/{chunk-LK7V32MR.js → chunk-H5NEXQTX.js} +1 -1
- package/dist/{chunk-T4CFSGSL.js → chunk-HKLW5KTW.js} +6 -6
- package/dist/{chunk-NHIGOEZF.js → chunk-JK2KQ4PF.js} +1 -1
- package/dist/chunk-LOXV3J6X.js +1005 -0
- package/dist/{chunk-QRV7RNQX.js → chunk-LTGIQ7HO.js} +14 -14
- package/dist/{chunk-MIAJQGWE.js → chunk-LY2G6LHW.js} +1 -1
- package/dist/{chunk-PE4F4MJE.js → chunk-MDI265RK.js} +4 -4
- package/dist/{chunk-FOEVG7RT.js → chunk-N3W6PH55.js} +11 -11
- package/dist/chunk-OBMR6BEP.js +1 -0
- package/dist/{chunk-SBDIHKLU.js → chunk-TMZVVRTA.js} +20 -20
- package/dist/{chunk-ZZKIKW62.js → chunk-VOY6TCS2.js} +19 -19
- package/dist/{chunk-VJP3R52B.js → chunk-XNHYCOPO.js} +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-HMDUOPnX.d.ts → index-CzMz_Y9A.d.ts} +139 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +479 -479
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +5 -5
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-ZbotP_I6.d.ts → strings-BEuOOURI.d.ts} +21 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-4K53PFBL.js +0 -29
- package/dist/ConfirmDialog-X2DPOYWO.js +0 -1
- package/dist/Files-2VSFXA45.js +0 -87
- package/dist/PdfViewer-UZGDE4HD.js +0 -1
- package/dist/Sidebar-3NZRIL7F.js +0 -44
- package/dist/chunk-67PNFBCW.js +0 -993
- package/dist/chunk-J3LIIIHJ.js +0 -1
- package/dist/chunk-YKHMAGEM.js +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{toast_default as e}from"./chunk-
|
|
2
|
-
/* @__PURE__ */f("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`);var v={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},x=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=v[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw w(n,t,a);return a}};function k(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:x}}var C=[50,75,100,125,150,200,300,400];function N(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function j({url:s,filename:c,fit:p="width",onDownload:w,onEmail:y,workerSrc:v,wasmUrl:x}){const j=i().pdf,M=d(null),E=d(null),
|
|
1
|
+
import{toast_default as e}from"./chunk-DBB4DB7J.js";import{ChevronLeftFallback as t,ChevronRightFallback as n,PrintFallback as r,DownloadFallback as a,EmailFallback as o}from"./chunk-XUF7VW4U.js";import{useShellStrings as i}from"./chunk-3JK2LSFU.js";import{Icon as l}from"./chunk-YKZHOXI4.js";import{createContext as s,useContext as c,useRef as d,useState as u,useEffect as m}from"react";import*as h from"pdfjs-dist";import{createPortal as p}from"react-dom";import{jsx as f,jsxs as g}from"react/jsx-runtime";function w(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var y=s(null);function b({children:e}){const t=c(y);return t?p(e,t):
|
|
2
|
+
/* @__PURE__ */f("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||h.GlobalWorkerOptions.workerSrc||(h.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`);var v={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},x=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=v[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw w(n,t,a);return a}};function k(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:x}}var C=[50,75,100,125,150,200,300,400];function N(e,t,n){const r=(t.width-40)/n.width,a="page"===e?Math.min(r,(t.height-40)/n.height):r;return Math.min(Math.max(a,.3),4)}function j({url:s,filename:c,fit:p="width",onDownload:w,onEmail:y,workerSrc:v,wasmUrl:x}){const j=i().pdf,M=d(null),E=d(null),D=d(null),[_,z]=u(null),[P,W]=u(1),[L,S]=u(0),[$,O]=u(1),[T,A]=u(!0),[U,F]=u(!0),H=d(j.loadFailed);H.current=j.loadFailed,m(()=>{let t=!1;return F(!0),W(1),v&&(h.GlobalWorkerOptions.workerSrc=v),h.getDocument({url:s,...k(x)}).promise.then(e=>{t||(z(e),S(e.numPages),F(!1))}).catch(()=>{t||(e.error(H.current),F(!1))}),()=>{t=!0}},[s,v,x]),m(()=>{if(!_||!T||!D.current)return;const e=()=>{const e=D.current;e&&_.getPage(P).then(t=>{if(!D.current)return;const n=t.getViewport({scale:1}),r=N(p,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});O(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(D.current),()=>t.disconnect()},[_,P,T,p]),m(()=>{if(!_||!M.current)return;let e=!1,t=null,n=null;return _.getPage(P).then(r=>{if(e||!M.current)return;const a=r.getViewport({scale:$}),o=M.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const l=E.current;l&&(l.replaceChildren(),l.style.setProperty("--total-scale-factor",String(a.scale)),n=new h.TextLayer({textContentSource:r.streamTextContent(),container:l,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",l.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[_,P,$]),m(()=>{const e=()=>E.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const R="page"===p?j.fitPage:j.fitWidth,B="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
3
|
return g("div",{className:"flex flex-col h-full",children:[
|
|
4
4
|
/* @__PURE__ */g(b,{children:[
|
|
5
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":j.previousPage,onClick:()=>
|
|
6
|
-
/* @__PURE__ */f("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:j.pageOf(
|
|
7
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":j.nextPage,onClick:()=>
|
|
5
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.previousPage,onClick:()=>W(e=>Math.max(1,e-1)),disabled:P<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */f(l,{name:"chevron-left",fallback:t,className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
6
|
+
/* @__PURE__ */f("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:j.pageOf(P,L)}),
|
|
7
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.nextPage,onClick:()=>W(e=>Math.min(L,e+1)),disabled:P>=L,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */f(l,{name:"chevron-right",fallback:n,className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
8
8
|
/* @__PURE__ */f("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
9
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomOut,title:j.zoomOut,onClick:()=>{A(!1)
|
|
10
|
-
/* @__PURE__ */g("select",{value:
|
|
11
|
-
/* @__PURE__ */f("option",{value:"fit",children:
|
|
12
|
-
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomIn,title:j.zoomIn,onClick:()=>{A(!1)
|
|
13
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>A(!0),"aria-pressed":
|
|
9
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomOut,title:j.zoomOut,onClick:()=>{A(!1),O(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:B,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
+
/* @__PURE__ */g("select",{value:T?"fit":C.includes(Math.round(100*$))?Math.round(100*$):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(A(!1),O(Number(t)/100)):A(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":j.zoom,title:j.zoom,children:[
|
|
11
|
+
/* @__PURE__ */f("option",{value:"fit",children:R}),!T&&!C.includes(Math.round(100*$))&&/* @__PURE__ */g("option",{value:"custom",children:[Math.round(100*$),"%"]}),C.map(e=>/* @__PURE__ */g("option",{value:e,children:[e,"%"]},e))]}),
|
|
12
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.zoomIn,title:j.zoomIn,onClick:()=>{A(!1),O(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:B,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>A(!0),"aria-pressed":T,className:B+(T?" bg-gray-200 text-gray-900":""),title:j.fitHint,children:j.fit}),
|
|
14
14
|
/* @__PURE__ */f("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
|
-
/* @__PURE__ */g("button",{type:"button",onClick:()=>{if(!
|
|
15
|
+
/* @__PURE__ */g("button",{type:"button",onClick:()=>{if(!_)return;const t=window.open("","_blank");if(!t)return void e.error(j.allowPopups);const n=[];for(let e=1;e<=L;e++)n.push(_.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(n).then(e=>{var n;t.document.write(`<html><head><title>${n=c,n.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),t.document.write(e.map(e=>`<img src="${e}"/>`).join("")),t.document.write("</body></html>"),t.document.close(),setTimeout(()=>{t.print(),t.close()},300)})},className:B,children:[
|
|
16
16
|
/* @__PURE__ */f(l,{name:"print",fallback:r,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.print]}),
|
|
17
|
-
/* @__PURE__ */g("button",{type:"button",onClick:w??(()=>{const e=document.createElement("a");e.href=s,e.download=c,e.click()}),className:
|
|
18
|
-
/* @__PURE__ */f(l,{name:"download",fallback:a,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.download]}),y&&/* @__PURE__ */g("button",{type:"button",onClick:y,className:
|
|
17
|
+
/* @__PURE__ */g("button",{type:"button",onClick:w??(()=>{const e=document.createElement("a");e.href=s,e.download=c,e.click()}),className:B,children:[
|
|
18
|
+
/* @__PURE__ */f(l,{name:"download",fallback:a,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.download]}),y&&/* @__PURE__ */g("button",{type:"button",onClick:y,className:B,children:[
|
|
19
19
|
/* @__PURE__ */f(l,{name:"email",fallback:o,className:"h-3.5 w-3.5",strokeWidth:1.5}),j.email]})]}),
|
|
20
|
-
/* @__PURE__ */f("div",{ref:
|
|
20
|
+
/* @__PURE__ */f("div",{ref:D,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!_)return;if(e.ctrlKey||e.metaKey)return;const t=D.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&P<L?(e.preventDefault(),W(e=>Math.min(L,e+1)),requestAnimationFrame(()=>{D.current&&(D.current.scrollTop=0)})):e.deltaY<0&&n&&P>1&&(e.preventDefault(),W(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{D.current&&(D.current.scrollTop=D.current.scrollHeight)}))},onKeyDown:e=>{if(!_)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?P<L&&(e.preventDefault(),W(e=>Math.min(L,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?P>1&&(e.preventDefault(),W(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),W(1)):"End"===e.key&&(e.preventDefault(),W(L)))},children:U?/* @__PURE__ */f("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",role:"status",children:j.loading}):/* @__PURE__ */g("div",{className:"min-h-full flex items-center justify-center p-4",children:[
|
|
21
21
|
/* @__PURE__ */f("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
|
|
22
22
|
/* @__PURE__ */g("div",{className:"relative shadow-lg rounded",children:[
|
|
23
23
|
/* @__PURE__ */f("canvas",{ref:M,className:"block rounded"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-TMZVVRTA.js";import{keepsNativeMenu as a}from"./chunk-ZDF5AR5W.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
|
|
2
2
|
return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
|
|
3
3
|
/* @__PURE__ */n("div",{children:[
|
|
4
4
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Tooltip as e}from"./chunk-OGXU7QFW.js";import{useBrowserLayoutEffect as r,useBrowserState as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-
|
|
2
|
-
return a(e,{content:y??N.hint,side:"left"===c?"right":"left",delay:600,className:`absolute inset-y-0 ${
|
|
1
|
+
import{Tooltip as e}from"./chunk-OGXU7QFW.js";import{useBrowserLayoutEffect as r,useBrowserState as t}from"./chunk-D65T4H6J.js";import{useShellStrings as n}from"./chunk-3JK2LSFU.js";import{useRef as o,useEffect as i,useCallback as l}from"react";import{jsx as a,jsxs as s,Fragment as c}from"react/jsx-runtime";var u=(e,r,t)=>Math.min(t,Math.max(r,e));function d(e,r,t,n,o){return Math.round(u("left"===t?e+r:e-r,n,o))}function h(e,r,t){let n=null;try{n=window.localStorage.getItem(e)}catch{return null}const o=n?parseInt(n,10):NaN;return Number.isNaN(o)?null:u(o,r,t)}function m({width:t,onResize:s,side:c,min:m,max:f,defaultWidth:v=m,step:b=16,storageKey:g,label:p,hint:y,controls:x,className:w=""}){const N=n().resizeHandle,z=o(null),k=o({onResize:s,min:m,max:f,side:c});k.current={onResize:s,min:m,max:f,side:c},r(()=>{if(!g)return;const e=h(g,m,f);null!==e&&e!==t&&s(e)},[g]),i(()=>{if(!g)return;const e=window.setTimeout(()=>{try{window.localStorage.setItem(g,String(Math.round(t)))}catch{}},200);return()=>window.clearTimeout(e)},[t,g]);const P=l(()=>{z.current=null,document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},[]);i(()=>P,[P]);const M=e=>{z.current&&(e.currentTarget.hasPointerCapture?.(z.current.pointer)&&e.currentTarget.releasePointerCapture(z.current.pointer),P())},C="left"===c?"right-0":"left-0";/* @__PURE__ */
|
|
2
|
+
return a(e,{content:y??N.hint,side:"left"===c?"right":"left",delay:600,className:`absolute inset-y-0 ${C} z-10 flex w-2 ${w}`.trim(),children:/* @__PURE__ */a("div",{role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":p??N.label,"aria-valuenow":Math.round(t),"aria-valuemin":m,"aria-valuemax":f,"aria-controls":x,"data-resize-handle":c,onPointerDown:e=>{0===e.button&&(e.preventDefault(),z.current={x:e.clientX,width:t,moved:!1,pointer:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},onPointerMove:e=>{const r=z.current;if(!r)return;if(0===e.buttons)return void P();const t=e.clientX-r.x;if(!r.moved){if(Math.abs(t)<3)return;r.moved=!0}const{onResize:n,min:o,max:i,side:l}=k.current;n(d(r.width,t,l,o,i))},onPointerUp:M,onPointerCancel:M,onLostPointerCapture:()=>{z.current&&P()},onDoubleClick:()=>s(u(v,m,f)),onKeyDown:e=>{const r="ArrowRight"===e.key?b:"ArrowLeft"===e.key?-b:null,n=null!==r?d(t,r,c,m,f):"Home"===e.key?m:"End"===e.key?f:"Enter"===e.key?u(v,m,f):null;null!==n&&(e.preventDefault(),n!==t&&s(n))},className:"group/resize relative h-full w-full cursor-col-resize touch-none rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */a("div",{"aria-hidden":"true",className:`absolute inset-y-0 ${C} w-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))] group-focus-visible/resize:w-0.5 group-focus-visible/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]`})})})}var f=(e,r,t)=>Math.min(Math.max(e,r),t);function v({sidebar:e,sidebarTop:r,sidebarBottom:o,children:i,side:l="left",storageKey:u,defaultWidth:d=256,minWidth:v=180,maxWidth:b=480,className:g="",sidebarClassName:p=("right"===l?"border-l border-gray-200 bg-gray-50":"border-r border-gray-200 bg-gray-50"),contentClassName:y="bg-white"}){const x="right"===l,w=n().sidebar,[N,z]=t(()=>(u?h(u,v,b):null)??f(d,v,b),f(d,v,b)),k=null!=r||null!=o,P=/* @__PURE__ */s("div",{className:"relative flex h-full shrink-0 flex-col",style:{width:N},children:[
|
|
3
3
|
/* @__PURE__ */s("div",{className:`flex h-full flex-col ${k?"overflow-hidden":"overflow-y-auto"} ${p}`,children:[null!=r&&/* @__PURE__ */a("div",{className:"flex shrink-0 flex-col gap-2 px-2 pt-3 pb-2",children:r}),k?/* @__PURE__ */a("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e}):e,null!=o&&/* @__PURE__ */a("div",{className:"mt-auto flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:o})]}),
|
|
4
|
-
/* @__PURE__ */a(m,{side:l,width:N,onResize:z,min:v,max:b,defaultWidth:f(d,v,b),storageKey:u,hint:w.resize})]}),
|
|
5
|
-
return a("div",{className:`flex h-full w-full overflow-hidden ${g}`,children:/* @__PURE__ */s(c,x?{children:[
|
|
4
|
+
/* @__PURE__ */a(m,{side:l,width:N,onResize:z,min:v,max:b,defaultWidth:f(d,v,b),storageKey:u,hint:w.resize})]}),M=/* @__PURE__ */a("div",{className:`flex min-w-0 flex-1 flex-col ${y}`,children:i});/* @__PURE__ */
|
|
5
|
+
return a("div",{className:`flex h-full w-full overflow-hidden ${g}`,children:/* @__PURE__ */s(c,x?{children:[M,P]}:{children:[P,M]})})}export{m as ResizeHandle,v as SidebarLayout};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{useCopyText as e,CopyGlyph as t}from"./chunk-
|
|
1
|
+
import{useCopyText as e,CopyGlyph as t}from"./chunk-6TCHOT4R.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-ZDF5AR5W.js";import{CloseFallbackC as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-3JK2LSFU.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as s,useEffect as c,Fragment as d}from"react";import{jsxs as m,jsx as u,Fragment as p}from"react/jsx-runtime";var y="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function h(){/* @__PURE__ */
|
|
2
2
|
return u(o,{name:"close",fallback:i,"aria-hidden":"true",className:"size-3.5"})}function b({text:n,label:r,copiedLabel:l}){const{copied:i,copy:a}=e(n);/* @__PURE__ */
|
|
3
|
-
return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:
|
|
3
|
+
return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:j}){const $=a().pageTabs,[I,z]=s(null),D=e.length;c(()=>{if(!t)return;const e=document.getElementById(i(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,t,D]);const M=e.some(e=>e.key===t)?t:e[0]?.key,A=t=>{const n=e[(t+e.length)%e.length];n&&document.getElementById(i(n.key,"tab"))?.focus()},_=I?e.find(e=>e.key===I.key):void 0,F=_&&j?j(_.key):[],R=_?e.indexOf(_):-1,T=e=>e.some(e=>!e.pinned),B=e=>()=>{z(null),e()};/* @__PURE__ */
|
|
4
4
|
return m("div",{className:v??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
|
|
5
5
|
/* @__PURE__ */u("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
|
|
6
|
-
/* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)A(n+1);else if("ArrowLeft"===t.key)A(n-1);else if("Home"===t.key)A(0);else if("End"===t.key)A(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===
|
|
6
|
+
/* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)A(n+1);else if("ArrowLeft"===t.key)A(n-1);else if("Home"===t.key)A(0);else if("End"===t.key)A(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===M?0:-1,title:n.title,onClick:()=>f(n.key)},k={onContextMenu:e=>((e,t)=>{e.preventDefault(),z({x:e.clientX,y:e.clientY,key:t.key})})(e,n),onAuxClick:e=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),g(t.key))})(e,n),onMouseDown:e=>{1===e.button&&e.preventDefault()}},v=s&&
|
|
7
7
|
/* @__PURE__ */m("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[s,a&&!l&&!n.pinned&&
|
|
8
8
|
/* @__PURE__ */u("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),N=l&&!!C&&!!s;return n.pinned?/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-9 flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${s?"w-10":""} ${c}`,...k,children:/* @__PURE__ */m("button",{...x,className:`flex h-full items-center justify-center rounded-t-md ${s?"w-full":"px-3"} ${y}`,children:[v,
|
|
9
9
|
/* @__PURE__ */u("span",{className:s?"sr-only":"whitespace-nowrap text-[13px]",children:n.title})]})},n.key):/* @__PURE__ */m(d,{children:[p&&/* @__PURE__ */u("span",{"aria-hidden":"true",className:"mb-2.5 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
|
|
10
10
|
/* @__PURE__ */m("div",{role:"presentation",className:`group @container relative flex h-9 items-center rounded-t-md border border-b-0 text-[13px] transition-colors ${l&&(n.copy||N)?"flex-[0_1_20rem]":"flex-[0_1_15rem]"} ${l?"min-w-[4.25rem]":"min-w-[2.75rem]"} ${c}`,...k,children:[N&&
|
|
11
|
-
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label"
|
|
11
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":$.tabMenu,title:$.tabMenu,onClick:e=>{const t=e.currentTarget.getBoundingClientRect();C?.(n.key,t.left,t.bottom+4)},className:`ml-2 flex size-6 shrink-0 items-center justify-center rounded hover:bg-gray-200 @max-[5rem]:ml-1.5 ${y}`,children:v}),
|
|
12
12
|
/* @__PURE__ */m("button",{...x,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${N?"pl-1.5":"pl-3"} ${y} ${l?N?"":"@max-[5rem]:pl-2.5":"@max-[6.5rem]:pr-3 @max-[6.5rem]:group-hover:pr-1 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-1.5"}`,children:[!N&&v,
|
|
13
|
-
/* @__PURE__ */u("span",{className:"min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] "+(s?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""),children:n.title})]}),l&&n.copy&&/* @__PURE__ */u(b,{text:n.copy,label
|
|
14
|
-
/* @__PURE__ */m("span",{className:"mr-1.5 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */u("span",{role:"img","aria-label"
|
|
15
|
-
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label"
|
|
13
|
+
/* @__PURE__ */u("span",{className:"min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] "+(s?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""),children:n.title})]}),l&&n.copy&&/* @__PURE__ */u(b,{text:n.copy,label:$.copy(n.copy),copiedLabel:$.copied}),
|
|
14
|
+
/* @__PURE__ */m("span",{className:"mr-1.5 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */u("span",{role:"img","aria-label":$.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
|
|
15
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label":$.closeTab?.(n.title)??`${$.close} ${n.title}`,onClick:()=>g(n.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */u(h,{})})]})]})]},n.key)})}),N&&/* @__PURE__ */u("div",{className:"flex shrink-0 items-center gap-2 self-center",children:N}),I&&_&&/* @__PURE__ */m(n,{portal:!0,style:{left:I.x,top:I.y},onClose:()=>z(null),children:[F.length>0&&/* @__PURE__ */m(p,{children:[F.map((e,t)=>/* @__PURE__ */m(r,{onClick:B(e.onSelect),children:[e.icon,e.label]},t)),
|
|
16
16
|
/* @__PURE__ */u(l,{})]}),
|
|
17
|
-
/* @__PURE__ */u(r,{disabled:_.pinned,onClick:
|
|
17
|
+
/* @__PURE__ */u(r,{disabled:_.pinned,onClick:B(()=>g(_.key)),children:$.close}),
|
|
18
18
|
/* @__PURE__ */u(l,{}),
|
|
19
|
-
/* @__PURE__ */u(r,{disabled:!
|
|
20
|
-
/* @__PURE__ */u(r,{disabled:!
|
|
21
|
-
/* @__PURE__ */u(r,{disabled:!
|
|
19
|
+
/* @__PURE__ */u(r,{disabled:!T(e.filter(e=>e.key!==_.key)),onClick:B(()=>x("others",_.key)),children:$.closeOthers}),
|
|
20
|
+
/* @__PURE__ */u(r,{disabled:!T(e.slice(R+1)),onClick:B(()=>x("right",_.key)),children:$.closeRight}),
|
|
21
|
+
/* @__PURE__ */u(r,{disabled:!T(e),onClick:B(()=>x("all",null)),children:$.closeAll})]})]})}export{f as TabStrip};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="5.1.0",a=r;export{a as APP_VERSION,r as VERSION};
|