efficient-shell 7.49.0 → 7.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/{Browser-VU76GASQ.js → Browser-VHXKQFXP.js} +9 -9
- package/dist/{Documents-OZ7MVNAR.js → Documents-QOJNAZQO.js} +17 -17
- package/dist/{Files-U4Y2PLA6.js → Files-FYKZZ5GN.js} +38 -38
- package/dist/{Notepad-YKYG3MDH.js → Notepad-4AABM6QK.js} +8 -8
- package/dist/{PdfViewer-5H5ER3VP.js → PdfViewer-EUW7YVAH.js} +1 -1
- package/dist/{PomodoroTimer-XH6KYRVX.js → PomodoroTimer-MXKIOXM7.js} +5 -5
- package/dist/{Preview-46IFY224.js → Preview-DS45CXVF.js} +22 -22
- package/dist/{Spreadsheet-B7W34MI2.js → Spreadsheet-JUV363ZX.js} +14 -14
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-64BLXOJL.js → chunk-2ZSSYQFK.js} +2 -2
- package/dist/{chunk-CEER73YL.js → chunk-4YGE5HLZ.js} +2 -2
- package/dist/chunk-5P2GSSZR.js +1 -0
- package/dist/{chunk-G5U45PTK.js → chunk-ANYZYIEY.js} +3 -3
- package/dist/{chunk-JDXMBDL7.js → chunk-C7DGCIVO.js} +1 -1
- package/dist/{chunk-W33ZFDRR.js → chunk-CPWXLXQ7.js} +1 -1
- package/dist/{chunk-JPU532DM.js → chunk-LBZF6GCK.js} +1 -1
- package/dist/{chunk-7S7Z4HD6.js → chunk-OUURHOIS.js} +1 -1
- package/dist/{chunk-AVESYKQN.js → chunk-QQEDB6JI.js} +333 -333
- package/dist/{chunk-SYY4PSVZ.js → chunk-SFO2M76G.js} +12 -12
- package/dist/{index-C6kh5wXj.d.ts → index-J7F5sn8L.d.ts} +106 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +688 -682
- package/dist/pdf/index.js +1 -1
- package/dist/sounds-E5OTSJLX.js +1 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-DQP6AG2L.js +0 -1
- package/dist/sounds-FO772MN2.js +0 -1
package/README.md
CHANGED
|
@@ -1438,7 +1438,8 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1438
1438
|
| `TimelineTrack` | The time axis both timelines are drawn on, and the reason they look and move alike rather than merely similar. A 6 px rail with a fill, a **date ruler** (month ticks always, week ticks where they clear 14 px, a month label only where it clears 72 px of the last one), dots whose shape and glyph say what kind of event they are — every one of them in the theme accent at its 600 step, the colour a primary `Button` wears, so a shape survives the greyscale print and the colour-blind reader that a hue never did, and one of two label strategies: `labels="lanes"` packs them into two rows and folds runs of the same kind into `×N` pills, `labels="active"` draws the one label a scrubber needs, `labels="none"` draws none — the bare rail, where an item's `caption` is the only text near its mark, the edge captions flank the rail on its own row, and the `pending` things are one dashed cap past a dashed tail rather than a column. `axis="compressed"` CUTS any stretch holding more than 30% of the window's time down to a fixed notch with a break glyph saying how many days it hides, and shares the rest of the track proportionally; `axis="linear"` keeps time proportional throughout; `axis="spread"` cuts nothing and keeps the 48 px floor, the idle stretches paying for it in proportion. `highlightKeys` lights one band from the leftmost named mark to the rightmost and every mark inside it; `onHoverChange` reports the mark under the pointer or the focus. A `provisional` item is hollow, never current, and outside the fill. `endMark` puts a hollow, dashed mark ON a bare rail's right edge for a day the window already runs to — an estimate, a contractual date — with the label and the date in its popover. An optional `thumb` turns it into a scrubber: give it `stops` and it becomes discrete — a drag follows the pointer but snaps to the nearest stop as it goes, arrows step stop to stop, and `valueText` says which one for a screen reader. An optional `playback` then drives that thumb along the rail by itself: the caller owns the button and the `playing` flag, the track owns the travel, because the distance between two stops is a distance in **pixels of its axis** and nobody outside knows how wide the track is. It is paced by that distance — 350 ms per 100 px, clamped to 450–1400 ms, eased in and out — so a compressed `//` notch costs 48 px of travel like any other 48 px instead of swallowing the glide, and the date chip, read back through the axis's inverse mapping, skips exactly the days the notch hides. `onArrive(key, ms)` fires on arrival and never mid-travel; the thumb then rests 700 ms before setting off again. The timing is the **wall clock**, not the frame rate: the rest is waited out on a timer and the travel is measured against the high-resolution timestamp each animation frame carries, so 700 ms is 700 ms on a throttled or occluded surface that hands out one frame a second instead of sixty — and a page that comes back after an idle stretch walks its backlog forward at one report per frame rather than announcing four at once. `onProgress({ fromKey, toKey, t, ms } | null)` hands out the in-flight position on every frame of a glide and `null` the moment there is none (arrival, pause, cancel, end, and a released drag), so a consumer can interpolate a table under the bar on the same eased `t` that places the disc; a drag reports the pointer's linear fraction between its two neighbouring stops. Flipping `playing` off freezes it where it is — keeping what is left of the rest rather than spending it — and flipping it back on carries on from there; taking hold of the thumb — a drag, a click, an arrow key — ends the playback through `onStop`. Under `prefers-reduced-motion` the walk stays, the travel goes, and `onProgress` only ever says `null`. Hovering a `×N` pill **magnifies** its stretch so the members can carry their own labels (or do it from code with `zoomRange`), and an item's `preview` fills the hover/focus popover with the document in miniature, with an "Open" footer that fires its `onOpen` — the popover has already drawn the mark's label and its date above the preview, so a consumer leaves both out of it. Also `markers` — each one free to name its own `glyph` where its kind's is not specific enough — `phases`, `edgeCaptions`, and a `pending` list for the things that have no date. Every mark takes its own pointer, including on a scrubber: the 24 px hit strip that makes a 6 px rail pressable runs UNDER the dots rather than over them, so hover, focus and click reach a report, an inspection or a shipment, while a press on the bare rail between two of them still starts a drag and a drag crossing a mark is not interrupted by it. No two marks are ever drawn on top of each other: a run whose centres are closer than one mark's width — of any kinds, folded or not — becomes ONE mark carrying `×N`, its kind's own shape and glyph where the run shares a kind and a neutral `×N` pill where it does not, named after every member it stands for. A pointer opens it: the axis magnifies around the run and each member is a mark again with its own popover, the same magnification a `×N` label pill asks for. A run that is all one DATE can never be opened — no magnification separates a coordinate from itself — so its popover lists every member with its date and its own preview instead. Folding is a drawing decision only: the thumb's stops, `onActivate` and playback all still see every mark. The marks are an `<ol>` with exactly one `aria-current="step"` and ONE tab stop — arrows traverse, Home/End jump, Enter/Space activates — and every tooltip and pill popover is hoverable, persistent and Escape-dismissible (WCAG 1.4.13). A popover is kept inside the track and inside the shell window that owns it (UI-11), the first day's mark included, and a mark carries no native `title` — its popover is the tooltip, on hover and on focus alike. Under a 320 px track it stops squeezing the axis and switches to a vertical variant. Motion is `rosh-tl-*` classes in `ui.css` behind one `prefers-reduced-motion` rule, replayed on every mount, total budget 600 ms. |
|
|
1439
1439
|
| `ProductionTimeline` | The scrubbable production bar, drawn on `TimelineTrack` inside the shared timeline card: a sentence-case heading with the PO as its subject, the window and the lead time as meta, a Play **pill** on the right whose glyph follows its state, and a footer carrying the status line and legend chips drawn with the track's own glyphs — a shipment is a diamond with a truck in it and an inspection a disc with a flask, on the rail and in the chip alike, because every kind is painted in the one accent and the glyph is the only thing left to tell them apart. The thumb only ever rests on a date a report was filed on — drag it and it snaps report to report, arrow it and it steps one report at a time — so the bar never shows an estimate dressed as a fact. Press Play and it **travels** between them: a fresh press rewinds to the first report, the thumb reads each snapshot for 700 ms and then glides to the next with the date chip counting the days it crosses, and the status line under the bar changes on arrival rather than while it is on its way. Pausing freezes it mid-glide and pressing Play again carries on from exactly there; touching the thumb ends the playback and hands it back. The walk keeps time by the clock rather than by the frame rate, so an idle or throttled pane does not stretch it. `onScrubProgress` forwards the track's in-flight fraction — `{ fromKey, toKey, t, ms }` keyed by report id, `null` at a stop — which is how a consumer's items table moves WITH the thumb instead of jumping a whole report's worth of quantities when it lands; it is optional and undefined by default, so a caller that only reads the snapshot needs no change. `onPickReport` selects a report; the optional `onOpenReport` / `onOpenMarker` make the label above the thumb a real button that opens the document behind it. `reportLabel` names a report wherever the bar states its identity — the caption over the thumb, the popover header, each dot's accessible name, the slider's value text and the status line — and defaults to its own `progress_number`, while `resetLabel` replaces the whole of the `Back to …` button: together they are what lets a portal that must not print an internal document number run the same card. A report carries an optional `preview` for its hover/focus popover — the stage row it filed, the note attached to it — and `renderReportPreview` builds one for the reports that carry none, the convenience for a caller whose list arrives straight off an API; the report's own preview wins where both exist, and the popover prints the report number and the date itself. `useProductionTimeline(opts)` owns the slider state and the derived snapshot so the caller's items table and the bar read the same state; `STAGES` / `calcOverall` / `calcReportOverall` are the stage maths it shares with that table. **`variant="rail"`** is the bar alone, for a window whose own header already says what the order is: no card, no heading, no lead-time line, no label under the active report — every report, shipment, inspection and **invoice** (kind `invoice`, a disc with a receipt) is a dot with a popover — the thumb with its date chip, `Start` and `Est. done` flanking the rail, the estimated completion as a hollow mark on the right edge while it is still ahead, and under the rail one row: Play, the return button when the thumb has been moved, and the `<report> · date · N% overall · N pc in stock` line. The rail spreads the reports (the track's `spread` axis) rather than folding two a week apart into a `×2`. `onPlayStart` fires before the thumb moves, on a fresh run and on a resume, so a window that keeps the bar in view while its table shows something else can switch the table first. |
|
|
1440
1440
|
| `MilestoneTimeline` | The static sibling, on the same `TimelineTrack` and in the same card: one dot per milestone on a date axis, no scrubber. `heading` and `subject` split the title from the record it is about (`Mould development` · **001F/1813**), and the meta line states when it started, how long it has run and how many milestones are dated. The axis **cuts** rather than squeezes: a stretch holding more than 30% of the window's time becomes a fixed notch with a break glyph saying how many days it hides, and every stretch that still keeps time gets at least 48 px. Labels are packed into **two lanes** by their **measured** width, and a run of same-kind revisions folds into one `DFM ×4` pill whose members keep their dots on the rail: hovering it magnifies that stretch until each member can carry its own label, a click pins the popover listing them, Escape closes it. A milestone carries an optional `glyph` (a `default` one that names `doc` is drawn as the signed drawing it is), a `preview` for the popover, and an `onOpen` that the popover's "Open" button fires — `onClick` selects the dot on the bar, `onOpen` opens the drawing behind it, and a card that declares only the first keeps its Open button because the footer falls back to it. Label and date are printed by the popover above the preview, so a consumer supplies neither. A milestone with **no date gets no position**, because the only position available would be a date the record does not have: it is listed beside the bar under "Not yet reached" (two rows, then a real `+N more` button) and takes no part in the range, the fill or a phase bracket. `phase` groups of 2+ get a bracket marking parallel work, the fill never runs past today, and today gets its dashed rule and tag even when it IS the right edge — the commonest case, because a programme with no finish date ends at today. **`variant="rail"`** is the bar alone, for a window whose stepper already names the stages: no card, no heading, no label under any dot — every milestone is a dot with a popover, a revision carries a two-character `caption` over its dot (`v3`; captions that would overprint collapse to `v1–v4`), `edgeCaptions` flank the rail on its own row (`{ start: 'Start', end: 'Ready' }`), nothing is cut (the `spread` axis: every stretch at least 48 px, the idle ones drawn short rather than notched), and what has not happened is one dashed **cap** at the end of a dashed tail — a real button announced as the last undated milestone, naming the rest in its popover. The stepper and the rail then point at each other: `highlightKeys` lights one soft band from the leftmost named milestone to the rightmost and every dot inside it (a single key rings one dot; the cap answers to the pending milestone's key), and `onHoverChange` reports the milestone under the pointer or the focus, `null` on leave. A `provisional` milestone — a sample ORDERED, drawn where the shipment will be — is hollow, never "where we are", and outside the fill. |
|
|
1441
|
-
| `SettingRow` | One setting in a settings card: the name with its explanation stacked under it on the left, the control or value on the right (it never shrinks), and an optional body (`children`) that opens beneath behind its own line. Each row draws its own top line (`divider`) and padding, so rows stack in a card. One prop per slot: `label` (the name) and `value` (a control or a read-only fact). `size="compact"` is the editor-panel row. Handles a value that is a control (`controlId` labels it), a read-only fact, a value nobody knows (an em dash in the faint ink, never an empty cell), and a `quiet` row nothing can write yet. A name over a field (children, no value) draws nothing on the right. `DescriptionList` is the record-detail neighbour and stays that. |
|
|
1441
|
+
| `SettingRow` | One setting in a settings card: the name with its explanation stacked under it on the left, the control or value on the right (it never shrinks), and an optional body (`children`) that opens beneath behind its own line. Each row draws its own top line (`divider`) and padding, so rows stack in a card. One prop per slot: `label` (the name) and `value` (a control or a read-only fact). `size="compact"` is the editor-panel row. Handles a value that is a control (`controlId` labels it), a read-only fact, a value nobody knows (an em dash in the faint ink, never an empty cell), and a `quiet` row nothing can write yet. A name over a field (children, no value) draws nothing on the right. `DescriptionList` is the record-detail neighbour and stays that. `showWhen` (with `values`, and `context` for where the row is) hides the row while the rule is false — see `ShowWhen` below. |
|
|
1442
|
+
| `ShowWhen` / `isShown` / `ShowWhenRule` | The ONE rule for "show this settings row only when another setting has a value" (owner ruling 2026-10-17). The rule is data, never a function: `{ field: 'country_selector_enabled', is: true }`, `{ field, in: [...] }` (is one of), `{ field, set: true }` (holds anything: not `undefined`/`null`/`false`/blank/empty list; `0` counts), `default` for an unset field, a dotted `field` (`'source.slug'`), `{ context: 'parentType', in: ['Flex'] }` (where the row is, not what it stores), and `{ not }` / `{ all: [] }` / `{ any: [] }`. `isShown(rule, values, context)` is the only reader; `SettingRow`'s `showWhen` and the `<ShowWhen rule values>` wrapper both use it. A hidden row keeps its stored value — nothing here writes — and a rule it cannot read shows the row. |
|
|
1442
1443
|
| `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. |
|
|
1443
1444
|
| `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. |
|
|
1444
1445
|
| `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. |
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-4YGE5HLZ.js";import{WindowTitle as r}from"./chunk-2ZRV46PX.js";import"./chunk-DSSLOQDW.js";import"./chunk-YDDG7MXB.js";import"./chunk-FNR5SPQM.js";import"./chunk-5A7MWTXX.js";import"./chunk-K73JEGD5.js";import"./chunk-5P2GSSZR.js";import"./chunk-KNUR2UEG.js";import{confirm as a}from"./chunk-VOUSFISE.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as n}from"./chunk-YT4B3NSV.js";import"./chunk-HQLDTFAF.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,S]=i([k]),[R,E]=i(0),[L,W]=i(0),[D,H]=i(x),[O,T]=i(!1),[U,F]=i(null),I=s(null),G=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(D))}catch{}},[D]);const P=e=>{const t=f(e);t&&(y(t),C(t),S(e=>{const o=e.slice(0,R+1);return o.push(t),o}),E(e=>e+1),T(!1))},B=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},K=()=>{const e=U?.trim();e?(H(t=>[...t,{label:e,url:k}]),F(null)):F(null)};l(()=>{if(null===U)return;I.current?.focus(),I.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||F(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==U]);const M=e=>{H(t=>t.filter((t,o)=>o!==e))},A=R>0,Q=R<z.length-1,X=D.some(e=>e.url===k),q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
|
|
4
4
|
/* @__PURE__ */m(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(R>0){const e=R-1;E(e),y(z[e]),C(z[e]),T(!1)}},disabled:!
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(R>0){const e=R-1;E(e),y(z[e]),C(z[e]),T(!1)}},disabled:!A,className:q,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
7
|
/* @__PURE__ */m("button",{onClick:()=>{if(R<z.length-1){const e=R+1;E(e),y(z[e]),C(z[e]),T(!1)}},disabled:!Q,className:q,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
8
|
/* @__PURE__ */m("button",{onClick:()=>W(e=>e+1),className:q,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>P(g),className:q,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),P(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),k!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(k),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>X?
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>X?M(D.findIndex(e=>e.url===k)):void F(v(k)),className:q+" "+(X?"text-yellow-500":""),title:X?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:X?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
14
|
/* @__PURE__ */m("button",{onClick:B,className:q,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
15
|
/* @__PURE__ */m("button",{onClick:()=>T(e=>!e),className:q,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==U&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
|
|
18
|
-
/* @__PURE__ */m("input",{ref:I,type:"text",value:U,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key?
|
|
18
|
+
/* @__PURE__ */m("input",{ref:I,type:"text",value:U,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key?K():"Escape"===e.key&&F(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
20
|
/* @__PURE__ */m("button",{onClick:()=>F(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:
|
|
22
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===D.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),D.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:K,disabled:!U.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===D.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),D.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>P(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&M(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */m("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */m("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:L,iframeRef:G,openExternal:B,showHelp:O,dismissHelp:()=>T(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
28
|
/* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-4YGE5HLZ.js";import{WindowTitle as n}from"./chunk-2ZRV46PX.js";import"./chunk-DSSLOQDW.js";import"./chunk-YDDG7MXB.js";import{toast_default as r}from"./chunk-OUURHOIS.js";import"./chunk-FNR5SPQM.js";import"./chunk-5A7MWTXX.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-K73JEGD5.js";import"./chunk-5P2GSSZR.js";import"./chunk-KNUR2UEG.js";import"./chunk-VOUSFISE.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as s}from"./chunk-YT4B3NSV.js";import"./chunk-HQLDTFAF.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as c}from"./chunk-2J6F4EE7.js";import{useState as d,useRef as m}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";var p=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=d(x),[v,b]=d(!1),[k,w]=d(!1),[N,j]=d(!1),[D,C]=d(null),L=m(null),M=m(null),U=m(null),R=(e,t)=>{U.current?.focus(),document.execCommand(e,!1,t),j(!0)},S=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{U.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),j(!0)},e.readAsDataURL(t)}},B=e=>{D&&(D.el.removeAttribute("width"),D.el.removeAttribute("height"),D.el.style.width=e??"",D.el.style.height=e?"auto":"",j(!0),C(null))},O=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();b(!0);try{if(p.has(n)||!g.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:n}),j(!1)}else if(g.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),j(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{b(!1)}},T=f?.filename?(W=f.filename).length>24?`${W.slice(0,23)}…`:W:"Untitled";var W;/* @__PURE__ */
|
|
4
4
|
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),k||w(!0)},onDragLeave:e=>{e.currentTarget===e.target&&w(!1)},onDrop:e=>{e.preventDefault(),w(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?S(t):O(t[0]))},children:[
|
|
5
5
|
/* @__PURE__ */u(n,{title:`${T}${N?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */u(t,{app:"documents"}),
|
|
@@ -8,18 +8,18 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
8
8
|
/* @__PURE__ */u("input",{ref:L,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&O(t),L.current&&(L.current.value="")},className:"hidden"}),
|
|
9
9
|
/* @__PURE__ */h("button",{onClick:()=>L.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
10
10
|
/* @__PURE__ */u(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=U.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=U.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
12
12
|
/* @__PURE__ */u("span",{className:"text-2xs text-gray-400 ml-1",children:"TXT · DOCX · Code"}),
|
|
13
13
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
14
|
/* @__PURE__ */h("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,N?" •":""]}),
|
|
15
15
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
16
16
|
/* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
|
|
17
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
18
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
19
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
20
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
17
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
|
|
21
21
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
22
|
-
/* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{
|
|
22
|
+
/* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
|
|
23
23
|
/* @__PURE__ */u("option",{value:"",disabled:!0,children:"Size"}),
|
|
24
24
|
/* @__PURE__ */u("option",{value:"1",children:"XS"}),
|
|
25
25
|
/* @__PURE__ */u("option",{value:"2",children:"S"}),
|
|
@@ -27,21 +27,21 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
27
27
|
/* @__PURE__ */u("option",{value:"4",children:"L"}),
|
|
28
28
|
/* @__PURE__ */u("option",{value:"5",children:"XL"}),
|
|
29
29
|
/* @__PURE__ */u("option",{value:"6",children:"2XL"})]}),
|
|
30
|
-
/* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>
|
|
30
|
+
/* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
|
|
31
31
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
32
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
33
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
32
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
|
|
33
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
|
|
34
34
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
35
35
|
/* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
|
|
36
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
37
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
38
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
39
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
36
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
|
|
37
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
|
|
38
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
40
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
41
|
/* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&S(Array.from(e.target.files)),M.current&&(M.current.value="")}}),
|
|
42
42
|
/* @__PURE__ */h("button",{onClick:()=>M.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
|
|
43
43
|
/* @__PURE__ */u(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
-
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:
|
|
44
|
+
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:v?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:U,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>j(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),S(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),C({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-sm leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),k&&/* @__PURE__ */u("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */u("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),D&&/* @__PURE__ */h(o,{minWidth:150,style:{left:D.x,top:D.y},onClose:()=>C(null),children:[
|
|
45
45
|
/* @__PURE__ */u(l,{children:"Image width"}),
|
|
46
46
|
/* @__PURE__ */u(a,{onClick:()=>B("25%"),children:"25%"}),
|
|
47
47
|
/* @__PURE__ */u(a,{onClick:()=>B("50%"),children:"50%"}),
|
|
@@ -49,4 +49,4 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
49
49
|
/* @__PURE__ */u(a,{onClick:()=>B("100%"),children:"100%"}),
|
|
50
50
|
/* @__PURE__ */u(a,{onClick:()=>B(null),children:"Original size"}),
|
|
51
51
|
/* @__PURE__ */u(i,{}),
|
|
52
|
-
/* @__PURE__ */u(a,{danger:!0,onClick:()=>{
|
|
52
|
+
/* @__PURE__ */u(a,{danger:!0,onClick:()=>{D?.el.remove(),j(!0),C(null)},children:"Remove image"})]})]})}export{f as default};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-
|
|
2
|
-
return
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-LBZF6GCK.js";import{Breadcrumbs as t}from"./chunk-7SNZKUCI.js";import{TH_ONE_LINE as a}from"./chunk-NZBX24NL.js";import{SidebarLayout as r}from"./chunk-TXLJEUYC.js";import{getFilesDemoTree as n}from"./chunk-3ZZ2UPNR.js";import{AboutApp as s}from"./chunk-4YGE5HLZ.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as l,FILES_SHOW_TRASH_EVENT as o,FILES_OPEN_DESKTOP_FOLDER_EVENT as d,subscribeDesktopFolders as c,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-4FQTMGCA.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-2ZRV46PX.js";import"./chunk-DSSLOQDW.js";import"./chunk-YDDG7MXB.js";import{toast_default as g}from"./chunk-OUURHOIS.js";import"./chunk-FNR5SPQM.js";import"./chunk-5A7MWTXX.js";import"./chunk-K73JEGD5.js";import"./chunk-5P2GSSZR.js";import"./chunk-KNUR2UEG.js";import{confirm as y,prompt as b}from"./chunk-VOUSFISE.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as k}from"./chunk-YT4B3NSV.js";import{formatBytes as N}from"./chunk-W32SKK3D.js";import"./chunk-HQLDTFAF.js";import"./chunk-C3QOHMR6.js";import{LoadingSpinner as w}from"./chunk-2J6F4EE7.js";import{useState as v,useEffect as $,useSyncExternalStore as j,useRef as C,useCallback as L}from"react";import{jsxs as D,jsx as E,Fragment as T}from"react/jsx-runtime";var R="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",S={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"};function F(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function P(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 I(){const I=R.replace(/\/$/,""),U=null!==n(),[O,W]=v("/"),[A,M]=v([]),[B,K]=v([]),[V,z]=v(null),[H,G]=v(!0),[J,Q]=v(!1),[X,Z]=v(null),[_,Y]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});$(()=>{l()},[]);const[te,ae]=v([]);$(()=>{const e=()=>{l(),ee("trash")},t=e=>{l();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(o,e),window.addEventListener(d,t),()=>{window.removeEventListener(o,e),window.removeEventListener(d,t)}},[]);const re=j(c,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?re?.folders.find(e=>e.id===ne)??null:null,ie=ne&&re?.itemsByFolder[ne]||[];$(()=>{ne&&re&&!re.folders.some(e=>e.id===ne)&&ee("files")},[ne,re]);const le=C(0),oe=C(null),{openPage:de,openEntity:ce}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>de(e)}):"page"===t.entityType?de(t.entityId):ce(t.entityType,t.entityId,null,t.label)},he=L((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=L(async()=>{try{const e=await he(`${I}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[he,I]),ue=L(async e=>{if(z(null),U){const t=function(e){const t=n();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return M(t),W(e),Q(!1),G(!1),void("/"===e&&K(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}G(!0);try{const t=await he(`${I}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];M(r),W(a.path||e),Q(!1),"/"===(a.path||e)&&K(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Q(!0)}finally{G(!1)}pe()},[he,I,pe,U]),fe=L(async()=>{if(U)return ae([]),void G(!1);G(!0),z(null);try{const e=await he(`${I}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void g.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ae(t.entries||[]),Q(!1)}catch{Q(!0)}finally{G(!1)}pe()},[he,I,pe,U]);$(()=>{"files"===q?ue(O):"trash"===q&&fe()},[O,q]);const xe=async e=>{const t=F(O,e.name);try{const a=await he(`${I}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void g.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){g.error(e?.message||"Download failed")}},ge=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await he(`${I}/api/upload?path=${encodeURIComponent(O)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));g.error(`Quota exceeded — ${N(a)} free, ${e.name} is ${N(t.attempted||e.size)}`)}else g.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){g.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(O)},ye=()=>{le.current=0,Y(!1)};if($(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),J)/* @__PURE__ */
|
|
2
|
+
return D("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */E(x,{title:"Files - offline"}),
|
|
4
|
-
/* @__PURE__ */E("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */
|
|
4
|
+
/* @__PURE__ */E("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */D("div",{className:"max-w-md",children:[
|
|
5
5
|
/* @__PURE__ */E(k,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
|
|
6
6
|
/* @__PURE__ */E("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
|
|
7
|
-
/* @__PURE__ */
|
|
7
|
+
/* @__PURE__ */D("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
8
|
/* @__PURE__ */E("span",{className:"font-mono",children:I}),". Make sure the server is running — see ",
|
|
9
9
|
/* @__PURE__ */E("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
-
/* @__PURE__ */E("button",{onClick:()=>ue(
|
|
10
|
+
/* @__PURE__ */E("button",{onClick:()=>ue(O),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===O?[]:O.split("/").filter(Boolean),ke=X&&X.limit>0?Math.min(100,Math.round(X.used/X.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>W("/")},...be.map((e,t)=>({label:e,onClick:()=>W("/"+be.slice(0,t+1).join("/"))}))],ve=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),$e=e=>/* @__PURE__ */E("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */E("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),je=/* @__PURE__ */D("nav",{className:"p-2",children:[
|
|
11
11
|
/* @__PURE__ */E("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */E("span",{className:"truncate",children:e})]},e)),!U&&/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */E("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */
|
|
12
|
+
/* @__PURE__ */D("button",{onClick:()=>{ee("files"),W("/")},className:ve("files"===q&&"/"===O),children:[$e("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),B.map(e=>/* @__PURE__ */D("button",{onClick:()=>{ee("files"),W("/"+e)},className:ve("files"===q&&O==="/"+e),children:[$e("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
13
|
+
/* @__PURE__ */E("span",{className:"truncate",children:e})]},e)),!U&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[$e("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),re&&re.folders.length>0&&/* @__PURE__ */D(T,{children:[
|
|
14
|
+
/* @__PURE__ */E("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */D("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
|
|
15
15
|
/* @__PURE__ */E(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
16
|
/* @__PURE__ */E("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */E("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
|
|
17
|
-
return
|
|
18
|
-
/* @__PURE__ */E(x,{title:se?`Files - ${se.name}`:"Files"+("/"===
|
|
17
|
+
return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{U||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,_||Y(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{le.current>0&&le.current--,0===le.current&&Y(!1)},onDrop:e=>{e.preventDefault(),ye(),U||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
|
|
18
|
+
/* @__PURE__ */E(x,{title:se?`Files - ${se.name}`:"Files"+("/"===O?"":" - "+O)}),
|
|
19
19
|
/* @__PURE__ */E(s,{app:"files"}),
|
|
20
20
|
/* @__PURE__ */E("input",{ref:oe,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),oe.current&&(oe.current.value="")}}),
|
|
21
|
-
/* @__PURE__ */E("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */E(r,{sidebar:je,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */E("button",{onClick:()=>
|
|
21
|
+
/* @__PURE__ */E("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */E(r,{sidebar:je,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */D("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
22
|
+
/* @__PURE__ */D("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0 text-xs",children:[/* @__PURE__ */D(T,"files"===q?{children:[
|
|
23
|
+
/* @__PURE__ */E("button",{onClick:()=>W(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(O)),disabled:"/"===O,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */E(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
24
24
|
/* @__PURE__ */E("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */E(t,{items:we,maxItems:5})}),
|
|
25
|
-
/* @__PURE__ */E("button",{onClick:()=>ue(
|
|
26
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */E("button",{onClick:()=>ue(O),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */E(k,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!U&&/* @__PURE__ */D(T,{children:[
|
|
26
|
+
/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
27
27
|
/* @__PURE__ */E(k,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */D("button",{onClick:async()=>{const e=await b({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void g.error("Folder names cannot contain slashes");const t=F(O,e),a=await he(`${I}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void g.error(e.error||`Create folder failed (${a.status})`)}ue(O)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
29
29
|
/* @__PURE__ */E(k,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */D("button",{onClick:()=>oe.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
|
|
31
31
|
/* @__PURE__ */E(k,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===q?{children:[
|
|
32
32
|
/* @__PURE__ */E("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
33
33
|
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
@@ -36,52 +36,52 @@ return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
36
36
|
/* @__PURE__ */E("button",{onClick:()=>ee("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(k,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
37
37
|
/* @__PURE__ */E(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
38
38
|
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
|
|
39
|
-
/* @__PURE__ */E("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),
|
|
39
|
+
/* @__PURE__ */E("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),X&&/* @__PURE__ */D(T,{children:[
|
|
40
40
|
/* @__PURE__ */E("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */D("div",{className:"flex items-center gap-2",title:`${N(X.used)} of ${N(X.limit)} used`,children:[
|
|
42
42
|
/* @__PURE__ */E("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */E("div",{className:`h-full ${Ne} transition-all`,style:{width:`${ke}%`}})}),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */E("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */D("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[N(X.used)," / ",N(X.limit)]})]})]})]}),
|
|
44
|
+
/* @__PURE__ */E("div",{className:"flex-1 overflow-auto",children:"object"==typeof q?0===ie.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
|
|
45
|
+
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
|
|
46
46
|
/* @__PURE__ */E("th",{className:`${a} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
47
47
|
/* @__PURE__ */E("th",{className:`${a} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
|
|
48
48
|
/* @__PURE__ */E("th",{className:`${a} w-56`})]})}),
|
|
49
49
|
/* @__PURE__ */E("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
50
|
-
return
|
|
51
|
-
/* @__PURE__ */
|
|
50
|
+
return D("tr",{onClick:()=>z(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(V===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
51
|
+
/* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:[
|
|
52
52
|
/* @__PURE__ */E(p,{item:e}),
|
|
53
53
|
/* @__PURE__ */E("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
54
54
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-xs text-gray-500",children:u(e)}),
|
|
55
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
56
56
|
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),me(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
|
|
57
57
|
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Move to desktop"}),
|
|
58
|
-
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?H&&0===te.length?/* @__PURE__ */E(w,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===q?H&&0===te.length?/* @__PURE__ */E(w,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
|
|
59
|
+
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
|
|
60
60
|
/* @__PURE__ */E("th",{className:`${a} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
61
61
|
/* @__PURE__ */E("th",{className:`${a} text-left font-medium px-3 h-8`,children:"Original location"}),
|
|
62
62
|
/* @__PURE__ */E("th",{className:`${a} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
63
63
|
/* @__PURE__ */E("th",{className:`${a} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
|
|
64
64
|
/* @__PURE__ */E("th",{className:`${a} w-44`})]})}),
|
|
65
|
-
/* @__PURE__ */E("tbody",{children:te.map(e=>/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */E("tbody",{children:te.map(e=>/* @__PURE__ */D("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
|
|
66
|
+
/* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */E(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */E(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
67
67
|
/* @__PURE__ */E("span",{className:"truncate",title:e.name,children:e.name})]}),
|
|
68
68
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-gray-500 text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
|
|
69
69
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:N(e.size)}),
|
|
70
70
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?P(e.deletedAt):"—"}),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
72
72
|
/* @__PURE__ */E("button",{onClick:()=>(async e=>{const t=await he(`${I}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Restore failed (${t.status})`)}g.success(`Restored "${e.name}"`),fe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
|
|
73
|
-
/* @__PURE__ */E("button",{onClick:()=>(async e=>{if(!await y({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await he(`${I}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):H&&0===
|
|
74
|
-
/* @__PURE__ */E("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */E("button",{onClick:()=>(async e=>{if(!await y({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await he(`${I}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void g.error(e.error||`Delete failed (${t.status})`)}fe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):H&&0===A.length?/* @__PURE__ */E(w,{size:"sm",padding:"p-6",label:"Loading"}):0===A.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!U&&/* @__PURE__ */D(T,{children:[" Drop files here or click ",
|
|
74
|
+
/* @__PURE__ */E("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
|
|
75
|
+
/* @__PURE__ */E("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
|
|
76
76
|
/* @__PURE__ */E("th",{className:`${a} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
77
77
|
/* @__PURE__ */E("th",{className:`${a} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
78
78
|
/* @__PURE__ */E("th",{className:`${a} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
|
|
79
79
|
/* @__PURE__ */E("th",{className:`${a} w-32`})]})}),
|
|
80
|
-
/* @__PURE__ */E("tbody",{children:
|
|
81
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */E("tbody",{children:A.map(t=>/* @__PURE__ */D("tr",{onClick:()=>z(t.name),onDoubleClick:()=>{"folder"===t.kind?W(F(O,t.name)):(async t=>{if(U)return;const a=F(O,t.name),r=(t.name.split(".").pop()||"").toLowerCase(),n=S[r];n?await e({filePath:a,filename:t.name,kind:n,onStaged:e=>de(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(V===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
81
|
+
/* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */E(k,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */E(k,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
82
82
|
/* @__PURE__ */E("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
83
83
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":N(t.size)}),
|
|
84
84
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:P(t.modifiedAt)}),
|
|
85
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!U&&/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await b({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void g.error("Names cannot contain slashes");const a=F(
|
|
87
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await y({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=F(
|
|
85
|
+
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!U&&/* @__PURE__ */D(T,{children:["file"===t.kind&&/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),xe(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs",children:"Download"}),
|
|
86
|
+
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await b({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void g.error("Names cannot contain slashes");const a=F(O,e.name),r=F(O,t),n=await he(`${I}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:r})});if(!n.ok){const e=await n.json().catch(()=>({}));return void g.error(e.error||`Rename failed (${n.status})`)}ue(O)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
|
|
87
|
+
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await y({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=F(O,e.name),a=await he(`${I}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void g.error(e.error||`Delete failed (${a.status})`)}ue(O)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */E("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */E("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{I as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-O5R4V3KH.js";import{SidebarLayout as t}from"./chunk-TXLJEUYC.js";import{AboutApp as r}from"./chunk-
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{
|
|
1
|
+
import{getNumberingConfigs as e}from"./chunk-O5R4V3KH.js";import{SidebarLayout as t}from"./chunk-TXLJEUYC.js";import{AboutApp as r}from"./chunk-4YGE5HLZ.js";import{useWindowManager as n,client_default as o}from"./chunk-2ZRV46PX.js";import"./chunk-DSSLOQDW.js";import"./chunk-YDDG7MXB.js";import{toast_default as i}from"./chunk-OUURHOIS.js";import{useShellPrefs as s}from"./chunk-FNR5SPQM.js";import"./chunk-5A7MWTXX.js";import"./chunk-K73JEGD5.js";import"./chunk-5P2GSSZR.js";import"./chunk-KNUR2UEG.js";import"./chunk-VOUSFISE.js";import"./chunk-UVBK6YSR.js";import"./chunk-DELNCIUK.js";import"./chunk-RDLWLATO.js";import"./chunk-7IQ3B77H.js";import"./chunk-D65T4H6J.js";import"./chunk-FIEA5CGB.js";import"./chunk-K7PQXJO7.js";import{Icon as c}from"./chunk-YT4B3NSV.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import"./chunk-HQLDTFAF.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";import{useRef as l,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var b={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=l({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}_.current=e},[w]);const j=v.notepad_notes||[],[T,S]=p(null),[C,$]=p(""),[D,O]=p(""),[W,X]=p("yellow"),[E,R]=p(!1),[U,I]=p(!1),K=l(null),F=l(),L=j.find(e=>e.id===T);d(()=>{if(!T&&j.length>0){const e=j[0];S(e.id),$(e.title),O(e.content),X(e.color)}},[j.length]);const P=m(e=>{N({notepad_notes:e})},[N]),H=m(()=>{if(!T||!E)return;const e=j.map(e=>e.id===T?{...e,title:C,content:D,color:W,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);P(e),R(!1)},[T,E,C,D,W,j,P]);d(()=>{if(E)return F.current&&clearTimeout(F.current),F.current=setTimeout(H,800),()=>{F.current&&clearTimeout(F.current)}},[E,H]),d(()=>()=>{E&&H()},[]);const q=e=>{E&&H(),S(e.id),$(e.title),O(e.content),X(e.color),R(!1),I(!1)},B=e=>{const t=D.slice(0,e),r=D.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=D.slice(e+r[0].length);O(t+n+o),R(!0)},G=async(e,t)=>{const r=_.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},Q="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",V=/* @__PURE__ */h(y,{children:[
|
|
2
|
+
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{E&&H();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...j];P(t),S(e.id),$(""),O(""),X("yellow"),R(!1),I(!0),setTimeout(()=>K.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
|
|
3
3
|
/* @__PURE__ */g(c,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
4
4
|
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===j.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):j.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
|
|
5
5
|
return h("button",{onClick:()=>q(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(T===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
@@ -12,14 +12,14 @@ return h("div",{className:"h-full",children:[
|
|
|
12
12
|
/* @__PURE__ */g(r,{app:"notepad"}),
|
|
13
13
|
/* @__PURE__ */g(t,{sidebar:V,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:T?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
14
|
/* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
|
-
/* @__PURE__ */g("input",{value:
|
|
16
|
-
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{X(e.key),
|
|
17
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);P(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(T),title:
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(P(t),T===e){const e=t[0];e?q(e):(
|
|
19
|
-
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(D):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:
|
|
15
|
+
/* @__PURE__ */g("input",{value:C,onChange:e=>{$(e.target.value),R(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
|
|
16
|
+
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{X(e.key),R(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${W===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
|
|
17
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);P(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(T),title:L?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(L?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(c,{name:"bookmark",className:"h-4 w-4",fill:L?.sticky?"currentColor":"none",strokeWidth:1.5})}),
|
|
18
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(P(t),T===e){const e=t[0];e?q(e):(S(null),$(""),O(""))}})(T),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(c,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),U?/* @__PURE__ */g("textarea",{ref:K,value:D,onChange:e=>{O(e.target.value),R(!0)},onBlur:()=>{I(!1),E&&H()},placeholder:Q,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{I(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:D?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>G(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=l+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>B(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g(c,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:""},`empty-${r}`));const d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
+
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(D):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:Q})}),
|
|
20
20
|
/* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
|
|
21
21
|
/* @__PURE__ */g("span",{children:"[] checkbox"}),
|
|
22
22
|
/* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
|
|
23
|
-
/* @__PURE__ */g("span",{className:"ml-auto",children:
|
|
23
|
+
/* @__PURE__ */g("span",{className:"ml-auto",children:U?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
|
|
24
24
|
/* @__PURE__ */g(c,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
25
25
|
/* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-
|
|
1
|
+
export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-SFO2M76G.js";import"./chunk-OUURHOIS.js";import"./chunk-K7PQXJO7.js";import"./chunk-YT4B3NSV.js";import"./chunk-HQLDTFAF.js";import"./chunk-C3QOHMR6.js";import"./chunk-2J6F4EE7.js";
|