efficient-shell 5.6.0 → 5.6.1
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 +5 -2
- package/dist/{Browser-6QB2QTO7.js → Browser-RXGEZ77D.js} +18 -18
- package/dist/Calculator-MVPKTZZF.js +29 -0
- package/dist/ConfirmDialog-XOYCYFA7.js +1 -0
- package/dist/{CurrencyConverter-YJ47A3L5.js → CurrencyConverter-2IGOOR3I.js} +9 -9
- package/dist/{Documents-TGGI2QBV.js → Documents-YBLR7WVX.js} +22 -22
- package/dist/{Files-KSDK3EO4.js → Files-7XNR5IL2.js} +87 -87
- package/dist/{Notepad-EKB6FJPR.js → Notepad-ZQYQXV75.js} +14 -14
- package/dist/PdfViewer-SQVMMA7B.js +1 -0
- package/dist/{PomodoroTimer-RD5GRRA5.js → PomodoroTimer-XIUN4M73.js} +7 -7
- package/dist/{Preview-AQVXKT2I.js → Preview-YCOA5JPP.js} +126 -126
- package/dist/{Sidebar-VYXN5YIJ.js → Sidebar-VI7E3EKI.js} +8 -8
- package/dist/{Spreadsheet-INXG5UMI.js → Spreadsheet-SRAUU3OA.js} +13 -13
- package/dist/{Stock-CBQN2IJF.js → Stock-7EKOAQ7C.js} +3 -3
- package/dist/{Weather-2EVUTIXX.js → Weather-RWI6NKB2.js} +15 -15
- package/dist/{WorldClock-TZUF7MOB.js → WorldClock-CEHWDFEO.js} +6 -6
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-3GPU3JOW.js → chunk-5ABLFFC5.js} +7 -7
- package/dist/{chunk-PKEQ7XOH.js → chunk-7WC3EOFS.js} +1 -1
- package/dist/{chunk-RCHCT7AO.js → chunk-F6B3J3GW.js} +1 -1
- package/dist/{chunk-ZUCYJAQH.js → chunk-IMMHJIV5.js} +4 -4
- package/dist/{chunk-HRLPFUPB.js → chunk-P4CIOJHP.js} +3 -3
- package/dist/{chunk-Z2353HNE.js → chunk-RBDGN4YU.js} +5 -5
- package/dist/{chunk-RDQ7OXUA.js → chunk-RC2EG6P4.js} +300 -300
- package/dist/chunk-SFCDHHQP.js +1 -0
- package/dist/{chunk-L5XA5MLK.js → chunk-VWBQ2P5G.js} +46 -46
- package/dist/{chunk-R4XSSHDI.js → chunk-WWF2EQXF.js} +1 -1
- package/dist/{chunk-FROOMUJ7.js → chunk-YGC7AX3X.js} +6 -6
- package/dist/{chunk-MLYC5VQI.js → chunk-YIH6JLMV.js} +2 -2
- package/dist/{chunk-JEM73E4C.js → chunk-Z7D6Y5WA.js} +13 -13
- package/dist/{index-BgM75MC6.d.ts → index-ZI6vl2Wq.d.ts} +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +99 -99
- package/dist/map/index.js +4 -4
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-KOWRV2VK.js +0 -29
- package/dist/ConfirmDialog-32NLLK4K.js +0 -1
- package/dist/PdfViewer-KW5B44AX.js +0 -1
- package/dist/chunk-WRBXEZFN.js +0 -1
package/README.md
CHANGED
|
@@ -602,7 +602,9 @@ end. `step` (default 1) is the range's step and the box's ArrowUp/ArrowDown.
|
|
|
602
602
|
`precision` (default: the decimals in `step`) rounds a value. A number typed on
|
|
603
603
|
its way somewhere else ("2" of "25" in a 10–100 box) is not written until it is
|
|
604
604
|
in bounds. Enter or blur commits it: snapped to `step` counted from the box's
|
|
605
|
-
lower bound (`inputMin`, default `min`), then clamped.
|
|
605
|
+
lower bound (`inputMin`, default `min`), then clamped. The snap is float-safe
|
|
606
|
+
and an exact half step goes away from zero: 1.15 at step 0.1 is 1.2, and
|
|
607
|
+
-1.15 is -1.2. Escape puts back the
|
|
606
608
|
value from before the box was entered, including numbers written live while
|
|
607
609
|
typing. These are `InputNumber`'s keys (`snap`, `allowEmpty`), not a copy.
|
|
608
610
|
`emptyLabel` lets the value be `null`: the box shows the word, and emptying it
|
|
@@ -981,7 +983,8 @@ now in the kit itself:
|
|
|
981
983
|
from before focus. Enter commits like blur, Shift+Arrow steps
|
|
982
984
|
`shiftStep` (default ten steps), and a comma is accepted as the decimal
|
|
983
985
|
separator. `steppers` adds two `IconButton` arrows with hold-to-repeat,
|
|
984
|
-
`snap` puts a committed number on the `step` grid from `min
|
|
986
|
+
`snap` puts a committed number on the `step` grid from `min` (float-safe:
|
|
987
|
+
a typed 1.15 at step 0.1 is 1.2, and an exact half goes away from zero), and
|
|
985
988
|
`allowEmpty={false}` puts an emptied field back to its value.
|
|
986
989
|
- **`IconButton`**: `aria-pressed` true draws the pressed look, the accent wash
|
|
987
990
|
and ink of an active `IconRailButton`. `iconButtonClasses({ pressed })` gives
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-RBDGN4YU.js";import"./chunk-SFCDHHQP.js";import{WindowTitle as r}from"./chunk-VWBQ2P5G.js";import"./chunk-YGC7AX3X.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-P4CIOJHP.js";import{confirm as a}from"./chunk-IMMHJIV5.js";import"./chunk-RMJZOKHY.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{ChevronLeftFallback as n,ChevronRightFallback as l,RefreshFallback as s,HomeFallback as i,StarFallback as c,ExternalFallback as m,HelpFallback as d,NoSymbolFallback as u}from"./chunk-6LTDJKIL.js";import{Icon as h}from"./chunk-XWSWYMGM.js";import"./chunk-TNBCUZVE.js";import"./chunk-C3QOHMR6.js";import{useRef as p,useEffect as b,useState as g}from"react";import{jsxs as f,jsx as k,Fragment as x}from"react/jsx-runtime";var w="react-os-shell:browser-bookmarks",y="react-os-shell:browser-homepage",v="https://en.wikipedia.org/wiki/Main_Page",N=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],j=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function C(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&j.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var z=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function W(){if("undefined"==typeof window)return N;try{const e=localStorage.getItem(w);if(!e)return N;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return N}function S(){return"undefined"==typeof window?v:localStorage.getItem(y)||v}function H(){const u=p(void 0);void 0===u.current&&(u.current=e()),b(()=>{null!=u.current&&t(u.current)},[]);const x=u.current?C(u.current.url):"",[v,N]=g(S),[j,z]=g(x||v),[H,D]=g(j),[O,E]=g([j]),[M,P]=g(0),[T,I]=g(0),[J,U]=g(W),[X,F]=g(!1),[G,Q]=g(null),q=p(null),A=p(null);b(()=>{try{localStorage.setItem(w,JSON.stringify(J))}catch{}},[J]);const B=e=>{const t=C(e);t&&(z(t),D(t),E(e=>{const o=e.slice(0,M+1);return o.push(t),o}),P(e=>e+1),F(!1))},Y=()=>{"undefined"!=typeof window&&window.open(j,"_blank","noopener,noreferrer")},K=()=>{const e=G?.trim();e?(U(t=>[...t,{label:e,url:j}]),Q(null)):Q(null)};b(()=>{if(null===G)return;q.current?.focus(),q.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||Q(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==G]);const Z=e=>{U(t=>t.filter((t,o)=>o!==e))},$=M>0,V=M<O.length-1,_=J.some(e=>e.url===j),ee="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return f("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
|
-
/* @__PURE__ */k(r,{title:`Browser - ${
|
|
3
|
+
/* @__PURE__ */k(r,{title:`Browser - ${R(j)}`}),
|
|
4
4
|
/* @__PURE__ */k(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */k("button",{onClick:()=>{if(M>0){const e=M-1;
|
|
7
|
-
/* @__PURE__ */k("button",{onClick:()=>{if(M<O.length-1){const e=M+1;
|
|
8
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */k("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */k("button",{onClick:()=>{if(M>0){const e=M-1;P(e),z(O[e]),D(O[e]),F(!1)}},disabled:!$,className:ee,title:"Back",children:/* @__PURE__ */k(h,{name:"chevron-left",fallback:n,className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */k("button",{onClick:()=>{if(M<O.length-1){const e=M+1;P(e),z(O[e]),D(O[e]),F(!1)}},disabled:!V,className:ee,title:"Forward",children:/* @__PURE__ */k(h,{name:"chevron-right",fallback:l,className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */k("button",{onClick:()=>I(e=>e+1),className:ee,title:"Refresh",children:/* @__PURE__ */k(h,{name:"refresh",fallback:s,className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */k("button",{onClick:()=>B(v),className:ee,title:"Home",children:/* @__PURE__ */k(h,{name:"home",fallback:i,className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */k("form",{onSubmit:e=>{e.preventDefault(),B(H)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */f("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */k("span",{className:"px-2 text-gray-400 text-xs",children:j.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
|
-
/* @__PURE__ */k("input",{type:"text",value:
|
|
13
|
-
/* @__PURE__ */k("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */k("button",{onClick:
|
|
15
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
12
|
+
/* @__PURE__ */k("input",{type:"text",value:H,onChange:e=>D(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),j!==H&&/* @__PURE__ */k("button",{type:"button",onClick:()=>D(j),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
+
/* @__PURE__ */k("button",{"data-bookmark-popover":!0,onClick:()=>_?Z(J.findIndex(e=>e.url===j)):void Q(R(j)),className:ee+" "+(_?"text-yellow-500":""),title:_?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */k(h,{name:"star",fallback:c,className:"h-4 w-4",fill:_?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */k("button",{onClick:Y,className:ee,title:"Open in new tab",children:/* @__PURE__ */k(h,{name:"external",fallback:m,className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */k("button",{onClick:()=>F(e=>!e),className:ee,title:"Embedding help",children:/* @__PURE__ */k(h,{name:"help",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),null!==G&&/* @__PURE__ */f("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */k("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */k("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:j,children:j}),
|
|
18
|
-
/* @__PURE__ */k("input",{ref:q,type:"text",value:
|
|
18
|
+
/* @__PURE__ */k("input",{ref:q,type:"text",value:G,onChange:e=>Q(e.target.value),onKeyDown:e=>{"Enter"===e.key?K():"Escape"===e.key&&Q(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */f("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
21
|
-
/* @__PURE__ */k("button",{onClick:
|
|
22
|
-
/* @__PURE__ */f("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===J.length&&/* @__PURE__ */k("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),J.map((e,t)=>/* @__PURE__ */f("button",{onClick:()=>
|
|
20
|
+
/* @__PURE__ */k("button",{onClick:()=>Q(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
+
/* @__PURE__ */k("button",{onClick:K,disabled:!G.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */f("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===J.length&&/* @__PURE__ */k("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),J.map((e,t)=>/* @__PURE__ */f("button",{onClick:()=>B(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&Z(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */k("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */k("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */k("button",{onClick:()=>{N(j);try{localStorage.setItem(y,j)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */k("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */k(
|
|
26
|
+
/* @__PURE__ */k("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */k(L,{url:j,iframeKey:T,iframeRef:A,openExternal:Y,showHelp:X,dismissHelp:()=>F(!1)})})]})}function R(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function L({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:n}){const[l,s]=g(!1);b(()=>{s(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return z.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!l?/* @__PURE__ */k("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */f("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */k(h,{name:"no-symbol",fallback:u,className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
|
-
/* @__PURE__ */f("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[
|
|
28
|
+
/* @__PURE__ */f("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[R(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */f("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
30
30
|
/* @__PURE__ */k("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
|
|
31
31
|
/* @__PURE__ */k("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
|
|
@@ -40,4 +40,4 @@ return f("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
|
40
40
|
/* @__PURE__ */f("p",{children:["Hit the ",
|
|
41
41
|
/* @__PURE__ */k("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
|
|
42
42
|
/* @__PURE__ */k("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
|
|
43
|
-
/* @__PURE__ */k("button",{onClick:n,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{
|
|
43
|
+
/* @__PURE__ */k("button",{onClick:n,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{H as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-7WC3EOFS.js";import{useWidgetSettings as n}from"./chunk-VWBQ2P5G.js";import"./chunk-YGC7AX3X.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-P4CIOJHP.js";import"./chunk-IMMHJIV5.js";import"./chunk-RMJZOKHY.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CheckFallbackB as l,CopyFallbackB as r}from"./chunk-6LTDJKIL.js";import{Icon as c}from"./chunk-XWSWYMGM.js";import"./chunk-TNBCUZVE.js";import"./chunk-C3QOHMR6.js";import{useState as a,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as u,Fragment as d,jsx as h}from"react/jsx-runtime";var m="calc_appearance";function b(){const[b,k]=a("0"),[p,g]=a(null),[f,y]=a(null),[N,x]=a(!1),[v,C]=a(""),[$,j]=a([]),[w,E]=a(!1),[S,W]=a(()=>e(m)),[T,F]=a(!1),[O,H]=a(S),J=i(null);n(o(()=>{H({...S}),F(!0)},[S]));const M=o(e=>{C(""),k(t=>N||"0"===t?(x(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),X=o(()=>{k("0"),g(null),y(null),x(!1)},[]),A=o((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}},[]),D=o(e=>{const t=parseFloat(b);if(null!==p&&f&&!N){const e=A(p,t,f);k(String(e)),g(e),j(n=>[`${p} ${f} ${t} = ${e}`,...n].slice(0,20))}else g(t);y(e),x(!0)},[b,p,f,N,A]),I=o(()=>{if(null===p||!f)return;const e=parseFloat(b),t=A(p,e,f),n=`${p} ${f} ${e} =`;j(e=>[`${n} ${t}`,...e].slice(0,20)),C(n),k(String(t)),g(null),y(null),x(!0)},[b,p,f,A]),L=o(()=>{k(e=>String(parseFloat(e)/100))},[]),P=o(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);s(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?M(e.key):"."===e.key?M("."):"+"===e.key?D("+"):"-"===e.key?D("-"):"*"===e.key?D("×"):"/"===e.key?(e.preventDefault(),D("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&J.current?.contains(e.target)&&e.preventDefault(),I()):"Escape"===e.key?X():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&L())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[M,D,I,X,L]);const B="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",Q=`${B} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,Z=`${B} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,G=`${B} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,R=`${B} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return u(d,{children:[
|
|
3
|
+
/* @__PURE__ */u("div",{ref:J,className:"flex flex-col h-full",style:{opacity:S.activeOpacity/100,backdropFilter:S.activeBlur>0?`blur(${S.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */u("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__ */h("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:$.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */h("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(v||f&&null!==p)&&/* @__PURE__ */h("div",{className:"text-base text-slate-600 text-right font-mono",children:v||`${p} ${f} ${N?"":b}`}),
|
|
6
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */h("button",{onClick:()=>{navigator.clipboard.writeText(b),E(!0),setTimeout(()=>E(!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__ */h(c,w?{name:"check",fallback:l,className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",fallback:r,className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */h("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)})(b)})]})]}),
|
|
9
|
+
/* @__PURE__ */u("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */h("button",{onClick:X,className:G,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */h("button",{onClick:P,className:G,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */h("button",{onClick:L,className:G,children:"%"}),
|
|
13
|
+
/* @__PURE__ */h("button",{onClick:()=>D("÷"),className:`${Z} ${"÷"===f?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */h("button",{onClick:()=>M("7"),className:Q,children:"7"}),
|
|
15
|
+
/* @__PURE__ */h("button",{onClick:()=>M("8"),className:Q,children:"8"}),
|
|
16
|
+
/* @__PURE__ */h("button",{onClick:()=>M("9"),className:Q,children:"9"}),
|
|
17
|
+
/* @__PURE__ */h("button",{onClick:()=>D("×"),className:`${Z} ${"×"===f?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */h("button",{onClick:()=>M("4"),className:Q,children:"4"}),
|
|
19
|
+
/* @__PURE__ */h("button",{onClick:()=>M("5"),className:Q,children:"5"}),
|
|
20
|
+
/* @__PURE__ */h("button",{onClick:()=>M("6"),className:Q,children:"6"}),
|
|
21
|
+
/* @__PURE__ */h("button",{onClick:()=>D("-"),className:`${Z} ${"-"===f?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */h("button",{onClick:()=>M("1"),className:Q,children:"1"}),
|
|
23
|
+
/* @__PURE__ */h("button",{onClick:()=>M("2"),className:Q,children:"2"}),
|
|
24
|
+
/* @__PURE__ */h("button",{onClick:()=>M("3"),className:Q,children:"3"}),
|
|
25
|
+
/* @__PURE__ */h("button",{onClick:()=>D("+"),className:`${Z} ${"+"===f?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */h("button",{onClick:()=>M("0"),className:`${Q} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */h("button",{onClick:()=>M("."),className:Q,children:"."}),
|
|
28
|
+
/* @__PURE__ */h("button",{onClick:I,className:R,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */h(t,{open:T,onClose:()=>F(!1),title:"Calculator Settings",appearance:O,onAppearanceChange:H,onSave:()=>{W(O),localStorage.setItem(m,JSON.stringify(O)),F(!1)}})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-IMMHJIV5.js";import"./chunk-AFYQTVZO.js";import"./chunk-X4FJ54PP.js";import"./chunk-6LTDJKIL.js";import"./chunk-XWSWYMGM.js";import"./chunk-TNBCUZVE.js";import"./chunk-C3QOHMR6.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-7WC3EOFS.js";import{useWidgetSettings as r}from"./chunk-VWBQ2P5G.js";import"./chunk-YGC7AX3X.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-P4CIOJHP.js";import"./chunk-IMMHJIV5.js";import"./chunk-RMJZOKHY.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-6LTDJKIL.js";import"./chunk-XWSWYMGM.js";import"./chunk-TNBCUZVE.js";import"./chunk-C3QOHMR6.js";import{useState as n,useCallback as a,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",p="currency_appearance",d="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(d)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,d]=n(x),[f,N]=n(()=>e(p)),[b,S]=n({}),[v,k]=n(!1),[D,C]=n(!1),[j,J]=n([]),[O,H]=n(f),[U,I]=n("USD"),[A,B]=n("CNY");r(a(()=>{J([...m]),H({...f}),C(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){k(!0);const r={};for(const t of e){const e=h(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,g(t,n.rates))}catch{}}t&&(S(r),k(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
|
|
2
2
|
return c(o,{children:[
|
|
3
|
-
/* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[
|
|
3
|
+
/* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const n=b[e]?.[t];/* @__PURE__ */
|
|
4
4
|
return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),localStorage.setItem(u,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
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1.5",children:[
|
|
6
6
|
/* @__PURE__ */i("span",{className:"text-base",children:y[e]||""}),
|
|
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),l
|
|
|
9
9
|
/* @__PURE__ */i("span",{className:"text-base",children:y[t]||""}),
|
|
10
10
|
/* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
11
|
/* @__PURE__ */i("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__ */i(t,{open:D,onClose:()=>
|
|
12
|
+
/* @__PURE__ */i(t,{open:D,onClose:()=>C(!1),title:"Currency Settings",appearance:O,onAppearanceChange:H,onSave:()=>{if(0===j.length)return;const e=j.slice(0,4);d(e),N(O),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(p,JSON.stringify(O)),C(!1)},children:/* @__PURE__ */c("div",{children:[
|
|
13
13
|
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",
|
|
15
|
-
/* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",j.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:j.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */i("button",{onClick:()=>J(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),
|
|
18
|
-
/* @__PURE__ */i("select",{value:
|
|
17
|
+
/* @__PURE__ */i("button",{onClick:()=>J(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),j.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */i("select",{value:U,onChange:e=>I(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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
19
19
|
/* @__PURE__ */i("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */i("select",{value:
|
|
21
|
-
/* @__PURE__ */i("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */i("select",{value:A,onChange:e=>B(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:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
21
|
+
/* @__PURE__ */i("button",{onClick:()=>{U!==A&&j.length<4&&J(e=>[...e,[U,A]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-RBDGN4YU.js";import{toast_default as n}from"./chunk-3HJTOINK.js";import"./chunk-SFCDHHQP.js";import{WindowTitle as r}from"./chunk-VWBQ2P5G.js";import"./chunk-YGC7AX3X.js";import"./chunk-DSSLOQDW.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-P4CIOJHP.js";import"./chunk-IMMHJIV5.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-RMJZOKHY.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{FolderOpenFallback as s,ImageFallback as c}from"./chunk-6LTDJKIL.js";import{Icon as d}from"./chunk-XWSWYMGM.js";import"./chunk-TNBCUZVE.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";var g=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),x=/* @__PURE__ */new Set(["docx"]),f={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function y(){const[y,v]=m(f),[b,k]=m(!1),[w,N]=m(!1),[C,j]=m(!1),[D,M]=m(null),L=h(null),U=h(null),R=h(null),W=(e,t)=>{R.current?.focus(),document.execCommand(e,!1,t),j(!0)},O=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{R.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),j(!0)},e.readAsDataURL(t)}},T=e=>{D&&(D.el.removeAttribute("width"),D.el.removeAttribute("height"),D.el.style.width=e??"",D.el.style.height=e?"auto":"",j(!0),M(null))},B=async t=>{const r=(t.name.split(".").pop()||"").toLowerCase();k(!0);try{if(g.has(r)||!x.has(r)&&t.type.startsWith("text/")){const n=await t.text(),o=e(n).replace(/\n/g,"<br>");v({filename:t.name,kind:"text",content:o,ext:r}),j(!1)}else if(x.has(r))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});v({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),
|
|
4
|
-
return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),w||N(!0)},onDragLeave:e=>{e.currentTarget===e.target&&N(!1)},onDrop:e=>{e.preventDefault(),N(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?
|
|
5
|
-
/* @__PURE__ */p(r,{title:`${
|
|
3
|
+
"mammoth")),n=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:n});v({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:r}),j(!1)}catch(e){n.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===r?n.error(".doc is the legacy Word binary format — convert to .docx first."):n.error(`Unsupported file type: .${r||"unknown"}`)}finally{k(!1)}},I=y?.filename?(S=y.filename).length>24?`${S.slice(0,23)}…`:S:"Untitled";var S;/* @__PURE__ */
|
|
4
|
+
return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),w||N(!0)},onDragLeave:e=>{e.currentTarget===e.target&&N(!1)},onDrop:e=>{e.preventDefault(),N(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?O(t):B(t[0]))},children:[
|
|
5
|
+
/* @__PURE__ */p(r,{title:`${I}${C?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */p(t,{app:"documents"}),
|
|
7
7
|
/* @__PURE__ */u("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
8
|
-
/* @__PURE__ */p("input",{ref:
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
8
|
+
/* @__PURE__ */p("input",{ref:L,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&B(t),L.current&&(L.current.value="")},className:"hidden"}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>L.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
10
10
|
/* @__PURE__ */p(d,{name:"folder-open",fallback:s,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
11
|
/* @__PURE__ */p("button",{onClick:()=>{if(!y)return;const t=R.current?.innerHTML??"";if("text"===y.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=R.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=y.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
12
12
|
/* @__PURE__ */p("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
|
|
13
13
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
|
-
/* @__PURE__ */u("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:y.filename,children:[y.filename,
|
|
14
|
+
/* @__PURE__ */u("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:y.filename,children:[y.filename,C?" •":""]}),
|
|
15
15
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
16
16
|
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
|
|
17
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
18
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
19
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
20
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
17
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
|
|
18
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
|
|
19
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
|
|
20
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
|
|
21
21
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
22
|
-
/* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{
|
|
22
|
+
/* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{W("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
|
|
23
23
|
/* @__PURE__ */p("option",{value:"",disabled:!0,children:"Size"}),
|
|
24
24
|
/* @__PURE__ */p("option",{value:"1",children:"XS"}),
|
|
25
25
|
/* @__PURE__ */p("option",{value:"2",children:"S"}),
|
|
@@ -27,21 +27,21 @@ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
27
27
|
/* @__PURE__ */p("option",{value:"4",children:"L"}),
|
|
28
28
|
/* @__PURE__ */p("option",{value:"5",children:"XL"}),
|
|
29
29
|
/* @__PURE__ */p("option",{value:"6",children:"2XL"})]}),
|
|
30
|
-
/* @__PURE__ */p("input",{type:"color",defaultValue:"#000000",onChange:e=>
|
|
30
|
+
/* @__PURE__ */p("input",{type:"color",defaultValue:"#000000",onChange:e=>W("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
|
|
31
31
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
32
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
33
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
32
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
|
|
33
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
|
|
34
34
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
35
35
|
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
|
|
36
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
37
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
38
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
39
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
36
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
|
|
37
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
|
|
38
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>W("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
40
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */p("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&
|
|
41
|
+
/* @__PURE__ */p("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&O(Array.from(e.target.files)),U.current&&(U.current.value="")}}),
|
|
42
42
|
/* @__PURE__ */u("button",{onClick:()=>U.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
|
|
43
43
|
/* @__PURE__ */p(d,{name:"image",fallback:c,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
-
/* @__PURE__ */p("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */p("div",b?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===y.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */p("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>
|
|
44
|
+
/* @__PURE__ */p("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */p("div",b?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===y.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */p("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>j(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),O(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),M({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:y.content},className:"docx"===y.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),w&&/* @__PURE__ */p("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */p("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),D&&/* @__PURE__ */u(o,{minWidth:150,style:{left:D.x,top:D.y},onClose:()=>M(null),children:[
|
|
45
45
|
/* @__PURE__ */p(l,{children:"Image width"}),
|
|
46
46
|
/* @__PURE__ */p(a,{onClick:()=>T("25%"),children:"25%"}),
|
|
47
47
|
/* @__PURE__ */p(a,{onClick:()=>T("50%"),children:"50%"}),
|
|
@@ -49,4 +49,4 @@ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
49
49
|
/* @__PURE__ */p(a,{onClick:()=>T("100%"),children:"100%"}),
|
|
50
50
|
/* @__PURE__ */p(a,{onClick:()=>T(null),children:"Original size"}),
|
|
51
51
|
/* @__PURE__ */p(i,{}),
|
|
52
|
-
/* @__PURE__ */p(a,{danger:!0,onClick:()=>{D?.el.remove(),
|
|
52
|
+
/* @__PURE__ */p(a,{danger:!0,onClick:()=>{D?.el.remove(),j(!0),M(null)},children:"Remove image"})]})]})}export{y as default};
|