efficient-shell 5.0.0 → 5.2.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 +98 -2
- package/dist/{Browser-5F5LWXYQ.js → Browser-FKZ6M2MK.js} +18 -18
- package/dist/Calculator-LBFBTFSD.js +29 -0
- package/dist/ConfirmDialog-JAEFVRJM.js +1 -0
- package/dist/{CurrencyConverter-QEG6RFAS.js → CurrencyConverter-OV5ZQIAJ.js} +7 -7
- package/dist/{Documents-6DEUZVVA.js → Documents-HGGL3AWI.js} +24 -24
- package/dist/Files-DAQKIF6W.js +87 -0
- package/dist/{Notepad-KNJRTYXR.js → Notepad-PO724TVP.js} +10 -10
- package/dist/PdfViewer-6ALXGVTV.js +1 -0
- package/dist/{PomodoroTimer-T6YAQFIE.js → PomodoroTimer-LN5MYRZO.js} +49 -49
- package/dist/{Preview-KEIDYSHF.js → Preview-CUOO5WQ7.js} +126 -126
- package/dist/Sidebar-T4ABK2WV.js +44 -0
- package/dist/{Spreadsheet-HKXSYD5B.js → Spreadsheet-2N2JXBCY.js} +14 -14
- package/dist/{Stock-BZFC2ROU.js → Stock-65WVUGLI.js} +4 -4
- package/dist/{Weather-S3N5OWYF.js → Weather-TXJICMJN.js} +18 -18
- package/dist/{WorldClock-ACC3S6OA.js → WorldClock-RIHLKZGC.js} +6 -6
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-WNEO7TSP.js → chunk-3PTA2C74.js} +1 -1
- package/dist/chunk-4QBLTEFU.js +1 -0
- package/dist/{chunk-TKUNR5KP.js → chunk-6GV4467L.js} +2 -2
- package/dist/chunk-AJB5G52B.js +1 -0
- package/dist/{chunk-2DX65GOO.js → chunk-ASSDCWKP.js} +1 -1
- package/dist/{chunk-MIAJQGWE.js → chunk-BFFXVA53.js} +1 -1
- package/dist/{chunk-R7EBJKN2.js → chunk-BFUBBDU6.js} +30 -30
- package/dist/{chunk-NHIGOEZF.js → chunk-H3UEYXRA.js} +1 -1
- package/dist/{chunk-ZDF5AR5W.js → chunk-HIAHERCD.js} +7 -7
- package/dist/{chunk-XUF7VW4U.js → chunk-JJIPGAXI.js} +29 -28
- package/dist/{chunk-T4CFSGSL.js → chunk-KHJ5XSEH.js} +8 -8
- package/dist/{chunk-KDRAU4XQ.js → chunk-M4OGNYOM.js} +8 -8
- package/dist/{chunk-P4SGJTK3.js → chunk-ML22KF7T.js} +1 -1
- package/dist/{chunk-ZZKIKW62.js → chunk-MTH7EAH3.js} +21 -21
- package/dist/{chunk-FOEVG7RT.js → chunk-OTP5WPI4.js} +8 -8
- package/dist/chunk-PS6PSCOR.js +1018 -0
- package/dist/{chunk-5IWSOLLY.js → chunk-QZNRMJE6.js} +2 -2
- package/dist/{chunk-VJP3R52B.js → chunk-R3622MOL.js} +1 -1
- package/dist/{chunk-PQLVWCUI.js → chunk-SSBOC52S.js} +4 -4
- package/dist/{chunk-3DGTIWZP.js → chunk-TKFAFZRY.js} +1 -1
- package/dist/{chunk-SBDIHKLU.js → chunk-TLTFS2D6.js} +51 -51
- package/dist/{chunk-GMMTTWHB.js → chunk-UAJQB45Y.js} +1 -1
- package/dist/{chunk-LK7V32MR.js → chunk-UG4ZPXXU.js} +1 -1
- package/dist/{chunk-QRV7RNQX.js → chunk-Y553QKEH.js} +14 -14
- package/dist/{chunk-PE4F4MJE.js → chunk-YJ6JMGMS.js} +4 -4
- package/dist/{chunk-LMIQV3NB.js → chunk-YQI7KXX3.js} +2 -2
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-HMDUOPnX.d.ts → index-Dk5VKml6.d.ts} +401 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +112 -112
- package/dist/locales/zh-Hans.d.ts +1 -1
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +5 -5
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/{strings-ZbotP_I6.d.ts → strings-aKfRDZWB.d.ts} +56 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +63 -0
- package/package.json +1 -1
- package/dist/Calculator-4K53PFBL.js +0 -29
- package/dist/ConfirmDialog-X2DPOYWO.js +0 -1
- package/dist/Files-2VSFXA45.js +0 -87
- package/dist/PdfViewer-UZGDE4HD.js +0 -1
- package/dist/Sidebar-3NZRIL7F.js +0 -44
- package/dist/chunk-67PNFBCW.js +0 -993
- package/dist/chunk-J3LIIIHJ.js +0 -1
- package/dist/chunk-YKHMAGEM.js +0 -1
package/README.md
CHANGED
|
@@ -582,7 +582,7 @@ menu open; a radio closes it, as a plain item does.
|
|
|
582
582
|
</PopupSubmenu>
|
|
583
583
|
```
|
|
584
584
|
|
|
585
|
-
### Editor controls — `Slider`, `ColorPicker`, `Tree`, `SortableList`, `IconRail`, `ResizeHandle`
|
|
585
|
+
### Editor controls — `Slider`, `ColorPicker`, `ImageFocusPoint`, `LinkPicker`, `Tree`, `SortableList`, `IconRail`, `ResizeHandle`
|
|
586
586
|
|
|
587
587
|
These were folded in from `efficient-easel` under harness UI-24, because the
|
|
588
588
|
website editor and the email designer each drew their own. All of them are on
|
|
@@ -650,6 +650,75 @@ Escape). `ColorSwatch` is a button painted with a colour (`selected` sets
|
|
|
650
650
|
`aria-pressed`). Beside them are `colorSwatchClasses`, `colorFill`, `HexInput`,
|
|
651
651
|
and the maths: `parseHexColor`, `hexToHsv`, `hsvToHex`.
|
|
652
652
|
|
|
653
|
+
**`ImageFocusPoint`** is a picture with a dot on it. Drag the dot, or press
|
|
654
|
+
anywhere on the picture, to choose which part of the picture stays in view when
|
|
655
|
+
it is cropped with `object-fit: cover`. It came from efficient-web-builder's
|
|
656
|
+
`ImageFocusRow`.
|
|
657
|
+
|
|
658
|
+
```tsx
|
|
659
|
+
<ImageFocusPoint label="Image focus" value={focal} onChange={setFocal} image={src} />
|
|
660
|
+
<img src={src} style={{ objectFit: 'cover', objectPosition: focal }} />
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
The value is a CSS `object-position` string, `"38% 64%"`, so the host renders
|
|
664
|
+
it as it is. A value it cannot read (empty, `left top`, `12px 4rem`) is the
|
|
665
|
+
centre. The picture is shown whole (`contain`), and the press is measured on the
|
|
666
|
+
picture itself, not on its frame, so a tall picture in a wide frame still puts
|
|
667
|
+
the dot under the pointer. A drag that leaves the picture keeps going and
|
|
668
|
+
clamps at the edge. The picture is a real `<button>`: Tab reaches it, the arrow
|
|
669
|
+
keys move the point 1%, Shift+arrow 10%, and every other key is left alone.
|
|
670
|
+
Enter and Space do nothing (a key press has no point to go to). Its name is the
|
|
671
|
+
label and the point: "Image focus: 38% 64%". `hint` replaces the line under the
|
|
672
|
+
picture (`null` hides it; the keys are still told to a screen reader),
|
|
673
|
+
`actions` sits at the end of that line (a "Done" button), `emptyText` shows
|
|
674
|
+
while there is no `image`, and `disabled` makes it read-only. The control holds
|
|
675
|
+
no open state: the host decides when it is on screen. The maths is exported
|
|
676
|
+
too: `parseFocal`, `formatFocal`, `nudgeFocal`, `focalFromRect`,
|
|
677
|
+
`FOCAL_DEFAULT`, `FOCAL_NUDGE_STEP`, `FOCAL_NUDGE_COARSE`.
|
|
678
|
+
|
|
679
|
+
**`LinkPicker`** says where a link goes. It is one part with two modes.
|
|
680
|
+
|
|
681
|
+
```tsx
|
|
682
|
+
// Field: every choice is written at once.
|
|
683
|
+
<LinkPicker label="Button link" value={url} onChange={(url, name) => save(url)}
|
|
684
|
+
kinds={kinds} rules={rules} filtersFor={filtersFor} />
|
|
685
|
+
|
|
686
|
+
// Window: nothing is written until Apply.
|
|
687
|
+
<LinkPicker value={href} onApply={(url) => setLink(url)} onCancel={close}
|
|
688
|
+
onRemove={href ? removeLink : undefined} />
|
|
689
|
+
|
|
690
|
+
// A button's words and its link in one box.
|
|
691
|
+
<TextLinkField label="Button" text={text} onTextChange={setText}
|
|
692
|
+
link={url} onLinkChange={setUrl} kinds={kinds} rules={rules} />
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
`kinds` is the Link type list (Page, Anchor, Blog post, Product, Custom URL —
|
|
696
|
+
whatever the host offers). Each kind has a target: a list, a list in groups, or
|
|
697
|
+
a typed address (`target: { type: 'text' }`). With no `kinds` the part is one
|
|
698
|
+
address box and no type list. `rules` is how the host reads and writes its own
|
|
699
|
+
URLs (`kindOf`, `targetOf`, `readFilter`, `withFilter`, and `isSafe`). The part
|
|
700
|
+
holds no URL rule of its own. `filtersFor` gives the Filter and Value boxes for
|
|
701
|
+
a product listing. A list over 10 options becomes a `SearchableSelect`.
|
|
702
|
+
`onChange` and `onApply` get the picked thing's name as a second argument, so a
|
|
703
|
+
host can fill a label with it.
|
|
704
|
+
|
|
705
|
+
A saved link is never changed just by opening it. A target, filter or value the
|
|
706
|
+
host no longer offers shows as "(unavailable)" and is kept. A kind the author
|
|
707
|
+
picks wins over what the URL looks like, until the link changes from outside
|
|
708
|
+
(Undo). A typed address that fails `isSafe` is refused with the reason: the
|
|
709
|
+
field says it while typing, the window says it on Apply. Without `isSafe` the
|
|
710
|
+
part uses **`isSafeLinkHref`**, the kit's one address rule: `http`, `https`,
|
|
711
|
+
`mailto`, `tel`, or no scheme; never a space or a control character.
|
|
712
|
+
`MarkdownLite` uses the same rule.
|
|
713
|
+
|
|
714
|
+
The window is a `role="dialog"`. The address box gets the caret, with the text
|
|
715
|
+
selected. Enter applies. Escape (from inside the window) and Cancel call
|
|
716
|
+
`onCancel`. Remove shows only when `onRemove` is given. `className` lets a host
|
|
717
|
+
place it (the text toolbar floats it under its buttons). `TextLinkField` is the
|
|
718
|
+
kit `Input` on top and a link row under it, in one box. The row opens the
|
|
719
|
+
window under the box, in the panel's own flow. Words come from the `link`
|
|
720
|
+
section of the strings catalogue; `placeholder` sets the address box's text.
|
|
721
|
+
|
|
653
722
|
**`Tree`**, **`TreeRow`**, **`TreeGroup`**, **`TreeGroupLabel`**,
|
|
654
723
|
**`TreeEmptySlot`** and **`TreeSeam`** draw a layers panel or an outline. They follow the WAI-ARIA
|
|
655
724
|
tree pattern.
|
|
@@ -939,13 +1008,14 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
939
1008
|
| `buttonClasses`, `iconButtonClasses` | `Button`'s and `IconButton`'s look as a class string, for something that must navigate and so cannot be a `<button>`: `<Link href="/organisations/new" className={buttonClasses({ variant: 'secondary' })}>Add a business</Link>`. Same options and defaults as the component (`variant`, `size`, `block`, `className`), and the components render through these functions, so the two cannot drift. What the string cannot give an `<a>`: a disabled state (`disabled:` never matches an anchor — drop the `href`, add `role="link"` and `aria-disabled="true"`, or render a disabled `Button`), and the cursor (an `<a href>` gets the browser's pointer, a `<button>` the host's preflight; set it once for both). Keep its `inline-flex` — ask for `block` rather than passing a display utility. An icon-only link still needs the `aria-label` `IconButton` would have required. Client references, like every kit function: call them in a `'use client'` file. |
|
|
940
1009
|
| `labelClasses` | `Label`'s look as a class string, for a `<label>` a host lays out itself — beside a check box, in a row with its control, `sr-only`: `<label htmlFor="x" className={labelClasses({ inline: true, className: 'flex gap-2' })}>`. `inline: true` drops `Label`'s block layout (`mb-1 block`) and keeps its size, weight and ink; without it the string is exactly what `Label` renders. A client reference: call it in a `'use client'` file. |
|
|
941
1010
|
| `Segmented` | A row of mutually exclusive options, all visible: a button group, or with `name` a real radio group that submits. Named by `label`, or by an element already on the page (`aria-labelledby`, a list row's own heading) and described by another (`aria-describedby`); an option's `title` says on hover what choosing it means. |
|
|
1011
|
+
| `DisplayChips` | Which parts of a section are shown, one chip per part ("Breadcrumb", "Stats", "Intro text"): blue with an eye while shown, grey with a crossed eye while hidden, and a press flips it. The chips wrap, so a long list takes a few short lines instead of one switch row per part. Controlled: `items` (`{ id, label, shown, disabled?, disabledReason? }`) and `onChange(id, shown)`. The group is named by `label` or `aria-labelledby`. Each chip is a real toggle button (`aria-pressed`), named by its part and described by its state in words (`displayChips.shown` / `hidden`), with a hover label that says what a press does; Space and Enter are the button's own. A chip with `disabledReason` stays focusable, its press does nothing and the reason is said, as on `Button`. Not `Segmented` (one choice of several) and not `TagInput` (typing values in). |
|
|
942
1012
|
| `RadioGroup` | One choice from a short visible list, with the group chrome each panel used to rebuild: a `role="radiogroup"` named by its own label (`aria-labelledby`, because `<label for>` cannot name a div), the `hint`/`error`/`required` wiring borrowed from `FormField`, and `orientation` for a row that wraps rather than compresses. The options are real native radios sharing one `name`, which is what gives the group its arrow keys, its disabled-skipping and its single tab stop — all from the user agent, none of it hand-rolled. `value: null` is "nothing chosen yet", not a silent first option. |
|
|
943
1013
|
| `Snippet` | A value the user copies rather than reads — an endpoint, a tenant id, a shell command. Monospace, truncated with the whole value on its `title` (`multiline` wraps instead), and a copy button that flips to a check for two seconds and says "Copied" through an `aria-live` region. `value` is what reaches the clipboard and `children` is what is shown, so a masked key displays masked and copies whole. `symbol` prints a leading glyph that is never copied and has **no default** — a URL has no `$` in front of it. A refused clipboard toasts rather than looking like it worked. Not a read-only `Input`: a value that can only be copied is not a control and should not take a tab stop or invite an edit. `id` and `aria-describedby` land on the COPY BUTTON — the only focusable thing in the row, and a labelable one — so a wrapping `FormField` really does label it and its hint is really announced; with `hideCopyButton` they fall back to the box, because an id that resolves to nothing is not wiring. |
|
|
944
1014
|
| `Kbd` | The badge the shortcut constants (`CMD_ENTER`, `ALT_SHIFT_E`, …) are shown in — a real `<kbd>`, two rungs, `className` layered on so a portal can tint it. It renders the string it is handed; which symbol a platform uses is what the constants already decide. |
|
|
945
1015
|
| `FormErrorSummary` | The error list at the top of a failed form (WCAG 3.3.1, the GOV.UK pattern): takes focus when errors appear, each message is a link that focuses the offending control by its `FormField` id. Renders nothing while `errors` is empty. |
|
|
946
1016
|
| `TagInput` | Multi-value field — chosen values as removable chips, typing filters the option list in the same dropdown SearchableSelect uses. `allowFreeText` admits unlisted entries; Backspace in the empty input removes the last chip. The value array stays duplicate-free by construction. |
|
|
947
1017
|
| `DatePicker`, `TimePicker`, `DateTimePicker`, `DateRangePicker` | Date/time fields, all careful to speak LOCAL dates and wall-clock times (never `toISOString`). `TimePicker` and `DateTimePicker` wrap the platform's own inputs in the kit's field styling; `TimePicker` hands back an `HH:MM` string — a time of day names no calendar day, so it never invents a Date. **`DatePicker`** opens the kit's `Calendar` in a popover (`native` swaps in the platform's date input). Its value posts from a hidden input that takes `name` and `form`; `required` adds "Required" to the trigger's description (`datePicker.required`; a button may not carry `aria-required`) and drops Clear from the footer (`clearable` overrides either way); `invalid` paints the field, and the reader hears the error message the host links through `aria-describedby` (`FormField` does) — the trigger carries no `aria-invalid`, which a button may not either; Today is offered only when `min`/`max` allow today; `aria-*`, `data-*`, `title`, `tabIndex`, `autoFocus`, `onFocus` and `onBlur` reach the trigger, while what only a text box can use (`readOnly`, `pattern`, `autoComplete`…) applies with `native` alone. Named by a `<label htmlFor={id}>` or `aria-labelledby`, the trigger is described by the date spelled out. A browser never validates a hidden input, so `required` cannot block a submit in the popover. **`DateRangePicker`** is a from/to calendar with presets in one popover: side by side on a desktop; where that does not fit the room the box allows (a phone, a narrow shell window — measured, not a media query), the panel takes the full width between the margins and stacks, the presets a wrapping row of chips above the calendar and From/To one line each. `fullWidth` fills a filter-grid cell instead of shrink-wrapping its label. `id` (on the trigger button, for `<label htmlFor>`), `aria-labelledby` and `aria-label` name the trigger, and the chosen range is then its description ("Period, button, 1 August 2026 to 3 October 2026"). `name={{ from, to }}` posts the applied range as two hidden `YYYY-MM-DD` inputs (`''` when unset), so a GET form or a server action reads it as it read two date inputs. `required` adds "Required" to the trigger's description (`dateRange.required`) and, unless `clearable` is given, removes Clear. `min` / `max` (`YYYY-MM-DD`) bound it as they bound `DatePicker`: days outside are disabled, a preset whose range reaches outside is not offered (none at all on a range that starts today — time off, a booking — and then no Custom either), and with nothing chosen the panel opens on the first month that has a day to pick. Both pickers take `weekStartsOn` (0 Sunday, 1 Monday); without it the week starts where the provider's `locale` says. |
|
|
948
|
-
| `Card`, `StatCard` | Surface panel (optional header/footer) + dashboard metric tile. |
|
|
1018
|
+
| `Card`, `StatCard` | Surface panel (optional header/footer; `description` puts one sentence under the title, outside the heading) + dashboard metric tile. |
|
|
949
1019
|
| `Avatar`, `AvatarGroup` | User avatar with initials fallback + status dot; overlapping stack with +N overflow. |
|
|
950
1020
|
| `Banner` | Static in-flow alert (`tone`: info / success / warning / danger). `action` renders a control at the right edge — after the text, so a screen reader reaches the problem before the remedy, and before the dismiss ×, so "Update card" is never past "close this". Vertically centred against the words and `shrink-0`, so a message that wraps does not drag the button down or squeeze it — and on a narrow banner (a phone, a narrow column: the words keep at least 12rem) it drops UNDER the words rather than leave them a column one word wide. A banner that names a condition and leaves the fix three menus away is the usual shape of a notice nobody acts on. |
|
|
951
1021
|
| `Tabs`, `Accordion`, `Tooltip` | Controlled tab strip, collapsible sections, frosted hover/focus tooltip. A tooltip's `side` is a preference: near an edge the bubble slides along that side to stay 8 px clear of it, and flips to the opposite side when its own has no room, keeping inside the screen and inside the shell window that owns its trigger (UI-11). It never leaves that box: a bubble wider than the room wraps, and one taller than the room is cut off at it. The bubble is drawn on `<body>`, in a `fixed` layer laid over its trigger, so a scrolling pane or an `overflow-hidden` box around the trigger cannot cut it off; it follows the trigger when that moves and closes once the trigger has scrolled out of sight. A small arrow on the edge facing the trigger points at the trigger's centre wherever the bubble ended up, kept clear of the bubble's corners; it is the bubble's own surface (`.rosh-tooltip-arrow` in `ui.css`), solid and seamless under `rosh-reduce-transparency`, and hidden from assistive technology. |
|
|
@@ -1508,6 +1578,32 @@ are a person's own choice, so they win over the host's theme, the way a chosen
|
|
|
1508
1578
|
colour theme does. Do not write literal radii (an arbitrary-value radius class,
|
|
1509
1579
|
an inline `borderRadius`): they are the one thing the setting cannot reach.
|
|
1510
1580
|
|
|
1581
|
+
**Spacing and control height.** Every margin, padding and gap is one of ten
|
|
1582
|
+
steps: 2, 4, 8, 12, 16, 20, 24, 32, 40, 48 px — multiples of 4, with 2 kept for
|
|
1583
|
+
hairline gaps. Each lands on a Tailwind utility (`p-0.5` … `p-12`), so markup
|
|
1584
|
+
keeps writing utilities; `p-1.5` (6px) and `p-2.5` (10px) are off the scale.
|
|
1585
|
+
`ui.css` declares the steps as `--space-2` … `--space-48`, and a role per
|
|
1586
|
+
common use, so a value a utility cannot reach still comes from one place:
|
|
1587
|
+
|
|
1588
|
+
| Token | Step | Used for |
|
|
1589
|
+
|---|---|---|
|
|
1590
|
+
| `--space-icon-gap` / `--space-icon-gap-sm` | 8 / 4 | an icon to its word; inside something small |
|
|
1591
|
+
| `--space-control-x-sm` / `--space-control-x` / `--space-control-x-lg` | 8 / 12 / 16 | a control's side padding |
|
|
1592
|
+
| `--space-cell-x` | 12 | a table cell's side padding |
|
|
1593
|
+
| `--space-label` | 4 | a label to its field |
|
|
1594
|
+
| `--space-toolbar` | 8 | between toolbar buttons |
|
|
1595
|
+
| `--space-form-row` | 12 | between form rows |
|
|
1596
|
+
| `--space-card` | 16 | inside a card |
|
|
1597
|
+
| `--space-block` | 16 | between a page's big blocks |
|
|
1598
|
+
| `--space-gutter` | 16 | a page's side gutter |
|
|
1599
|
+
| `--space-panel-group` … `--space-panel-setting` | 2 / 4 / 8 / 12 / 16 (12 narrow) / 32 | an editor panel: one group, a sub-name, a setting's layers, rows, padding, between settings |
|
|
1600
|
+
|
|
1601
|
+
Buttons, fields, selects, segmented controls, filter chips and sidebar and menu
|
|
1602
|
+
rows take their height from `--control-height-sm` / `-md` / `-lg` (24 / 32 /
|
|
1603
|
+
40), not from top and bottom padding. Code takes the same numbers from
|
|
1604
|
+
`efficient-shell/ui`: `SPACING_SCALE`, `SPACING_ROLES`, `CONTROL_HEIGHTS`, and
|
|
1605
|
+
`isSpacingStep('2.5')` for a Tailwind step.
|
|
1606
|
+
|
|
1511
1607
|
**Glass.** Menus, popups, listboxes and tooltips are frosted glass
|
|
1512
1608
|
(`glassStyle()`). `--menu-opacity` (0–1, default `0.95`) sets how much shows
|
|
1513
1609
|
through. `rosh-reduce-transparency` on `<html>` makes every popup one solid
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-6GV4467L.js";import{WindowTitle as r}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-4QBLTEFU.js";import"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import{confirm as a}from"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{ChevronLeftFallback as n,ChevronRightFallback as l,RefreshFallback as s,HomeFallback as i,StarFallback as c,ExternalFallback as m,HelpFallback as d,NoSymbolFallback as u}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{Icon as h}from"./chunk-YKZHOXI4.js";import{useRef as p,useEffect as b,useState as g}from"react";import{jsxs as f,jsx as k,Fragment as x}from"react/jsx-runtime";var w="react-os-shell:browser-bookmarks",y="react-os-shell:browser-homepage",v="https://en.wikipedia.org/wiki/Main_Page",N=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],j=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function C(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&j.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var z=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function S(){if("undefined"==typeof window)return N;try{const e=localStorage.getItem(w);if(!e)return N;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return N}function W(){return"undefined"==typeof window?v:localStorage.getItem(y)||v}function H(){const u=p(void 0);void 0===u.current&&(u.current=e()),b(()=>{null!=u.current&&t(u.current)},[]);const x=u.current?C(u.current.url):"",[v,N]=g(W),[j,z]=g(x||v),[H,E]=g(j),[T,D]=g([j]),[O,A]=g(0),[I,F]=g(0),[J,U]=g(S),[B,P]=g(!1),[X,G]=g(null),M=p(null),Q=p(null);b(()=>{try{localStorage.setItem(w,JSON.stringify(J))}catch{}},[J]);const q=e=>{const t=C(e);t&&(z(t),E(t),D(e=>{const o=e.slice(0,O+1);return o.push(t),o}),A(e=>e+1),P(!1))},$=()=>{"undefined"!=typeof window&&window.open(j,"_blank","noopener,noreferrer")},K=()=>{const e=X?.trim();e?(U(t=>[...t,{label:e,url:j}]),G(null)):G(null)};b(()=>{if(null===X)return;M.current?.focus(),M.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||G(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==X]);const Y=e=>{U(t=>t.filter((t,o)=>o!==e))},Z=O>0,_=O<T.length-1,V=J.some(e=>e.url===j),ee="p-1.5 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return f("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
|
-
/* @__PURE__ */k(r,{title:`Browser - ${
|
|
3
|
+
/* @__PURE__ */k(r,{title:`Browser - ${L(j)}`}),
|
|
4
4
|
/* @__PURE__ */k(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */k("button",{onClick:()=>{if(
|
|
7
|
-
/* @__PURE__ */k("button",{onClick:()=>{if(
|
|
8
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */k("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */k("button",{onClick:()=>{if(O>0){const e=O-1;A(e),z(T[e]),E(T[e]),P(!1)}},disabled:!Z,className:ee,title:"Back",children:/* @__PURE__ */k(h,{name:"chevron-left",fallback:n,className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */k("button",{onClick:()=>{if(O<T.length-1){const e=O+1;A(e),z(T[e]),E(T[e]),P(!1)}},disabled:!_,className:ee,title:"Forward",children:/* @__PURE__ */k(h,{name:"chevron-right",fallback:l,className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */k("button",{onClick:()=>F(e=>e+1),className:ee,title:"Refresh",children:/* @__PURE__ */k(h,{name:"refresh",fallback:s,className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */k("button",{onClick:()=>q(v),className:ee,title:"Home",children:/* @__PURE__ */k(h,{name:"home",fallback:i,className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */k("form",{onSubmit:e=>{e.preventDefault(),q(H)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */f("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */k("span",{className:"px-2 text-gray-400 text-xs",children:j.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
|
-
/* @__PURE__ */k("input",{type:"text",value:
|
|
13
|
-
/* @__PURE__ */k("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */k("button",{onClick
|
|
15
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
12
|
+
/* @__PURE__ */k("input",{type:"text",value:H,onChange:e=>E(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),j!==H&&/* @__PURE__ */k("button",{type:"button",onClick:()=>E(j),className:"px-1.5 text-[10px] text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
+
/* @__PURE__ */k("button",{"data-bookmark-popover":!0,onClick:()=>V?Y(J.findIndex(e=>e.url===j)):void G(L(j)),className:ee+" "+(V?"text-yellow-500":""),title:V?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */k(h,{name:"star",fallback:c,className:"h-4 w-4",fill:V?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */k("button",{onClick:$,className:ee,title:"Open in new tab",children:/* @__PURE__ */k(h,{name:"external",fallback:m,className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */k("button",{onClick:()=>P(e=>!e),className:ee,title:"Embedding help",children:/* @__PURE__ */k(h,{name:"help",fallback:d,className:"h-4 w-4",strokeWidth:1.5})})]}),null!==X&&/* @__PURE__ */f("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */k("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */k("div",{className:"text-[11px] text-gray-400 truncate mb-2 font-mono",title:j,children:j}),
|
|
18
|
-
/* @__PURE__ */k("input",{ref:
|
|
18
|
+
/* @__PURE__ */k("input",{ref:M,type:"text",value:X,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key?K():"Escape"===e.key&&G(null)},placeholder:"Name",className:"w-full text-sm px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */f("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
|
-
/* @__PURE__ */k("button",{onClick:()=>
|
|
21
|
-
/* @__PURE__ */k("button",{onClick:
|
|
22
|
-
/* @__PURE__ */f("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
20
|
+
/* @__PURE__ */k("button",{onClick:()=>G(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
+
/* @__PURE__ */k("button",{onClick:K,disabled:!X.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */f("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===J.length&&/* @__PURE__ */k("span",{className:"text-[11px] text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),J.map((e,t)=>/* @__PURE__ */f("button",{onClick:()=>q(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"})&&Y(t)},className:"flex items-center gap-1.5 px-2 py-0.5 rounded text-[12px] text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */k("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */k("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */k("button",{onClick:()=>{N(j);try{localStorage.setItem(y,j)}catch{}},className:"px-2 py-0.5 text-[11px] text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */k("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */k(
|
|
26
|
+
/* @__PURE__ */k("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */k(R,{url:j,iframeKey:I,iframeRef:Q,openExternal:$,showHelp:B,dismissHelp:()=>P(!1)})})]})}function L(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function R({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:n}){const[l,s]=g(!1);b(()=>{s(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return z.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!l?/* @__PURE__ */k("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */f("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */k(h,{name:"no-symbol",fallback:u,className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
|
-
/* @__PURE__ */f("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[
|
|
28
|
+
/* @__PURE__ */f("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[L(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */f("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
30
30
|
/* @__PURE__ */k("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
|
|
31
31
|
/* @__PURE__ */k("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
|
|
@@ -40,4 +40,4 @@ return f("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
|
40
40
|
/* @__PURE__ */f("p",{children:["Hit the ",
|
|
41
41
|
/* @__PURE__ */k("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
|
|
42
42
|
/* @__PURE__ */k("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
|
|
43
|
-
/* @__PURE__ */k("button",{onClick:n,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{
|
|
43
|
+
/* @__PURE__ */k("button",{onClick:n,className:"mt-2 text-[11px] text-blue-600 hover:underline",children:"Got it"})]})]})}export{H as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-BFFXVA53.js";import{useWidgetSettings as n}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{CheckFallbackB as l,CopyFallbackB as r}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{Icon as c}from"./chunk-YKZHOXI4.js";import{useState as a,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as u,Fragment as d,jsx as h}from"react/jsx-runtime";var m="calc_appearance";function b(){const[b,k]=a("0"),[p,g]=a(null),[f,y]=a(null),[x,N]=a(!1),[v,C]=a(""),[$,j]=a([]),[w,S]=a(!1),[A,E]=a(()=>e(m)),[T,F]=a(!1),[H,B]=a(A),J=i(null);n(o(()=>{B({...A}),F(!0)},[A]));const O=o(e=>{C(""),k(t=>x||"0"===t?(N(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[x]),W=o(()=>{k("0"),g(null),y(null),N(!1)},[]),X=o((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),D=o(e=>{const t=parseFloat(b);if(null!==p&&f&&!x){const e=X(p,t,f);k(String(e)),g(e),j(n=>[`${p} ${f} ${t} = ${e}`,...n].slice(0,20))}else g(t);y(e),N(!0)},[b,p,f,x,X]),I=o(()=>{if(null===p||!f)return;const e=parseFloat(b),t=X(p,e,f),n=`${p} ${f} ${e} =`;j(e=>[`${n} ${t}`,...e].slice(0,20)),C(n),k(String(t)),g(null),y(null),N(!0)},[b,p,f,X]),L=o(()=>{k(e=>String(parseFloat(e)/100))},[]),Q=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"?O(e.key):"."===e.key?O("."):"+"===e.key?D("+"):"-"===e.key?D("-"):"*"===e.key?D("×"):"/"===e.key?(e.preventDefault(),D("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&J.current?.contains(e.target)&&e.preventDefault(),I()):"Escape"===e.key?W():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&L())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[O,D,I,W,L]);const M="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",P=`${M} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,R=`${M} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,Z=`${M} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,G=`${M} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return u(d,{children:[
|
|
3
|
+
/* @__PURE__ */u("div",{ref:J,className:"flex flex-col h-full",style:{opacity:A.activeOpacity/100,backdropFilter:A.activeBlur>0?`blur(${A.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */u("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
|
|
5
|
+
/* @__PURE__ */h("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:$.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */h("div",{className:"text-[11px] text-slate-400 text-right font-mono truncate",children:e},t))}),(v||f&&null!==p)&&/* @__PURE__ */h("div",{className:"text-base text-slate-600 text-right font-mono",children:v||`${p} ${f} ${x?"":b}`}),
|
|
6
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */h("button",{onClick:()=>{navigator.clipboard.writeText(b),S(!0),setTimeout(()=>S(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */h(c,w?{name:"check",fallback:l,className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",fallback:r,className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */h("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(b)})]})]}),
|
|
9
|
+
/* @__PURE__ */u("div",{className:"grid grid-cols-4 grid-rows-5 gap-1.5 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */h("button",{onClick:W,className:Z,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */h("button",{onClick:Q,className:Z,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */h("button",{onClick:L,className:Z,children:"%"}),
|
|
13
|
+
/* @__PURE__ */h("button",{onClick:()=>D("÷"),className:`${R} ${"÷"===f?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */h("button",{onClick:()=>O("7"),className:P,children:"7"}),
|
|
15
|
+
/* @__PURE__ */h("button",{onClick:()=>O("8"),className:P,children:"8"}),
|
|
16
|
+
/* @__PURE__ */h("button",{onClick:()=>O("9"),className:P,children:"9"}),
|
|
17
|
+
/* @__PURE__ */h("button",{onClick:()=>D("×"),className:`${R} ${"×"===f?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */h("button",{onClick:()=>O("4"),className:P,children:"4"}),
|
|
19
|
+
/* @__PURE__ */h("button",{onClick:()=>O("5"),className:P,children:"5"}),
|
|
20
|
+
/* @__PURE__ */h("button",{onClick:()=>O("6"),className:P,children:"6"}),
|
|
21
|
+
/* @__PURE__ */h("button",{onClick:()=>D("-"),className:`${R} ${"-"===f?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */h("button",{onClick:()=>O("1"),className:P,children:"1"}),
|
|
23
|
+
/* @__PURE__ */h("button",{onClick:()=>O("2"),className:P,children:"2"}),
|
|
24
|
+
/* @__PURE__ */h("button",{onClick:()=>O("3"),className:P,children:"3"}),
|
|
25
|
+
/* @__PURE__ */h("button",{onClick:()=>D("+"),className:`${R} ${"+"===f?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */h("button",{onClick:()=>O("0"),className:`${P} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */h("button",{onClick:()=>O("."),className:P,children:"."}),
|
|
28
|
+
/* @__PURE__ */h("button",{onClick:I,className:G,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */h(t,{open:T,onClose:()=>F(!1),title:"Calculator Settings",appearance:H,onAppearanceChange:B,onSave:()=>{E(H),localStorage.setItem(m,JSON.stringify(H)),F(!1)}})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ConfirmProvider,confirm,confirmDestructive,prompt,useConfirm}from"./chunk-MTH7EAH3.js";import"./chunk-AFYQTVZO.js";import"./chunk-X4FJ54PP.js";import"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.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-BFFXVA53.js";import{useWidgetSettings as r}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-MTH7EAH3.js";import"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as n,useCallback as a,useEffect as s}from"react";import{jsxs as c,Fragment as o,jsx as i}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],m=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],u="currency_pairs",p="currency_appearance",d="currency_rates_cache";function h(e){try{const t=JSON.parse(localStorage.getItem(d)||"{}")[e];if(t&&Date.now()-t.timestamp<36e5)return t.rates}catch{}return null}function g(e,t){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[e]={rates:t,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function x(){try{const e=JSON.parse(localStorage.getItem(u)||"");if(Array.isArray(e)&&e.length)return e.slice(0,4)}catch{}return m}var y={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[m,d]=n(x),[f,N]=n(()=>e(p)),[b,S]=n({}),[v,k]=n(!1),[D,j]=n(!1),[C,A]=n([]),[J,H]=n(f),[B,O]=n("USD"),[U,I]=n("CNY");r(a(()=>{A([...m]),H({...f}),j(!0)},[m,f])),s(()=>{const e=[...new Set(m.map(([e])=>e))];let t=!0;return async function(){k(!0);const r={};for(const t of e){const e=h(t);if(e)r[t]=e;else try{const e=await fetch(`https://open.er-api.com/v6/latest/${t}`),n=await e.json();n.rates&&(r[t]=n.rates,g(t,n.rates))}catch{}}t&&(S(r),k(!1))}(),()=>{t=!1}},[m]);/* @__PURE__ */
|
|
2
2
|
return c(o,{children:[
|
|
3
|
-
/* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[
|
|
3
|
+
/* @__PURE__ */i("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[v&&/* @__PURE__ */i("div",{className:"text-xs text-gray-400 text-center py-4",children:"Loading rates..."}),m.map(([e,t],r)=>{const n=b[e]?.[t];/* @__PURE__ */
|
|
4
4
|
return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),localStorage.setItem(u,JSON.stringify(e))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1.5",children:[
|
|
6
6
|
/* @__PURE__ */i("span",{className:"text-base",children:y[e]||""}),
|
|
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const e=m.map((e,t)=>t===r?[e[1],e[0]]:e);d(e),l
|
|
|
9
9
|
/* @__PURE__ */i("span",{className:"text-base",children:y[t]||""}),
|
|
10
10
|
/* @__PURE__ */i("span",{className:"text-sm font-semibold text-gray-700",children:t})]}),
|
|
11
11
|
/* @__PURE__ */i("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${e}-${t}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */i(t,{open:D,onClose:()=>j(!1),title:"Currency Settings",appearance:
|
|
12
|
+
/* @__PURE__ */i(t,{open:D,onClose:()=>j(!1),title:"Currency Settings",appearance:J,onAppearanceChange:H,onSave:()=>{if(0===C.length)return;const e=C.slice(0,4);d(e),N(J),localStorage.setItem(u,JSON.stringify(e)),localStorage.setItem(p,JSON.stringify(J)),j(!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
14
|
/* @__PURE__ */c("span",{className:"text-[11px] font-normal text-gray-400",children:["(",C.length,"/",4,")"]})]}),
|
|
15
15
|
/* @__PURE__ */i("div",{className:"space-y-1 mb-2",children:C.map(([e,t],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */c("span",{className:"text-sm",children:[y[e]||""," ",e," → ",y[t]||""," ",t]}),
|
|
17
|
-
/* @__PURE__ */i("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */i("select",{value:
|
|
17
|
+
/* @__PURE__ */i("button",{onClick:()=>A(e=>e.filter((e,t)=>t!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),C.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */i("select",{value:B,onChange:e=>O(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
19
19
|
/* @__PURE__ */i("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */i("select",{value:
|
|
21
|
-
/* @__PURE__ */i("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */i("select",{value:U,onChange:e=>I(e.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(e=>/* @__PURE__ */i("option",{children:e},e))}),
|
|
21
|
+
/* @__PURE__ */i("button",{onClick:()=>{B!==U&&C.length<4&&A(e=>[...e,[B,U]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-[11px] text-gray-400 italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-6GV4467L.js";import{WindowTitle as n}from"./chunk-TLTFS2D6.js";import"./chunk-DSSLOQDW.js";import"./chunk-UAJQB45Y.js";import"./chunk-4QBLTEFU.js";import{toast_default as r}from"./chunk-TKFAFZRY.js";import"./chunk-SSBOC52S.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-MTH7EAH3.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-HIAHERCD.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import{FolderOpenFallback as s,ImageFallback as c}from"./chunk-JJIPGAXI.js";import"./chunk-AJB5G52B.js";import"./chunk-C3QOHMR6.js";import{Icon as d}from"./chunk-YKZHOXI4.js";import{useState as m,useRef as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";var g=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),x=/* @__PURE__ */new Set(["docx"]),f={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function y(){const[y,v]=m(f),[b,k]=m(!1),[w,N]=m(!1),[j,C]=m(!1),[D,L]=m(null),M=h(null),U=h(null),R=h(null),T=(e,t)=>{R.current?.focus(),document.execCommand(e,!1,t),C(!0)},A=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)),C(!0)},e.readAsDataURL(t)}},B=e=>{D&&(D.el.removeAttribute("width"),D.el.removeAttribute("height"),D.el.style.width=e??"",D.el.style.height=e?"auto":"",C(!0),L(null))},O=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();k(!0);try{if(g.has(n)||!x.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");v({filename:t.name,kind:"text",content:o,ext:n}),C(!1)}else if(x.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});v({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),C(!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{k(!1)}},
|
|
4
|
-
return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),w||N(!0)},onDragLeave:e=>{e.currentTarget===e.target&&N(!1)},onDrop:e=>{e.preventDefault(),N(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?
|
|
5
|
-
/* @__PURE__ */p(n,{title:`${
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});v({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),C(!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{k(!1)}},S=y?.filename?(W=y.filename).length>24?`${W.slice(0,23)}…`:W:"Untitled";var W;/* @__PURE__ */
|
|
4
|
+
return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),w||N(!0)},onDragLeave:e=>{e.currentTarget===e.target&&N(!1)},onDrop:e=>{e.preventDefault(),N(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?A(t):O(t[0]))},children:[
|
|
5
|
+
/* @__PURE__ */p(n,{title:`${S}${j?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */p(t,{app:"documents"}),
|
|
7
7
|
/* @__PURE__ */u("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
8
8
|
/* @__PURE__ */p("input",{ref:M,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&&O(t),M.current&&(M.current.value="")},className:"hidden"}),
|
|
9
9
|
/* @__PURE__ */u("button",{onClick:()=>M.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
10
10
|
/* @__PURE__ */p(d,{name:"folder-open",fallback:s,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
|
-
/* @__PURE__ */p("button",{onClick:()=>{if(!y)return;const t=
|
|
11
|
+
/* @__PURE__ */p("button",{onClick:()=>{if(!y)return;const t=R.current?.innerHTML??"";if("text"===y.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=R.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=y.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(y.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${y.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
12
12
|
/* @__PURE__ */p("span",{className:"text-[10px] text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
|
|
13
13
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
14
|
/* @__PURE__ */u("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:y.filename,children:[y.filename,j?" •":""]}),
|
|
15
15
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
16
16
|
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
|
|
17
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
18
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
19
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
20
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
17
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
|
|
18
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
|
|
19
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
|
|
20
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
|
|
21
21
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
22
|
-
/* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{
|
|
22
|
+
/* @__PURE__ */u("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{T("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
|
|
23
23
|
/* @__PURE__ */p("option",{value:"",disabled:!0,children:"Size"}),
|
|
24
24
|
/* @__PURE__ */p("option",{value:"1",children:"XS"}),
|
|
25
25
|
/* @__PURE__ */p("option",{value:"2",children:"S"}),
|
|
@@ -27,26 +27,26 @@ return u("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
27
27
|
/* @__PURE__ */p("option",{value:"4",children:"L"}),
|
|
28
28
|
/* @__PURE__ */p("option",{value:"5",children:"XL"}),
|
|
29
29
|
/* @__PURE__ */p("option",{value:"6",children:"2XL"})]}),
|
|
30
|
-
/* @__PURE__ */p("input",{type:"color",defaultValue:"#000000",onChange:e=>
|
|
30
|
+
/* @__PURE__ */p("input",{type:"color",defaultValue:"#000000",onChange:e=>T("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
|
|
31
31
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
32
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
33
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
32
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
|
|
33
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
|
|
34
34
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
35
35
|
/* @__PURE__ */u("div",{className:"flex items-center gap-0.5",children:[
|
|
36
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
37
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
38
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
39
|
-
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
36
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
|
|
37
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
|
|
38
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
|
+
/* @__PURE__ */p("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>T("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */p("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */p("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
40
|
/* @__PURE__ */p("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */p("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&
|
|
41
|
+
/* @__PURE__ */p("input",{ref:U,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&A(Array.from(e.target.files)),U.current&&(U.current.value="")}}),
|
|
42
42
|
/* @__PURE__ */u("button",{onClick:()=>U.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
|
|
43
43
|
/* @__PURE__ */p(d,{name:"image",fallback:c,className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
-
/* @__PURE__ */p("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */p("div",b?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===y.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */p("div",{ref:
|
|
44
|
+
/* @__PURE__ */p("div",{className:"flex-1 min-h-0 overflow-hidden",children:/* @__PURE__ */p("div",b?{className:"flex items-center justify-center h-full text-sm text-gray-400",children:"Loading…"}:{className:"h-full overflow-auto "+("docx"===y.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */p("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>C(!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(),A(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),L({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:y.content},className:"docx"===y.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-[14px] leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-[13px] leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),w&&/* @__PURE__ */p("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */p("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),D&&/* @__PURE__ */u(o,{minWidth:150,style:{left:D.x,top:D.y},onClose:()=>L(null),children:[
|
|
45
45
|
/* @__PURE__ */p(l,{children:"Image width"}),
|
|
46
|
-
/* @__PURE__ */p(a,{onClick:()=>
|
|
47
|
-
/* @__PURE__ */p(a,{onClick:()=>
|
|
48
|
-
/* @__PURE__ */p(a,{onClick:()=>
|
|
49
|
-
/* @__PURE__ */p(a,{onClick:()=>
|
|
50
|
-
/* @__PURE__ */p(a,{onClick:()=>
|
|
46
|
+
/* @__PURE__ */p(a,{onClick:()=>B("25%"),children:"25%"}),
|
|
47
|
+
/* @__PURE__ */p(a,{onClick:()=>B("50%"),children:"50%"}),
|
|
48
|
+
/* @__PURE__ */p(a,{onClick:()=>B("75%"),children:"75%"}),
|
|
49
|
+
/* @__PURE__ */p(a,{onClick:()=>B("100%"),children:"100%"}),
|
|
50
|
+
/* @__PURE__ */p(a,{onClick:()=>B(null),children:"Original size"}),
|
|
51
51
|
/* @__PURE__ */p(i,{}),
|
|
52
52
|
/* @__PURE__ */p(a,{danger:!0,onClick:()=>{D?.el.remove(),C(!0),L(null)},children:"Remove image"})]})]})}export{y as default};
|