efficient-shell 12.23.0 → 12.24.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 +1 -1
- package/dist/{Browser-G3NJJDFN.js → Browser-I3RMT2LB.js} +15 -15
- package/dist/Calculator-LSDVIJVQ.js +29 -0
- package/dist/CurrencyConverter-G5IYUCN7.js +21 -0
- package/dist/{Files-A5MD7QNE.js → Files-WKTSGZLO.js} +141 -141
- package/dist/Notepad-GMDSZEAO.js +24 -0
- package/dist/PomodoroTimer-SFTPXEDV.js +91 -0
- package/dist/{Preview-DRNDT6WX.js → Preview-XYR5M6UU.js} +10 -10
- package/dist/{Stock-JY3PJI2M.js → Stock-YCPMLYPR.js} +3 -3
- package/dist/{Weather-POQXLYFA.js → Weather-TLFNIPDG.js} +13 -13
- package/dist/{WorldClock-FUJOPJ5G.js → WorldClock-66IRFS2W.js} +6 -6
- package/dist/ai/index.js +30 -30
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/{chunk-F4XGUOVL.js → chunk-4BKJ6A5H.js} +4 -4
- package/dist/{chunk-ZNLCITYY.js → chunk-5MWXBDRG.js} +2 -2
- package/dist/{chunk-QJWQ6OMF.js → chunk-AQCUGTOR.js} +6 -6
- package/dist/{chunk-MFSDS6CN.js → chunk-BKPP47DR.js} +1 -1
- package/dist/{chunk-T2OSPUS6.js → chunk-BZHP645G.js} +3 -3
- package/dist/{chunk-OGWQABFP.js → chunk-CALBDO7B.js} +1 -1
- package/dist/chunk-EC3P3W7Z.js +28 -0
- package/dist/chunk-EIFNESXS.js +1 -0
- package/dist/{chunk-XQWHKXLS.js → chunk-F37II2EH.js} +13 -13
- package/dist/{chunk-ZLKEPDJE.js → chunk-H6WXTJOT.js} +1 -1
- package/dist/{chunk-DG2TGWXI.js → chunk-JUFCEWE3.js} +5 -5
- package/dist/chunk-KZRZYLN7.js +99 -0
- package/dist/chunk-N56HV4IH.js +1 -0
- package/dist/{chunk-2NZ7CVMW.js → chunk-OALFCXD6.js} +1 -1
- package/dist/{chunk-VP2GI3UP.js → chunk-OHSRZLRD.js} +2 -2
- package/dist/{chunk-FVKXDF2Q.js → chunk-RB7IU7ZK.js} +5 -5
- package/dist/{chunk-WLX24TG6.js → chunk-TUPPFC74.js} +4 -4
- package/dist/{chunk-EEB5XPWP.js → chunk-VXDW6ZPG.js} +2 -2
- package/dist/format/index.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.d.ts +4 -3
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +120 -120
- package/dist/shell/Dialog.d.ts +5 -0
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-OUPD7SZV.js +0 -29
- package/dist/CurrencyConverter-CNGYEKE3.js +0 -21
- package/dist/Notepad-CUWBPETD.js +0 -24
- package/dist/PomodoroTimer-I53C5QYM.js +0 -91
- package/dist/chunk-EEGTFJUQ.js +0 -28
- package/dist/chunk-MDVABA4H.js +0 -1
- package/dist/chunk-XQNZJNEJ.js +0 -99
package/README.md
CHANGED
|
@@ -1685,7 +1685,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1685
1685
|
| `ImageLightbox`, `ZoomableImage`, `LIGHTBOX_PICTURE_FIT` | The full-screen viewer for a GALLERY (harness PAT-7; a single stored document opens in the Preview window instead, UI-18). `images` (`{ url, caption?, kind? }`), `startIndex`, `onClose`, `onIndexChange`, `onOpenFile`. A picture zooms with the wheel, a pinch and a double-click and pans with a drag (`ZoomableImage`); a video gets the player; any other file a card whose "Open file" links to it, or calls `onOpenFile` (a host that can show it in the Preview window). A `1 / 5` counter and Close top right, Previous / Next that wrap, caption and "Open original" below; ArrowLeft / ArrowRight step, and Escape closes through the shell's Escape seam, so the window behind stays open. A modal dialog with a focus trap and a scroll lock, portalled to `<body>` on the overlay layer; a click on the backdrop closes, a click on the picture does not. `LIGHTBOX_PICTURE_FIT` is the class string that fits the picture between the edge controls (the bars and the side arrows); a host that draws its own viewer round `ZoomableImage` uses it with `object-contain` instead of keeping a copy. Words: the `lightbox` section. |
|
|
1686
1686
|
| `MediaUsedInList` | "Used in 7 places": a row per place that still uses a file — the host's kind word as a badge ("Page", "Email") and the place's name. A row with `onOpen` is a link-look button; a row without one is plain text, never a button that goes nowhere. It fetches nothing; the host hands over the rows. `heading` and `emptyText` replace the catalog's `media.usedIn` / `media.notUsed`. |
|
|
1687
1687
|
| `mediaMoveItems`, `useMediaMoveItems` | The "Move to" list as `DropdownMenu` entries, so a bulk bar's "Move to" button and any menu that takes the same entries draw one definition. `{ count, kind, targets, onPick }`: it leads with "Move 3 images to" (`media.moveTo`), runs of targets that share a `group` get a label and a line, `depth` indents a nested folder, and a target with `disabledReason` stays in the list, off, with the reason under it. No targets says `media.moveNowhere`. The hook reads the words from the catalog; the plain function takes them as its second argument. `mediaMoveSubmenu(options)` is the same list as ONE "Move to ▸" row (a `type: 'submenu'` entry) for a menu that holds other things; `head: false` drops the "Move 3 images to" line (a folder moving). |
|
|
1688
|
-
| `MediaLibrary`, `mediaLibraryMenu` | THE media library (harness UI-21): the Media Library window (`mode="manage"`) and the website editor's and email designer's image picker (`mode="pick"`) are this one part. Presentational: it never fetches; the host is the port (`MediaLibraryProps`). It hands over `location` (`{ place: 'files', folderId }`, `{ place: 'products', nodeId }`, `{ place: 'trash' }`) with `onLocationChange`, `folders` (`{ id, name, parentId, count, notEmpty }`, any depth), `products` (brand > design > finish, `sharedFrom` on a shared brand), `files` (what the open place holds, filtered by the host: `name`, `url`, `thumbUrl`, `usedCount`, `email`, `private`, `trashedDaysAgo`, and the detail rows), `usedIn` rows for the one chosen file, the counts, and the callbacks: `onUpload(files, folderId)`, `onNewFolder(parentId)` (return the new id and its name field opens, selected), `onRename`, `onMove`, `onTrash` (files), `onDeleteFolder(folderId)`, `onRestore`, `onDeleteForever`, `onEmptyTrash`, `onReplace`, `onCropEdit`, `onOpenInDesign`, `onChoose`, `onCancel`. A callback left out takes its action away (Replace before it exists); `denied: { action: reason }` keeps an action, off, with the reason. The tree: Products (read-only, lock, "Read-only" badge; hover, the details panel and the empty state say "Read-only. Edit these pictures in Products > Design > Media.", plus "Edited at HQ (<tenant>)." under a shared brand), All files, Trash (not in the picker). The toolbar: `Breadcrumbs`, search (`query`), Media type / Use / Sort (`filters` + `onFiltersChange`), the host's own `extraFilters`, Grid / List (`view` + `onViewChange`), New folder and Upload (off in Products with their reasons). The grid is `MediaUploadGrid` with `useGridSelection` and `useMarquee` (Ctrl/Cmd+A, Escape), marks "Used N", "Email", "Private", "N days ago"; a double click opens `ImageLightbox` (in the picker it chooses). ONE menu definition, `mediaLibraryMenu(target, context)`, feeds both a folder's ⋯ `DropdownMenu` and every right-click `ContextMenu` (a folder, 1 or N files, a file in Trash, a Products folder, a render), "Move to ▸" a submenu in both. A folder has no Trash: its danger row is "Delete folder" (the backend deletes only an empty folder), off with "Only an empty folder can be deleted." while the host sets `notEmpty`; pressing it calls `onDeleteFolder`, and the host asks through the shell destructive confirm (the part does not). With N files chosen, Rename, Replace and Copy URL are off. Drag: files onto a folder move there, a folder onto a folder nests, files from the computer upload into the open folder; Products takes nothing, and its `Tooltip` says why (`MEDIA_FILES_DRAG_TYPE`, `MEDIA_FOLDER_DRAG_TYPE`). The details panel: picture, `DescriptionList`, Copy URL, Replace / Crop & edit / Move to / Rename / Trash (Restore / Delete forever in Trash; a render: read-only `Banner` and Open in Design), `MediaUsedInList`. Two or more chosen: a bulk bar. The picker: a footer "1 selected · <name>", Cancel / Choose image; a `private` file (or one with `pickDisabledReason`) cannot be chosen. With `onDragOut` (opt-in, harness UI-20 media popup) a choosable file can be dragged OUT onto an editor's canvas, from the picker and while managing (not from Trash; in All files the same tile drag still moves to a folder, carrying both payloads through `MediaUploadGrid`'s `dragAlso`): it carries `{ id, url, kind, name }` under `MEDIA_FILE_DRAG_TYPE` (read it with `readMediaFileDrag(e.dataTransfer)`, which answers null for anything else), with `effectAllowed: 'link'`, and `onDragOut` hears `start`, then `dropped` or `cancelled`. Under 640 px of its own width (or `layout="phone"`): the tree over the toolbar, three tiles a row, and the details in a bottom sheet (`Drawer side="bottom"`). Words: the `mediaLibrary` section. |
|
|
1688
|
+
| `MediaLibrary`, `mediaLibraryMenu` | THE media library (harness UI-21): the Media Library window (`mode="manage"`) and the website editor's and email designer's image picker (`mode="pick"`) are this one part. Presentational: it never fetches; the host is the port (`MediaLibraryProps`). It hands over `location` (`{ place: 'files', folderId }`, `{ place: 'products', nodeId }`, `{ place: 'trash' }`) with `onLocationChange`, `folders` (`{ id, name, parentId, count, notEmpty }`, any depth), `products` (brand > design > finish, `sharedFrom` on a shared brand), `files` (what the open place holds, filtered by the host: `name`, `url`, `thumbUrl`, `usedCount`, `email`, `private`, `trashedDaysAgo`, and the detail rows), `usedIn` rows for the one chosen file, the counts, and the callbacks: `onUpload(files, folderId)`, `onNewFolder(parentId)` (return the new id and its name field opens, selected), `onRename`, `onMove`, `onTrash` (files), `onDeleteFolder(folderId)`, `onRestore`, `onDeleteForever`, `onEmptyTrash`, `onReplace`, `onCropEdit`, `onOpenInDesign`, `onChoose`, `onCancel`. A callback left out takes its action away (Replace before it exists); `denied: { action: reason }` keeps an action, off, with the reason. The tree: Products (read-only, lock, "Read-only" badge; hover, the details panel and the empty state say "Read-only. Edit these pictures in Products > Design > Media.", plus "Edited at HQ (<tenant>)." under a shared brand), All files, Trash (not in the picker). The toolbar: `Breadcrumbs`, search (`query`), Media type / Use / Sort (`filters` + `onFiltersChange`), the host's own `extraFilters`, Grid / List (`view` + `onViewChange`), New folder and Upload (off in Products with their reasons). The grid is `MediaUploadGrid` with `useGridSelection` and `useMarquee` (Ctrl/Cmd+A, Escape), marks "Used N", "Email", "Private", "N days ago"; a double click opens `ImageLightbox` (in the picker it chooses). ONE menu definition, `mediaLibraryMenu(target, context)`, feeds both a folder's ⋯ `DropdownMenu` and every right-click `ContextMenu` (a folder, 1 or N files, a file in Trash, a Products folder, a render), "Move to ▸" a submenu in both. A folder has no Trash: its danger row is "Delete folder" (the backend deletes only an empty folder), off with "Only an empty folder can be deleted." while the host sets `notEmpty`; pressing it calls `onDeleteFolder`, and the host asks through the shell destructive confirm (the part does not). With N files chosen, Rename, Replace and Copy URL are off. Drag: files onto a folder move there, a folder onto a folder nests, files from the computer upload into the open folder; Products takes nothing, and its `Tooltip` says why (`MEDIA_FILES_DRAG_TYPE`, `MEDIA_FOLDER_DRAG_TYPE`). The details panel: picture, `DescriptionList`, Copy URL, Replace / Crop & edit / Move to / Rename / Trash (Restore / Delete forever in Trash; a render: read-only `Banner` and Open in Design), `MediaUsedInList`. Two or more chosen: a bulk bar. The picker: a footer "1 selected · <name>", Cancel / Choose image; a `private` file (or one with `pickDisabledReason`) cannot be chosen. With `onDragOut` (opt-in, harness UI-20 media popup) a choosable file can be dragged OUT onto an editor's canvas, from the picker and while managing (not from Trash; in All files the same tile drag still moves to a folder, carrying both payloads through `MediaUploadGrid`'s `dragAlso`): it carries `{ id, url, kind, name }` under `MEDIA_FILE_DRAG_TYPE` (read it with `readMediaFileDrag(e.dataTransfer)`, which answers null for anything else), with `effectAllowed: 'link'`, and `onDragOut` hears `start`, then `dropped` or `cancelled`. In a shell window the window steps aside for the drag by itself (invisible, click-through, still mounted, so the canvas under it takes the drop) and comes back when the drag ends; the host adds no style. Under 640 px of its own width (or `layout="phone"`): the tree over the toolbar, three tiles a row, and the details in a bottom sheet (`Drawer side="bottom"`). Words: the `mediaLibrary` section. |
|
|
1689
1689
|
| `StartMenu` / `Desktop` / `WindowManagerProvider` | Used internally by `Layout`; rarely instantiated directly. |
|
|
1690
1690
|
| `Modal`, `ModalActions`, `CopyButton`, `CancelButton` | Window primitive supporting standard / compact / widget styles. Every window frame is a non-modal `role="dialog"` (no `aria-modal`: a window stands beside other windows, with no scrim and no focus trap), named by the title it draws through `aria-labelledby`; a widget, a phone frame and the Home tab draw no title, so their title text is the `aria-label`. A test finds an open window with `getByRole('dialog', { name: 'Its title' })`, and a modal popup over it with `[role="dialog"][aria-modal="true"]`. |
|
|
1691
1691
|
| `splitTitle(title)` | Splits a window or page title for the Sidebar layout's tab: `{ text, copy, accessories, badges, actions }` — the title's words for the tab (a badge's own text is not among them), the `CopyButton`'s text (a routed page tab's copy icon; window tabs draw none), and every badge and control (any component, `button`, `a`, `select`, …) in title order, split into `badges` (`StatusBadge`, `ColoredBadge`, or a component with `titleRole = 'badge'`) for the record bar and `actions` (everything else) for the active window tab. Inline SVG is dropped. A badge drawn as a styled `<span>` counts as words, so draw badges with `StatusBadge` / `ColoredBadge`. |
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-6RK6R3RY.js";import"./chunk-SFULX4E3.js";import"./chunk-FTMCNC66.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-6RK6R3RY.js";import"./chunk-SFULX4E3.js";import"./chunk-FTMCNC66.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-5MWXBDRG.js";import{WindowTitle as n}from"./chunk-KZRZYLN7.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DK5SXOXJ.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-UR2ECNBB.js";import{confirm as s}from"./chunk-HMT3MES3.js";import"./chunk-D2WJAF62.js";import"./chunk-EIFNESXS.js";import"./chunk-MWTCGJAI.js";import"./chunk-RIG5FEVS.js";import"./chunk-5WK56FA3.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-CJHYOHMU.js";import"./chunk-JZBLOIL7.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-N56HV4IH.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-THLXDI76.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as a}from"./chunk-XZXFUZIK.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-JSHMIMAJ.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=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 f(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&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["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 x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(p)||k}function v(){const h=i(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,v]=l(k||b),[C,R]=l(w),[W,S]=l([w]),[D,z]=l(0),[M,E]=l(0),[H,L]=l(x),[J,T]=l(!1),[U,X]=l(null),F=i(null),G=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(H))}catch{}},[H]);const A=e=>{const t=f(e);t&&(v(t),R(t),S(e=>{const o=e.slice(0,D+1);return o.push(t),o}),z(e=>e+1),T(!1))},I=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},K=()=>{const e=U?.trim();e?(L(t=>[...t,{label:e,url:w}]),X(null)):X(null)};c(()=>{if(null===U)return;F.current?.focus(),F.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||X(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==U]);const O=e=>{L(t=>t.filter((t,o)=>o!==e))},Y=D>0,Z=D<W.length-1,B=H.some(e=>e.url===w),Q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */u(n,{title:`Browser - ${N(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(D>0){const e=D-1;z(e),v(
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(D<
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(D>0){const e=D-1;z(e),v(W[e]),R(W[e]),T(!1)}},disabled:!Y,className:Q,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(D<W.length-1){const e=D+1;z(e),v(W[e]),R(W[e]),T(!1)}},disabled:!Z,className:Q,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>E(e=>e+1),className:Q,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>A(b),className:Q,title:"Home",children:/* @__PURE__ */u(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),A(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("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__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
|
-
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>
|
|
13
|
-
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>B?
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:
|
|
12
|
+
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>R(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…"}),w!==C&&
|
|
13
|
+
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>R(w)}})})]})}),
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>B?O(H.findIndex(e=>e.url===w)):void X(N(w)),className:Q+" "+(B?"text-yellow-500":""),title:B?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:B?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:I,className:Q,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
16
|
/* @__PURE__ */u("button",{onClick:()=>T(e=>!e),className:Q,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==U&&/* @__PURE__ */m("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:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:F,type:"text",value:U,onChange:e=>X(e.target.value),onKeyDown:e=>{"Enter"===e.key?K():"Escape"===e.key&&X(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:
|
|
23
|
-
/* @__PURE__ */m("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===
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>X(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:K,disabled:!U.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("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===H.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),H.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>A(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&O(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("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)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:M,iframeRef:
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:M,iframeRef:G,openExternal:I,showHelp:J,dismissHelp:()=>T(!1)})})]})}function N(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function j({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[i,d]=l(!1);c(()=>{d(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!i?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
29
|
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[N(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-H6WXTJOT.js";import{useWidgetSettings as n}from"./chunk-KZRZYLN7.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DK5SXOXJ.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-UR2ECNBB.js";import"./chunk-HMT3MES3.js";import"./chunk-D2WJAF62.js";import"./chunk-EIFNESXS.js";import"./chunk-MWTCGJAI.js";import"./chunk-RIG5FEVS.js";import"./chunk-5WK56FA3.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-CJHYOHMU.js";import"./chunk-JZBLOIL7.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-THLXDI76.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as r}from"./chunk-XZXFUZIK.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-JSHMIMAJ.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as l,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[b,g]=c(null),[j,N]=c(!1),[y,x]=c(""),[C,f]=c([]),[v,$]=c(!1),[E,T]=c(()=>e(h)),[J,S]=c(!1),[W,D]=c(E),M=i(null);n(o(()=>{D({...E}),S(!0)},[E]));const F=o(e=>{x(""),k(t=>j||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[j]),X=o(()=>{k("0"),d(null),g(null),N(!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}},[]),w=o(e=>{const t=parseFloat(m);if(null!==p&&b&&!j){const e=A(p,t,b);k(String(e)),d(e),f(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),N(!0)},[m,p,b,j,A]),H=o(()=>{if(null===p||!b)return;const e=parseFloat(m),t=A(p,e,b),n=`${p} ${b} ${e} =`;f(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),N(!0)},[m,p,b,A]),U=o(()=>{k(e=>String(parseFloat(e)/100))},[]),Z=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"?F(e.key):"."===e.key?F("."):"+"===e.key?w("+"):"-"===e.key?w("-"):"*"===e.key?w("×"):"/"===e.key?(e.preventDefault(),w("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&M.current?.contains(e.target)&&e.preventDefault(),H()):"Escape"===e.key?X():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&U())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F,w,H,X,U]);const G="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",K=`${G} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,L=`${G} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,O=`${G} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,R=`${G} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return l(a,{children:[
|
|
3
|
+
/* @__PURE__ */l("div",{ref:M,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */l("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:C.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(y||b&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${b} ${j?"":m}`}),
|
|
6
|
+
/* @__PURE__ */l("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(m)})]})]}),
|
|
9
|
+
/* @__PURE__ */l("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:X,className:O,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:Z,className:O,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:U,className:O,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>w("÷"),className:`${L} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */u("button",{onClick:()=>F("7"),className:K,children:"7"}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:()=>F("8"),className:K,children:"8"}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>F("9"),className:K,children:"9"}),
|
|
17
|
+
/* @__PURE__ */u("button",{onClick:()=>w("×"),className:`${L} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>F("4"),className:K,children:"4"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>F("5"),className:K,children:"5"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>F("6"),className:K,children:"6"}),
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>w("-"),className:`${L} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:()=>F("1"),className:K,children:"1"}),
|
|
23
|
+
/* @__PURE__ */u("button",{onClick:()=>F("2"),className:K,children:"2"}),
|
|
24
|
+
/* @__PURE__ */u("button",{onClick:()=>F("3"),className:K,children:"3"}),
|
|
25
|
+
/* @__PURE__ */u("button",{onClick:()=>w("+"),className:`${L} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */u("button",{onClick:()=>F("0"),className:`${K} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */u("button",{onClick:()=>F("."),className:K,children:"."}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:H,className:R,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(t,{open:J,onClose:()=>S(!1),title:"Calculator Settings",appearance:W,onAppearanceChange:D,onSave:()=>{T(W),localStorage.setItem(h,JSON.stringify(W)),S(!1)}})]})}export{m as default};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-H6WXTJOT.js";import{useWidgetSettings as r}from"./chunk-KZRZYLN7.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DK5SXOXJ.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-UR2ECNBB.js";import"./chunk-HMT3MES3.js";import"./chunk-D2WJAF62.js";import"./chunk-EIFNESXS.js";import"./chunk-MWTCGJAI.js";import"./chunk-RIG5FEVS.js";import"./chunk-5WK56FA3.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-CJHYOHMU.js";import"./chunk-JZBLOIL7.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-THLXDI76.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import"./chunk-XZXFUZIK.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-JSHMIMAJ.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as i,Fragment as a,jsx as m}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",h="currency_appearance",d="currency_rates_cache";function k(t){try{const e=JSON.parse(localStorage.getItem(d)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function g(t,e){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function j(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var N={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,d]=s(j),[f,x]=s(()=>t(h)),[y,b]=s({}),[D,S]=s(!1),[C,v]=s(!1),[J,U]=s([]),[M,A]=s(f),[H,R]=s("USD"),[B,G]=s("CNY");r(o(()=>{U([...u]),A({...f}),v(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=k(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,g(e,n.rates))}catch{}}e&&(b(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
|
|
2
|
+
return i(a,{children:[
|
|
3
|
+
/* @__PURE__ */m("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__ */i("div",{className:"px-4 py-3 space-y-1",children:[D&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
|
|
4
|
+
return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
|
+
/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
6
|
+
/* @__PURE__ */m("span",{className:"text-base",children:N[t]||""}),
|
|
7
|
+
/* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:t}),
|
|
8
|
+
/* @__PURE__ */m("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */m("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
|
|
9
|
+
/* @__PURE__ */m("span",{className:"text-base",children:N[e]||""}),
|
|
10
|
+
/* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
|
|
11
|
+
/* @__PURE__ */m("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${t}-${e}-${r}`)})]})}),
|
|
12
|
+
/* @__PURE__ */m(e,{open:C,onClose:()=>v(!1),title:"Currency Settings",appearance:M,onAppearanceChange:A,onSave:()=>{if(0===J.length)return;const t=J.slice(0,4);d(t),x(M),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(M)),v(!1)},children:/* @__PURE__ */i("div",{children:[
|
|
13
|
+
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
|
|
14
|
+
/* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",J.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:J.map(([t,e],r)=>/* @__PURE__ */i("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
|
+
/* @__PURE__ */i("span",{className:"text-sm",children:[N[t]||""," ",t," → ",N[e]||""," ",e]}),
|
|
17
|
+
/* @__PURE__ */m("button",{onClick:()=>U(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),J.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */m("select",{value:H,onChange:t=>R(t.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(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
19
|
+
/* @__PURE__ */m("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
+
/* @__PURE__ */m("select",{value:B,onChange:t=>G(t.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(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:()=>{H!==B&&J.length<4&&U(t=>[...t,[H,B]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */i("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|