efficient-shell 4.180.0 → 4.181.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 +12 -0
- package/dist/Browser-QYHW6I6J.js +43 -0
- package/dist/Calculator-4K53PFBL.js +29 -0
- package/dist/ConfirmDialog-X2DPOYWO.js +1 -0
- package/dist/{CurrencyConverter-AMXUOQR2.js → CurrencyConverter-QEG6RFAS.js} +9 -9
- package/dist/Documents-SFNMDRYU.js +52 -0
- package/dist/Files-OX2UBSQQ.js +87 -0
- package/dist/Notepad-CNZEWFCR.js +25 -0
- package/dist/PdfViewer-UZGDE4HD.js +1 -0
- package/dist/PomodoroTimer-T6YAQFIE.js +91 -0
- package/dist/Preview-OOVIIQQG.js +182 -0
- package/dist/Sidebar-3NZRIL7F.js +44 -0
- package/dist/Spreadsheet-7NUDGOSX.js +37 -0
- package/dist/{Stock-GWVG2INU.js → Stock-BZFC2ROU.js} +6 -6
- package/dist/{Weather-APBCG4TO.js → Weather-S3N5OWYF.js} +17 -17
- package/dist/{WorldClock-2LMZYKWR.js → WorldClock-ACC3S6OA.js} +4 -4
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-FORN7LG7.js → chunk-2DX65GOO.js} +1 -1
- package/dist/{chunk-6CFBF543.js → chunk-5IWSOLLY.js} +2 -2
- package/dist/chunk-FOEVG7RT.js +21 -0
- package/dist/chunk-GMMTTWHB.js +3 -0
- package/dist/chunk-LMIQV3NB.js +13 -0
- package/dist/{chunk-SVO3ES2E.js → chunk-MIAJQGWE.js} +1 -1
- package/dist/chunk-MSIN5HKX.js +9 -0
- package/dist/chunk-OD5KLVU5.js +1 -0
- package/dist/{chunk-ILTSTULF.js → chunk-P4SGJTK3.js} +1 -1
- package/dist/chunk-PQLVWCUI.js +11 -0
- package/dist/chunk-QRV7RNQX.js +24 -0
- package/dist/chunk-R3PCJLQF.js +993 -0
- package/dist/chunk-SBDIHKLU.js +108 -0
- package/dist/chunk-VJP3R52B.js +6 -0
- package/dist/chunk-XUF7VW4U.js +136 -0
- package/dist/chunk-ZDF5AR5W.js +10 -0
- package/dist/chunk-ZZKIKW62.js +29 -0
- package/dist/index.js +639 -656
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Browser-RZFOKBSF.js +0 -43
- package/dist/Calculator-R5OEHQ67.js +0 -29
- package/dist/ConfirmDialog-CMNQZQA3.js +0 -1
- package/dist/Documents-VD32HWDQ.js +0 -52
- package/dist/Files-NAY3WK6O.js +0 -89
- package/dist/Notepad-AHRPMF57.js +0 -25
- package/dist/PdfViewer-3SC3LE4U.js +0 -1
- package/dist/PomodoroTimer-LE6J2KUU.js +0 -99
- package/dist/Preview-OKR5QRQP.js +0 -188
- package/dist/Sidebar-BQ4P5LBI.js +0 -44
- package/dist/Spreadsheet-RME4IQ43.js +0 -37
- package/dist/chunk-4VTHXNGZ.js +0 -1003
- package/dist/chunk-5ZDM6WIC.js +0 -24
- package/dist/chunk-7WZEFHPS.js +0 -6
- package/dist/chunk-AA4TMQOS.js +0 -10
- package/dist/chunk-BSJIBRWC.js +0 -1
- package/dist/chunk-C2A4PIGZ.js +0 -13
- package/dist/chunk-CIXQKCFA.js +0 -11
- package/dist/chunk-KVOFUFPP.js +0 -3
- package/dist/chunk-N6STBYXR.js +0 -112
- package/dist/chunk-RQOP5JAJ.js +0 -9
- package/dist/chunk-UAIVAA5X.js +0 -21
- package/dist/chunk-ZAE6ROV7.js +0 -29
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{toast_default as e}from"./chunk-3DGTIWZP.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-J3LIIIHJ.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),P=d(null),[W,_]=u(null),[z,D]=u(1),[L,S]=u(0),[T,$]=u(1),[O,A]=u(!0),[U,H]=u(!0),I=d(j.loadFailed);I.current=j.loadFailed,m(()=>{let t=!1;return H(!0),D(1),v&&(h.GlobalWorkerOptions.workerSrc=v),h.getDocument({url:s,...k(x)}).promise.then(e=>{t||(_(e),S(e.numPages),H(!1))}).catch(()=>{t||(e.error(I.current),H(!1))}),()=>{t=!0}},[s,v,x]),m(()=>{if(!W||!O||!P.current)return;const e=()=>{const e=P.current;e&&W.getPage(z).then(t=>{if(!P.current)return;const n=t.getViewport({scale:1}),r=N(p,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});$(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(P.current),()=>t.disconnect()},[W,z,O,p]),m(()=>{if(!W||!M.current)return;let e=!1,t=null,n=null;return W.getPage(z).then(r=>{if(e||!M.current)return;const a=r.getViewport({scale:T}),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()}},[W,z,T]),m(()=>{const e=()=>E.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const F="page"===p?j.fitPage:j.fitWidth,R="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
|
|
3
|
+
return g("div",{className:"flex flex-col h-full",children:[
|
|
4
|
+
/* @__PURE__ */g(b,{children:[
|
|
5
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.previousPage,onClick:()=>D(e=>Math.max(1,e-1)),disabled:z<=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(z,L)}),
|
|
7
|
+
/* @__PURE__ */f("button",{type:"button","aria-label":j.nextPage,onClick:()=>D(e=>Math.min(L,e+1)),disabled:z>=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
|
+
/* @__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),$(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:R,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"−"})}),
|
|
10
|
+
/* @__PURE__ */g("select",{value:O?"fit":C.includes(Math.round(100*T))?Math.round(100*T):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(A(!1),$(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:F}),!O&&!C.includes(Math.round(100*T))&&/* @__PURE__ */g("option",{value:"custom",children:[Math.round(100*T),"%"]}),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),$(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:R,children:/* @__PURE__ */f("span",{"aria-hidden":"true",children:"+"})}),
|
|
13
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>A(!0),"aria-pressed":O,className:R+(O?" bg-gray-200 text-gray-900":""),title:j.fitHint,children:j.fit}),
|
|
14
|
+
/* @__PURE__ */f("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
15
|
+
/* @__PURE__ */g("button",{type:"button",onClick:()=>{if(!W)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(W.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:R,children:[
|
|
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:R,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:R,children:[
|
|
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:P,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!W)return;if(e.ctrlKey||e.metaKey)return;const t=P.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&z<L?(e.preventDefault(),D(e=>Math.min(L,e+1)),requestAnimationFrame(()=>{P.current&&(P.current.scrollTop=0)})):e.deltaY<0&&n&&z>1&&(e.preventDefault(),D(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{P.current&&(P.current.scrollTop=P.current.scrollHeight)}))},onKeyDown:e=>{if(!W)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?z<L&&(e.preventDefault(),D(e=>Math.min(L,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?z>1&&(e.preventDefault(),D(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),D(1)):"End"===e.key&&(e.preventDefault(),D(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
|
+
/* @__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
|
+
/* @__PURE__ */g("div",{className:"relative shadow-lg rounded",children:[
|
|
23
|
+
/* @__PURE__ */f("canvas",{ref:M,className:"block rounded"}),
|
|
24
|
+
/* @__PURE__ */f("div",{ref:E,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{b as PanelActions,j as PdfViewer,y as ToolbarSlotContext,N as fitScale,k as pdfWasmParams};
|