efficient-shell 8.6.0 → 8.8.1
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 +29 -1
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/{Browser-DWCAT7YU.js → Browser-KDTFCM5G.js} +13 -13
- package/dist/{Documents-TJGLPXWF.js → Documents-RJDGQ43B.js} +12 -12
- package/dist/{Files-6A6VPSMP.js → Files-LZRYWVGV.js} +12 -12
- package/dist/{Notepad-F42I5BFB.js → Notepad-SL6AYTBY.js} +9 -9
- package/dist/{Preview-D535MRVA.js → Preview-3KTDQJ2R.js} +1 -1
- package/dist/{Spreadsheet-PUAIM4ZN.js → Spreadsheet-OT7LXL3F.js} +11 -11
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-4TWBDIMX.js +2 -0
- package/dist/chunk-4VIRG42K.js +2 -0
- package/dist/chunk-64ACCUNN.js +1 -0
- package/dist/chunk-7ELH72YJ.js +2 -0
- package/dist/chunk-AFMPM43F.js +2 -0
- package/dist/chunk-BUDBBIKN.js +14 -0
- package/dist/chunk-E3E7DODJ.js +2 -0
- package/dist/chunk-FFNV7UGR.js +1 -0
- package/dist/chunk-HSXNUF53.js +2 -0
- package/dist/{chunk-PZ6D5DYB.js → chunk-JSVNCBNK.js} +1 -1
- package/dist/{chunk-RFNU5AIH.js → chunk-KA4RAVCT.js} +2 -2
- package/dist/chunk-L7DBGH2Z.js +2 -0
- package/dist/chunk-OD2ZMT64.js +2 -0
- package/dist/chunk-RWIT3OF2.js +1 -0
- package/dist/chunk-RWL7F776.js +2 -0
- package/dist/chunk-S2Q6BOAX.js +10 -0
- package/dist/chunk-TUMURSQU.js +2 -0
- package/dist/chunk-VIJ5BZ5U.js +1 -0
- package/dist/{chunk-UULKUZAG.js → chunk-XDWTPVDR.js} +1 -1
- package/dist/chunk-ZHNKLVWV.js +2 -0
- package/dist/forms/MediaUploadGrid.d.ts +19 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/Select.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/icons/efficient-glyphs.d.ts +11 -0
- package/dist/icons/efficient-glyphs.js +1 -1
- package/dist/icons/efficient-looks.js +1 -1
- package/dist/icons/efficient-meanings.d.ts +11 -0
- package/dist/icons/efficient-meanings.js +1 -1
- package/dist/icons/efficient.d.ts +11 -0
- package/dist/icons/efficient.js +1 -1
- package/dist/icons/glyphs/Brand1passwordIcon.d.ts +11 -0
- package/dist/icons/glyphs/Brand1passwordIcon.js +1 -0
- package/dist/icons/glyphs/BrandAmdIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandAmdIcon.js +1 -0
- package/dist/icons/glyphs/BrandAnthropicIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandAnthropicIcon.js +1 -0
- package/dist/icons/glyphs/BrandAppleIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandAppleIcon.js +1 -0
- package/dist/icons/glyphs/BrandAwsIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandAwsIcon.js +1 -0
- package/dist/icons/glyphs/BrandCloudflareIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandCloudflareIcon.js +1 -0
- package/dist/icons/glyphs/BrandDellIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandDellIcon.js +1 -0
- package/dist/icons/glyphs/BrandGithubIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandGithubIcon.js +1 -0
- package/dist/icons/glyphs/BrandIntelIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandIntelIcon.js +1 -0
- package/dist/icons/glyphs/BrandNvidiaIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandNvidiaIcon.js +1 -0
- package/dist/icons/glyphs/BrandSamsungIcon.d.ts +11 -0
- package/dist/icons/glyphs/BrandSamsungIcon.js +1 -0
- package/dist/icons/index.d.ts +44 -4
- package/dist/icons/index.js +1 -1
- package/dist/icons/looks/map.js +1 -1
- package/dist/icons/sets.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +694 -694
- package/dist/names-CwL-QSC9.d.ts +21 -0
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/SettingRow.d.ts +4 -4
- package/dist/shell/SettingRow.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ErrorBoundary.d.ts +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BZK6F2KO.js +0 -1
- package/dist/chunk-GJDK54K6.js +0 -13
- package/dist/chunk-RA2HF3VC.js +0 -10
- package/dist/chunk-X4KIXGW5.js +0 -1
- package/dist/chunk-YUMPKSS4.js +0 -1
- package/dist/names-BizAB6aS.d.ts +0 -13
- /package/dist/{chunk-Y6Q5E3MQ.js → chunk-WHTINFQU.js} +0 -0
package/README.md
CHANGED
|
@@ -1484,7 +1484,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1484
1484
|
| `FilePicker` | Documents on a record: one dashed zone that is a button (click, Enter, Space) and a drop target, listing the chosen `File[]`. It never uploads — the form submits them as it submits everything else. `accept`, `maxSizeBytes` and `maxFiles` are enforced on a drop exactly as on a pick, and a rejected file is announced (`role="alert"`) naming the file and the rule. Forwards its ref to the zone for `FormErrorSummary`. |
|
|
1485
1485
|
| `useFileIntake`, `acceptsFile`, `FileIntakeAlert` | The intake every upload primitive above takes its files through — the file dialog, a drop and a paste reach one set of checks (`accept`, `maxSizeBytes`, `maxFiles`) and one announced rejection list. For a surface with a layout of its own; never so a consumer renders its own file input. Also on the React-only subpath [`efficient-shell/file-intake`](#upload-intake-without-the-shell--efficient-shellfile-intake) for a page that cannot load the shell. |
|
|
1486
1486
|
| `MediaUploadField` | The single image / video slot — logo, cover, avatar, favicon. Dashed zone empty; filled, the preview carries a bar along its bottom edge with "Change image" (or "Change video") and a Remove bin, shown on hover or keyboard focus and always on a screen with no hover; both take a drop. `kind` + `onKindChange` put an Image / Video strip on top; `focus` + `onFocusChange` make the picture an `ImageFocusPoint` (drag the dot or move it with the arrow keys; `focus` alone still places the picture). `replaceLabel` is the bar's words; `removeLabel` names the bin. `onFile` hands the consumer the chosen `File` to upload (the field owns the gesture); `onPick` opens the consumer's own library picker instead; with neither it emits an object-URL. `maxSizeBytes` joins `accept` on every gesture. A library that answers later returns a promise of the URL from `onPick`: the field is busy ("Choosing") until it settles, takes the URL it resolves to, and says "The library could not be opened" if it fails. |
|
|
1487
|
-
| `MediaUploadGrid` | The gallery sibling: thumbnails, an Add tile, per-thumb remove, drag-and-keyboard reorder, optional cover badge. `onFiles` receives EVERY file of a multi-file drop or dialog pick; `onPick` defers to a library picker. `maxFiles` counts against the items held. |
|
|
1487
|
+
| `MediaUploadGrid` | The gallery sibling: thumbnails, an Add tile, per-thumb remove, drag-and-keyboard reorder, optional cover badge. `onFiles` receives EVERY file of a multi-file drop or dialog pick; `onPick` defers to a library picker. `maxFiles` counts against the items held. Typed drags between galleries: `dragType` + an item's `dragData` let a tile be dragged out (a `readOnly` gallery too); `dropType` + `onDropData` let the zone take that drag and hand over its payload (to link an existing picture instead of uploading it again). An item's `mark` sits at the top left ("Linked") and its `removeLabel` names its × ("Unlink"). |
|
|
1488
1488
|
| `StartMenu` / `Desktop` / `WindowManagerProvider` | Used internally by `Layout`; rarely instantiated directly. |
|
|
1489
1489
|
| `Modal`, `ModalActions`, `CopyButton`, `CancelButton` | Window primitive supporting standard / compact / widget styles. Every window frame is a non-modal `role="dialog"` (no `aria-modal`: a window stands beside other windows, with no scrim and no focus trap), named by the title it draws through `aria-labelledby`; a widget, a phone frame and the Home tab draw no title, so their title text is the `aria-label`. A test finds an open window with `getByRole('dialog', { name: 'Its title' })`, and a modal popup over it with `[role="dialog"][aria-modal="true"]`. |
|
|
1490
1490
|
| `splitTitle(title)` | Splits a window or page title for the Sidebar layout's tab: `{ text, copy, accessories, badges, actions }` — the title's words for the tab (a badge's own text is not among them), the `CopyButton`'s text (a routed page tab's copy icon; window tabs draw none), and every badge and control (any component, `button`, `a`, `select`, …) in title order, split into `badges` (`StatusBadge`, `ColoredBadge`, or a component with `titleRole = 'badge'`) for the record bar and `actions` (everything else) for the active window tab. Inline SVG is dropped. A badge drawn as a styled `<span>` counts as words, so draw badges with `StatusBadge` / `ColoredBadge`. |
|
|
@@ -4232,6 +4232,34 @@ look keeps its ink line round the fill, so a light colour still shows on a
|
|
|
4232
4232
|
light toolbar; with no such rule it draws a hollow A, so "no colour" is told
|
|
4233
4233
|
apart from black.
|
|
4234
4234
|
|
|
4235
|
+
**Brand marks.** Vendor logos are meanings of the set too, `brand-<key>`, so
|
|
4236
|
+
every portal draws them from one owner (Henry 2026-10-20; Server Status and the
|
|
4237
|
+
Dev costs window first):
|
|
4238
|
+
|
|
4239
|
+
```tsx
|
|
4240
|
+
<Icon name="brand-aws" /> // the area of a 1em square, the text's colour
|
|
4241
|
+
<Icon name="brand-samsung" size={20} /> // the area of a 20 px square
|
|
4242
|
+
```
|
|
4243
|
+
|
|
4244
|
+
`brand-1password`, `brand-amd`, `brand-anthropic`, `brand-apple`, `brand-aws`,
|
|
4245
|
+
`brand-cloudflare`, `brand-dell`, `brand-github`, `brand-intel`,
|
|
4246
|
+
`brand-nvidia`, `brand-samsung`: `BRAND_ICON_NAMES` lists them
|
|
4247
|
+
(`BrandIconName`, `isBrandIconName`), and each is a single export too
|
|
4248
|
+
(`BrandAwsIcon`). A mark is filled in one colour (`currentColor`, so it
|
|
4249
|
+
follows the text and dark mode), has no other look, and no theme set redraws
|
|
4250
|
+
it. Marks differ wildly in shape (Apple is taller than wide, Samsung's
|
|
4251
|
+
wordmark six times wider than tall), so each is cropped to its own outline and
|
|
4252
|
+
drawn at its own aspect with the **area** of a `size` square, not its height:
|
|
4253
|
+
`brandBox(size, aspect)` gives `height = max(5.5px, size × min(1/√aspect,
|
|
4254
|
+
1.1))` and `width = height × aspect`. The box is inline style, so a square
|
|
4255
|
+
sizing class (`h-4 w-4`) does not squash a wordmark; size a mark with `size`.
|
|
4256
|
+
|
|
4257
|
+
The paths are copied from [Simple Icons](https://simpleicons.org) 16.35.0
|
|
4258
|
+
(`brand-aws` from 13.21.0, the last release that had it), CC0 1.0; every mark
|
|
4259
|
+
is a trademark of its owner, shown only to name that owner's product. The
|
|
4260
|
+
source, with each mark's file and version, is `src/icons/brands.json`; to add a
|
|
4261
|
+
mark, add its entry there and run `npm run icons` (`scripts/icons/brands.mjs`).
|
|
4262
|
+
|
|
4235
4263
|
| Import | Holds | Use it for | Needs |
|
|
4236
4264
|
|---|---|---|---|
|
|
4237
4265
|
| `efficient-shell/icons/efficient` | each default drawing as its own export (`TrashIcon`) | a page or part that draws a few icons | nothing |
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -270,6 +270,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
270
270
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
271
271
|
SOFTWARE.
|
|
272
272
|
|
|
273
|
+
## Simple Icons
|
|
274
|
+
|
|
275
|
+
The brand marks in the `efficient` icon set (the `brand-*` meanings,
|
|
276
|
+
`BrandAwsIcon` and the rest; source `src/icons/brands.json`) are copied from
|
|
277
|
+
simple-icons 16.35.0, and `brand-aws` from simple-icons 13.21.0
|
|
278
|
+
(https://github.com/simple-icons/simple-icons). The drawings are dedicated to
|
|
279
|
+
the public domain under CC0 1.0 Universal
|
|
280
|
+
(https://creativecommons.org/publicdomain/zero/1.0/). Each mark is a trademark
|
|
281
|
+
of its owner; it is shown only to name that owner's product, and implies no
|
|
282
|
+
endorsement.
|
|
283
|
+
|
|
273
284
|
## Iconoir
|
|
274
285
|
|
|
275
286
|
The drawings in the `iconoir` icon set (`efficient-shell/icons/iconoir`, the Nature
|
|
@@ -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-KA4RAVCT.js";import{WindowTitle as r}from"./chunk-H7BP5LLG.js";import"./chunk-TPDOOCFS.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BXRWPGAT.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-CJUN2VOD.js";import"./chunk-4A2X6KLQ.js";import{confirm as n}from"./chunk-CP6FITHO.js";import"./chunk-OZ2ALRKX.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-KC3EX26K.js";import"./chunk-RAHIWTPJ.js";import"./chunk-GZCAFWWB.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-BOGBLZKS.js";import"./chunk-CDAJKLGL.js";import"./chunk-QMQVOUIV.js";import"./chunk-FFNV7UGR.js";import"./chunk-FSP63GKK.js";import"./chunk-K7U4RWXJ.js";import"./chunk-ABJ4LWOW.js";import{Icon as a}from"./chunk-C2HHGLLR.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-Z3WKHMVB.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-T53TXXOC.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-OVNRVFWS.js";import"./chunk-C3QOHMR6.js";import{useRef as s,useEffect as i,useState as l}from"react";import{jsxs as c,jsx as m,Fragment as u}from"react/jsx-runtime";var d="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 k(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 f=["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(d);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 u=s(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?k(u.current.url):"",[g,b]=l(w),[f,y]=l(p||g),[j,C]=l(f),[W,R]=l([f]),[z,L]=l(0),[K,S]=l(0),[T,O]=l(x),[D,G]=l(!1),[H,U]=l(null),A=s(null),J=s(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(T))}catch{}},[T]);const P=e=>{const t=k(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,z+1);return o.push(t),o}),L(e=>e+1),G(!1))},E=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},M=()=>{const e=H?.trim();e?(O(t=>[...t,{label:e,url:f}]),U(null)):U(null)};i(()=>{if(null===H)return;A.current?.focus(),A.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!==H]);const V=e=>{O(t=>t.filter((t,o)=>o!==e))},F=z>0,X=z<W.length-1,B=T.some(e=>e.url===f),I="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(f)}`}),
|
|
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(z>0){const e=z-1;L(e),y(W[e]),C(W[e]),
|
|
7
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(z<W.length-1){const e=z+1;L(e),y(W[e]),C(W[e]),
|
|
8
|
-
/* @__PURE__ */m("button",{onClick:()=>S(e=>e+1),className:
|
|
9
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;L(e),y(W[e]),C(W[e]),G(!1)}},disabled:!F,className:I,title:"Back",children:/* @__PURE__ */m(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(z<W.length-1){const e=z+1;L(e),y(W[e]),C(W[e]),G(!1)}},disabled:!X,className:I,title:"Forward",children:/* @__PURE__ */m(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */m("button",{onClick:()=>S(e=>e+1),className:I,title:"Refresh",children:/* @__PURE__ */m(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>P(g),className:I,title:"Home",children:/* @__PURE__ */m(a,{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:f.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…"}),f!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(f),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */m("button",{onClick:
|
|
15
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>B?V(T.findIndex(e=>e.url===f)):void U(v(f)),className:I+" "+(B?"text-yellow-500":""),title:B?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(a,{name:"star",className:"h-4 w-4",fill:B?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */m("button",{onClick:E,className:I,title:"Open in new tab",children:/* @__PURE__ */m(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */m("button",{onClick:()=>G(e=>!e),className:I,title:"Embedding help",children:/* @__PURE__ */m(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==H&&/* @__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:f,children:f}),
|
|
18
|
-
/* @__PURE__ */m("input",{ref:
|
|
18
|
+
/* @__PURE__ */m("input",{ref:A,type:"text",value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?M():"Escape"===e.key&&U(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
20
|
/* @__PURE__ */m("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:
|
|
22
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:M,disabled:!H.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===T.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),T.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>P(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&V(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(f);try{localStorage.setItem(h,f)}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:f,iframeKey:K,iframeRef:
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:K,iframeRef:J,openExternal:E,showHelp:D,dismissHelp:()=>G(!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:n,dismissHelp:s}){const[d,h]=l(!1);i(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return f.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__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(a,{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,11 +1,11 @@
|
|
|
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-KA4RAVCT.js";import{WindowTitle as n}from"./chunk-H7BP5LLG.js";import"./chunk-TPDOOCFS.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BXRWPGAT.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-CJUN2VOD.js";import"./chunk-4A2X6KLQ.js";import"./chunk-CP6FITHO.js";import"./chunk-OZ2ALRKX.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-KC3EX26K.js";import{toast_default as r}from"./chunk-2LKH6JM5.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as i,PopupMenuDivider as a}from"./chunk-RAHIWTPJ.js";import"./chunk-GZCAFWWB.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-BOGBLZKS.js";import"./chunk-CDAJKLGL.js";import"./chunk-QMQVOUIV.js";import"./chunk-FFNV7UGR.js";import"./chunk-FSP63GKK.js";import"./chunk-K7U4RWXJ.js";import"./chunk-ABJ4LWOW.js";import{Icon as s}from"./chunk-C2HHGLLR.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as c}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-Z3WKHMVB.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-T53TXXOC.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-OVNRVFWS.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as d}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]=m(x),[k,v]=m(!1),[b,w]=m(!1),[j,C]=m(!1),[N,D]=m(null),L=d(null),M=d(null),R=d(null),W=(e,t)=>{R.current?.focus(),document.execCommand(e,!1,t),C(!0)},U=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{R.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),C(!0)},e.readAsDataURL(t)}},T=e=>{N&&(N.el.removeAttribute("width"),N.el.removeAttribute("height"),N.el.style.width=e??"",N.el.style.height=e?"auto":"",C(!0),D(null))},O=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!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}),C(!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}),
|
|
4
|
-
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||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/"))?U(t):
|
|
5
|
-
/* @__PURE__ */u(n,{title:`${
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),C(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},A=f?.filename?(B=f.filename).length>24?`${B.slice(0,23)}…`:B:"Untitled";var B;/* @__PURE__ */
|
|
4
|
+
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||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/"))?U(t):O(t[0]))},children:[
|
|
5
|
+
/* @__PURE__ */u(n,{title:`${A}${j?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */u(t,{app:"documents"}),
|
|
7
7
|
/* @__PURE__ */h("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
8
|
-
/* @__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&&
|
|
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
11
|
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=R.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=R.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
@@ -41,12 +41,12 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
41
41
|
/* @__PURE__ */u("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&U(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:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>
|
|
44
|
+
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:R,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>C(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),U(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),D({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-white p-[1in] shadow text-sm leading-relaxed text-gray-800 outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-gray-800 bg-white outline-none whitespace-pre-wrap"})})}),b&&/* @__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"})}),N&&/* @__PURE__ */h(o,{minWidth:150,style:{left:N.x,top:N.y},onClose:()=>D(null),children:[
|
|
45
45
|
/* @__PURE__ */u(l,{children:"Image width"}),
|
|
46
|
-
/* @__PURE__ */u(i,{onClick:()=>
|
|
47
|
-
/* @__PURE__ */u(i,{onClick:()=>
|
|
48
|
-
/* @__PURE__ */u(i,{onClick:()=>
|
|
49
|
-
/* @__PURE__ */u(i,{onClick:()=>
|
|
50
|
-
/* @__PURE__ */u(i,{onClick:()=>
|
|
46
|
+
/* @__PURE__ */u(i,{onClick:()=>T("25%"),children:"25%"}),
|
|
47
|
+
/* @__PURE__ */u(i,{onClick:()=>T("50%"),children:"50%"}),
|
|
48
|
+
/* @__PURE__ */u(i,{onClick:()=>T("75%"),children:"75%"}),
|
|
49
|
+
/* @__PURE__ */u(i,{onClick:()=>T("100%"),children:"100%"}),
|
|
50
|
+
/* @__PURE__ */u(i,{onClick:()=>T(null),children:"Original size"}),
|
|
51
51
|
/* @__PURE__ */u(a,{}),
|
|
52
|
-
/* @__PURE__ */u(i,{danger:!0,onClick:()=>{
|
|
52
|
+
/* @__PURE__ */u(i,{danger:!0,onClick:()=>{N?.el.remove(),C(!0),D(null)},children:"Remove image"})]})]})}export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-C4D4L2E5.js";import{SidebarLayout as t}from"./chunk-JK3QY266.js";import"./chunk-QWK6DRSN.js";import"./chunk-XSY22PWH.js";import{Breadcrumbs as r}from"./chunk-BKV6PH3R.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-OIVLPNOR.js";import{AboutApp as s}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-C4D4L2E5.js";import{SidebarLayout as t}from"./chunk-JK3QY266.js";import"./chunk-QWK6DRSN.js";import"./chunk-XSY22PWH.js";import{Breadcrumbs as r}from"./chunk-BKV6PH3R.js";import{formatBytes as a}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as n}from"./chunk-OIVLPNOR.js";import{AboutApp as s}from"./chunk-KA4RAVCT.js";import{peekFilesViewRequest as i,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-O4NTKMC5.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-H7BP5LLG.js";import"./chunk-TPDOOCFS.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BXRWPGAT.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-CJUN2VOD.js";import"./chunk-4A2X6KLQ.js";import{confirm as g,prompt as y}from"./chunk-CP6FITHO.js";import"./chunk-OZ2ALRKX.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-KC3EX26K.js";import{toast_default as b}from"./chunk-2LKH6JM5.js";import"./chunk-RAHIWTPJ.js";import"./chunk-GZCAFWWB.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-BOGBLZKS.js";import"./chunk-CDAJKLGL.js";import{TH_ONE_LINE as k}from"./chunk-QMQVOUIV.js";import"./chunk-FFNV7UGR.js";import"./chunk-FSP63GKK.js";import"./chunk-K7U4RWXJ.js";import"./chunk-ABJ4LWOW.js";import{Icon as N}from"./chunk-C2HHGLLR.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as w}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-Z3WKHMVB.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-T53TXXOC.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-OVNRVFWS.js";import"./chunk-C3QOHMR6.js";import{useState as v,useEffect as j,useSyncExternalStore as $,useRef as C,useCallback as L}from"react";import{jsxs as D,jsx as R,Fragment as T}from"react/jsx-runtime";var E="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",W={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 O(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 S(){const S=E.replace(/\/$/,""),F=null!==n(),[M,A]=v("/"),[I,K]=v([]),[U,V]=v([]),[J,B]=v(null),[H,G]=v(!0),[X,Q]=v(!1),[z,Z]=v(null),[_,Y]=v(!1),[q,ee]=v(()=>{const e=i();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});j(()=>{o()},[]);const[te,re]=v([]);j(()=>{const e=()=>{o(),ee("trash")},t=e=>{o();const t=e.detail?.folderId;t&&ee({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const ae=$(d,m,m),ne="object"==typeof q?q.desktopFolderId:null,se=ne?ae?.folders.find(e=>e.id===ne)??null:null,ie=ne&&ae?.itemsByFolder[ne]||[];j(()=>{ne&&ae&&!ae.folders.some(e=>e.id===ne)&&ee("files")},[ne,ae]);const oe=C(0),le=C(null),{openPage:ce,openEntity:de}=f(),me=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>ce(e)}):"page"===t.entityType?ce(t.entityId):de(t.entityType,t.entityId,null,t.label)},he=L((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),pe=L(async()=>{try{const e=await he(`${S}/api/quota`);if(e.ok){const t=await e.json();Z({used:t.used,limit:t.limit})}}catch{}},[he,S]),ue=L(async e=>{if(B(null),F){const t=function(e){const t=n();if(!t)return[];let r=t;for(const t of e.split("/").filter(Boolean)){const e=r.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];r=e.children}return r.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return K(t),A(e),Q(!1),G(!1),void("/"===e&&V(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}G(!0);try{const t=await he(`${S}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void b.error(e.error||`Failed to list (${t.status})`)}const r=await t.json(),a=r.entries||[];K(a),A(r.path||e),Q(!1),"/"===(r.path||e)&&V(a.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Q(!0)}finally{G(!1)}pe()},[he,S,pe,F]),fe=L(async()=>{if(F)return re([]),void G(!1);G(!0),B(null);try{const e=await he(`${S}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void b.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();re(t.entries||[]),Q(!1)}catch{Q(!0)}finally{G(!1)}pe()},[he,S,pe,F]);j(()=>{"files"===q?ue(M):"trash"===q&&fe()},[M,q]);const xe=async e=>{const t=O(M,e.name);try{const r=await he(`${S}/api/file?path=${encodeURIComponent(t)}`);if(!r.ok)return void b.error(`Download failed (${r.status})`);const a=await r.blob(),n=URL.createObjectURL(a),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){b.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 r=await he(`${S}/api/upload?path=${encodeURIComponent(M)}`,{method:"POST",body:t});if(!r.ok){const t=await r.json().catch(()=>({}));if(413===r.status){const r=Math.max(0,(t.limit||0)-(t.used||0));b.error(`Quota exceeded — ${a(r)} free, ${e.name} is ${a(t.attempted||e.size)}`)}else b.error(`Upload ${e.name}: ${t.error||r.status}`)}}catch(t){b.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}ue(M)},ye=()=>{oe.current=0,Y(!1)};if(j(()=>{const e=()=>ye();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),X)/* @__PURE__ */
|
|
2
2
|
return D("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */R(x,{title:"Files - offline"}),
|
|
4
4
|
/* @__PURE__ */R("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */D("div",{className:"max-w-md",children:[
|
|
@@ -7,22 +7,22 @@ return D("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
7
7
|
/* @__PURE__ */D("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
8
|
/* @__PURE__ */R("span",{className:"font-mono",children:S}),". Make sure the server is running — see ",
|
|
9
9
|
/* @__PURE__ */R("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
-
/* @__PURE__ */R("button",{onClick:()=>ue(M),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===M?[]:M.split("/").filter(Boolean),ke=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>
|
|
10
|
+
/* @__PURE__ */R("button",{onClick:()=>ue(M),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const be="/"===M?[]:M.split("/").filter(Boolean),ke=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,Ne=ke>90?"bg-red-500":ke>75?"bg-amber-500":"bg-blue-500",we=[{label:"My files",onClick:()=>A("/")},...be.map((e,t)=>({label:e,onClick:()=>A("/"+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"),je=e=>/* @__PURE__ */R("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__ */R("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),$e=/* @__PURE__ */D("nav",{className:"p-2",children:[
|
|
11
11
|
/* @__PURE__ */R("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
12
|
-
/* @__PURE__ */D("button",{onClick:()=>{ee("files"),
|
|
13
|
-
/* @__PURE__ */R("span",{className:"truncate",children:e})]},e)),!
|
|
12
|
+
/* @__PURE__ */D("button",{onClick:()=>{ee("files"),A("/")},className:ve("files"===q&&"/"===M),children:[je("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"]}),U.map(e=>/* @__PURE__ */D("button",{onClick:()=>{ee("files"),A("/"+e)},className:ve("files"===q&&M==="/"+e),children:[je("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__ */R("span",{className:"truncate",children:e})]},e)),!F&&/* @__PURE__ */D("button",{onClick:()=>ee("trash"),className:ve("trash"===q),children:[je("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"]}),ae&&ae.folders.length>0&&/* @__PURE__ */D(T,{children:[
|
|
14
14
|
/* @__PURE__ */R("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Desktop"}),ae.folders.map(e=>/* @__PURE__ */D("button",{onClick:()=>ee({desktopFolderId:e.id}),className:ve(ne===e.id),children:[
|
|
15
15
|
/* @__PURE__ */R(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
16
|
/* @__PURE__ */R("span",{className:"truncate",children:e.name}),e.itemCount>0&&/* @__PURE__ */R("span",{className:"ml-auto text-2xs text-gray-400 tabular-nums",children:e.itemCount})]},e.id))]})]});/* @__PURE__ */
|
|
17
|
-
return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{
|
|
17
|
+
return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{F||"object"==typeof q||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),oe.current++,_||Y(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{oe.current>0&&oe.current--,0===oe.current&&Y(!1)},onDrop:e=>{e.preventDefault(),ye(),F||"object"==typeof q||e.dataTransfer.files?.length&&ge(e.dataTransfer.files)},children:[
|
|
18
18
|
/* @__PURE__ */R(x,{title:se?`Files - ${se.name}`:"Files"+("/"===M?"":" - "+M)}),
|
|
19
19
|
/* @__PURE__ */R(s,{app:"files"}),
|
|
20
20
|
/* @__PURE__ */R("input",{ref:le,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ge(e.target.files),le.current&&(le.current.value="")}}),
|
|
21
21
|
/* @__PURE__ */R("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */R(t,{sidebar:$e,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */D("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
22
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__ */R("button",{onClick:()=>
|
|
23
|
+
/* @__PURE__ */R("button",{onClick:()=>A(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}(M)),disabled:"/"===M,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */R(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
24
24
|
/* @__PURE__ */R("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */R(r,{items:we,maxItems:5})}),
|
|
25
|
-
/* @__PURE__ */R("button",{onClick:()=>ue(M),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */R(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!
|
|
25
|
+
/* @__PURE__ */R("button",{onClick:()=>ue(M),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */R(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!F&&/* @__PURE__ */D(T,{children:[
|
|
26
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__ */R(N,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
28
28
|
/* @__PURE__ */D("button",{onClick:async()=>{const e=await y({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void b.error("Folder names cannot contain slashes");const t=O(M,e),r=await he(`${S}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Create folder failed (${r.status})`)}ue(M)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
@@ -47,7 +47,7 @@ return D("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
47
47
|
/* @__PURE__ */R("th",{className:`${k} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
|
|
48
48
|
/* @__PURE__ */R("th",{className:`${k} w-56`})]})}),
|
|
49
49
|
/* @__PURE__ */R("tbody",{children:ie.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
50
|
-
return D("tr",{onClick:()=>
|
|
50
|
+
return D("tr",{onClick:()=>B(t),onDoubleClick:()=>me(e),className:"cursor-default border-b border-gray-100 "+(J===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
51
51
|
/* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:[
|
|
52
52
|
/* @__PURE__ */R(p,{item:e}),
|
|
53
53
|
/* @__PURE__ */R("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
@@ -55,7 +55,7 @@ return D("tr",{onClick:()=>H(t),onDoubleClick:()=>me(e),className:"cursor-defaul
|
|
|
55
55
|
/* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
56
56
|
/* @__PURE__ */R("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__ */R("button",{onClick:t=>{t.stopPropagation(),ae?.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__ */R("button",{onClick:t=>{t.stopPropagation(),ae?.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?
|
|
58
|
+
/* @__PURE__ */R("button",{onClick:t=>{t.stopPropagation(),ae?.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__ */R(w,{size:"sm",padding:"p-6",label:"Loading"}):0===te.length?/* @__PURE__ */R("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
59
|
/* @__PURE__ */R("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
|
|
60
60
|
/* @__PURE__ */R("th",{className:`${k} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
61
61
|
/* @__PURE__ */R("th",{className:`${k} text-left font-medium px-3 h-8`,children:"Original location"}),
|
|
@@ -70,18 +70,18 @@ return D("tr",{onClick:()=>H(t),onDoubleClick:()=>me(e),className:"cursor-defaul
|
|
|
70
70
|
/* @__PURE__ */R("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:e.deletedAt?P(e.deletedAt):"—"}),
|
|
71
71
|
/* @__PURE__ */D("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
72
72
|
/* @__PURE__ */R("button",{onClick:()=>(async e=>{const t=await he(`${S}/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 b.error(e.error||`Restore failed (${t.status})`)}b.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__ */R("button",{onClick:()=>(async e=>{if(!await g({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(`${S}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.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))})]}):
|
|
73
|
+
/* @__PURE__ */R("button",{onClick:()=>(async e=>{if(!await g({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(`${S}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void b.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===I.length?/* @__PURE__ */R(w,{size:"sm",padding:"p-6",label:"Loading"}):0===I.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!F&&/* @__PURE__ */D(T,{children:[" Drop files here or click ",
|
|
74
74
|
/* @__PURE__ */R("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */D("table",{className:"w-full text-sm",children:[
|
|
75
75
|
/* @__PURE__ */R("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */D("tr",{children:[
|
|
76
76
|
/* @__PURE__ */R("th",{className:`${k} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
77
77
|
/* @__PURE__ */R("th",{className:`${k} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
78
78
|
/* @__PURE__ */R("th",{className:`${k} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
|
|
79
79
|
/* @__PURE__ */R("th",{className:`${k} w-32`})]})}),
|
|
80
|
-
/* @__PURE__ */R("tbody",{children:
|
|
80
|
+
/* @__PURE__ */R("tbody",{children:I.map(t=>/* @__PURE__ */D("tr",{onClick:()=>B(t.name),onDoubleClick:()=>{"folder"===t.kind?A(O(M,t.name)):(async t=>{if(F)return;const r=O(M,t.name),a=(t.name.split(".").pop()||"").toLowerCase(),n=W[a];n?await e({filePath:r,filename:t.name,kind:n,onStaged:e=>ce(e)}):xe(t)})(t)},className:"cursor-default border-b border-gray-100 "+(J===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
81
81
|
/* @__PURE__ */D("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */R(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */R(N,{name:"page",className:"h-4 w-4 text-gray-400 shrink-0",strokeWidth:1.5}),
|
|
82
82
|
/* @__PURE__ */R("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
83
83
|
/* @__PURE__ */R("td",{className:"px-3 h-8 text-right tabular-nums text-gray-500",children:"folder"===t.kind?"—":a(t.size)}),
|
|
84
84
|
/* @__PURE__ */R("td",{className:"px-3 h-8 text-right text-gray-500 tabular-nums",children:P(t.modifiedAt)}),
|
|
85
|
-
/* @__PURE__ */R("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!
|
|
85
|
+
/* @__PURE__ */R("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!F&&/* @__PURE__ */D(T,{children:["file"===t.kind&&/* @__PURE__ */R("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
86
|
/* @__PURE__ */R("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await y({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void b.error("Names cannot contain slashes");const r=O(M,e.name),a=O(M,t),n=await he(`${S}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:r,to:a})});if(!n.ok){const e=await n.json().catch(()=>({}));return void b.error(e.error||`Rename failed (${n.status})`)}ue(M)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-gray-500 text-2xs ml-1",children:"Rename"}),
|
|
87
87
|
/* @__PURE__ */R("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=O(M,e.name),r=await he(`${S}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!r.ok){const e=await r.json().catch(()=>({}));return void b.error(e.error||`Delete failed (${r.status})`)}ue(M)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */R("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__ */R("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{S as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-P25GL5BQ.js";import{SidebarLayout as t}from"./chunk-JK3QY266.js";import"./chunk-QWK6DRSN.js";import"./chunk-XSY22PWH.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{$&&U();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,...T];Q(t),
|
|
1
|
+
import{getNumberingConfigs as e}from"./chunk-P25GL5BQ.js";import{SidebarLayout as t}from"./chunk-JK3QY266.js";import"./chunk-QWK6DRSN.js";import"./chunk-XSY22PWH.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-KA4RAVCT.js";import{useWindowManager as o,client_default as i}from"./chunk-H7BP5LLG.js";import"./chunk-TPDOOCFS.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BXRWPGAT.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-CJUN2VOD.js";import"./chunk-4A2X6KLQ.js";import"./chunk-CP6FITHO.js";import"./chunk-OZ2ALRKX.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import{toast_default as c}from"./chunk-2LKH6JM5.js";import"./chunk-RAHIWTPJ.js";import"./chunk-GZCAFWWB.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-BOGBLZKS.js";import"./chunk-CDAJKLGL.js";import"./chunk-QMQVOUIV.js";import"./chunk-FFNV7UGR.js";import"./chunk-FSP63GKK.js";import"./chunk-K7U4RWXJ.js";import"./chunk-ABJ4LWOW.js";import{Icon as a}from"./chunk-C2HHGLLR.js";import"./chunk-J75ZT2JQ.js";import"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-Z3WKHMVB.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-T53TXXOC.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-OVNRVFWS.js";import"./chunk-C3QOHMR6.js";import{useRef as l,useEffect as p,useState as d,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 k={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/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:v,save:N}=s(),{data:j}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=l({});p(()=>{if(!j)return;const e={};for(const t of j){const r=k[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})}}w.current=e},[j]);const T=v.notepad_notes||[],[_,W]=d(null),[C,R]=d(""),[K,S]=d(""),[X,O]=d("yellow"),[$,D]=d(!1),[G,J]=d(!1),L=l(null),P=l(),V=T.find(e=>e.id===_);p(()=>{if(!_&&T.length>0){const e=T[0];W(e.id),R(e.title),S(e.content),O(e.color)}},[T.length]);const Q=m(e=>{N({notepad_notes:e})},[N]),U=m(()=>{if(!_||!$)return;const e=T.map(e=>e.id===_?{...e,title:C,content:K,color:X,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);Q(e),D(!1)},[_,$,C,K,X,T,Q]);p(()=>{if($)return P.current&&clearTimeout(P.current),P.current=setTimeout(U,800),()=>{P.current&&clearTimeout(P.current)}},[$,U]),p(()=>()=>{$&&U()},[]);const A=e=>{$&&U(),W(e.id),R(e.title),S(e.content),O(e.color),D(!1),J(!1)},M=e=>{const t=K.slice(0,e),r=K.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=K.slice(e+r[0].length);S(t+n+o),D(!0)},B=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},H="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.)",I=/* @__PURE__ */h(y,{children:[
|
|
2
|
+
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{$&&U();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,...T];Q(t),W(e.id),R(""),S(""),O("yellow"),D(!1),J(!0),setTimeout(()=>L.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(a,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
4
4
|
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===T.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."}):T.map(e=>{const t=(n=e.color,x.find(e=>e.key===n)||x[0]);var n;/* @__PURE__ */
|
|
5
|
-
return h("button",{onClick:()=>
|
|
5
|
+
return h("button",{onClick:()=>A(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(_===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
6
6
|
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
7
|
/* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
8
|
/* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(a,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
|
|
@@ -10,13 +10,13 @@ return h("button",{onClick:()=>H(e),className:"w-full text-left px-3 py-3 border
|
|
|
10
10
|
/* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
11
|
return h("div",{className:"h-full",children:[
|
|
12
12
|
/* @__PURE__ */g(n,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */g(t,{sidebar:
|
|
13
|
+
/* @__PURE__ */g(t,{sidebar:I,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__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:C,onChange:e=>{
|
|
16
|
-
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{O(e.key),D(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${
|
|
17
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);Q(t);const r=t.find(t=>t.id===e);c.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(Q(t),
|
|
19
|
-
return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(K):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:
|
|
15
|
+
/* @__PURE__ */g("input",{value:C,onChange:e=>{R(e.target.value),D(!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:()=>{O(e.key),D(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${X===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=T.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);Q(t);const r=t.find(t=>t.id===e);c.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(_),title:V?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(V?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(a,{name:"bookmark",className:"h-4 w-4",fill:V?.sticky?"currentColor":"none",strokeWidth:1.5})}),
|
|
18
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(Q(t),_===e){const e=t[0];e?A(e):(W(null),R(""),S(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(a,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),G?/* @__PURE__ */g("textarea",{ref:L,value:K,onChange:e=>{S(e.target.value),D(!0)},onBlur:()=>{J(!1),$&&U()},placeholder:H,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:()=>{J(!0),setTimeout(()=>L.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:K?(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 c;for(;null!==(c=s.exec(e));){const e=c[1],t=c[2];if(w.current[e]){const n=c.index,o=c[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>B(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let l=0;for(let e=0;e<r;e++)l+=t[e].length+1;for(;null!==(c=b.exec(e));){const e="x"===c[1]||"X"===c[1],t=c.index,n=l+t;i.push({idx:t,len:c[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>M(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(a,{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 p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
+
return g("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(K):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:H})}),
|
|
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"}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-7A7HRAC6.js";import{ImageAnnotator_default as r}from"./chunk-42U4LJT7.js";import{AboutApp as s}from"./chunk-
|
|
1
|
+
import{PdfViewer as e,ToolbarSlotContext as t,PanelActions as n}from"./chunk-7A7HRAC6.js";import{ImageAnnotator_default as r}from"./chunk-42U4LJT7.js";import{AboutApp as s}from"./chunk-KA4RAVCT.js";import{peekPdfPreviewStage as i,claimPdfPreviewStage as a,PDF_PREVIEW_UPDATE_EVENT as o}from"./chunk-ESL5TDNA.js";import{WindowTitle as l,getActiveModalId as c}from"./chunk-H7BP5LLG.js";import"./chunk-TPDOOCFS.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-BXRWPGAT.js";import"./chunk-5A7MWTXX.js";import"./chunk-Y53KNQKL.js";import"./chunk-CJUN2VOD.js";import"./chunk-4A2X6KLQ.js";import"./chunk-CP6FITHO.js";import"./chunk-OZ2ALRKX.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-KC3EX26K.js";import{toast_default as d}from"./chunk-2LKH6JM5.js";import"./chunk-RAHIWTPJ.js";import"./chunk-GZCAFWWB.js";import"./chunk-UGTRSRIW.js";import"./chunk-QR4RM7PO.js";import"./chunk-BOGBLZKS.js";import"./chunk-CDAJKLGL.js";import"./chunk-QMQVOUIV.js";import"./chunk-FFNV7UGR.js";import"./chunk-FSP63GKK.js";import"./chunk-K7U4RWXJ.js";import"./chunk-ABJ4LWOW.js";import{Icon as u}from"./chunk-C2HHGLLR.js";import"./chunk-J75ZT2JQ.js";import{SpinnerRing as p,LoadingSpinner as m}from"./chunk-Q5MD3VY6.js";import"./chunk-MRJKZWWV.js";import"./chunk-Z3WKHMVB.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-T53TXXOC.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as y,splitAround as x}from"./chunk-OVNRVFWS.js";import"./chunk-C3QOHMR6.js";import{useRef as f,useState as g,useEffect as b}from"react";import{jsxs as w,jsx as v,Fragment as k}from"react/jsx-runtime";var N=!1;function C(e,t){return e?.url&&e.url!==t.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url),t}function A(){const n=f(void 0);void 0===n.current&&(n.current=i());const[r,p]=g(n.current?.data??null);b(()=>{const e=n.current;null!=e&&(a(e),p(t=>t===e.data?t:C(t,e.data)))},[]),b(()=>{const e=n.current?.token;if(null==e)return;const t=t=>{const n=t.detail;n&&n.token===e&&p(e=>C(e,n.data))};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)},[]);const m=f(void 0);b(()=>{m.current=r?.url},[r?.url]);const h=f(null);b(()=>(null!==h.current&&(clearTimeout(h.current),h.current=null),()=>{const e=m.current;e?.startsWith("blob:")&&(h.current=setTimeout(()=>URL.revokeObjectURL(e),0))}),[]);const N=y().preview,A=r?.filename?(E=r.filename).length>24?`${E.slice(0,23)}…`:E:N.untitled;var E;const M=f(null),z=f(null),[j,R]=g(null),[T,D]=g(!1),H=f(0),P=()=>M.current?.click(),O=()=>{H.current=0,D(!1)},I=e=>{const t=e.closest("[data-modal-id]");return!t||c()===t.dataset.modalId};b(()=>{const e=()=>O(),t=()=>O(),n=e=>{"Escape"===e.key&&O()};return window.addEventListener("dragend",e),window.addEventListener("drop",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",t),window.removeEventListener("keydown",n)}},[]);const X=e=>{const t=(e.name.split(".").pop()||"").toLowerCase(),n="pdf"===t?"pdf":"dxf"===t?"dxf":["jpg","jpeg","png","gif","webp","svg","avif","bmp"].includes(t)?"image":["stp","step","stl","obj","gltf","glb","3mf","iges","igs","ply","fbx"].includes(t)?"3d":void 0;if(!n)return void("dwg"===t?d.error(N.dwgUnsupported):d.error(N.unsupportedType(t)));const r=URL.createObjectURL(e);p(t=>(t?.url?.startsWith("blob:")&&t.url!==r&&URL.revokeObjectURL(t.url),{url:r,filename:e.name,kind:n}))},B=/* @__PURE__ */w("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
2
2
|
/* @__PURE__ */v("input",{ref:M,type:"file",accept:".pdf,.dxf,.jpg,.jpeg,.png,.gif,.webp,.svg,.avif,.bmp,.stp,.step,.stl,.obj,.gltf,.glb,.3mf,.iges,.igs,.ply,.fbx",onChange:e=>{const t=e.target.files?.[0];t&&X(t),M.current&&(M.current.value="")},className:"hidden"}),
|
|
3
3
|
/* @__PURE__ */w("button",{onClick:P,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:[
|
|
4
4
|
/* @__PURE__ */v(u,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),N.open]}),
|