efficient-shell 12.17.0 → 12.18.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 +14 -7
- package/dist/{Browser-OAMMQWCR.js → Browser-U6V2IAOZ.js} +11 -11
- package/dist/{Files-6ZCDCTDZ.js → Files-V67UDEO6.js} +44 -44
- package/dist/{Notepad-QJFTXGMP.js → Notepad-F3Z4ZFVY.js} +8 -8
- package/dist/{Preview-2FQMXNSY.js → Preview-HSW3BKA5.js} +25 -25
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-35MQCHVD.js → chunk-35CKKH2S.js} +1 -1
- package/dist/chunk-3PSLQJWR.js +1 -0
- package/dist/{chunk-UWLGKMH5.js → chunk-4KXATGI3.js} +6 -6
- package/dist/{chunk-JQWZ36JD.js → chunk-4PIQG2ZK.js} +1 -1
- package/dist/{chunk-OGL2GV37.js → chunk-DQMRPTGY.js} +1 -1
- package/dist/chunk-EFKJLUYP.js +2 -0
- package/dist/chunk-GCTJIZTJ.js +2 -0
- package/dist/{chunk-G3E4CD77.js → chunk-GJLN4NRB.js} +6 -6
- package/dist/{chunk-QAS22BIS.js → chunk-HNIIDDLJ.js} +1 -1
- package/dist/{chunk-TW7SWDKZ.js → chunk-I5EVMLPB.js} +4 -4
- package/dist/chunk-I76W4ZNU.js +6 -0
- package/dist/{chunk-VPXAOSVH.js → chunk-PZSVISYY.js} +12 -12
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/PictureTiles.js +1 -1
- package/dist/forms/Segmented.js +1 -1
- package/dist/forms/Slider.d.ts +5 -4
- package/dist/forms/Slider.js +1 -1
- package/dist/index.js +97 -97
- package/dist/shell/Tabs.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-24JKQX2N.js +0 -4
- package/dist/chunk-JDQGHQ2C.js +0 -2
- package/dist/chunk-LSF43AEU.js +0 -1
- package/dist/chunk-WCCGKDG6.js +0 -2
package/README.md
CHANGED
|
@@ -987,10 +987,17 @@ range alone.
|
|
|
987
987
|
The typed box is as wide as what the slider can show, and no wider: the
|
|
988
988
|
widest of its `min` and `max` with the step's decimals, the number it holds
|
|
989
989
|
(a typed one may go past the range), and its `emptyLabel` or
|
|
990
|
-
`placeholderValue`, plus the unit.
|
|
991
|
-
own font, so
|
|
992
|
-
|
|
993
|
-
|
|
990
|
+
`placeholderValue`, plus the unit. Each of those texts is measured in the
|
|
991
|
+
field's own font, so the width follows the font the machine has and a word is
|
|
992
|
+
measured as a word ("Auto", or a translation of it), not counted in digits; the
|
|
993
|
+
box's borders and padding are read from the field. Both are read again when the
|
|
994
|
+
field's box changes, so a field drawn before the stylesheet arrived, or in a
|
|
995
|
+
hidden panel, is sized once it is laid out. Until then the width is counted in
|
|
996
|
+
`ch` at the field's text size for its `boxSize`. A 0–1 slider gets a narrow
|
|
997
|
+
box, 0–10000 still fits, "100" never shows as "10" and "Auto" never shows as
|
|
998
|
+
"Aut". The box never pushes its row out of the slot: the range gives way down
|
|
999
|
+
to 64px, and only then does the box stop growing. A text wider than the room
|
|
1000
|
+
left (a long word in a narrow panel) shows whole in the box's `Tooltip`.
|
|
994
1001
|
|
|
995
1002
|
`SliderGroup` lines a stack of sliders up: wrap the rows of one settings
|
|
996
1003
|
group in it, and every box takes the widest width any of them needs, so
|
|
@@ -1705,9 +1712,9 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1705
1712
|
| `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. |
|
|
1706
1713
|
| `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. |
|
|
1707
1714
|
| `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. |
|
|
1708
|
-
| `Segmented` | A row of mutually exclusive options, all visible: a button group, or with `name` a real radio group that submits. It looks exactly like `Tabs variant="pill"`: the chosen option is solid blue with white text on the grey track, the others grey text. Both draw through one shared strip, so they cannot drift apart; only the roles differ (a value here, a tab panel there). `size` is `sm` / `md` / `lg` (24 / 32 / 40, the control-height ladder) or `touch` (56, as `Button size="touch"`). Icon-only: give the option its `icon` and its word as a visually hidden label (`sr-only`); the word names it and the icon is hidden from screen readers. 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. |
|
|
1715
|
+
| `Segmented` | A row of mutually exclusive options, all visible: a button group, or with `name` a real radio group that submits. It looks exactly like `Tabs variant="pill"`: the chosen option is solid blue with white text on the grey track, the others grey text. Both draw through one shared strip, so they cannot drift apart; only the roles differ (a value here, a tab panel there). `size` is `sm` / `md` / `lg` (24 / 32 / 40, the control-height ladder) or `touch` (56, as `Button size="touch"`). Icon-only: give the option its `icon` and its word as a visually hidden label (`sr-only`); the word names it and the icon is hidden from screen readers. A word is never cut and never broken inside itself, at any width and with no script measuring: with `block` every option is an equal share while the words fit; an option of several words wider than its share wraps at its spaces and grows (the size is a minimum height, so a one-line option keeps 24 / 32 / 40, with or without an icon up to that height); a single word wider than its share sends the options that do not fit to a second row of the track. Without `block` the track wraps first: a whole option moves to the second row before a label wraps. The track never scrolls. 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. |
|
|
1709
1716
|
| `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). |
|
|
1710
|
-
| `PictureTiles` | Pick one of a few choices by its PICTURE: a grid of small tiles, each a toggle button (`aria-pressed`) holding the caller's drawing of what the choice makes (a wall layout, how a row's blocks share its width, what a header button will look like). `options` (`{ value, label, picture, disabled? }`), `value`, `onChange(value)`. `columns` fixes the tiles in a row (without it, as many 58px tiles as fit). `captions` writes each name under its picture, wrapping a long name onto a second line
|
|
1717
|
+
| `PictureTiles` | Pick one of a few choices by its PICTURE: a grid of small tiles, each a toggle button (`aria-pressed`) holding the caller's drawing of what the choice makes (a wall layout, how a row's blocks share its width, what a header button will look like). `options` (`{ value, label, picture, disabled? }`), `value`, `onChange(value)`. `columns` fixes the tiles in a row (without it, as many 58px tiles as fit). `captions` writes each name under its picture, wrapping a long name at its spaces onto a second line, never cutting it and never breaking a word inside itself; with captions the tiles flow, each its share of the row, and a tile whose longest word needs more than its share moves to the next row; with captions and no `columns` every tile stays 58px (wider only for a longer word) on every row, the last row too; without it the name is the tile's accessible name and its hover label. `onClear` lets a press on the chosen tile clear the choice. The chosen tile wears the accent edge and ring and the accent text colour, so a picture drawn in `currentColor` follows it. Not `Segmented` (a few words in one track) and not `TileButton` (a large catalogue tile). |
|
|
1711
1718
|
| `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. |
|
|
1712
1719
|
| `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. |
|
|
1713
1720
|
| `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. `tone` says what it sits on: `neutral` (default, grey), `accent` (inside a primary or submit button: the `kbd-submit` chip, with no colour utility of its own) or `warning` (an amber button). It renders the string it is handed; which symbol a platform uses is what the constants already decide. |
|
|
@@ -1717,7 +1724,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1717
1724
|
| `Card`, `StatCard` | Surface panel (optional header/footer; `description` puts one sentence under the title, outside the heading; `headingLevel` makes the title a heading and the card a region named by it, and an `aria-label` names the region instead when the title is not the name, such as a count; `tone="warning"` draws the border amber for a card that needs attention, and the card's words still say why; `tone="current"` marks the current card in a list with a light-blue header band, a blue title and `aria-current`) + dashboard metric tile. |
|
|
1718
1725
|
| `Avatar`, `AvatarGroup` | User avatar with initials fallback + status dot; overlapping stack with +N overflow. |
|
|
1719
1726
|
| `Banner` | Static in-flow alert (`tone`: info / success / warning / danger / neutral). `neutral` is a note that is none of the other four ("Prices exclude GST"): grey in the kit's neutral, the same wash and ink as a neutral `StatusBadge` (`--status-neutral-soft` / `--status-neutral-soft-ink`, `--status-neutral-solid` when `emphasis="solid"`), with the info glyph. `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. |
|
|
1720
|
-
| `Tabs`, `Accordion`, `Tooltip` | Controlled tab strip, collapsible sections, solid hover/focus tooltip. `Tabs variant="pill"` draws the same strip as `Segmented` (the active tab solid blue on the grey track); use it when each choice shows its own panel, and `Segmented` when the choice is a value. `block` gives every tab an equal share of the strip's width, in either look (the same word as `Segmented`'s `block`): the editors' settings panel uses it for its two icon-only tabs, Design (`adjust`) and Animation (`animation`), with the `underline` look, so the chosen tab is a blue icon over a blue underline. `labelsFit` shows an icon tab's word beside its icon only while the words fit the strip's parent, measured in the three steps `IconRail`'s `labelsFit` takes (every word, then only the chosen tab's, then icons only); a hidden word still names the tab, and the tab's Tooltip says it. Items with an `href` make the strip in-page links for one scrolling page: the same underline drawn as a `<nav>` of `<a>`, `aria-current="location"` on the section in view, the current item following the scroll through `onChange`, and a click scrolling its `#section` into view and focusing it. A tab's `dot` draws a small mark after its word to say the tab holds a value (the chosen tab's dot is the tab colour, another tab's the accent); `dotLabel` names it for a screen reader (default "Has a setting"). A tab's `tone="warning"` inks it amber while it is not the chosen one, in either mode's underline look. Each `Accordion` title is a heading holding its button, `<h3><button aria-expanded aria-controls>`, the WAI-ARIA accordion pattern; `level` (2–6, default 3) sets the heading under the host's own, and the heading draws nothing of its own. An open item's panel is a region named by its button. `AccordionHeading` is a title in a tier's look that folds nothing (the heading element itself, no button, no box round it), and `AccordionBody` is the band body's side inset with no band above it. 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`), seamless, and hidden from assistive technology. The bubble is SOLID, not glass, in every setting: the kit's solid popup surface (`--rosh-glass-surface`, `--rosh-glass-solid-border`, `--rosh-glass-solid-shadow`), so words behind a small bubble never mix with its own. `open` holds a tooltip open (or shut) whatever the pointer does: for a drag over a place that refuses the drop, when the browser sends no hover. |
|
|
1727
|
+
| `Tabs`, `Accordion`, `Tooltip` | Controlled tab strip, collapsible sections, solid hover/focus tooltip. `Tabs variant="pill"` draws the same strip as `Segmented` (the active tab solid blue on the grey track), so its words wrap the same way and never scroll out of sight; a tab that goes to a second row keeps one tab stop and the arrow keys; use it when each choice shows its own panel, and `Segmented` when the choice is a value. `block` gives every tab an equal share of the strip's width, in either look (the same word as `Segmented`'s `block`): the editors' settings panel uses it for its two icon-only tabs, Design (`adjust`) and Animation (`animation`), with the `underline` look, so the chosen tab is a blue icon over a blue underline. `labelsFit` shows an icon tab's word beside its icon only while the words fit the strip's parent, measured in the three steps `IconRail`'s `labelsFit` takes (every word, then only the chosen tab's, then icons only); a hidden word still names the tab, and the tab's Tooltip says it. Items with an `href` make the strip in-page links for one scrolling page: the same underline drawn as a `<nav>` of `<a>`, `aria-current="location"` on the section in view, the current item following the scroll through `onChange`, and a click scrolling its `#section` into view and focusing it. A tab's `dot` draws a small mark after its word to say the tab holds a value (the chosen tab's dot is the tab colour, another tab's the accent); `dotLabel` names it for a screen reader (default "Has a setting"). A tab's `tone="warning"` inks it amber while it is not the chosen one, in either mode's underline look. Each `Accordion` title is a heading holding its button, `<h3><button aria-expanded aria-controls>`, the WAI-ARIA accordion pattern; `level` (2–6, default 3) sets the heading under the host's own, and the heading draws nothing of its own. An open item's panel is a region named by its button. `AccordionHeading` is a title in a tier's look that folds nothing (the heading element itself, no button, no box round it), and `AccordionBody` is the band body's side inset with no band above it. 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`), seamless, and hidden from assistive technology. The bubble is SOLID, not glass, in every setting: the kit's solid popup surface (`--rosh-glass-surface`, `--rosh-glass-solid-border`, `--rosh-glass-solid-shadow`), so words behind a small bubble never mix with its own. `open` holds a tooltip open (or shut) whatever the pointer does: for a drag over a place that refuses the drop, when the browser sends no hover. |
|
|
1721
1728
|
| `StepChain`, `StepChainItem` | A chain of steps for work in progress — a one-line summary that opens to steps, each with a status glyph (`pending`, `active`, `complete`, `failed`, `stopped`, `waiting`, `skipped`), a label, a one-line `description` and folded detail. Open while `busy`, folded to its summary when the work is done, and a click always wins; `aria-expanded` on the toggle, the summary is a polite live region, the spinner and chevron respect reduced motion. Modelled on the "Chain of Thought" shape of Vercel AI Elements (no code copied). The assistant chat's tool calls and a plan checklist draw with it. |
|
|
1722
1729
|
| `Stepper` | A linear wizard's progress strip — numbered circles, connectors, `aria-current="step"`. Controlled like Tabs; completed steps are clickable to go back (when `onChange` is wired), upcoming steps never are — moving forward belongs to the wizard's own Continue button, behind its validation. |
|
|
1723
1730
|
| `DataTable` | Read-only table for server-driven lists: it renders and reports, and never sorts or pages its own `data`. Controlled sort and pager, row selection, column groups, pinned columns, windowed rendering. `onRow` gives a row `onClick`, a `className`, any `data-*` attributes for its `<tr>` — a test's or a stylesheet's hook (`data-testid`, `data-state`) — the pointer and the keyboard coming in and out (`onMouseEnter` … `onBlur`) and `current`. `rowHref` makes each row one real link (`onRowPress` a button) with its controls still pressable — see [DataTable rows that are links](#datatable-rows-that-are-links). `stackOnNarrow` turns each row into a labelled card on a narrow container — see [DataTable on a narrow screen](#datatable-on-a-narrow-screen). |
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-ZKGUBIBT.js";import"./chunk-QBWMWK2W.js";import"./chunk-W7DYKTHE.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-ZKGUBIBT.js";import"./chunk-QBWMWK2W.js";import"./chunk-W7DYKTHE.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-DQMRPTGY.js";import{WindowTitle as n}from"./chunk-TKPUYQ3Q.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-Y6E7IRK2.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-WLUJQLXG.js";import{confirm as s}from"./chunk-5QYKF7NK.js";import"./chunk-PMBCQWJW.js";import"./chunk-MWTCGJAI.js";import"./chunk-RIG5FEVS.js";import"./chunk-2VFSYSDS.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-WQ4YKWN2.js";import"./chunk-JZBLOIL7.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-3PSLQJWR.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-ZICGXJUB.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as a}from"./chunk-JOAKKXTL.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-JSHMIMAJ.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as l,useState as c}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(p)||k}function v(){const h=i(void 0);void 0===h.current&&(h.current=t()),l(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=c(y),[w,v]=c(k||b),[C,W]=c(w),[R,S]=c([w]),[z,D]=c(0),[L,J]=c(0),[M,T]=c(x),[K,Q]=c(!1),[G,U]=c(null),E=i(null),Y=i(null);l(()=>{try{localStorage.setItem(d,JSON.stringify(M))}catch{}},[M]);const H=e=>{const t=f(e);t&&(v(t),W(t),S(e=>{const o=e.slice(0,z+1);return o.push(t),o}),D(e=>e+1),Q(!1))},A=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},B=()=>{const e=G?.trim();e?(T(t=>[...t,{label:e,url:w}]),U(null)):U(null)};l(()=>{if(null===G)return;E.current?.focus(),E.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!==G]);const I=e=>{T(t=>t.filter((t,o)=>o!==e))},P=z>0,O=z<R.length-1,F=M.some(e=>e.url===w),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */u(n,{title:`Browser - ${N(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(z>0){const e=z-1;
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(z<
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(z>0){const e=z-1;D(e),v(R[e]),W(R[e]),Q(!1)}},disabled:!P,className:X,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(z<R.length-1){const e=z+1;D(e),v(R[e]),W(R[e]),Q(!1)}},disabled:!O,className:X,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>J(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
9
|
/* @__PURE__ */u("button",{onClick:()=>H(b),className:X,title:"Home",children:/* @__PURE__ */u(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
10
|
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),H(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>W(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),w!==C&&
|
|
13
13
|
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>W(w)}})})]})}),
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>F?I(M.findIndex(e=>e.url===w)):void U(N(w)),className:X+" "+(F?"text-yellow-500":""),title:F?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:F?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
15
|
/* @__PURE__ */u("button",{onClick:A,className:X,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>Q(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==G&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:E,type:"text",value:G,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?B():"Escape"===e.key&&U(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:B,disabled:!
|
|
23
|
-
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:B,disabled:!G.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===M.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),M.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>H(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&I(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:L,iframeRef:Y,openExternal:A,showHelp:K,dismissHelp:()=>Q(!1)})})]})}function N(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function j({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[i,d]=c(!1);l(()=>{d(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!i?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
29
|
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[N(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-T3JSUBIF.js";import{SidebarLayout as t}from"./chunk-XG5ER6GJ.js";import"./chunk-QWK6DRSN.js";import"./chunk-OOWPLQD5.js";import{SearchableSelect as n}from"./chunk-25QDSYH5.js";import{Breadcrumbs as a}from"./chunk-JTGRLXZN.js";import{Select_default as r}from"./chunk-VJXPT53M.js";import"./chunk-EO5RLFRX.js";import"./chunk-RAOM3WIQ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-7ARBBWPQ.js";import{Input_default as l}from"./chunk-ZKGUBIBT.js";import{DropdownMenu as o}from"./chunk-QBWMWK2W.js";import"./chunk-W7DYKTHE.js";import{IconButton_default as c}from"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{formatBytes as d}from"./chunk-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as m,subscribeFilesChoice as h,getFilesChoice as u,holdFilesChoice as f,answerFilesChoice as p,choiceTakes as g}from"./chunk-XJW65EIG.js";import{AboutApp as k}from"./chunk-
|
|
2
|
-
return V(
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-T3JSUBIF.js";import{SidebarLayout as t}from"./chunk-XG5ER6GJ.js";import"./chunk-QWK6DRSN.js";import"./chunk-OOWPLQD5.js";import{SearchableSelect as n}from"./chunk-25QDSYH5.js";import{Breadcrumbs as a}from"./chunk-JTGRLXZN.js";import{Select_default as r}from"./chunk-VJXPT53M.js";import"./chunk-EO5RLFRX.js";import"./chunk-RAOM3WIQ.js";import"./chunk-2NMW66P5.js";import{useContextMenu as i,ContextMenu as s}from"./chunk-7ARBBWPQ.js";import{Input_default as l}from"./chunk-ZKGUBIBT.js";import{DropdownMenu as o}from"./chunk-QBWMWK2W.js";import"./chunk-W7DYKTHE.js";import{IconButton_default as c}from"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{formatBytes as d}from"./chunk-GEYM4WN3.js";import"./chunk-Y3JW2GW5.js";import"./chunk-36BRD5J3.js";import"./chunk-LF27WIN2.js";import{getFilesDemoTree as m,subscribeFilesChoice as h,getFilesChoice as u,holdFilesChoice as f,answerFilesChoice as p,choiceTakes as g}from"./chunk-XJW65EIG.js";import{AboutApp as k}from"./chunk-DQMRPTGY.js";import{getFilesStore as w,peekFilesViewRequest as y,consumeFilesViewRequest as v,FILES_SHOW_TRASH_EVENT as b,FILES_OPEN_DESKTOP_FOLDER_EVENT as x,subscribeDesktopFolders as N,getDesktopFoldersSnapshot as C,hasHostFilesStore as S,FolderGlyph as j,DesktopItemMiniIcon as D,desktopItemTypeLabel as M,FilesQuotaError as T,FILES_OFFICE_EXTENSIONS as $}from"./chunk-J2YURAQY.js";import"./chunk-ESL5TDNA.js";import{useWindowManager as L,WindowTitle as W}from"./chunk-TKPUYQ3Q.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-Y6E7IRK2.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-WLUJQLXG.js";import{confirm as R,prompt as A}from"./chunk-5QYKF7NK.js";import{Dialog as P}from"./chunk-PMBCQWJW.js";import{ItemCount as E}from"./chunk-MWTCGJAI.js";import"./chunk-RIG5FEVS.js";import"./chunk-2VFSYSDS.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-WQ4YKWN2.js";import"./chunk-JZBLOIL7.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-3PSLQJWR.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-ZICGXJUB.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import{Button_default as F}from"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as z}from"./chunk-JOAKKXTL.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as K}from"./chunk-R2VKEMZH.js";import{TH_ONE_LINE as O}from"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import{toast_default as I}from"./chunk-3YBXA72C.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-JSHMIMAJ.js";import"./chunk-C3QOHMR6.js";import{useState as U,useRef as Y,useEffect as J,useCallback as Q,useSyncExternalStore as G,useMemo as B}from"react";import{jsxs as V,jsx as X,Fragment as H}from"react/jsx-runtime";var Z={doc:"document",docx:"document",odt:"document",rtf:"document",txt:"document",md:"document",xls:"spreadsheet",xlsx:"spreadsheet",ods:"spreadsheet",csv:"spreadsheet",sheet:"spreadsheet",ppt:"slides",pptx:"slides",odp:"slides",key:"slides",slides:"slides",pdf:"pdf",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",heic:"image",tif:"image",tiff:"image",mp4:"video",mov:"video",webm:"video",avi:"video",mkv:"video",mp3:"audio",wav:"audio",m4a:"audio",ogg:"audio",flac:"audio",zip:"archive",rar:"archive","7z":"archive",gz:"archive",tar:"archive",dxf:"drawing",dwg:"drawing",stp:"drawing",step:"drawing",stl:"drawing",obj:"drawing",iges:"drawing",igs:"drawing","3mf":"drawing",glb:"drawing",gltf:"drawing"};function q(e){const t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function _(e){if("folder"===e.kind)return"folder";if("document"===e.officeKind)return"document";if("spreadsheet"===e.officeKind)return"spreadsheet";if("deck"===e.officeKind)return"slides";const t=e.contentType??"";return"application/pdf"===t?"pdf":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":Z[q(e.name)]??"other"}var ee={folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",slides:"Slides",pdf:"PDF",image:"Image",video:"Video",audio:"Audio",archive:"Archive",drawing:"Drawing",other:"File"},te={folder:{name:"folder",tone:"muted"},document:{name:"document",tone:"accent"},spreadsheet:{name:"table",tone:"success"},slides:{name:"presentation-chart-bar",tone:"warning"},pdf:{name:"document",tone:"danger"},image:{name:"image",tone:"muted"},video:{name:"play",tone:"muted"},audio:{name:"speaker-wave",tone:"muted"},archive:{name:"archive-box",tone:"muted"},drawing:{name:"cube-transparent",tone:"muted"},other:{name:"page",tone:"muted"}};function ne(e){const t=e.officeKind?$[e.officeKind]:"";return t&&e.name.toLowerCase().endsWith(t)&&e.name.length>t.length?e.name.slice(0,-t.length):e.name}function ae(e){return"folder"===e.kind||e.officeKind&&e.size<=2?"—":d(e.size)}function re(e,t=/* @__PURE__ */new Date){if(!e)return"—";const n=new Date(e);return isNaN(n.getTime())?"—":n.toDateString()===t.toDateString()?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.getFullYear()===t.getFullYear()?n.toLocaleDateString(void 0,{day:"numeric",month:"short"}):n.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function ie(e){return"owner"===(e.role??"owner")?"me":e.owner?.name??"—"}var se=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function le(e,t){const n="asc"===t.dir?1:-1;return[...e].sort((e,a)=>e.kind!==a.kind?"folder"===e.kind?-1:1:n*((e,n)=>{switch(t.key){case"owner":return se.compare(ie(e),ie(n));case"size":return e.size-n.size;case"modified":return(Date.parse(e.modifiedAt)||0)-(Date.parse(n.modifiedAt)||0);default:return se.compare(ne(e),ne(n))}})(e,a)||se.compare(e.name,a.name))}var oe=["folder","document","spreadsheet","slides","pdf","image","video"],ce={today:"Today",week:"Last 7 days",month:"Last 30 days",year:"This year"};function de(e,t,n=/* @__PURE__ */new Date){const a=t.modified?function(e,t){const n=new Date(t);return n.setHours(0,0,0,0),"week"===e&&n.setDate(n.getDate()-6),"month"===e&&n.setDate(n.getDate()-29),"year"===e&&n.setMonth(0,1),n.getTime()}(t.modified,n):null;return e.filter(e=>{if(t.type&&_(e)!==t.type)return!1;if(t.person){const n="owner"===(e.role??"owner");if("me"===t.person?!n:n||e.owner?.id!==t.person)return!1}return null===a||(Date.parse(e.modifiedAt)||0)>=a})}var me=[{value:"viewer",label:"Viewer"},{value:"editor",label:"Editor"}];function he({store:e,entry:t,onClose:a,onChanged:i}){const[s,l]=U(null),[o,d]=U(""),[m,h]=U([]),[u,f]=U(!1),[p,g]=U(""),[k,w]=U("viewer"),[y,v]=U(!1),b=Y(/* @__PURE__ */new Map),x=t?.id??null;if(J(()=>{if(l(null),g(""),d(""),!x||!e.shares)return;let t=!0;return e.shares(x).then(e=>{t&&l(e)}).catch(e=>{t&&(I.error(e.message),l([]))}),()=>{t=!1}},[x,e]),J(()=>{if(!e.searchPeople||!x)return;let t=!0;f(!0);const n=setTimeout(()=>{e.searchPeople(o).then(e=>{if(t){for(const t of e)b.current.set(t.id,t);h(e)}}).catch(()=>{t&&h([])}).finally(()=>{t&&f(!1)})},250);return()=>{t=!1,clearTimeout(n)}},[o,x,e]),!t)return null;const N=new Set((s??[]).map(e=>e.person.id)),C=m.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),S=async n=>{v(!0);try{await n(),l(await e.shares(t.id)),i()}catch(e){I.error(e.message)}finally{v(!1)}};/* @__PURE__ */
|
|
2
|
+
return V(P,{open:!0,onClose:a,size:"md",title:`Share “${t.name}”`,description:"folder"===t.kind?"Everything inside this folder is shared too. Editors’ uploads count toward your quota.":"Viewers can open and download it. Editors can also replace, rename and delete it.",footer:/* @__PURE__ */X(F,{variant:"secondary",onClick:a,children:"Done"}),children:[
|
|
3
3
|
/* @__PURE__ */V("div",{className:"flex items-center gap-2",children:[
|
|
4
4
|
/* @__PURE__ */X("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */X(n,{value:p,onChange:g,onSearchChange:d,loading:u&&0===m.length,options:C,placeholder:"Search colleagues by name","aria-label":"Colleague to share with"})}),
|
|
5
5
|
/* @__PURE__ */X("div",{className:"w-28 shrink-0",children:/* @__PURE__ */X(r,{value:k,onChange:e=>w(e),options:me,"aria-label":"Access"})}),
|
|
6
|
-
/* @__PURE__ */X(
|
|
7
|
-
/* @__PURE__ */X("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */X(
|
|
6
|
+
/* @__PURE__ */X(F,{variant:"primary",onClick:()=>{if(!p||!e.share)return;const n=b.current.get(p);S(async()=>{await e.share(t.id,p,k),g(""),d(""),n&&I.success(`Shared with ${n.name}`)})},disabled:!p||y,children:"Add"})]}),
|
|
7
|
+
/* @__PURE__ */X("div",{className:"mt-4 mb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Who has access"}),null===s?/* @__PURE__ */X(K,{size:"sm",padding:"p-4",label:"Loading"}):/* @__PURE__ */V("ul",{className:"divide-y divide-line-subtle text-sm",children:[
|
|
8
8
|
/* @__PURE__ */V("li",{className:"flex items-center gap-2 h-10",children:[
|
|
9
9
|
/* @__PURE__ */X("span",{className:"flex-1 truncate",children:"You"}),
|
|
10
10
|
/* @__PURE__ */X("span",{className:"text-xs text-ink-faint",children:"Owner"})]}),s.map(n=>/* @__PURE__ */V("li",{className:"flex items-center gap-2 h-10",children:[
|
|
11
11
|
/* @__PURE__ */X("span",{className:"flex-1 truncate",title:n.person.name,children:n.person.name}),
|
|
12
12
|
/* @__PURE__ */X("div",{className:"w-28 shrink-0",children:/* @__PURE__ */X(r,{value:n.role,onChange:a=>S(()=>e.share(t.id,n.person.id,a)),options:me,"aria-label":`Access for ${n.person.name}`,disabled:y})}),
|
|
13
13
|
/* @__PURE__ */X(c,{"aria-label":`Remove ${n.person.name}`,variant:"ghost",size:"sm",disabled:y,onClick:()=>S(()=>e.unshare(t.id,n.person.id)),children:/* @__PURE__ */X(z,{name:"close",className:"h-4 w-4",strokeWidth:1.8})})]},n.person.id))]})]})}function ue({store:e,items:t,from:n,onClose:a,onMove:r}){const[i,s]=U(n??null),[l,o]=U(null),[d,m]=U(!1);J(()=>{t&&s(n??null)},[t,n]),J(()=>{if(!t)return;let n=!0;return m(!0),e.list(i).then(e=>{n&&o(e)}).catch(()=>{n&&o(null)}).finally(()=>{n&&m(!1)}),()=>{n=!1}},[e,i,t]);const h=new Set((t??[]).map(e=>e.id)),u=(l?.entries??[]).filter(e=>"folder"===e.kind&&!h.has(e.id)),f=(l?.folder.path??[]).filter(e=>null!==e.id),p=f.length>1?f[f.length-2].id:null,g=l?.folder,k="viewer"!==(g?.role??"owner"),w=void 0!==n&&i===n,y=t?.length??0,v=1===y?`"${t[0].name}"`:`${y} items`;/* @__PURE__ */
|
|
14
|
-
return V(
|
|
15
|
-
/* @__PURE__ */X(
|
|
16
|
-
/* @__PURE__ */X(
|
|
14
|
+
return V(P,{open:!!t,onClose:a,title:`Move ${v}`,size:"sm",footer:/* @__PURE__ */V(H,{children:[
|
|
15
|
+
/* @__PURE__ */X(F,{variant:"secondary",onClick:a,children:"Cancel"}),
|
|
16
|
+
/* @__PURE__ */X(F,{variant:"primary",onClick:()=>r(i),disabled:d||!k||w,children:"Move here"})]}),children:[
|
|
17
17
|
/* @__PURE__ */V("div",{className:"flex items-center gap-1 mb-2 min-h-8",children:[null!==i&&/* @__PURE__ */X(c,{"aria-label":"Back",size:"sm",onClick:()=>s(p),children:/* @__PURE__ */X(z,{name:"arrow-left",className:"h-4 w-4"})}),
|
|
18
18
|
/* @__PURE__ */X("span",{className:"text-sm font-medium text-ink-strong truncate",children:null===i?"My files":g?.name??""})]}),
|
|
19
|
-
/* @__PURE__ */X("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:d?/* @__PURE__ */X(
|
|
19
|
+
/* @__PURE__ */X("div",{className:"border border-line rounded-(--radius-control) h-64 overflow-auto",children:d?/* @__PURE__ */X(K,{size:"sm",padding:"p-6",label:"Loading"}):0===u.length?/* @__PURE__ */X("div",{className:"p-6 text-center text-sm text-ink-faintest",children:"No folders here."}):/* @__PURE__ */X("ul",{children:u.map(e=>/* @__PURE__ */X("li",{children:/* @__PURE__ */V("button",{type:"button",onClick:()=>s(e.id),className:"flex w-full items-center gap-2 px-3 h-9 text-left text-sm hover:bg-row-hover",children:[
|
|
20
20
|
/* @__PURE__ */X(z,{name:"folder",look:"solid",tone:"muted",className:"h-4 w-4 shrink-0"}),
|
|
21
21
|
/* @__PURE__ */X("span",{className:"truncate flex-1",children:e.name}),
|
|
22
22
|
/* @__PURE__ */X(z,{name:"chevron-right",tone:"muted",className:"h-4 w-4 shrink-0"})]})},e.id))})}),!k&&/* @__PURE__ */X("p",{className:"mt-2 text-xs text-ink-faint",children:"You can view this folder but not move things into it."})]})}function fe({store:e,entry:t,selectedCount:n,onClose:a}){const[r,i]=U(null),[s,l]=U(null);J(()=>{if(i(null),l(null),!t)return;let n=!0;return e.info?.(t.id).then(e=>{n&&i(e)}).catch(()=>{}),e.shares?.(t.id).then(e=>{n&&l(e)}).catch(()=>{}),()=>{n=!1}},[e,t]);const o=t?_(t):null,d=o?te[o]:null,m=r?.path.slice(0,-1).map(e=>e.name||"My files").join(" / "),h=(e,t)=>t?/* @__PURE__ */V("div",{className:"py-2",children:[
|
|
@@ -32,7 +32,7 @@ return V("aside",{className:"w-72 shrink-0 border-l border-line flex flex-col mi
|
|
|
32
32
|
/* @__PURE__ */X("span",{className:"truncate",children:e.person.name}),
|
|
33
33
|
/* @__PURE__ */X("span",{className:"text-ink-faint text-xs",children:"editor"===e.role?"Editor":"Viewer"})]},e.person.id))})]}),
|
|
34
34
|
/* @__PURE__ */V("dl",{className:"border-t border-line pt-2",children:[h("Type",o?ee[o]:null),"file"===t.kind&&h("Size",ae(t)),h("Location",m),h("Owner","me"===ie(t)?"me":ie(t)),h("Modified",t.modifiedAt?`${re(t.modifiedAt)}${t.modifiedBy?` by ${t.modifiedBy.name}`:""}`:null),h("Created",r?.createdAt?re(r.createdAt):null)]})]}):/* @__PURE__ */X("p",{className:"pt-6 text-center text-sm text-ink-faintest",children:n>1?"Select one item to see its details.":"Select a file or folder to see its details."})})]})}var pe=e=>"recent"===e||"starred"===e||"shared"===e||"search"===e,ge="files.layout",ke={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"},we=[{kind:"document",label:"Document"},{kind:"spreadsheet",label:"Spreadsheet"},{kind:"deck",label:"Slides"}],ye="application/x-efficient-files";function ve(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function be(){try{return"grid"===localStorage.getItem(ge)?"grid":"list"}catch{return"list"}}function xe(e){const t=e??"/",n=t.split("/").filter(Boolean);let a=m()??[];for(const e of n){const t=a.find(t=>"folder"===t.kind&&t.name===e);a=t?.children??[]}return{folder:{id:e,name:n[n.length-1]??"",role:"owner",path:[{id:null,name:""},...n.map((e,t)=>({id:"/"+n.slice(0,t+1).join("/"),name:e}))]},entries:a.map(e=>({id:("/"===t?"":t)+"/"+e.name,name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}}function Ne(e,t){return`Not enough space for “${e}” (${d(t.attempted)}). You've used ${d(t.used)} of ${d(t.limit)}. Empty Trash or ask an administrator for more space.`}var Ce=(e,t)=>e instanceof Error&&e.message||t;function Se(e){const t=[];for(const n of e)("divider"!==n.type||0!==t.length&&"divider"!==t[t.length-1].type)&&t.push(n);for(;t.length&&"divider"===t[t.length-1].type;)t.pop();return t}function je({entry:e,className:t="h-5 w-5"}){const{name:n,tone:a}=te[_(e)];/* @__PURE__ */
|
|
35
|
-
return X(z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function De({entry:e,read:t}){const[n,a]=U(null),r="image"===_(e)&&e.size<=5242880;return J(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */X("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */X(je,{entry:e,className:"h-10 w-10"})}function Me(){const n=w(),r=n.title??"Files",E=null!==m(),Z=!E&&!!n.shares&&!!n.sharedWithMe,[_,me]=U(null),[Me,Te]=U(null),[$e,Le]=U([]),[We,Ae]=U(()=>/* @__PURE__ */new Set),Re=Y(null),[Ee,Fe]=U(!0),[Pe,ze]=U(!1),[Oe,Ke]=U(null),[Ie,Ue]=U(!1),[Ye,Je]=U(null),[Ge,Qe]=U(null),[Be,Ve]=U(null),[Xe,He]=U(be),[Ze,qe]=U(!1),[_e,et]=U(""),[tt,nt]=U(""),[at,rt]=U({}),[it,st]=U({key:"name",dir:"asc"}),[lt,ot]=U(()=>{const e=y();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=Y("files"),dt=Y(lt);dt.current=lt,J(()=>{v()},[]);const[mt,ht]=U([]),ut=e=>{He(e);try{localStorage.setItem(ge,e)}catch{}},ft=G(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);J(()=>{const e=()=>{v(),ft("trash")},t=e=>{v();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(b,e),window.addEventListener(x,t),()=>{window.removeEventListener(b,e),window.removeEventListener(x,t)}},[ft]);const pt=Q(N,C,C),gt="object"==typeof lt?lt.desktopFolderId:null,kt=gt?pt?.folders.find(e=>e.id===gt)??null:null,wt=gt&&pt?.itemsByFolder[gt]||[];J(()=>{gt&&pt&&!pt.folders.some(e=>e.id===gt)&&ft("files")},[gt,pt,ft]);const yt=Y(0),vt=Y(null),bt=Y(null),{openPage:xt,openEntity:Nt}=L(),Ct=i(),St=i(),jt=i(),Dt=Q(h,u,u);J(()=>f(),[]),J(()=>{!Dt||"trash"!==lt&&"object"!=typeof lt||ft("files")},[Dt,lt,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>xt(e)}):"page"===t.entityType?xt(t.entityId):Nt(t.entityType,t.entityId,null,t.label)},Tt=G(async()=>{if(!E)try{Ke(await n.quota())}catch{}},[n,E]),$t=G(async(e,t)=>{Fe(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):I.error(Ce(e,t))}finally{Fe(!1)}},[]),Lt=G(async e=>{if(E)return Te(xe(e)),ze(!1),void Fe(!1);await $t(async()=>{Te(await n.list(e))},"Failed to list"),Tt()},[n,Tt,E,$t]),Wt=G(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=E?xe(_):await n.list(_).catch(()=>null);return Le((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void Fe(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await $t(async()=>{Le(await a())},"Failed to list files")},[n,E,_,$t]),At=G(async()=>{if(E)return ht([]),void Fe(!1);await $t(async()=>{ht(await n.trash())},"Failed to list trash"),Tt()},[n,Tt,E,$t]),Rt=()=>{"files"===lt?Lt(_):pe(lt)?Wt(lt,tt):"trash"===lt&&At()};J(()=>{Ae(/* @__PURE__ */new Set),Re.current=null,Rt()},[_,lt,tt]),J(()=>{const e=_e.trim();if(!e)return;const t=setTimeout(()=>{e===tt&&"search"===dt.current||("search"!==dt.current&&(ct.current=dt.current),ot("search"),rt({}),nt(e))},300);return()=>clearTimeout(t)},[_e]);const Et=()=>{et(""),"search"===dt.current&&ft(ct.current)},Ft=e=>{ft("files"),me(e)},Pt=async(e,t)=>{try{await e()}catch(e){I.error(Ce(e,t))}Rt()},zt=e=>Pt(async()=>{await n.restore(e.id),I.success(`Restored "${e.name}"`)},"Restore failed"),Ot=async e=>{await A({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Pt(()=>n.purge(e.id),"Delete failed")},Kt=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){I.error(Ce(e,"Download failed"))}},It="files"===lt?Me?.folder??null:null,Ut=It?.role??"owner",Yt="owner"!==Ut,Jt="files"===lt?_:null,Gt=!E&&("files"!==lt||"viewer"!==Ut),Qt=!E&&"files"===lt&&"viewer"!==Ut,Bt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Jt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof T?I.error(Ne(r.name,e)):I.error(`Upload ${r.name}: ${Ce(e,"failed")}`)}}a>1&&I.success(`Uploaded ${a} files`),"files"===lt?Lt(_):Ft(null)},Vt=async e=>{const t=ne(e),a=await R({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?I.error("Names cannot contain slashes"):Pt(()=>n.rename(e.id,function(e,t){const n=e.officeKind?$[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Xt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??Me?.folder.owner)?.name??"its owner":"their owners";await A({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ne(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await Pt(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),I.success(t?`"${ne(t)}" moved to trash`:`${e.length} items moved to trash`))},Ht=(e,t)=>Pt(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Zt=async(e,t)=>{Ve(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Pt(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),I.success(1===a.length?`Moved "${ne(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Je(null)};J(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?Me?.entries??[]:pe(lt)?$e:[],en=B(()=>le(de(_t,at),it),[_t,at,it]),tn=B(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...We].map(e=>tn.get(e)).filter(e=>!!e),an=1===nn.length?nn[0]:null,rn=e=>e.role??("files"===lt?Ut:"owner"),sn=e=>!E&&"viewer"!==rn(e),ln=e=>Z&&"owner"===rn(e),on=e=>!!n.move&&sn(e),cn=(e,t)=>{if(Dt){const t=tn.get(e);if(t&&"file"===t.kind&&!mn(t))return;return void Ae(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Re.current){const t=en.map(e=>e.id),n=t.indexOf(Re.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Ae(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Re.current=e,t.metaKey||t.ctrlKey?Ae(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Ae(/* @__PURE__ */new Set([e]))},dn=()=>{Ae(/* @__PURE__ */new Set),Re.current=null},mn=e=>!!Dt&&"file"===e.kind&&g(Dt.request,e.name),hn=e=>Dt&&"file"===e.kind&&!mn(e)?"text-ink-faintest":"",un=e=>{if(!Dt||!mn(e))return;const t="files"===lt?Me?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===lt?"Shared with me":"My files";p(Dt.id,{entry:e,folderId:"files"===lt?_:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Ft(t.id):Dt?un(t):(async t=>{if(E)return;if(n.open?.(t))return;const a=ke[q(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>xt(e)}):Kt(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Dt)return t&&("folder"===t.kind||mn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(sn);if(E)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Se([...t?[{key:"open",label:a,icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */X(z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Kt)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */X(z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Vt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */X(z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Pt(async()=>{for(const t of e)await n.copy(t.id);I.success(1===e.length?`Copied "${ne(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */X(z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Qe(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */X(z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Ve(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */X(z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Ht(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */X(z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Ae(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Xt(e)}]:[]])},kn=(e,t)=>{const n=We.has(t.id)?nn:[t];Ct.open(e,n)&&!We.has(t.id)&&(Ae(/* @__PURE__ */new Set([t.id])),Re.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=We.has(e.id)?nn:[e];t.dataTransfer.setData(ye,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},yn=e=>"folder"===e.kind&&sn(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(ye)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&Je(e.id))},onDragLeave:()=>{Ye===e.id&&Je(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(ye))return;t.preventDefault(),t.stopPropagation(),Je(null);const n=JSON.parse(t.dataTransfer.getData(ye)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Zt(n,e.id)}}:{};if(Pe)/* @__PURE__ */
|
|
35
|
+
return X(z,{name:n,tone:a,look:"folder"===e.kind?"solid":void 0,className:`${t} shrink-0`})}function De({entry:e,read:t}){const[n,a]=U(null),r="image"===_(e)&&e.size<=5242880;return J(()=>{if(!r||!t||"function"!=typeof URL.createObjectURL)return;let n=!0,i=null;return t(e.id).then(e=>{n&&(i=URL.createObjectURL(e),a(i))}).catch(()=>{}),()=>{n=!1,i&&URL.revokeObjectURL(i)}},[e.id,e.modifiedAt,r,t]),n?/* @__PURE__ */X("img",{src:n,alt:"",className:"h-full w-full object-cover",draggable:!1}):/* @__PURE__ */X(je,{entry:e,className:"h-10 w-10"})}function Me(){const n=w(),r=n.title??"Files",P=null!==m(),Z=!P&&!!n.shares&&!!n.sharedWithMe,[_,me]=U(null),[Me,Te]=U(null),[$e,Le]=U([]),[We,Re]=U(()=>/* @__PURE__ */new Set),Ae=Y(null),[Pe,Ee]=U(!0),[Fe,ze]=U(!1),[Ke,Oe]=U(null),[Ie,Ue]=U(!1),[Ye,Je]=U(null),[Qe,Ge]=U(null),[Be,Ve]=U(null),[Xe,He]=U(be),[Ze,qe]=U(!1),[_e,et]=U(""),[tt,nt]=U(""),[at,rt]=U({}),[it,st]=U({key:"name",dir:"asc"}),[lt,ot]=U(()=>{const e=y();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"}),ct=Y("files"),dt=Y(lt);dt.current=lt,J(()=>{v()},[]);const[mt,ht]=U([]),ut=e=>{He(e);try{localStorage.setItem(ge,e)}catch{}},ft=Q(e=>{ot(e),rt({}),st("recent"===e?{key:"modified",dir:"desc"}:{key:"name",dir:"asc"}),"search"!==e&&(et(""),nt(""))},[]);J(()=>{const e=()=>{v(),ft("trash")},t=e=>{v();const t=e.detail?.folderId;t&&ft({desktopFolderId:t})};return window.addEventListener(b,e),window.addEventListener(x,t),()=>{window.removeEventListener(b,e),window.removeEventListener(x,t)}},[ft]);const pt=G(N,C,C),gt="object"==typeof lt?lt.desktopFolderId:null,kt=gt?pt?.folders.find(e=>e.id===gt)??null:null,wt=gt&&pt?.itemsByFolder[gt]||[];J(()=>{gt&&pt&&!pt.folders.some(e=>e.id===gt)&&ft("files")},[gt,pt,ft]);const yt=Y(0),vt=Y(null),bt=Y(null),{openPage:xt,openEntity:Nt}=L(),Ct=i(),St=i(),jt=i(),Dt=G(h,u,u);J(()=>f(),[]),J(()=>{!Dt||"trash"!==lt&&"object"!=typeof lt||ft("files")},[Dt,lt,ft]);const Mt=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>xt(e)}):"page"===t.entityType?xt(t.entityId):Nt(t.entityType,t.entityId,null,t.label)},Tt=Q(async()=>{if(!P)try{Oe(await n.quota())}catch{}},[n,P]),$t=Q(async(e,t)=>{Ee(!0);try{await e(),ze(!1)}catch(e){e instanceof TypeError?ze(!0):I.error(Ce(e,t))}finally{Ee(!1)}},[]),Lt=Q(async e=>{if(P)return Te(xe(e)),ze(!1),void Ee(!1);await $t(async()=>{Te(await n.list(e))},"Failed to list"),Tt()},[n,Tt,P,$t]),Wt=Q(async(e,t)=>{if("search"===e&&!n.search){const e=t.toLowerCase(),a=P?xe(_):await n.list(_).catch(()=>null);return Le((a?.entries??[]).filter(t=>t.name.toLowerCase().includes(e))),void Ee(!1)}const a={recent:()=>n.recent?.()??Promise.resolve([]),starred:()=>n.starred?.()??Promise.resolve([]),shared:()=>n.sharedWithMe?.()??Promise.resolve([]),search:()=>n.search?.(t)??Promise.resolve([])}[e];await $t(async()=>{Le(await a())},"Failed to list files")},[n,P,_,$t]),Rt=Q(async()=>{if(P)return ht([]),void Ee(!1);await $t(async()=>{ht(await n.trash())},"Failed to list trash"),Tt()},[n,Tt,P,$t]),At=()=>{"files"===lt?Lt(_):pe(lt)?Wt(lt,tt):"trash"===lt&&Rt()};J(()=>{Re(/* @__PURE__ */new Set),Ae.current=null,At()},[_,lt,tt]),J(()=>{const e=_e.trim();if(!e)return;const t=setTimeout(()=>{e===tt&&"search"===dt.current||("search"!==dt.current&&(ct.current=dt.current),ot("search"),rt({}),nt(e))},300);return()=>clearTimeout(t)},[_e]);const Pt=()=>{et(""),"search"===dt.current&&ft(ct.current)},Et=e=>{ft("files"),me(e)},Ft=async(e,t)=>{try{await e()}catch(e){I.error(Ce(e,t))}At()},zt=e=>Ft(async()=>{await n.restore(e.id),I.success(`Restored "${e.name}"`)},"Restore failed"),Kt=async e=>{await R({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"})&&Ft(()=>n.purge(e.id),"Delete failed")},Ot=async e=>{try{const t=await n.read(e.id),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){I.error(Ce(e,"Download failed"))}},It="files"===lt?Me?.folder??null:null,Ut=It?.role??"owner",Yt="owner"!==Ut,Jt="files"===lt?_:null,Qt=!P&&("files"!==lt||"viewer"!==Ut),Gt=!P&&"files"===lt&&"viewer"!==Ut,Bt=async(e,{withFolders:t=!1}={})=>{let a=0;for(const r of Array.from(e)){const e=r.webkitRelativePath??"",i=t?e.split("/").slice(0,-1).join("/"):"";try{await n.upload(Jt,r,i?{folderPath:i}:void 0),a++}catch(e){e instanceof T?I.error(Ne(r.name,e)):I.error(`Upload ${r.name}: ${Ce(e,"failed")}`)}}a>1&&I.success(`Uploaded ${a} files`),"files"===lt?Lt(_):Et(null)},Vt=async e=>{const t=ne(e),a=await A({title:`Rename ${e.kind}`,defaultValue:t,confirmLabel:"Rename"});a&&a!==t&&(/[\\/]/.test(a)?I.error("Names cannot contain slashes"):Ft(()=>n.rename(e.id,function(e,t){const n=e.officeKind?$[e.officeKind]:"";return n&&!t.toLowerCase().endsWith(n)?t+n:t}(e,a)),"Rename failed"))},Xt=async e=>{if(0===e.length)return;const t=1===e.length?e[0]:null,a=e.some(e=>"owner"!==(e.role??"owner")),r=t?(t.owner??Me?.folder.owner)?.name??"its owner":"their owners";await R({title:t?`Move ${t.kind} to trash`:`Move ${e.length} items to trash`,message:(t?`"${ne(t)}"${"folder"===t.kind?" and everything inside":""}`:`${e.length} items`)+" will move to "+(a?`${r}'s Trash.`:"Trash. You can restore it from there."),confirmLabel:"Move to trash",variant:"danger"})&&(await Ft(async()=>{for(const t of e)await n.remove(t.id)},"Delete failed"),I.success(t?`"${ne(t)}" moved to trash`:`${e.length} items moved to trash`))},Ht=(e,t)=>Ft(async()=>{for(const a of e)await n.setStarred(a.id,t)},t?"Star failed":"Unstar failed"),Zt=async(e,t)=>{Ve(null);const a=e.filter(e=>e.id!==t);0!==a.length&&(await Ft(async()=>{for(const e of a)await n.move(e.id,t)},"Move failed"),I.success(1===a.length?`Moved "${ne(a[0])}"`:`Moved ${a.length} items`))},qt=()=>{yt.current=0,Ue(!1),Je(null)};J(()=>{const e=()=>qt();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]);const _t="files"===lt?Me?.entries??[]:pe(lt)?$e:[],en=B(()=>le(de(_t,at),it),[_t,at,it]),tn=B(()=>new Map(en.map(e=>[e.id,e])),[en]),nn=[...We].map(e=>tn.get(e)).filter(e=>!!e),an=1===nn.length?nn[0]:null,rn=e=>e.role??("files"===lt?Ut:"owner"),sn=e=>!P&&"viewer"!==rn(e),ln=e=>Z&&"owner"===rn(e),on=e=>!!n.move&&sn(e),cn=(e,t)=>{if(Dt){const t=tn.get(e);if(t&&"file"===t.kind&&!mn(t))return;return void Re(/* @__PURE__ */new Set([e]))}if(t.shiftKey&&Ae.current){const t=en.map(e=>e.id),n=t.indexOf(Ae.current),a=t.indexOf(e);if(n>=0&&a>=0)return void Re(new Set(t.slice(Math.min(n,a),Math.max(n,a)+1)))}Ae.current=e,t.metaKey||t.ctrlKey?Re(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}):Re(/* @__PURE__ */new Set([e]))},dn=()=>{Re(/* @__PURE__ */new Set),Ae.current=null},mn=e=>!!Dt&&"file"===e.kind&&g(Dt.request,e.name),hn=e=>Dt&&"file"===e.kind&&!mn(e)?"text-ink-faintest":"",un=e=>{if(!Dt||!mn(e))return;const t="files"===lt?Me?.folder:null,n=t?["owner"===t.role?"My files":"Shared with me",...t.path.filter(e=>null!==e.id).map(e=>e.name)].join(" › "):"shared"===lt?"Shared with me":"My files";p(Dt.id,{entry:e,folderId:"files"===lt?_:null,location:n})},fn=Dt&&an&&mn(an)?an:null,pn=t=>{"folder"===t.kind?Et(t.id):Dt?un(t):(async t=>{if(P)return;if(n.open?.(t))return;const a=ke[q(t.name)];a?await e({filePath:n.shortcutPath?.(t.id)??t.id,filename:t.name,kind:a,load:()=>n.read(t.id),onStaged:e=>xt(e)}):Ot(t)})(t)},gn=e=>{if(0===e.length)return[];const t=1===e.length?e[0]:null;if(Dt)return t&&("folder"===t.kind||mn(t))?[{key:"open",label:"Open",icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const a=t&&"file"===t.kind&&n.openLabel?.(t)||"Open",r=e.every(e=>"file"===e.kind),i=e.every(sn);if(P)return t?[{key:"open",label:"Open",icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[];const s=e.some(e=>!e.starred);return Se([...t?[{key:"open",label:a,icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>pn(t)}]:[],{type:"divider",key:"d1"},...r?[{key:"download",label:"Download",icon:/* @__PURE__ */X(z,{name:"download",className:"h-4 w-4"}),onSelect:()=>{e.forEach(Ot)}}]:[],...t&&i?[{key:"rename",label:"Rename",icon:/* @__PURE__ */X(z,{name:"edit",className:"h-4 w-4"}),onSelect:()=>Vt(t)}]:[],...r&&n.copy?[{key:"copy",label:"Make a copy",icon:/* @__PURE__ */X(z,{name:"copy",className:"h-4 w-4"}),onSelect:()=>(e=>Ft(async()=>{for(const t of e)await n.copy(t.id);I.success(1===e.length?`Copied "${ne(e[0])}"`:`Copied ${e.length} files`)},"Copy failed"))(e)}]:[],{type:"divider",key:"d2"},...t&&ln(t)?[{key:"share",label:"Share",icon:/* @__PURE__ */X(z,{name:"add-person",className:"h-4 w-4"}),onSelect:()=>Ge(t)}]:[],...e.every(on)?[{key:"move",label:"Move",icon:/* @__PURE__ */X(z,{name:"forward",className:"h-4 w-4"}),onSelect:()=>Ve(e)}]:[],...n.setStarred?[{key:"star",label:s?"Add to starred":"Remove from starred",icon:/* @__PURE__ */X(z,{name:"star",className:"h-4 w-4"}),onSelect:()=>Ht(e,s)}]:[],...t?[{key:"info",label:"File information",icon:/* @__PURE__ */X(z,{name:"info",className:"h-4 w-4"}),onSelect:()=>{Re(/* @__PURE__ */new Set([t.id])),qe(!0)}}]:[],{type:"divider",key:"d3"},...i?[{key:"trash",label:"Move to trash",danger:!0,icon:/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Xt(e)}]:[]])},kn=(e,t)=>{const n=We.has(t.id)?nn:[t];Ct.open(e,n)&&!We.has(t.id)&&(Re(/* @__PURE__ */new Set([t.id])),Ae.current=t.id)},wn=e=>on(e)?{draggable:!0,onDragStart:t=>{const n=We.has(e.id)?nn:[e];t.dataTransfer.setData(ye,JSON.stringify(n.map(e=>e.id))),t.dataTransfer.effectAllowed="move"}}:{},yn=e=>"folder"===e.kind&&sn(e)&&n.move?{onDragOver:t=>{t.dataTransfer.types.includes(ye)&&(t.preventDefault(),t.stopPropagation(),Ye!==e.id&&Je(e.id))},onDragLeave:()=>{Ye===e.id&&Je(null)},onDrop:t=>{if(!t.dataTransfer.types.includes(ye))return;t.preventDefault(),t.stopPropagation(),Je(null);const n=JSON.parse(t.dataTransfer.getData(ye)||"[]").map(e=>tn.get(e)).filter(t=>!!t&&t.id!==e.id);Zt(n,e.id)}}:{};if(Fe)/* @__PURE__ */
|
|
36
36
|
return V("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
37
37
|
/* @__PURE__ */X(W,{title:`${r} - offline`}),
|
|
38
38
|
/* @__PURE__ */X("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */V("div",{className:"max-w-md",children:[
|
|
@@ -42,38 +42,38 @@ return V("div",{className:"flex flex-col h-full bg-surface",children:[
|
|
|
42
42
|
/* @__PURE__ */X("h3",{className:"text-base font-semibold text-ink-strong mb-1",children:"Can't reach the file server"}),
|
|
43
43
|
/* @__PURE__ */V("p",{className:"text-sm text-ink-faint mb-3",children:["No response from the file server. Make sure the server is running — see ",
|
|
44
44
|
/* @__PURE__ */X("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]})]}),
|
|
45
|
-
/* @__PURE__ */X(
|
|
45
|
+
/* @__PURE__ */X(F,{variant:"primary",onClick:At,children:"Retry"})]})})]});const vn=Ke&&Ke.limit>0?Math.min(100,Math.round(Ke.used/Ke.limit*100)):0,bn=vn>90?"bg-danger":vn>75?"bg-warning":"bg-accent-fill",xn=[Yt?{label:"Shared with me",onClick:()=>ft("shared")}:{label:"My files",onClick:()=>Et(null)},...(It?.path??[]).filter(e=>null!==e.id).map(e=>({label:e.name,onClick:()=>Et(e.id)}))],Nn="recent"===lt?"Recent":"starred"===lt?"Starred":"shared"===lt?"Shared with me":"search"===lt?`Results for “${tt}”`:"trash"===lt?"Trash":kt?kt.name:null,Cn=Dt?`${r} - Choosing`:Nn?`${r} - ${"search"===lt?"Search":Nn}`:It&&null!==It.id?`${r} - ${It.name}`:r,Sn=e=>"flex w-full items-center gap-3 rounded-full px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-accent-tint font-medium text-accent-text":"text-ink hover:bg-row-hover"),jn=Se([{key:"folder",label:"New folder",icon:/* @__PURE__ */X(z,{name:"folder-plus",className:"h-4 w-4"}),onSelect:async()=>{const e=await A({title:"New folder",placeholder:"Folder name",defaultValue:"Untitled folder",confirmLabel:"Create"});e&&(/[\\/]/.test(e)?I.error("Folder names cannot contain slashes"):(await Ft(()=>n.createFolder(Jt,e),"Create folder failed"),"files"!==lt&&Et(null)))}},{type:"divider",key:"d1"},{key:"upload",label:"File upload",icon:/* @__PURE__ */X(z,{name:"upload",className:"h-4 w-4"}),onSelect:()=>vt.current?.click()},...n.folderUpload?[{key:"upload-folder",label:"Folder upload",icon:/* @__PURE__ */X(z,{name:"cloud-arrow-up",className:"h-4 w-4"}),onSelect:()=>bt.current?.click()}]:[],{type:"divider",key:"d2"},...n.createOfficeFile?we.filter(e=>!n.officeKinds||n.officeKinds.includes(e.kind)).map(e=>{const t=te["deck"===e.kind?"slides":e.kind];return{key:e.kind,label:e.label,icon:/* @__PURE__ */X(z,{name:t.name,tone:t.tone,className:"h-4 w-4"}),onSelect:()=>{Promise.resolve(n.createOfficeFile(e.kind,Jt)).catch(e=>I.error(Ce(e,"Could not create it")))}}}):[]]),Dn=/* @__PURE__ */V("div",{className:"flex h-full flex-col",children:[
|
|
46
46
|
/* @__PURE__ */X("div",{className:"p-3 pb-2",children:/* @__PURE__ */X(o,{trigger:/* @__PURE__ */V(H,{children:[
|
|
47
47
|
/* @__PURE__ */X(z,{name:"add",className:"h-5 w-5"}),
|
|
48
|
-
/* @__PURE__ */X("span",{children:"New"})]}),items:jn,align:"start","aria-label":"New",disabled:!
|
|
48
|
+
/* @__PURE__ */X("span",{children:"New"})]}),items:jn,align:"start","aria-label":"New",disabled:!Qt,triggerClassName:"inline-flex items-center gap-2 h-11 pl-4 pr-5 rounded-2xl bg-surface-raised border border-line shadow-sm text-sm font-medium text-ink-strong hover:bg-row-hover disabled:opacity-50 rosh-focus-ring focus-visible:ring-2"})}),
|
|
49
49
|
/* @__PURE__ */V("nav",{className:"px-2 flex-1 overflow-auto","aria-label":"Locations",children:[
|
|
50
|
-
/* @__PURE__ */V("button",{onClick:()=>
|
|
51
|
-
/* @__PURE__ */X(z,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!
|
|
52
|
-
/* @__PURE__ */X(z,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!
|
|
50
|
+
/* @__PURE__ */V("button",{onClick:()=>Et(null),className:Sn("files"===lt&&!Yt),children:[
|
|
51
|
+
/* @__PURE__ */X(z,{name:"home",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"My files"]}),n.recent&&!P&&/* @__PURE__ */V("button",{onClick:()=>ft("recent"),className:Sn("recent"===lt),children:[
|
|
52
|
+
/* @__PURE__ */X(z,{name:"clock",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Recent"]}),n.starred&&!P&&/* @__PURE__ */V("button",{onClick:()=>ft("starred"),className:Sn("starred"===lt),children:[
|
|
53
53
|
/* @__PURE__ */X(z,{name:"star",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Starred"]}),Z&&/* @__PURE__ */V("button",{onClick:()=>ft("shared"),className:Sn("shared"===lt||"files"===lt&&Yt),children:[
|
|
54
|
-
/* @__PURE__ */X(z,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!
|
|
54
|
+
/* @__PURE__ */X(z,{name:"team",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Shared with me"]}),!P&&/* @__PURE__ */V("button",{onClick:()=>ft("trash"),className:Sn("trash"===lt),children:[
|
|
55
55
|
/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),"Trash"]}),pt&&pt.folders.length>0&&/* @__PURE__ */V(H,{children:[
|
|
56
56
|
/* @__PURE__ */X("div",{className:"px-3 pt-4 pb-1 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),pt.folders.map(e=>/* @__PURE__ */V("button",{onClick:()=>ft({desktopFolderId:e.id}),className:Sn(gt===e.id),children:[
|
|
57
57
|
/* @__PURE__ */X(j,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
58
58
|
/* @__PURE__ */X("span",{className:"truncate",children:e.name}),
|
|
59
|
-
/* @__PURE__ */X(
|
|
59
|
+
/* @__PURE__ */X(E,{count:e.itemCount,active:gt===e.id,className:"ml-auto"})]},e.id))]})]}),Ke&&/* @__PURE__ */V("div",{className:"px-5 py-3 shrink-0",title:`${d(Ke.used)} of ${d(Ke.limit)} used`,children:[
|
|
60
60
|
/* @__PURE__ */X("div",{className:"h-1 rounded-full bg-line overflow-hidden",children:/* @__PURE__ */X("div",{className:`h-full ${bn} transition-all`,style:{width:`${vn}%`}})}),
|
|
61
|
-
/* @__PURE__ */V("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[d(
|
|
61
|
+
/* @__PURE__ */V("div",{className:"mt-2 text-2xs text-ink-faint tabular-nums",children:[d(Ke.used)," of ",d(Ke.limit)," used"]})]})]}),Mn=(e,t)=>/* @__PURE__ */V("span",{className:"inline-flex items-center gap-1",children:[e,
|
|
62
62
|
/* @__PURE__ */X(z,{name:"chevron-down",className:"h-3.5 w-3.5"}),t?"":null]}),Tn=e=>"inline-flex items-center h-7 px-3 rounded-(--radius-control) border text-xs whitespace-nowrap rosh-focus-ring focus-visible:ring-2 "+(e?"border-accent-border bg-accent-tint text-accent-text":"border-line-strong text-ink-muted hover:bg-row-hover"),$n=pe(lt)||"files"===lt,Ln=function(e){const t=/* @__PURE__ */new Map;for(const n of e)"owner"!==(n.role??"owner")&&n.owner&&t.set(n.owner.id,n.owner.name);return[...t].map(([e,t])=>({id:e,name:t})).sort((e,t)=>se.compare(e.name,t.name))}(_t),Wn=$n&&_t.length>0?/* @__PURE__ */V("div",{className:"flex items-center gap-2 shrink-0",children:[
|
|
63
63
|
/* @__PURE__ */X(o,{trigger:Mn(at.type?ee[at.type]:"Type",!!at.type),"aria-label":"Type",triggerClassName:Tn(!!at.type),items:[...oe.map(e=>({type:"radio",key:e,label:ee[e],checked:at.type===e,onSelect:()=>rt(t=>({...t,type:t.type===e?null:e}))})),...at.type?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,type:null}))}]:[]]}),Z&&/* @__PURE__ */X(o,{trigger:Mn(at.person?"me"===at.person?"Owned by me":Ln.find(e=>e.id===at.person)?.name??"People":"People",!!at.person),"aria-label":"People",triggerClassName:Tn(!!at.person),items:[{type:"radio",key:"me",label:"Owned by me",checked:"me"===at.person,onSelect:()=>rt(e=>({...e,person:"me"===e.person?null:"me"}))},...Ln.map(e=>({type:"radio",key:e.id,label:e.name,checked:at.person===e.id,onSelect:()=>rt(t=>({...t,person:t.person===e.id?null:e.id}))})),...at.person?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,person:null}))}]:[]]}),
|
|
64
|
-
/* @__PURE__ */X(o,{trigger:Mn(at.modified?ce[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:Tn(!!at.modified),items:[...Object.keys(ce).map(e=>({type:"radio",key:e,label:ce[e],checked:at.modified===e,onSelect:()=>rt(t=>({...t,modified:t.modified===e?null:e}))})),...at.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,modified:null}))}]:[]]})]}):null,
|
|
64
|
+
/* @__PURE__ */X(o,{trigger:Mn(at.modified?ce[at.modified]:"Modified",!!at.modified),"aria-label":"Modified",triggerClassName:Tn(!!at.modified),items:[...Object.keys(ce).map(e=>({type:"radio",key:e,label:ce[e],checked:at.modified===e,onSelect:()=>rt(t=>({...t,modified:t.modified===e?null:e}))})),...at.modified?[{type:"divider",key:"d"},{key:"clear",label:"Clear",onSelect:()=>rt(e=>({...e,modified:null}))}]:[]]})]}):null,Rn=$n&&nn.length>0&&!Dt?/* @__PURE__ */V("div",{className:"flex items-center gap-0.5 h-10 px-2 rounded-full bg-surface-sunken",role:"toolbar","aria-label":"Selection",children:[
|
|
65
65
|
/* @__PURE__ */X(c,{"aria-label":"Clear selection",size:"sm",onClick:dn,children:/* @__PURE__ */X(z,{name:"close",className:"h-4 w-4"})}),
|
|
66
|
-
/* @__PURE__ */V("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */X(c,{"aria-label":"Share",size:"sm",onClick:()=>
|
|
67
|
-
/* @__PURE__ */X(o,{trigger:/* @__PURE__ */X(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(nn)})]}):null,
|
|
66
|
+
/* @__PURE__ */V("span",{className:"text-sm text-ink mr-2 whitespace-nowrap",children:[nn.length," selected"]}),an&&ln(an)&&/* @__PURE__ */X(c,{"aria-label":"Share",size:"sm",onClick:()=>Ge(an),children:/* @__PURE__ */X(z,{name:"add-person",className:"h-4 w-4"})}),!P&&nn.every(e=>"file"===e.kind)&&/* @__PURE__ */X(c,{"aria-label":"Download",size:"sm",onClick:()=>nn.forEach(Ot),children:/* @__PURE__ */X(z,{name:"download",className:"h-4 w-4"})}),nn.every(on)&&/* @__PURE__ */X(c,{"aria-label":"Move",size:"sm",onClick:()=>Ve(nn),children:/* @__PURE__ */X(z,{name:"forward",className:"h-4 w-4"})}),!P&&nn.every(sn)&&/* @__PURE__ */X(c,{"aria-label":"Move to trash",size:"sm",onClick:()=>Xt(nn),children:/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4"})}),
|
|
67
|
+
/* @__PURE__ */X(o,{trigger:/* @__PURE__ */X(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(nn)})]}):null,An=/* @__PURE__ */X("div",{className:"flex items-center gap-2 px-4 pb-2 min-h-12 shrink-0",children:Rn??/* @__PURE__ */V(H,{children:[
|
|
68
68
|
/* @__PURE__ */V("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:["files"===lt?/* @__PURE__ */X("div",{className:"min-w-0 text-base [&_*]:text-base",children:/* @__PURE__ */X(a,{items:xn,maxItems:5})}):"trash"===lt?/* @__PURE__ */X("span",{className:"text-base font-medium text-ink-strong",children:"Trash"}):"object"==typeof lt?/* @__PURE__ */V(H,{children:[
|
|
69
69
|
/* @__PURE__ */X(j,{className:"h-4 w-4 text-amber-500 shrink-0"}),
|
|
70
70
|
/* @__PURE__ */X("span",{className:"text-base font-medium text-ink-strong truncate",children:kt?.name??"Desktop folder"}),
|
|
71
71
|
/* @__PURE__ */X("span",{className:"text-2xs text-ink-faintest whitespace-nowrap",children:"Desktop shortcuts"})]}):/* @__PURE__ */X("span",{className:"text-base font-medium text-ink-strong truncate",children:Nn}),"files"===lt&&Yt&&"viewer"===Ut&&/* @__PURE__ */V("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-2xs text-ink-faint whitespace-nowrap",children:[
|
|
72
|
-
/* @__PURE__ */X(z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Yt&&It?.owner&&/* @__PURE__ */V("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",It.owner.name]})]}),Wn,"trash"===lt&&/* @__PURE__ */X(
|
|
73
|
-
/* @__PURE__ */X("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */X(o,{trigger:/* @__PURE__ */X(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(We.has(e.id)&&nn.length>1?nn:[e])})})]}),
|
|
72
|
+
/* @__PURE__ */X(z,{name:"eye",className:"h-3 w-3",strokeWidth:1.8}),"View only"]}),"files"===lt&&Yt&&It?.owner&&/* @__PURE__ */V("span",{className:"shrink-0 text-2xs text-ink-faint whitespace-nowrap",children:["Shared by ",It.owner.name]})]}),Wn,"trash"===lt&&/* @__PURE__ */X(F,{variant:"secondary-danger",size:"sm",onClick:async()=>{if(0===mt.length)return;await R({title:"Empty trash",message:`${mt.length} item${1===mt.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"})&&Ft(()=>n.emptyTrash(),"Empty trash failed")},disabled:0===mt.length,children:"Empty trash"})]})}),Pn=(e,t)=>Dt?null:/* @__PURE__ */V("div",{className:"flex items-center justify-end "+(t?"":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[ln(e)&&/* @__PURE__ */X(c,{"aria-label":"Share",size:"sm",onClick:t=>{t.stopPropagation(),Ge(e)},children:/* @__PURE__ */X(z,{name:"add-person",className:"h-4 w-4"})}),!P&&"file"===e.kind&&/* @__PURE__ */X(c,{"aria-label":"Download",size:"sm",onClick:t=>{t.stopPropagation(),Ot(e)},children:/* @__PURE__ */X(z,{name:"download",className:"h-4 w-4"})}),n.setStarred&&!P&&/* @__PURE__ */X(c,{"aria-label":e.starred?"Remove from starred":"Add to starred","aria-pressed":!!e.starred,size:"sm",onClick:t=>{t.stopPropagation(),Ht([e],!e.starred)},children:/* @__PURE__ */X(z,{name:"star",look:e.starred?"solid":void 0,tone:e.starred?"warning":void 0,className:"h-4 w-4"})}),
|
|
73
|
+
/* @__PURE__ */X("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */X(o,{trigger:/* @__PURE__ */X(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(We.has(e.id)&&nn.length>1?nn:[e])})})]}),En=e=>/* @__PURE__ */V("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
74
74
|
/* @__PURE__ */X(je,{entry:e}),
|
|
75
|
-
/* @__PURE__ */X("span",{className:"truncate",title:e.name,children:ne(e)}),!!e.shareCount&&/* @__PURE__ */X("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */X(z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */X("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */X(z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),
|
|
76
|
-
return X("th",{className:`${
|
|
75
|
+
/* @__PURE__ */X("span",{className:"truncate",title:e.name,children:ne(e)}),!!e.shareCount&&/* @__PURE__ */X("span",{className:"shrink-0",role:"img","aria-label":"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),title:"Shared with "+(1===e.shareCount?"1 person":`${e.shareCount} people`),children:/* @__PURE__ */X(z,{name:"team",tone:"muted",className:"h-3.5 w-3.5"})}),e.starred&&/* @__PURE__ */X("span",{className:"shrink-0",role:"img","aria-label":"Starred",title:"Starred",children:/* @__PURE__ */X(z,{name:"star",look:"solid",tone:"warning",className:"h-3.5 w-3.5"})})]}),Fn=(e,t,n)=>{const a=it.key===e;/* @__PURE__ */
|
|
76
|
+
return X("th",{className:`${O} font-medium px-3 h-9 ${n}`,"aria-sort":a?"asc"===it.dir?"ascending":"descending":void 0,children:/* @__PURE__ */V("button",{type:"button",className:"inline-flex items-center gap-1 rounded hover:text-ink "+(a?"text-ink":""),onClick:()=>st(t=>({key:e,dir:t.key===e&&"asc"===t.dir?"desc":"asc"})),children:[t,a&&("asc"===it.dir?/* @__PURE__ */X(z,{name:"arrow-up",className:"h-3 w-3"}):/* @__PURE__ */X(z,{name:"arrow-down",className:"h-3 w-3"}))]})})},zn="recent"===lt?"Files you and your colleagues change show here.":"starred"===lt?"Star the files and folders you want to find quickly.":"shared"===lt?"Nothing has been shared with you yet. Files and folders colleagues share with you show here.":"search"===lt?`Nothing matches “${tt}”.`:null,Kn=0===en.length?Pe?/* @__PURE__ */X(K,{size:"sm",padding:"p-6",label:"Loading"}):/* @__PURE__ */X("div",{className:"p-10 text-center text-sm text-ink-faintest",children:_t.length>0?"Nothing matches these filters.":zn??/* @__PURE__ */V(H,{children:["This folder is empty.",Gt&&/* @__PURE__ */V(H,{children:[" Drop files here or choose ",
|
|
77
77
|
/* @__PURE__ */X("span",{className:"font-medium",children:"New"}),"."]})]})}):"grid"===Xe?/* @__PURE__ */X("div",{className:"px-4 pb-4",children:["folder","file"].map(e=>{const t=en.filter(t=>t.kind===e);return 0===t.length?null:/* @__PURE__ */V("section",{className:"mb-4",children:[
|
|
78
78
|
/* @__PURE__ */X("h3",{className:"text-xs font-medium text-ink-faint mb-2",children:"folder"===e?"Folders":"Files"}),
|
|
79
79
|
/* @__PURE__ */X("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))"},children:t.map(t=>{const a=We.has(t.id);/* @__PURE__ */
|
|
@@ -82,22 +82,22 @@ return V("div",{role:"button",tabIndex:0,"aria-pressed":a,"aria-label":ne(t),onC
|
|
|
82
82
|
/* @__PURE__ */X(je,{entry:t,className:"h-4 w-4"}),
|
|
83
83
|
/* @__PURE__ */X("span",{className:"flex-1 truncate text-sm",title:t.name,children:ne(t)}),
|
|
84
84
|
/* @__PURE__ */X("span",{onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:/* @__PURE__ */X(o,{trigger:/* @__PURE__ */X(z,{name:"more-vertical",className:"h-4 w-4"}),"aria-label":"More actions",items:gn(a&&nn.length>1?nn:[t])})})]}),"file"===e&&/* @__PURE__ */V(H,{children:[
|
|
85
|
-
/* @__PURE__ */X("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */X(De,{entry:t,read:
|
|
85
|
+
/* @__PURE__ */X("div",{className:"mx-2 h-28 rounded-lg bg-surface flex items-center justify-center overflow-hidden",children:/* @__PURE__ */X(De,{entry:t,read:P?void 0:n.read})}),
|
|
86
86
|
/* @__PURE__ */V("div",{className:"px-3 py-2 text-2xs text-ink-faint truncate",children:["me"===ie(t)?"You":ie(t)," · ",re(t.modifiedAt)]})]})]},t.id)})})]},e)})}):/* @__PURE__ */V("table",{className:"w-full text-sm table-fixed",children:[
|
|
87
|
-
/* @__PURE__ */X("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */V("tr",{children:[
|
|
88
|
-
/* @__PURE__ */X("th",{className:`${
|
|
87
|
+
/* @__PURE__ */X("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */V("tr",{children:[Fn("name","Name","text-left"),Z&&Fn("owner","Owner","text-left w-32"),Fn("modified","Modified","text-left w-28"),Fn("size","Size","text-right w-20"),
|
|
88
|
+
/* @__PURE__ */X("th",{className:`${O} w-32`,children:/* @__PURE__ */X("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
89
89
|
/* @__PURE__ */X("tbody",{children:en.map(e=>{const t=We.has(e.id);/* @__PURE__ */
|
|
90
90
|
return V("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),onContextMenu:t=>kn(t,e),...wn(e),...yn(e),className:`group cursor-default select-none border-b border-line-subtle ${hn(e)} ${t||Ye===e.id?"bg-accent-tint":"hover:bg-row-hover"}`,children:[
|
|
91
|
-
/* @__PURE__ */X("td",{className:"px-3 h-11",children:
|
|
91
|
+
/* @__PURE__ */X("td",{className:"px-3 h-11",children:En(e)}),Z&&/* @__PURE__ */X("td",{className:"px-3 h-11 text-ink-faint truncate",children:ie(e)}),
|
|
92
92
|
/* @__PURE__ */X("td",{className:"px-3 h-11 text-ink-faint whitespace-nowrap",title:ve(e.modifiedAt),children:re(e.modifiedAt)}),
|
|
93
93
|
/* @__PURE__ */X("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint whitespace-nowrap",children:Dt&&"file"===e.kind&&!mn(e)&&Dt.request.otherLabel?Dt.request.otherLabel:ae(e)}),
|
|
94
|
-
/* @__PURE__ */X("td",{className:"px-2 h-11",children:
|
|
94
|
+
/* @__PURE__ */X("td",{className:"px-2 h-11",children:Pn(e,t)})]},e.id)})})]}),On=Pe&&0===mt.length?/* @__PURE__ */X(K,{size:"sm",padding:"p-6",label:"Loading"}):0===mt.length?/* @__PURE__ */X("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"Trash is empty. What you delete stays here for 30 days."}):/* @__PURE__ */V("table",{className:"w-full text-sm table-fixed",children:[
|
|
95
95
|
/* @__PURE__ */X("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */V("tr",{children:[
|
|
96
|
-
/* @__PURE__ */X("th",{className:`${
|
|
97
|
-
/* @__PURE__ */X("th",{className:`${
|
|
98
|
-
/* @__PURE__ */X("th",{className:`${
|
|
99
|
-
/* @__PURE__ */X("th",{className:`${
|
|
100
|
-
/* @__PURE__ */X("th",{className:`${
|
|
96
|
+
/* @__PURE__ */X("th",{className:`${O} text-left font-medium px-3 h-9`,children:"Name"}),
|
|
97
|
+
/* @__PURE__ */X("th",{className:`${O} text-left font-medium px-3 h-9 w-48`,children:"Original location"}),
|
|
98
|
+
/* @__PURE__ */X("th",{className:`${O} text-left font-medium px-3 h-9 w-32`,children:"Deleted"}),
|
|
99
|
+
/* @__PURE__ */X("th",{className:`${O} text-right font-medium px-3 h-9 w-24`,children:"Size"}),
|
|
100
|
+
/* @__PURE__ */X("th",{className:`${O} w-28`,children:/* @__PURE__ */X("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
101
101
|
/* @__PURE__ */X("tbody",{children:mt.map(e=>/* @__PURE__ */V("tr",{className:"group border-b border-line-subtle hover:bg-row-hover",onContextMenu:t=>St.open(t,e),children:[
|
|
102
102
|
/* @__PURE__ */X("td",{className:"px-3 h-11",children:/* @__PURE__ */V("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
103
103
|
/* @__PURE__ */X(je,{entry:e}),
|
|
@@ -107,11 +107,11 @@ return V("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),o
|
|
|
107
107
|
/* @__PURE__ */X("td",{className:"px-3 h-11 text-right tabular-nums text-ink-faint",children:"folder"===e.kind?"—":d(e.size)}),
|
|
108
108
|
/* @__PURE__ */X("td",{className:"px-2 h-11",children:/* @__PURE__ */V("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[
|
|
109
109
|
/* @__PURE__ */X(c,{"aria-label":"Restore",size:"sm",onClick:()=>zt(e),children:/* @__PURE__ */X(z,{name:"revert",className:"h-4 w-4"})}),
|
|
110
|
-
/* @__PURE__ */X(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>
|
|
110
|
+
/* @__PURE__ */X(c,{"aria-label":"Delete forever",size:"sm",variant:"ghost-danger",onClick:()=>Kt(e),children:/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4"})})]})})]},e.id))})]}),In=0===wt.length?/* @__PURE__ */X("div",{className:"p-10 text-center text-sm text-ink-faintest",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */V("table",{className:"w-full text-sm table-fixed",children:[
|
|
111
111
|
/* @__PURE__ */X("thead",{className:"text-xs text-ink-faint border-b border-line",children:/* @__PURE__ */V("tr",{children:[
|
|
112
|
-
/* @__PURE__ */X("th",{className:`${
|
|
113
|
-
/* @__PURE__ */X("th",{className:`${
|
|
114
|
-
/* @__PURE__ */X("th",{className:`${
|
|
112
|
+
/* @__PURE__ */X("th",{className:`${O} text-left font-medium px-3 h-9`,children:"Name"}),
|
|
113
|
+
/* @__PURE__ */X("th",{className:`${O} text-left font-medium px-3 h-9 w-32`,children:"Type"}),
|
|
114
|
+
/* @__PURE__ */X("th",{className:`${O} w-32`,children:/* @__PURE__ */X("span",{className:"sr-only",children:"Actions"})})]})}),
|
|
115
115
|
/* @__PURE__ */X("tbody",{children:wt.map(e=>/* @__PURE__ */V("tr",{onDoubleClick:()=>Mt(e),onContextMenu:t=>jt.open(t,e),className:"group cursor-default border-b border-line-subtle hover:bg-row-hover",children:[
|
|
116
116
|
/* @__PURE__ */X("td",{className:"px-3 h-11",children:/* @__PURE__ */V("span",{className:"flex items-center gap-3 min-w-0",children:[
|
|
117
117
|
/* @__PURE__ */X(D,{item:e}),
|
|
@@ -121,7 +121,7 @@ return V("tr",{"aria-selected":t,onClick:t=>cn(e.id,t),onDoubleClick:()=>pn(e),o
|
|
|
121
121
|
/* @__PURE__ */X(c,{"aria-label":"Open",size:"sm",onClick:()=>Mt(e),children:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"})}),
|
|
122
122
|
/* @__PURE__ */X(c,{"aria-label":"Move to desktop",size:"sm",onClick:()=>pt?.moveToDesktop([e]),children:/* @__PURE__ */X(z,{name:"desktop",className:"h-4 w-4"})}),
|
|
123
123
|
/* @__PURE__ */X(c,{"aria-label":"Remove",size:"sm",variant:"ghost-danger",onClick:()=>pt?.removeShortcuts([e]),children:/* @__PURE__ */X(z,{name:"close",className:"h-4 w-4"})})]})})]},`${e.entityType}|${e.entityId}`))})]});/* @__PURE__ */
|
|
124
|
-
return V("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{
|
|
124
|
+
return V("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter:e=>{Gt&&e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),yt.current++,Ie||Ue(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{yt.current>0&&yt.current--,0===yt.current&&Ue(!1)},onDrop:e=>{e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),qt(),Gt&&e.dataTransfer.files?.length&&Bt(e.dataTransfer.files))},children:[
|
|
125
125
|
/* @__PURE__ */X(W,{title:Cn}),
|
|
126
126
|
/* @__PURE__ */X(k,{app:"files"}),
|
|
127
127
|
/* @__PURE__ */X("input",{ref:vt,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&Bt(e.target.files),vt.current&&(vt.current.value="")}}),
|
|
@@ -130,12 +130,12 @@ return V("div",{className:"relative flex flex-col h-full bg-surface",onDragEnter
|
|
|
130
130
|
/* @__PURE__ */V("div",{className:"flex flex-1 min-w-0 flex-col",children:[Dt&&/* @__PURE__ */V("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-line bg-accent-tint text-accent-text text-sm shrink-0",role:"status",children:[
|
|
131
131
|
/* @__PURE__ */X(z,{name:"cursor",className:"h-4 w-4 shrink-0",strokeWidth:1.6}),
|
|
132
132
|
/* @__PURE__ */X("span",{className:"flex-1 min-w-0 truncate",children:Dt.request.title}),
|
|
133
|
-
/* @__PURE__ */X(
|
|
134
|
-
/* @__PURE__ */X(
|
|
133
|
+
/* @__PURE__ */X(F,{variant:"secondary",size:"sm",onClick:()=>p(Dt.id,null),children:"Cancel"}),
|
|
134
|
+
/* @__PURE__ */X(F,{variant:"primary",size:"sm",disabled:!fn,onClick:()=>{fn&&un(fn)},children:"Open"})]}),
|
|
135
135
|
/* @__PURE__ */V("div",{className:"flex items-center gap-1 px-4 py-2 shrink-0",children:[
|
|
136
|
-
/* @__PURE__ */X("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */X(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||
|
|
136
|
+
/* @__PURE__ */X("div",{className:"flex-1 min-w-48 max-w-2xl",role:"search",children:/* @__PURE__ */X(l,{type:"text",enterKeyHint:"search",value:_e,onChange:e=>{et(e.target.value),e.target.value.trim()||Pt()},onKeyDown:e=>{"Escape"===e.key&&_e&&(e.stopPropagation(),Pt())},placeholder:`Search in ${r}`,"aria-label":`Search in ${r}`,leftIcon:/* @__PURE__ */X(z,{name:"search",className:"h-4 w-4"}),endAction:_e?{label:"Clear search",icon:/* @__PURE__ */X(z,{name:"close",className:"h-4 w-4"}),onClick:Pt}:void 0})}),
|
|
137
137
|
/* @__PURE__ */X("div",{className:"flex-1"}),"object"!=typeof lt&&"trash"!==lt&&/* @__PURE__ */V(H,{children:[
|
|
138
138
|
/* @__PURE__ */X(c,{"aria-label":"List view","aria-pressed":"list"===Xe,onClick:()=>ut("list"),children:/* @__PURE__ */X(z,{name:"list",className:"h-4 w-4"})}),
|
|
139
139
|
/* @__PURE__ */X(c,{"aria-label":"Grid view","aria-pressed":"grid"===Xe,onClick:()=>ut("grid"),children:/* @__PURE__ */X(z,{name:"grid",className:"h-4 w-4"})})]}),
|
|
140
|
-
/* @__PURE__ */X(c,{"aria-label":"Details","aria-pressed":Ze,onClick:()=>qe(e=>!e),children:/* @__PURE__ */X(z,{name:"info",className:"h-4 w-4"})})]}),
|
|
141
|
-
/* @__PURE__ */X("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Dt?"Enter"===e.key&&fn&&(e.preventDefault(),un(fn)):("Delete"===e.key||"Backspace"===e.key)&&nn.length&&nn.every(sn)?(e.preventDefault(),Xt(nn)):"Enter"===e.key&&an?(e.preventDefault(),pn(an)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&en.length&&(e.preventDefault(),
|
|
140
|
+
/* @__PURE__ */X(c,{"aria-label":"Details","aria-pressed":Ze,onClick:()=>qe(e=>!e),children:/* @__PURE__ */X(z,{name:"info",className:"h-4 w-4"})})]}),An,
|
|
141
|
+
/* @__PURE__ */X("div",{className:"flex-1 overflow-auto outline-none",tabIndex:-1,onKeyDown:e=>{e.target instanceof HTMLInputElement||(Dt?"Enter"===e.key&&fn&&(e.preventDefault(),un(fn)):("Delete"===e.key||"Backspace"===e.key)&&nn.length&&nn.every(sn)?(e.preventDefault(),Xt(nn)):"Enter"===e.key&&an?(e.preventDefault(),pn(an)):(e.metaKey||e.ctrlKey)&&"a"===e.key.toLowerCase()&&en.length&&(e.preventDefault(),Re(new Set(en.map(e=>e.id)))))},onClick:e=>{e.target===e.currentTarget&&dn()},children:"object"==typeof lt?In:"trash"===lt?On:Kn})]}),Ze&&$n&&/* @__PURE__ */X(fe,{store:n,entry:an,selectedCount:nn.length,onClose:()=>qe(!1)})]})})}),Ct.state&&/* @__PURE__ */X(s,{...Ct.props,items:gn(Ct.state.data),"aria-label":"File actions"}),St.state&&/* @__PURE__ */X(s,{...St.props,"aria-label":"Trash actions",items:[{key:"restore",label:"Restore",icon:/* @__PURE__ */X(z,{name:"revert",className:"h-4 w-4"}),onSelect:()=>zt(St.state.data)},{type:"divider",key:"d"},{key:"purge",label:"Delete forever",danger:!0,icon:/* @__PURE__ */X(z,{name:"trash",className:"h-4 w-4"}),onSelect:()=>Kt(St.state.data)}]}),jt.state&&/* @__PURE__ */X(s,{...jt.props,"aria-label":"Shortcut actions",items:[{key:"open",label:"Open",icon:/* @__PURE__ */X(z,{name:"external",className:"h-4 w-4"}),onSelect:()=>Mt(jt.state.data)},{key:"desktop",label:"Move to desktop",icon:/* @__PURE__ */X(z,{name:"desktop",className:"h-4 w-4"}),onSelect:()=>pt?.moveToDesktop([jt.state.data])},{type:"divider",key:"d"},{key:"remove",label:"Remove",danger:!0,icon:/* @__PURE__ */X(z,{name:"close",className:"h-4 w-4"}),onSelect:()=>pt?.removeShortcuts([jt.state.data])}]}),Z&&/* @__PURE__ */X(he,{store:n,entry:Qe,onClose:()=>Ge(null),onChanged:At}),n.move&&/* @__PURE__ */X(ue,{store:n,items:Be,from:"files"===lt?_:void 0,onClose:()=>Ve(null),onMove:e=>Be&&Zt(Be,e)}),Ie&&/* @__PURE__ */X("div",{className:"absolute inset-0 bg-accent-tint border-4 border-dashed border-accent-border pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */X("div",{className:"px-4 py-2 rounded-md bg-accent-fill text-on-accent text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{Me as default,Ne as quotaExceededMessage};
|