efficient-shell 7.61.0 → 7.63.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 +2 -1
- package/dist/{Browser-G2JFFX3S.js → Browser-2EWFLK6R.js} +13 -13
- package/dist/Calculator-XECRZGNK.js +29 -0
- package/dist/ConfirmDialog-IZ3NJINY.js +1 -0
- package/dist/{CurrencyConverter-6EKGFJBO.js → CurrencyConverter-RT5WIUCM.js} +9 -9
- package/dist/{Documents-4FP54PLS.js → Documents-AEYU2PZT.js} +7 -7
- package/dist/{Files-ZCQQ5TMI.js → Files-FHHYHLPN.js} +80 -80
- package/dist/{Notepad-BY5XAWFD.js → Notepad-OVG7P57T.js} +11 -11
- package/dist/PdfViewer-EVJRMYTK.js +1 -0
- package/dist/{PomodoroTimer-GXYZ2SJO.js → PomodoroTimer-S5I57YDE.js} +64 -64
- package/dist/{Preview-RFBGMX6O.js → Preview-4HUSONTN.js} +26 -26
- package/dist/Sidebar-7BYOIUQK.js +44 -0
- package/dist/{Spreadsheet-SJIYCTON.js → Spreadsheet-QBMJD2AP.js} +13 -13
- package/dist/{Stock-PWUI6WGP.js → Stock-APMSVB5J.js} +3 -3
- package/dist/{Weather-33OWOCGM.js → Weather-PHUSTWBQ.js} +17 -17
- package/dist/{WorldClock-3OKI4M2W.js → WorldClock-WQY6DN7N.js} +4 -4
- package/dist/ai/index.js +15 -15
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-3TQNOXBC.js → chunk-2RPTKZSC.js} +4 -4
- package/dist/{chunk-6JB7DBBQ.js → chunk-3G5E2R7F.js} +65 -65
- package/dist/{chunk-VTEZ4V6B.js → chunk-3NRCLNCH.js} +13 -13
- package/dist/{chunk-RXULW43T.js → chunk-5THIN3JV.js} +29 -29
- package/dist/{chunk-KH75SE7M.js → chunk-76DRQSJM.js} +2 -1
- package/dist/{chunk-JQEAGIUK.js → chunk-AAHMUDUP.js} +2 -2
- package/dist/{chunk-F6BEA7V7.js → chunk-BJ47M4AR.js} +1 -1
- package/dist/{chunk-O4LQMA4L.js → chunk-BVETBHYF.js} +1 -1
- package/dist/{chunk-OMDIZJGV.js → chunk-C6IR6W7P.js} +6 -6
- package/dist/{chunk-UQSYTHIV.js → chunk-CCWPP3YK.js} +1 -1
- package/dist/chunk-CU3GY5Y2.js +1 -0
- package/dist/{chunk-LLT243LM.js → chunk-I33KGECT.js} +4 -4
- package/dist/{chunk-L4646RA4.js → chunk-JDS2IFBP.js} +1 -1
- package/dist/chunk-K3WWKV3D.js +1 -0
- package/dist/{chunk-OWWIRUAW.js → chunk-KYBZBZEP.js} +8 -8
- package/dist/{chunk-DSSLOQDW.js → chunk-LHHIRTEG.js} +1 -1
- package/dist/{chunk-MTBMAIFM.js → chunk-LW5XF5JD.js} +1 -1
- package/dist/{chunk-MVDBVNIJ.js → chunk-MCHZT2FL.js} +566 -560
- package/dist/{chunk-UBPBDZZ7.js → chunk-MHGVLZYL.js} +1 -1
- package/dist/{chunk-7V63XT4O.js → chunk-OKPYIQ2Q.js} +10 -10
- package/dist/{chunk-5XT7DLHL.js → chunk-RUBR4GCW.js} +7 -7
- package/dist/{chunk-OBEI75WB.js → chunk-RWIFSTEK.js} +1 -1
- package/dist/{chunk-BEDROWTG.js → chunk-SMFD6EID.js} +2 -2
- package/dist/{chunk-ZG423VCB.js → chunk-SYFDOMTA.js} +1 -1
- package/dist/{chunk-FCXXSKFR.js → chunk-TJR6B3YD.js} +1 -1
- package/dist/{chunk-S2PS4IOT.js → chunk-TT6QOFWA.js} +1 -1
- package/dist/{chunk-EIIGM74J.js → chunk-UCZFCKKS.js} +15 -15
- package/dist/{chunk-DZ5QTET2.js → chunk-UNBLH4EQ.js} +18 -18
- package/dist/{chunk-QFH2UQJS.js → chunk-UYKGVCZO.js} +1 -1
- package/dist/chunk-W7W4JMOT.js +1 -0
- package/dist/{chunk-5PXEPQRQ.js → chunk-WPXX6GY2.js} +1 -1
- package/dist/{chunk-RHTH3RQG.js → chunk-YJIG2KT3.js} +11 -11
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/{index-Df7KnoGi.d.ts → index-D16PP-U7.d.ts} +76 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +137 -137
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +3 -3
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-dDZPOlkC.d.ts → strings-mUwozHxH.d.ts} +27 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +8 -5
- package/package.json +1 -1
- package/dist/Calculator-5CPQRITG.js +0 -29
- package/dist/ConfirmDialog-ZOQHYUNL.js +0 -1
- package/dist/PdfViewer-MCWSL4ZR.js +0 -1
- package/dist/Sidebar-YJ4YSBTU.js +0 -44
- package/dist/chunk-54M2NPNH.js +0 -1
- package/dist/chunk-HJQAE6SP.js +0 -1
- package/dist/chunk-JZEBE6B6.js +0 -1
package/README.md
CHANGED
|
@@ -1502,7 +1502,8 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1502
1502
|
| `TimelineTrack` | The time axis both timelines are drawn on, and the reason they look and move alike rather than merely similar. A 6 px rail with a fill, a **date ruler** (month ticks always, week ticks where they clear 14 px, a month label only where it clears 72 px of the last one), dots whose shape and glyph say what kind of event they are — every one of them in the theme accent at its 600 step, the colour a primary `Button` wears, so a shape survives the greyscale print and the colour-blind reader that a hue never did, and one of two label strategies: `labels="lanes"` packs them into two rows and folds runs of the same kind into `×N` pills, `labels="active"` draws the one label a scrubber needs, `labels="none"` draws none — the bare rail, where an item's `caption` is the only text near its mark, the edge captions flank the rail on its own row, and the `pending` things are one dashed cap past a dashed tail rather than a column. `axis="compressed"` CUTS any stretch holding more than 30% of the window's time down to a fixed notch with a break glyph saying how many days it hides, and shares the rest of the track proportionally; `axis="linear"` keeps time proportional throughout; `axis="spread"` cuts nothing and keeps the 48 px floor, the idle stretches paying for it in proportion. `highlightKeys` lights one band from the leftmost named mark to the rightmost and every mark inside it; `onHoverChange` reports the mark under the pointer or the focus. A `provisional` item is hollow, never current, and outside the fill. `endMark` puts a hollow, dashed mark ON a bare rail's right edge for a day the window already runs to — an estimate, a contractual date — with the label and the date in its popover. An optional `thumb` turns it into a scrubber: give it `stops` and it becomes discrete — a drag follows the pointer but snaps to the nearest stop as it goes, arrows step stop to stop, and `valueText` says which one for a screen reader. An optional `playback` then drives that thumb along the rail by itself: the caller owns the button and the `playing` flag, the track owns the travel, because the distance between two stops is a distance in **pixels of its axis** and nobody outside knows how wide the track is. It is paced by that distance — 350 ms per 100 px, clamped to 450–1400 ms, eased in and out — so a compressed `//` notch costs 48 px of travel like any other 48 px instead of swallowing the glide, and the date chip, read back through the axis's inverse mapping, skips exactly the days the notch hides. `onArrive(key, ms)` fires on arrival and never mid-travel; the thumb then rests 700 ms before setting off again. The timing is the **wall clock**, not the frame rate: the rest is waited out on a timer and the travel is measured against the high-resolution timestamp each animation frame carries, so 700 ms is 700 ms on a throttled or occluded surface that hands out one frame a second instead of sixty — and a page that comes back after an idle stretch walks its backlog forward at one report per frame rather than announcing four at once. `onProgress({ fromKey, toKey, t, ms } | null)` hands out the in-flight position on every frame of a glide and `null` the moment there is none (arrival, pause, cancel, end, and a released drag), so a consumer can interpolate a table under the bar on the same eased `t` that places the disc; a drag reports the pointer's linear fraction between its two neighbouring stops. Flipping `playing` off freezes it where it is — keeping what is left of the rest rather than spending it — and flipping it back on carries on from there; taking hold of the thumb — a drag, a click, an arrow key — ends the playback through `onStop`. Under `prefers-reduced-motion` the walk stays, the travel goes, and `onProgress` only ever says `null`. Hovering a `×N` pill **magnifies** its stretch so the members can carry their own labels (or do it from code with `zoomRange`), and an item's `preview` fills the hover/focus popover with the document in miniature, with an "Open" footer that fires its `onOpen` — the popover has already drawn the mark's label and its date above the preview, so a consumer leaves both out of it. Also `markers` — each one free to name its own `glyph` where its kind's is not specific enough — `phases`, `edgeCaptions`, and a `pending` list for the things that have no date. Every mark takes its own pointer, including on a scrubber: the 24 px hit strip that makes a 6 px rail pressable runs UNDER the dots rather than over them, so hover, focus and click reach a report, an inspection or a shipment, while a press on the bare rail between two of them still starts a drag and a drag crossing a mark is not interrupted by it. No two marks are ever drawn on top of each other: a run whose centres are closer than one mark's width — of any kinds, folded or not — becomes ONE mark carrying `×N`, its kind's own shape and glyph where the run shares a kind and a neutral `×N` pill where it does not, named after every member it stands for. A pointer opens it: the axis magnifies around the run and each member is a mark again with its own popover, the same magnification a `×N` label pill asks for. A run that is all one DATE can never be opened — no magnification separates a coordinate from itself — so its popover lists every member with its date and its own preview instead. Folding is a drawing decision only: the thumb's stops, `onActivate` and playback all still see every mark. The marks are an `<ol>` with exactly one `aria-current="step"` and ONE tab stop — arrows traverse, Home/End jump, Enter/Space activates — and every tooltip and pill popover is hoverable, persistent and Escape-dismissible (WCAG 1.4.13). A popover is kept inside the track and inside the shell window that owns it (UI-11), the first day's mark included, and a mark carries no native `title` — its popover is the tooltip, on hover and on focus alike. Under a 320 px track it stops squeezing the axis and switches to a vertical variant. Motion is `rosh-tl-*` classes in `ui.css` behind one `prefers-reduced-motion` rule, replayed on every mount, total budget 600 ms. |
|
|
1503
1503
|
| `ProductionTimeline` | The scrubbable production bar, drawn on `TimelineTrack` inside the shared timeline card: a sentence-case heading with the PO as its subject, the window and the lead time as meta, a Play **pill** on the right whose glyph follows its state, and a footer carrying the status line and legend chips drawn with the track's own glyphs — a shipment is a diamond with a truck in it and an inspection a disc with a flask, on the rail and in the chip alike, because every kind is painted in the one accent and the glyph is the only thing left to tell them apart. The thumb only ever rests on a date a report was filed on — drag it and it snaps report to report, arrow it and it steps one report at a time — so the bar never shows an estimate dressed as a fact. Press Play and it **travels** between them: a fresh press rewinds to the first report, the thumb reads each snapshot for 700 ms and then glides to the next with the date chip counting the days it crosses, and the status line under the bar changes on arrival rather than while it is on its way. Pausing freezes it mid-glide and pressing Play again carries on from exactly there; touching the thumb ends the playback and hands it back. The walk keeps time by the clock rather than by the frame rate, so an idle or throttled pane does not stretch it. `onScrubProgress` forwards the track's in-flight fraction — `{ fromKey, toKey, t, ms }` keyed by report id, `null` at a stop — which is how a consumer's items table moves WITH the thumb instead of jumping a whole report's worth of quantities when it lands; it is optional and undefined by default, so a caller that only reads the snapshot needs no change. `onPickReport` selects a report; the optional `onOpenReport` / `onOpenMarker` make the label above the thumb a real button that opens the document behind it. `reportLabel` names a report wherever the bar states its identity — the caption over the thumb, the popover header, each dot's accessible name, the slider's value text and the status line — and defaults to its own `progress_number`, while `resetLabel` replaces the whole of the `Back to …` button: together they are what lets a portal that must not print an internal document number run the same card. A report carries an optional `preview` for its hover/focus popover — the stage row it filed, the note attached to it — and `renderReportPreview` builds one for the reports that carry none, the convenience for a caller whose list arrives straight off an API; the report's own preview wins where both exist, and the popover prints the report number and the date itself. `useProductionTimeline(opts)` owns the slider state and the derived snapshot so the caller's items table and the bar read the same state; `STAGES` / `calcOverall` / `calcReportOverall` are the stage maths it shares with that table. **`variant="rail"`** is the bar alone, for a window whose own header already says what the order is: no card, no heading, no lead-time line, no label under the active report — every report, shipment, inspection and **invoice** (kind `invoice`, a disc with a receipt) is a dot with a popover — the thumb with its date chip, `Start` and `Est. done` flanking the rail, the estimated completion as a hollow mark on the right edge while it is still ahead, and under the rail one row: Play, the return button when the thumb has been moved, and the `<report> · date · N% overall · N pc in stock` line. The rail spreads the reports (the track's `spread` axis) rather than folding two a week apart into a `×2`. `onPlayStart` fires before the thumb moves, on a fresh run and on a resume, so a window that keeps the bar in view while its table shows something else can switch the table first. |
|
|
1504
1504
|
| `MilestoneTimeline` | The static sibling, on the same `TimelineTrack` and in the same card: one dot per milestone on a date axis, no scrubber. `heading` and `subject` split the title from the record it is about (`Mould development` · **001F/1813**), and the meta line states when it started, how long it has run and how many milestones are dated. The axis **cuts** rather than squeezes: a stretch holding more than 30% of the window's time becomes a fixed notch with a break glyph saying how many days it hides, and every stretch that still keeps time gets at least 48 px. Labels are packed into **two lanes** by their **measured** width, and a run of same-kind revisions folds into one `DFM ×4` pill whose members keep their dots on the rail: hovering it magnifies that stretch until each member can carry its own label, a click pins the popover listing them, Escape closes it. A milestone carries an optional `glyph` (a `default` one that names `doc` is drawn as the signed drawing it is), a `preview` for the popover, and an `onOpen` that the popover's "Open" button fires — `onClick` selects the dot on the bar, `onOpen` opens the drawing behind it, and a card that declares only the first keeps its Open button because the footer falls back to it. Label and date are printed by the popover above the preview, so a consumer supplies neither. A milestone with **no date gets no position**, because the only position available would be a date the record does not have: it is listed beside the bar under "Not yet reached" (two rows, then a real `+N more` button) and takes no part in the range, the fill or a phase bracket. `phase` groups of 2+ get a bracket marking parallel work, the fill never runs past today, and today gets its dashed rule and tag even when it IS the right edge — the commonest case, because a programme with no finish date ends at today. **`variant="rail"`** is the bar alone, for a window whose stepper already names the stages: no card, no heading, no label under any dot — every milestone is a dot with a popover, a revision carries a two-character `caption` over its dot (`v3`; captions that would overprint collapse to `v1–v4`), `edgeCaptions` flank the rail on its own row (`{ start: 'Start', end: 'Ready' }`), nothing is cut (the `spread` axis: every stretch at least 48 px, the idle ones drawn short rather than notched), and what has not happened is one dashed **cap** at the end of a dashed tail — a real button announced as the last undated milestone, naming the rest in its popover. The stepper and the rail then point at each other: `highlightKeys` lights one soft band from the leftmost named milestone to the rightmost and every dot inside it (a single key rings one dot; the cap answers to the pending milestone's key), and `onHoverChange` reports the milestone under the pointer or the focus, `null` on leave. A `provisional` milestone — a sample ORDERED, drawn where the shipment will be — is hollow, never "where we are", and outside the fill. |
|
|
1505
|
-
| `SettingRow` | One setting in a settings card: the name with its explanation stacked under it on the left, the control or value on the right (it never shrinks), and an optional body (`children`) that opens beneath behind its own line. Each row draws its own top line (`divider`) and padding, so rows stack in a card. One prop per slot: `label` (the name) and `value` (a control or a read-only fact). `size="compact"` is the editor-panel row (Lewis, final 2026-10-17): `icon` before the name; the name on one line, never wrapped; and at the right end the value, then a 24px reset slot drawn on EVERY row, empty until `action` (the Reset button) fills it, so every control in a group ends on one line. When the name and the control do not fit, the control drops under the name and still ends on that line. Number boxes in a compact row are one 80px box with the compact steppers, by default; a `Slider` takes the room from the name to its box (track at least 96px) or drops under the name. The default size draws what it always drew. Handles a value that is a control (`controlId` labels it), a read-only fact, a value nobody knows (an em dash in the faint ink, never an empty cell), and a `quiet` row nothing can write yet. A name over a field (children, no value) draws nothing on the right. `DescriptionList` is the record-detail neighbour and stays that. `showWhen` (with `values`, and `context` for where the row is) hides the row while the rule is false — see `ShowWhen` below. |
|
|
1505
|
+
| `SettingRow` | One setting in a settings card: the name with its explanation stacked under it on the left, the control or value on the right (it never shrinks), and an optional body (`children`) that opens beneath behind its own line. Each row draws its own top line (`divider`) and padding, so rows stack in a card. One prop per slot: `label` (the name) and `value` (a control or a read-only fact). `size="compact"` is the editor-panel row (Lewis, final 2026-10-17): `icon` before the name; the name on one line, never wrapped; and at the right end the value, then a 24px reset slot drawn on EVERY row, empty until `action` (the Reset button) fills it, so every control in a group ends on one line. When the name and the control do not fit, the control drops under the name and still ends on that line. Number boxes in a compact row are one 80px box with the compact steppers, by default; a `Slider` takes the room from the name to its box (track at least 96px) or drops under the name. The default size draws what it always drew. Handles a value that is a control (`controlId` labels it), a read-only fact, a value nobody knows (an em dash in the faint ink, never an empty cell), and a `quiet` row nothing can write yet. A name over a field (children, no value) draws nothing on the right. `DescriptionList` is the record-detail neighbour and stays that. `showWhen` (with `values`, and `context` for where the row is) hides the row while the rule is false — see `ShowWhen` below. **The per-view state** (S7: V2 2026-10-09, D3 2026-10-12): `viewState="auto"` is a value never edited in the view on screen, worked out from the view above — an "auto" tag after the name, and every `InputNumber`, `Select` and `Slider` in the value wears the auto look (dashed edge, sunken ground, grey value) and is described as "auto" to a screen reader, from this one prop (a control's own `auto` wins; `useSettingAuto()` lets a host's own control follow it). `viewState="edited"` is a value set in this view: the kit's blue changed dot (`CountBadge dot tone="accent"`) after the name, heard as "Changed in this view". |
|
|
1506
|
+
| `SettingReset` | The ↺ in a `SettingRow`'s reset slot (`action`), passed while the value is edited in this view. `view="desktop"` (default): "Reset Padding", back to the site default. `view="tablet"` / `"phone"`: "Inherit parent layout for Padding", back to auto. `detail` says what it goes back to ("auto, 40px"), in its tooltip and description. The kit's 24px ghost `IconButton` with a 44 x 44 hit area that reaches 4px left (never over the value) and 16px right; a press calls `onReset` and moves focus to the row's own control. A host's right-click item on Tablet and Phone uses the same words: `strings.settingView.inheritParentLayout`, with a `PopupMenuItem` `description` second line. |
|
|
1506
1507
|
| `Accordion` | Folds with a heading button each (`h3` by default, `level`). Two tiers: `tier="band"` (default) is a settings group, an edge-to-edge grey band one step darker than the panel (`--rosh-fold-band`, `--rosh-fold-band-hover`), title 16 / 600; `tier="row"` is a fold inside a group or a quiet fold in a portal form, no ground, title 14 / 500. Each item can carry an `icon` and, on a band, a `count` of changed settings (a pill, read as "2 changed"). The chevron points right when shut and down when open, in a 24px column that lines up with the settings rows' reset slot. |
|
|
1507
1508
|
| `ShowWhen` / `isShown` / `ShowWhenRule` | The ONE rule for "show this settings row only when another setting has a value" (owner ruling 2026-10-17). The rule is data, never a function: `{ field: 'country_selector_enabled', is: true }`, `{ field, in: [...] }` (is one of), `{ field, set: true }` (holds anything: not `undefined`/`null`/`false`/blank/empty list; `0` counts), `default` for an unset field, a dotted `field` (`'source.slug'`), `{ context: 'parentType', in: ['Flex'] }` (where the row is, not what it stores), and `{ not }` / `{ all: [] }` / `{ any: [] }`. `isShown(rule, values, context)` is the only reader; `SettingRow`'s `showWhen` and the `<ShowWhen rule values>` wrapper both use it. A hidden row keeps its stored value — nothing here writes — and a rule it cannot read shows the row. |
|
|
1508
1509
|
| `Button`, `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`, `FormField`, `Label` | Form controls — controlled (`value`/`onChange`); `Button`'s `variant` is `primary` (the default), `secondary` (outlined), `secondary-danger` (outlined in red: a destructive action in a footer of outlined buttons, e.g. Delete beside Archive — the same size and shape as `secondary`, red border and text, a light red wash on hover), `ghost`, `ghost-danger` (red text, no box: a destructive action among quiet `ghost` buttons), `danger` (solid red: the one action a confirm dialog asks for) or `link`; `Button` takes `pressed` (or follows `aria-pressed`) for a toggle that is on, with `IconButton`'s accent wash and ink on `ghost` and `secondary` (`secondary` keeps its border, tinted, so it does not move; `buttonClasses({ pressed })` gives a link the same); `Input`/`Textarea` forward native props for react-hook-form. `Button` and `Switch` take `disabledReason`: persistent text beside the control wired with `aria-describedby`, never a `title` — a tooltip needs a hover a disabled control does not reliably get. `Switch` also takes `disabledReasonId`, so a panel whose controls are all dead for one reason states it once and points every control at it. A `Select` option carries an optional `description`, rendered as a second muted line **in the open list only** — the closed trigger stays one line, so one explained option cannot change the height of every field in the row. `NativeSelect` (and so `Select` on touch) ignores it: an `<option>` holds text and nothing else. An option also takes `lang` (a BCP 47 tag) when its label is written in another language than the page's — a language picker naming each language in its own words: it goes on the option in the open list, on the native `<option>` and on the closed trigger's label while chosen, so a screen reader and the font fallback treat each name as its own language (WCAG 3.1.2). On the desktop listbox, `title` joins `aria-label` / `aria-labelledby` / `aria-describedby` on the VISIBLE trigger button — it used to ride the native spread onto the `sr-only` `<select>`, where a tooltip has no pointer that can reach it and a fallback name sits on an `aria-hidden` element. `name`, `required` and the forwarded ref stay on the native control, which is what it is for. A `Checkbox` or `Radio` with both a `label` and a `description` is NAMED by the label and DESCRIBED by the description (`aria-labelledby` / `aria-describedby`); the whole row is still its `<label>`, so its words still tick it. `FormField` points its one child at the hint or error on screen with `aria-describedby`, and marks it `aria-invalid` while `error` is set. A child that already has its own `aria-describedby` (a react-hook-form binding often does) keeps it: the ids are merged, the child's own first, and each id is said once — a repeated id is a message a screen reader reads twice. |
|
|
@@ -1,29 +1,29 @@
|
|
|
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-2RPTKZSC.js";import{WindowTitle as r}from"./chunk-3G5E2R7F.js";import"./chunk-LHHIRTEG.js";import"./chunk-MHGVLZYL.js";import"./chunk-KYBZBZEP.js";import"./chunk-5A7MWTXX.js";import"./chunk-YJIG2KT3.js";import"./chunk-K3WWKV3D.js";import"./chunk-KNUR2UEG.js";import{confirm as a}from"./chunk-UNBLH4EQ.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as n}from"./chunk-76DRQSJM.js";import"./chunk-W7W4JMOT.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=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&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["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 g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,R]=i([k]),[W,E]=i(0),[L,S]=i(0),[H,T]=i(x),[D,K]=i(!1),[I,U]=i(null),O=s(null),B=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(H))}catch{}},[H]);const G=e=>{const t=f(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,W+1);return o.push(t),o}),E(e=>e+1),K(!1))},M=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},J=()=>{const e=I?.trim();e?(T(t=>[...t,{label:e,url:k}]),U(null)):U(null)};l(()=>{if(null===I)return;O.current?.focus(),O.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||U(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==I]);const P=e=>{T(t=>t.filter((t,o)=>o!==e))},F=W>0,q=W<z.length-1,A=H.some(e=>e.url===k),Q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
|
|
4
4
|
/* @__PURE__ */m(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(
|
|
7
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(
|
|
8
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(W>0){const e=W-1;E(e),y(z[e]),C(z[e]),K(!1)}},disabled:!F,className:Q,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(W<z.length-1){const e=W+1;E(e),y(z[e]),C(z[e]),K(!1)}},disabled:!q,className:Q,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */m("button",{onClick:()=>S(e=>e+1),className:Q,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>G(g),className:Q,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),G(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("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__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(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…"}),k!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(k),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */m("button",{onClick:M,className:
|
|
15
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>A?P(H.findIndex(e=>e.url===k)):void U(v(k)),className:Q+" "+(A?"text-yellow-500":""),title:A?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:A?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */m("button",{onClick:M,className:Q,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */m("button",{onClick:()=>K(e=>!e),className:Q,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==I&&/* @__PURE__ */c("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__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
|
|
18
|
-
/* @__PURE__ */m("input",{ref:
|
|
18
|
+
/* @__PURE__ */m("input",{ref:O,type:"text",value:I,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?J():"Escape"===e.key&&U(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
20
|
/* @__PURE__ */m("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:
|
|
22
|
-
/* @__PURE__ */c("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__ */m("button",{onClick:J,disabled:!I.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__ */c("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__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),H.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>G(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"})&&P(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */m("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__ */m("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:B,openExternal:M,showHelp:D,dismissHelp:()=>K(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
28
|
/* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */c("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-WPXX6GY2.js";import{useWidgetSettings as n}from"./chunk-3G5E2R7F.js";import"./chunk-LHHIRTEG.js";import"./chunk-MHGVLZYL.js";import"./chunk-KYBZBZEP.js";import"./chunk-5A7MWTXX.js";import"./chunk-YJIG2KT3.js";import"./chunk-KNUR2UEG.js";import"./chunk-UNBLH4EQ.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as r}from"./chunk-76DRQSJM.js";import"./chunk-W7W4JMOT.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useState as l,useRef as c,useCallback as i,useEffect as a}from"react";import{jsxs as o,Fragment as s,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function d(){const[d,m]=l("0"),[k,b]=l(null),[p,g]=l(null),[y,N]=l(!1),[x,f]=l(""),[v,C]=l([]),[$,j]=l(!1),[E,w]=l(()=>e(h)),[T,L]=l(!1),[S,W]=l(E),B=c(null);n(i(()=>{W({...E}),L(!0)},[E]));const F=i(e=>{f(""),m(t=>y||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[y]),R=i(()=>{m("0"),b(null),g(null),N(!1)},[]),A=i((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}},[]),G=i(e=>{const t=parseFloat(d);if(null!==k&&p&&!y){const e=A(k,t,p);m(String(e)),b(e),C(n=>[`${k} ${p} ${t} = ${e}`,...n].slice(0,20))}else b(t);g(e),N(!0)},[d,k,p,y,A]),H=i(()=>{if(null===k||!p)return;const e=parseFloat(d),t=A(k,e,p),n=`${k} ${p} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),f(n),m(String(t)),b(null),g(null),N(!0)},[d,k,p,A]),I=i(()=>{m(e=>String(parseFloat(e)/100))},[]),J=i(()=>{m(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);a(()=>{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?G("+"):"-"===e.key?G("-"):"*"===e.key?G("×"):"/"===e.key?(e.preventDefault(),G("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&B.current?.contains(e.target)&&e.preventDefault(),H()):"Escape"===e.key?R():"Backspace"===e.key?m(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&I())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F,G,H,R,I]);const D="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",K=`${D} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,M=`${D} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,O=`${D} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,U=`${D} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return o(s,{children:[
|
|
3
|
+
/* @__PURE__ */o("div",{ref:B,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */o("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:v.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(x||p&&null!==k)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:x||`${k} ${p} ${y?"":d}`}),
|
|
6
|
+
/* @__PURE__ */o("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(d),j(!0),setTimeout(()=>j(!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,$?{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)})(d)})]})]}),
|
|
9
|
+
/* @__PURE__ */o("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:R,className:O,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:J,className:O,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:I,className:O,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>G("÷"),className:`${M} ${"÷"===p?"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:()=>G("×"),className:`${M} ${"×"===p?"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:()=>G("-"),className:`${M} ${"-"===p?"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:()=>G("+"),className:`${M} ${"+"===p?"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:U,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(t,{open:T,onClose:()=>L(!1),title:"Calculator Settings",appearance:S,onAppearanceChange:W,onSave:()=>{w(S),localStorage.setItem(h,JSON.stringify(S)),L(!1)}})]})}export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-UNBLH4EQ.js";import"./chunk-UVBK6YSR.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-76DRQSJM.js";import"./chunk-W7W4JMOT.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-WPXX6GY2.js";import{useWidgetSettings as r}from"./chunk-3G5E2R7F.js";import"./chunk-LHHIRTEG.js";import"./chunk-MHGVLZYL.js";import"./chunk-KYBZBZEP.js";import"./chunk-5A7MWTXX.js";import"./chunk-YJIG2KT3.js";import"./chunk-KNUR2UEG.js";import"./chunk-UNBLH4EQ.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import"./chunk-76DRQSJM.js";import"./chunk-W7W4JMOT.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as n}from"./chunk-2J6F4EE7.js";import{useState as a,useCallback as s,useEffect as o}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["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",d="currency_appearance",h="currency_rates_cache";function g(e){try{const t=JSON.parse(localStorage.getItem(h)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function f(e,t){try{const r=JSON.parse(localStorage.getItem(h)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(h,JSON.stringify(r))}catch{}}function y(){try{const e=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return u}var x={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function N(){const[u,h]=a(y),[N,b]=a(()=>e(d)),[k,v]=a({}),[S,D]=a(!1),[j,C]=a(!1),[U,B]=a([]),[J,R]=a(N),[I,L]=a("USD"),[H,A]=a("CNY");r(s(()=>{B([...u]),R({...N}),C(!0)},[u,N])),o(()=>{const e=[...new Set(u.map(([e])=>e))];let t=!0;return async function(){D(!0);const r={};for(const t of e){const e=g(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,f(t,n.rates))}catch{}}t&&(v(r),D(!1))}(),()=>{t=!1}},[u]);/* @__PURE__ */
|
|
2
2
|
return c(i,{children:[
|
|
3
|
-
/* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${N.activeOpacity/100})`,backdropFilter:N.activeBlur>0?`blur(${N.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[
|
|
3
|
+
/* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${N.activeOpacity/100})`,backdropFilter:N.activeBlur>0?`blur(${N.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[S&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([e,t],r)=>{const n=k[e]?.[t];/* @__PURE__ */
|
|
4
4
|
return c("button",{onClick:()=>{const e=u.map((e,t)=>t===r?[e[1],e[0]]:e);h(e),localStorage.setItem(p,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-2",children:[
|
|
6
6
|
/* @__PURE__ */l("span",{className:"text-base",children:x[e]||""}),
|
|
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=u.map((e,t)=>t===r?[e[1],e[0]]:e);h(e),l
|
|
|
9
9
|
/* @__PURE__ */l("span",{className:"text-base",children:x[t]||""}),
|
|
10
10
|
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
11
|
/* @__PURE__ */l("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__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:
|
|
12
|
+
/* @__PURE__ */l(t,{open:j,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:R,onSave:()=>{if(0===U.length)return;const e=U.slice(0,4);h(e),b(J),localStorage.setItem(p,JSON.stringify(e)),localStorage.setItem(d,JSON.stringify(J)),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-2xs font-normal text-gray-400",children:["(",
|
|
15
|
-
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */c("span",{className:"text-2xs font-normal text-gray-400",children:["(",U.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:U.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:[x[e]||""," ",e," → ",x[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */l("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */l("select",{value:
|
|
17
|
+
/* @__PURE__ */l("button",{onClick:()=>B(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),U.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */l("select",{value:I,onChange:e=>L(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:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
19
19
|
/* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */l("select",{value:
|
|
21
|
-
/* @__PURE__ */l("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */l("select",{value:H,onChange:e=>A(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:m.map(e=>/* @__PURE__ */l("option",{children:e},e))}),
|
|
21
|
+
/* @__PURE__ */l("button",{onClick:()=>{I!==H&&U.length<4&&B(e=>[...e,[I,H]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{N as default};
|
|
@@ -1,14 +1,14 @@
|
|
|
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-2RPTKZSC.js";import{WindowTitle as n}from"./chunk-3G5E2R7F.js";import"./chunk-LHHIRTEG.js";import"./chunk-MHGVLZYL.js";import{toast_default as r}from"./chunk-BJ47M4AR.js";import"./chunk-KYBZBZEP.js";import"./chunk-5A7MWTXX.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-YJIG2KT3.js";import"./chunk-K3WWKV3D.js";import"./chunk-KNUR2UEG.js";import"./chunk-UNBLH4EQ.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as s}from"./chunk-76DRQSJM.js";import"./chunk-W7W4JMOT.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as c}from"./chunk-2J6F4EE7.js";import{useState as d,useRef as m}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";var p=/* @__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"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=d(x),[v,b]=d(!1),[k,w]=d(!1),[N,j]=d(!1),[C,D]=d(null),L=m(null),M=m(null),R=m(null),U=(e,t)=>{R.current?.focus(),document.execCommand(e,!1,t),j(!0)},B=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)}},W=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",j(!0),D(null))},T=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();b(!0);try{if(p.has(n)||!g.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:n}),j(!1)}else if(g.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),j(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{b(!1)}},
|
|
4
|
-
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),k||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?
|
|
5
|
-
/* @__PURE__ */u(n,{title:`${
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),j(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{b(!1)}},E=f?.filename?(I=f.filename).length>24?`${I.slice(0,23)}…`:I:"Untitled";var I;/* @__PURE__ */
|
|
4
|
+
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),k||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?B(t):T(t[0]))},children:[
|
|
5
|
+
/* @__PURE__ */u(n,{title:`${E}${N?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */u(t,{app:"documents"}),
|
|
7
7
|
/* @__PURE__ */h("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
8
|
/* @__PURE__ */u("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&&T(t),L.current&&(L.current.value="")},className:"hidden"}),
|
|
9
9
|
/* @__PURE__ */h("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__ */u(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=R.current?.innerHTML??"";if("text"===f.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(f.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=`${f.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=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.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__ */u("span",{className:"text-2xs text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
|
|
13
13
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
14
|
/* @__PURE__ */h("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,N?" •":""]}),
|
|
@@ -38,10 +38,10 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
38
38
|
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
39
|
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>U("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
40
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&
|
|
41
|
+
/* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&B(Array.from(e.target.files)),M.current&&(M.current.value="")}}),
|
|
42
42
|
/* @__PURE__ */h("button",{onClick:()=>M.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__ */u(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
-
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:
|
|
44
|
+
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("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(),B(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),D({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-sm 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-sm leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),k&&/* @__PURE__ */u("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__ */u("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"})}),C&&/* @__PURE__ */h(o,{minWidth:150,style:{left:C.x,top:C.y},onClose:()=>D(null),children:[
|
|
45
45
|
/* @__PURE__ */u(l,{children:"Image width"}),
|
|
46
46
|
/* @__PURE__ */u(a,{onClick:()=>W("25%"),children:"25%"}),
|
|
47
47
|
/* @__PURE__ */u(a,{onClick:()=>W("50%"),children:"50%"}),
|