@w100n/documents 0.13.0 → 0.15.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.
Files changed (53) hide show
  1. package/dist/{SheetView-3XTEV2VT.css → SheetView-43MPR64N.css} +5 -4
  2. package/dist/{SheetView-3XTEV2VT.css.map → SheetView-43MPR64N.css.map} +1 -1
  3. package/dist/{SheetView-3UAFXGZS.js → SheetView-72KXS4DM.js} +51 -10
  4. package/dist/SheetView-72KXS4DM.js.map +1 -0
  5. package/dist/TextEditor-NSICFE6U.js +1562 -0
  6. package/dist/TextEditor-NSICFE6U.js.map +1 -0
  7. package/dist/{chunk-L765DZPO.js → chunk-2CA3HQTI.js} +3 -3
  8. package/dist/{chunk-L765DZPO.js.map → chunk-2CA3HQTI.js.map} +1 -1
  9. package/dist/{chunk-WR3MT7KP.js → chunk-M4OQG3EN.js} +754 -57
  10. package/dist/chunk-M4OQG3EN.js.map +1 -0
  11. package/dist/{chunk-T7XCGDE5.js → chunk-OXC4PUOC.js} +2 -2
  12. package/dist/{chunk-MRP3EURG.js → chunk-Z7UNJ4ND.js} +194 -25
  13. package/dist/chunk-Z7UNJ4ND.js.map +1 -0
  14. package/dist/collab.cjs +927 -80
  15. package/dist/collab.cjs.map +1 -1
  16. package/dist/collab.d.cts +2 -2
  17. package/dist/collab.d.ts +2 -2
  18. package/dist/collab.js +2 -2
  19. package/dist/{grid-EI5JNZAA.js → grid-Q4XBPQFY.js} +3 -3
  20. package/dist/grid-Q4XBPQFY.js.map +1 -0
  21. package/dist/index.cjs +2136 -420
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.css +1047 -171
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.d.cts +9 -4
  26. package/dist/index.d.ts +9 -4
  27. package/dist/index.js +283 -33
  28. package/dist/index.js.map +1 -1
  29. package/dist/kinds.cjs +2 -2
  30. package/dist/kinds.cjs.map +1 -1
  31. package/dist/kinds.d.cts +2 -2
  32. package/dist/kinds.d.ts +2 -2
  33. package/dist/kinds.js +1 -1
  34. package/dist/memory.cjs +3 -0
  35. package/dist/memory.cjs.map +1 -1
  36. package/dist/memory.d.cts +1 -1
  37. package/dist/memory.d.ts +1 -1
  38. package/dist/memory.js +4 -1
  39. package/dist/memory.js.map +1 -1
  40. package/dist/{types-Er60M5kL.d.ts → types-BTsVooZw.d.cts} +2 -1
  41. package/dist/{types-Er60M5kL.d.cts → types-BTsVooZw.d.ts} +2 -1
  42. package/dist/write-BCI8yool.d.cts +16 -0
  43. package/dist/write-BCI8yool.d.ts +16 -0
  44. package/package.json +1 -1
  45. package/dist/SheetView-3UAFXGZS.js.map +0 -1
  46. package/dist/TextEditor-OLBLWC6F.js +0 -983
  47. package/dist/TextEditor-OLBLWC6F.js.map +0 -1
  48. package/dist/chunk-MRP3EURG.js.map +0 -1
  49. package/dist/chunk-WR3MT7KP.js.map +0 -1
  50. package/dist/grid-EI5JNZAA.js.map +0 -1
  51. package/dist/write-DaVtTJCS.d.cts +0 -6
  52. package/dist/write-DaVtTJCS.d.ts +0 -6
  53. /package/dist/{chunk-T7XCGDE5.js.map → chunk-OXC4PUOC.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,12 +1,17 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, RefObject } from 'react';
3
- import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-Er60M5kL.cjs';
4
- export { C as Comment, b as DocumentKind, c as DocumentSummary, d as DocumentVersion, F as Fetch, e as GuestFile, f as GuestLink, g as LinkEntry, h as Person, S as Signature, i as SignatureMethod, j as Space } from './types-Er60M5kL.cjs';
3
+ import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-BTsVooZw.cjs';
4
+ export { C as Comment, b as DocumentKind, c as DocumentSummary, d as DocumentVersion, F as Fetch, e as GuestFile, f as GuestLink, g as LinkEntry, h as Person, S as Signature, i as SignatureMethod, j as Space } from './types-BTsVooZw.cjs';
5
5
  import { JSONContent } from '@tiptap/core';
6
- import { I as Img } from './write-DaVtTJCS.cjs';
6
+ import { I as Img, S as Setup } from './write-BCI8yool.cjs';
7
7
  export { kindOf, kinds, matches, readable } from './kinds.cjs';
8
8
 
9
9
  type DocxModel = {
10
+ marginal: {
11
+ header: string;
12
+ footer: string;
13
+ numbers: boolean;
14
+ };
10
15
  doc: JSONContent;
11
16
  styles: {
12
17
  name: string;
@@ -20,7 +25,7 @@ type DocxModel = {
20
25
  };
21
26
  };
22
27
  declare function readDocx(bytes: ArrayBuffer): Promise<DocxModel>;
23
- declare function writeDocx(original: ArrayBuffer, doc: JSONContent, load?: (src: string) => Promise<Img>): Promise<ArrayBuffer>;
28
+ declare function writeDocx(original: ArrayBuffer, doc: JSONContent, load?: (src: string) => Promise<Img>, setup?: Setup): Promise<ArrayBuffer>;
24
29
 
25
30
  declare function DocumentOverlay({ source, name, mimeType, info, download, actions, onClose, onOpen, language, theme, worker, host, documentId }: {
26
31
  source: ArrayBuffer | Blob | string;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, RefObject } from 'react';
3
- import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-Er60M5kL.js';
4
- export { C as Comment, b as DocumentKind, c as DocumentSummary, d as DocumentVersion, F as Fetch, e as GuestFile, f as GuestLink, g as LinkEntry, h as Person, S as Signature, i as SignatureMethod, j as Space } from './types-Er60M5kL.js';
3
+ import { L as Language, D as DocumentsHost, P as Place, a as DocumentFile, G as GuestHost, R as Rights } from './types-BTsVooZw.js';
4
+ export { C as Comment, b as DocumentKind, c as DocumentSummary, d as DocumentVersion, F as Fetch, e as GuestFile, f as GuestLink, g as LinkEntry, h as Person, S as Signature, i as SignatureMethod, j as Space } from './types-BTsVooZw.js';
5
5
  import { JSONContent } from '@tiptap/core';
6
- import { I as Img } from './write-DaVtTJCS.js';
6
+ import { I as Img, S as Setup } from './write-BCI8yool.js';
7
7
  export { kindOf, kinds, matches, readable } from './kinds.js';
8
8
 
9
9
  type DocxModel = {
10
+ marginal: {
11
+ header: string;
12
+ footer: string;
13
+ numbers: boolean;
14
+ };
10
15
  doc: JSONContent;
11
16
  styles: {
12
17
  name: string;
@@ -20,7 +25,7 @@ type DocxModel = {
20
25
  };
21
26
  };
22
27
  declare function readDocx(bytes: ArrayBuffer): Promise<DocxModel>;
23
- declare function writeDocx(original: ArrayBuffer, doc: JSONContent, load?: (src: string) => Promise<Img>): Promise<ArrayBuffer>;
28
+ declare function writeDocx(original: ArrayBuffer, doc: JSONContent, load?: (src: string) => Promise<Img>, setup?: Setup): Promise<ArrayBuffer>;
24
29
 
25
30
  declare function DocumentOverlay({ source, name, mimeType, info, download, actions, onClose, onOpen, language, theme, worker, host, documentId }: {
26
31
  source: ArrayBuffer | Blob | string;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  kinds,
5
5
  matches,
6
6
  readable
7
- } from "./chunk-L765DZPO.js";
7
+ } from "./chunk-2CA3HQTI.js";
8
8
  import {
9
9
  useLoad
10
10
  } from "./chunk-QDH7EZAF.js";
@@ -17,7 +17,7 @@ import {
17
17
  readDocx,
18
18
  texts,
19
19
  writeDocx
20
- } from "./chunk-WR3MT7KP.js";
20
+ } from "./chunk-M4OQG3EN.js";
21
21
 
22
22
  // src/DocumentOverlay.tsx
23
23
  import { Download, ExternalLink, FileSpreadsheet, FileText, FileType, Files, Presentation, X as X4 } from "lucide-react";
@@ -2407,8 +2407,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
2407
2407
 
2408
2408
  // src/DocumentOverlay.tsx
2409
2409
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2410
- var TextEditor = lazy(() => import("./TextEditor-OLBLWC6F.js"));
2411
- var SheetView = lazy(() => import("./SheetView-3UAFXGZS.js"));
2410
+ var TextEditor = lazy(() => import("./TextEditor-NSICFE6U.js"));
2411
+ var SheetView = lazy(() => import("./SheetView-72KXS4DM.js"));
2412
2412
  var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
2413
2413
  var read = { view: true, comment: false, edit: false };
2414
2414
  var quiet = () => {
@@ -2515,10 +2515,12 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2515
2515
  import { lazy as lazy2, Suspense as Suspense2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState9 } from "react";
2516
2516
  import { flushSync } from "react-dom";
2517
2517
  import {
2518
+ Bookmark,
2518
2519
  Check as Check2,
2519
2520
  ChevronDown as ChevronDown2,
2520
2521
  ChevronRight as ChevronRight2,
2521
2522
  FileDown,
2523
+ FilePlus,
2522
2524
  FileSpreadsheet as FileSpreadsheet3,
2523
2525
  FileText as FileText3,
2524
2526
  FileType as FileType3,
@@ -2526,6 +2528,7 @@ import {
2526
2528
  History,
2527
2529
  Info,
2528
2530
  LayoutGrid,
2531
+ ListFilter,
2529
2532
  ListTree,
2530
2533
  MessagesSquare,
2531
2534
  PanelLeftClose,
@@ -2538,6 +2541,7 @@ import {
2538
2541
  Search as Search2,
2539
2542
  Share2,
2540
2543
  Signature,
2544
+ Upload,
2541
2545
  X as X6
2542
2546
  } from "lucide-react";
2543
2547
 
@@ -3093,8 +3097,8 @@ function Thumb({ host, item, label }) {
3093
3097
 
3094
3098
  // src/DocumentsWorkspace.tsx
3095
3099
  import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3096
- var TextEditor2 = lazy2(() => import("./TextEditor-OLBLWC6F.js"));
3097
- var SheetView2 = lazy2(() => import("./SheetView-3UAFXGZS.js"));
3100
+ var TextEditor2 = lazy2(() => import("./TextEditor-NSICFE6U.js"));
3101
+ var SheetView2 = lazy2(() => import("./SheetView-72KXS4DM.js"));
3098
3102
  var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
3099
3103
  function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
3100
3104
  const t = texts[language];
@@ -3105,7 +3109,12 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3105
3109
  onPlace?.(next);
3106
3110
  };
3107
3111
  const [query, setQuery] = useState9("");
3108
- const [kind, setKind] = useState9("all");
3112
+ const [picked, setPicked] = useState9([]);
3113
+ const [typing, setTyping] = useState9(false);
3114
+ const [menusAt, setMenusAt] = useState9(null);
3115
+ const [renaming, setRenaming] = useState9(null);
3116
+ const [renamed, setRenamed] = useState9("idle");
3117
+ const [statusAt, setStatusAt] = useState9(null);
3109
3118
  const [listOpen, setListOpen] = useState9(true);
3110
3119
  const [panelOpen, setPanelOpen] = useState9(true);
3111
3120
  const [narrow, setNarrow] = useState9(false);
@@ -3119,13 +3128,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3119
3128
  const el = body.current;
3120
3129
  let was = false;
3121
3130
  const check = () => {
3122
- const now = getComputedStyle(el).getPropertyValue("--docs-narrow").trim() === "1";
3123
- if (now && !was) {
3131
+ const now2 = getComputedStyle(el).getPropertyValue("--docs-narrow").trim() === "1";
3132
+ if (now2 && !was) {
3124
3133
  setPanelOpen(false);
3125
3134
  if (here.documentId) setListOpen(false);
3126
3135
  }
3127
- was = now;
3128
- setNarrow(now);
3136
+ was = now2;
3137
+ setNarrow(now2);
3129
3138
  };
3130
3139
  check();
3131
3140
  if (typeof ResizeObserver === "undefined") return;
@@ -3134,6 +3143,23 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3134
3143
  return () => watch.disconnect();
3135
3144
  }, [here.documentId]);
3136
3145
  const [picking, setPicking] = useState9(false);
3146
+ const [adding, setAdding] = useState9(false);
3147
+ useEffect6(() => {
3148
+ if (!adding) return;
3149
+ const close = (e) => {
3150
+ if (!e.target.closest(".w100n-docs-new")) setAdding(false);
3151
+ };
3152
+ document.addEventListener("pointerdown", close);
3153
+ return () => document.removeEventListener("pointerdown", close);
3154
+ }, [adding]);
3155
+ useEffect6(() => {
3156
+ if (!typing) return;
3157
+ const close = (e) => {
3158
+ if (!e.target.closest(".w100n-docs-types")) setTyping(false);
3159
+ };
3160
+ document.addEventListener("pointerdown", close);
3161
+ return () => document.removeEventListener("pointerdown", close);
3162
+ }, [typing]);
3137
3163
  useEffect6(() => {
3138
3164
  if (!picking) return;
3139
3165
  const close = (e) => {
@@ -3144,6 +3170,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3144
3170
  }, [picking]);
3145
3171
  const [tab, setTab] = useState9("outline");
3146
3172
  const [outline, setOutline] = useState9([]);
3173
+ const [reading, setReading] = useState9(null);
3174
+ const [hunt, setHunt] = useState9("");
3175
+ const [fold, setFold] = useState9({});
3147
3176
  const [version, setVersion] = useState9({ documentId: null, id: null });
3148
3177
  const versionId = version.documentId === here.documentId ? version.id : null;
3149
3178
  const [restoring, setRestoring] = useState9("idle");
@@ -3151,6 +3180,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3151
3180
  const [copying, setCopying] = useState9("idle");
3152
3181
  const [box, setBox] = useState9(null);
3153
3182
  const [making, setMaking] = useState9(false);
3183
+ const [sending, setSending] = useState9("idle");
3184
+ const upload = useRef6(null);
3154
3185
  const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
3155
3186
  const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
3156
3187
  const spaceId = here.spaceId ?? single;
@@ -3161,14 +3192,30 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3161
3192
  const all2 = await host.spaces({ signal });
3162
3193
  return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
3163
3194
  }, [host, spaceId]);
3195
+ useEffect6(() => {
3196
+ const sync = () => {
3197
+ if (document.visibilityState !== "visible") return;
3198
+ spaces.retry();
3199
+ list.retry();
3200
+ };
3201
+ const timer = window.setInterval(sync, 3e4);
3202
+ window.addEventListener("focus", sync);
3203
+ document.addEventListener("visibilitychange", sync);
3204
+ return () => {
3205
+ clearInterval(timer);
3206
+ window.removeEventListener("focus", sync);
3207
+ document.removeEventListener("visibilitychange", sync);
3208
+ };
3209
+ }, []);
3164
3210
  const doc = useLoad((signal) => here.documentId ? host.document(here.documentId, { signal }) : Promise.resolve(null), [host, here.documentId]);
3165
3211
  const versions = useLoad((signal) => here.documentId ? host.versions(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId]);
3166
3212
  const content = useLoad((signal) => here.documentId ? host.content(here.documentId, versionId, { signal }) : Promise.resolve(null), [host, here.documentId, versionId]);
3167
3213
  const pdf = doc.data?.kind === "pdf";
3168
3214
  const text = doc.data?.kind === "markdown" || doc.data?.kind === "docx";
3215
+ const docbar = text && !versionId && !narrow;
3169
3216
  const signatures = useLoad((signal) => here.documentId && pdf && host.signatures ? host.signatures(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId, pdf]);
3170
3217
  const all = list.data ?? [];
3171
- const shown = all.filter((item) => matches(item, query, kind));
3218
+ const shown = all.filter((item) => matches(item, query, picked));
3172
3219
  const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
3173
3220
  const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
3174
3221
  const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
@@ -3206,6 +3253,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3206
3253
  }
3207
3254
  ask(() => {
3208
3255
  setOutline([]);
3256
+ setHunt("");
3257
+ setFold({});
3209
3258
  setTab("outline");
3210
3259
  go({ spaceId: here.spaceId, documentId: item.id });
3211
3260
  if (narrow) setListOpen(false);
@@ -3214,7 +3263,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3214
3263
  const pick = (next) => {
3215
3264
  setPicking(false);
3216
3265
  ask(() => {
3217
- setKind("all");
3266
+ setPicked([]);
3218
3267
  go({ spaceId: next, documentId: null });
3219
3268
  });
3220
3269
  };
@@ -3265,6 +3314,44 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3265
3314
  setCopying("failed");
3266
3315
  }
3267
3316
  };
3317
+ const copy = async (file) => {
3318
+ setCopying("busy");
3319
+ try {
3320
+ const made = await host.create({ name: `${t.copyOf} ${file.name}`, bytes: await host.content(file.id), mimeType: file.mimeType ?? "application/octet-stream" });
3321
+ setCopying("idle");
3322
+ opened(made);
3323
+ } catch {
3324
+ setCopying("failed");
3325
+ }
3326
+ };
3327
+ const rename = async (file, draft) => {
3328
+ setRenaming(null);
3329
+ const ext = /\.[^.]+$/.exec(file.name)?.[0] ?? "";
3330
+ const name = draft.trim() && (/\.[^.\s]+$/.test(draft.trim()) ? draft.trim() : draft.trim() + ext);
3331
+ if (!name || name === file.name) return;
3332
+ try {
3333
+ await host.rename(file.id, name);
3334
+ setRenamed("idle");
3335
+ doc.retry();
3336
+ list.retry();
3337
+ } catch {
3338
+ setRenamed("failed");
3339
+ }
3340
+ };
3341
+ const opened = (made) => {
3342
+ spaces.retry();
3343
+ list.retry();
3344
+ ask(() => go({ spaceId: here.spaceId && made.spaceId, documentId: made.id }));
3345
+ };
3346
+ const send = async (file) => {
3347
+ setSending("busy");
3348
+ try {
3349
+ opened(await host.create({ name: file.name, bytes: await file.arrayBuffer(), mimeType: file.type || "application/octet-stream" }));
3350
+ setSending("idle");
3351
+ } catch {
3352
+ setSending("failed");
3353
+ }
3354
+ };
3268
3355
  let stage = /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-empty", children: [
3269
3356
  /* @__PURE__ */ jsx9(FileText3, { "aria-hidden": true }),
3270
3357
  t.pick
@@ -3287,13 +3374,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3287
3374
  together: doc.data.live,
3288
3375
  documentId: doc.data.id,
3289
3376
  onOutline: setOutline,
3377
+ onReading: setReading,
3290
3378
  onPanel: (next) => {
3291
3379
  setPanelOpen(true);
3292
3380
  setTab(next);
3293
3381
  if (narrow) setListOpen(false);
3294
3382
  },
3295
3383
  slot: tab === "comments" && panelOpen ? box : null,
3384
+ head: docbar ? { menus: menusAt, status: statusAt } : void 0,
3296
3385
  guard,
3386
+ file: versionId ? void 0 : {
3387
+ formats: host.exportAs ? doc.data.exports ?? [] : [],
3388
+ download: (f) => void exportAs(doc.data, f),
3389
+ copy: host.create ? () => void copy(doc.data) : void 0,
3390
+ rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0
3391
+ },
3297
3392
  onSaved: () => {
3298
3393
  versions.retry();
3299
3394
  doc.retry();
@@ -3373,6 +3468,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3373
3468
  else stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.unsupported });
3374
3469
  }
3375
3470
  const Kind = doc.data ? icons3[doc.data.kind] : FileText3;
3471
+ const top = Math.min(...outline.map((h) => h.level));
3472
+ const chapters = outline.reduce((all2, h) => {
3473
+ if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
3474
+ else all2[all2.length - 1].subs.push(h);
3475
+ return all2;
3476
+ }, []);
3477
+ const now = reading?.documentId === here.documentId ? reading : null;
3478
+ const reached = now ? chapters.findIndex((c) => c.head.id === now.id || c.subs.some((s) => s.id === now.id)) : -1;
3479
+ const words = hunt.toLocaleLowerCase().split(/\s+/).filter(Boolean);
3480
+ const hit = (h) => words.every((w) => h.text.toLocaleLowerCase().includes(w));
3481
+ const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
3376
3482
  const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
3377
3483
  const panelTabs = [["outline", ListTree, t.outline], ["versions", History, t.versions], ["details", Info, t.details]];
3378
3484
  if (pdf && host.signatures) panelTabs.push(["signatures", Signature, t.signatures]);
@@ -3411,13 +3517,38 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3411
3517
  narrow && listToggle,
3412
3518
  /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx9(Kind, { "aria-hidden": true }) }),
3413
3519
  /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-heading", children: [
3414
- /* @__PURE__ */ jsx9("strong", { className: "w100n-docs-title", children: doc.data?.name ?? t.documents }),
3415
- crumbs.length > 0 ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs9("span", { children: [
3520
+ renaming !== null && doc.data ? /* @__PURE__ */ jsx9(
3521
+ "input",
3522
+ {
3523
+ className: "w100n-docs-title w100n-docs-rename",
3524
+ autoFocus: true,
3525
+ value: renaming,
3526
+ "aria-label": t.rename,
3527
+ onFocus: (e) => e.currentTarget.select(),
3528
+ onChange: (e) => setRenaming(e.target.value),
3529
+ onBlur: () => void rename(doc.data, renaming),
3530
+ onKeyDown: (e) => {
3531
+ if (e.key === "Enter") e.currentTarget.blur();
3532
+ if (e.key === "Escape") {
3533
+ e.stopPropagation();
3534
+ setRenaming(null);
3535
+ }
3536
+ }
3537
+ }
3538
+ ) : /* @__PURE__ */ jsx9(
3539
+ "strong",
3540
+ {
3541
+ className: "w100n-docs-title",
3542
+ title: docbar ? crumbs.join(" / ") : void 0,
3543
+ onDoubleClick: host.rename && doc.data?.rights.edit && !versionId ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0,
3544
+ children: doc.data?.name ?? t.documents
3545
+ }
3546
+ ),
3547
+ docbar ? /* @__PURE__ */ jsx9("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs9("span", { children: [
3416
3548
  i > 0 && /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true }),
3417
3549
  item
3418
3550
  ] }, i)) }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-hint", children: t.hint })
3419
3551
  ] }),
3420
- doc.data && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", "data-kind": doc.data.kind, children: t.kinds[doc.data.kind] }),
3421
3552
  versionId && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
3422
3553
  versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
3423
3554
  /* @__PURE__ */ jsx9(RotateCcw2, { "aria-hidden": true }),
@@ -3429,6 +3560,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3429
3560
  t.copyAs
3430
3561
  ] }),
3431
3562
  copying === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.copyFailed }),
3563
+ renamed === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.renameFailed }),
3564
+ docbar && /* @__PURE__ */ jsx9("span", { ref: setStatusAt, className: "w100n-docs-status" }),
3432
3565
  sharing && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
3433
3566
  setTab("sharing");
3434
3567
  side("panel", true);
@@ -3437,10 +3570,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3437
3570
  /* @__PURE__ */ jsx9("span", { children: t.share })
3438
3571
  ] }),
3439
3572
  doc.data && !versionId && actions?.(doc.data),
3440
- host.create && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-label": t.create, title: t.create, onClick: () => setMaking(true), children: [
3441
- /* @__PURE__ */ jsx9(Plus4, { "aria-hidden": true }),
3442
- /* @__PURE__ */ jsx9("span", { children: t.create })
3443
- ] }),
3444
3573
  narrow && panelToggle,
3445
3574
  end && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
3446
3575
  ] }),
@@ -3453,6 +3582,39 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3453
3582
  t.documents,
3454
3583
  /* @__PURE__ */ jsx9("span", { children: all.length })
3455
3584
  ] }),
3585
+ host.create && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-new", onKeyDown: (e) => {
3586
+ if (e.key === "Escape" && adding) {
3587
+ e.stopPropagation();
3588
+ setAdding(false);
3589
+ }
3590
+ }, children: [
3591
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
3592
+ /* @__PURE__ */ jsx9(Plus4, { "aria-hidden": true }),
3593
+ /* @__PURE__ */ jsx9("span", { children: sending === "busy" ? t.uploading : t.create }),
3594
+ /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
3595
+ ] }),
3596
+ adding && /* @__PURE__ */ jsxs9("div", { role: "menu", className: "w100n-docs-menu", children: [
3597
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
3598
+ setAdding(false);
3599
+ setMaking(true);
3600
+ }, children: [
3601
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(FilePlus, { "aria-hidden": true }) }),
3602
+ /* @__PURE__ */ jsx9("b", { children: t.newTitle })
3603
+ ] }),
3604
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
3605
+ setAdding(false);
3606
+ upload.current.click();
3607
+ }, children: [
3608
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(Upload, { "aria-hidden": true }) }),
3609
+ /* @__PURE__ */ jsx9("b", { children: t.uploadFile })
3610
+ ] })
3611
+ ] }),
3612
+ /* @__PURE__ */ jsx9("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
3613
+ const file = e.target.files?.[0];
3614
+ e.target.value = "";
3615
+ if (file) void send(file);
3616
+ } })
3617
+ ] }),
3456
3618
  /* @__PURE__ */ jsx9("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
3457
3619
  ] }),
3458
3620
  (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
@@ -3484,16 +3646,48 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3484
3646
  ] }, group))
3485
3647
  ] })
3486
3648
  ] }),
3487
- /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3488
- /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3489
- /* @__PURE__ */ jsx9("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
3649
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-filters", children: [
3650
+ /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3651
+ /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3652
+ /* @__PURE__ */ jsx9("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
3653
+ ] }),
3654
+ present.length > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-types", onKeyDown: (e) => {
3655
+ if (e.key !== "Escape" || !typing) return;
3656
+ e.stopPropagation();
3657
+ setTyping(false);
3658
+ e.currentTarget.querySelector("button").focus();
3659
+ }, children: [
3660
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
3661
+ /* @__PURE__ */ jsx9(ListFilter, { "aria-hidden": true }),
3662
+ /* @__PURE__ */ jsx9("b", { children: t.typeFilter }),
3663
+ picked.length > 0 && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: picked.length }),
3664
+ /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
3665
+ ] }),
3666
+ typing && /* @__PURE__ */ jsxs9("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
3667
+ present.map((item) => {
3668
+ const Icon = icons3[item];
3669
+ const on = picked.includes(item);
3670
+ return /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": on, onClick: () => setPicked(on ? picked.filter((k) => k !== item) : [...picked, item]), children: [
3671
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-box", children: on && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true }) }),
3672
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }) }),
3673
+ /* @__PURE__ */ jsx9("b", { children: t.kinds[item] }),
3674
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
3675
+ ] }, item);
3676
+ }),
3677
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-menu-foot", children: [
3678
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
3679
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
3680
+ ] })
3681
+ ] })
3682
+ ] })
3490
3683
  ] }),
3491
- present.length > 1 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: ["all", ...present].map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": kind === item, onClick: () => setKind(item), children: [
3492
- item === "all" ? t.all : t.kinds[item],
3493
- /* @__PURE__ */ jsx9("span", { "aria-hidden": true, children: item === "all" ? all.length : all.filter((doc2) => doc2.kind === item).length })
3684
+ picked.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
3685
+ t.kinds[item],
3686
+ /* @__PURE__ */ jsx9(X6, { "aria-hidden": true })
3494
3687
  ] }, item)) })
3495
3688
  ] }),
3496
3689
  /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-cards", children: [
3690
+ sending === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
3497
3691
  list.error && failed(list.retry),
3498
3692
  list.loading && !list.data && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.loading }),
3499
3693
  list.data && !shown.length && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
@@ -3518,12 +3712,70 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3518
3712
  /* @__PURE__ */ jsx9("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-row", children: [
3519
3713
  /* @__PURE__ */ jsx9("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key, Icon, label]) => /* @__PURE__ */ jsxs9("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
3520
3714
  /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }),
3521
- (panelTabs.length < 4 || tab === key) && label
3715
+ (panelTabs.length < 4 || tab === key && panelTabs.length < 5) && /* @__PURE__ */ jsx9("span", { children: label })
3522
3716
  ] }, key)) }),
3523
3717
  /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
3524
3718
  ] }) }),
3525
3719
  /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
3526
- tab === "outline" && (outline.length ? /* @__PURE__ */ jsx9("nav", { className: "w100n-docs-outline", children: outline.map((item) => /* @__PURE__ */ jsx9("button", { type: "button", "data-level": item.level, onClick: () => item.go ? item.go() : document.getElementById(item.id)?.scrollIntoView({ behavior: "smooth", block: "start" }), children: item.text }, item.id)) }) : /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noOutline })),
3720
+ tab === "outline" && (outline.length ? /* @__PURE__ */ jsxs9("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
3721
+ now && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-reading", children: [
3722
+ /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
3723
+ /* @__PURE__ */ jsxs9("small", { children: [
3724
+ Math.round(now.progress * 100),
3725
+ "% ",
3726
+ t.read
3727
+ ] })
3728
+ ] }),
3729
+ outline.length > 8 && /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3730
+ /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3731
+ /* @__PURE__ */ jsx9("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
3732
+ ] }),
3733
+ chapters.map((c, i) => {
3734
+ const subs = words.length ? c.subs.filter(hit) : c.subs;
3735
+ if (words.length && !hit(c.head) && !subs.length) return null;
3736
+ const opened2 = words.length > 0 || (fold[c.head.id] ?? i === reached);
3737
+ const named = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
3738
+ const mark = c.subs.findIndex((s) => s.id === now?.id);
3739
+ return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
3740
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter-row", children: [
3741
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-chapter-go", "aria-label": c.head.text, "aria-current": now?.id === c.head.id ? "location" : void 0, onClick: () => reach(c.head), children: [
3742
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-chapter-num", children: named ? named[1] : /* @__PURE__ */ jsx9(Bookmark, { "aria-hidden": true }) }),
3743
+ /* @__PURE__ */ jsx9("b", { children: named ? named[2] : c.head.text })
3744
+ ] }),
3745
+ c.subs.length > 0 && /* @__PURE__ */ jsxs9(
3746
+ "button",
3747
+ {
3748
+ type: "button",
3749
+ className: "w100n-docs-chapter-fold",
3750
+ "aria-expanded": opened2,
3751
+ "aria-label": opened2 ? t.hideSections : t.showSections,
3752
+ title: opened2 ? t.hideSections : t.showSections,
3753
+ onClick: () => setFold({ ...fold, [c.head.id]: !opened2 }),
3754
+ children: [
3755
+ /* @__PURE__ */ jsx9("small", { children: c.subs.length }),
3756
+ opened2 ? /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true })
3757
+ ]
3758
+ }
3759
+ )
3760
+ ] }),
3761
+ opened2 && subs.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs9(
3762
+ "button",
3763
+ {
3764
+ type: "button",
3765
+ "data-level": s.level - top,
3766
+ onClick: () => reach(s),
3767
+ "data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
3768
+ "aria-current": now?.id === s.id ? "location" : void 0,
3769
+ children: [
3770
+ /* @__PURE__ */ jsx9("i", { "aria-hidden": true }),
3771
+ s.text
3772
+ ]
3773
+ },
3774
+ s.id
3775
+ )) })
3776
+ ] }, c.head.id);
3777
+ })
3778
+ ] }) : /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noOutline })),
3527
3779
  tab === "versions" && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-versions", children: [
3528
3780
  versions.error && failed(versions.retry),
3529
3781
  (versions.data ?? []).map((item) => /* @__PURE__ */ jsxs9(
@@ -3614,9 +3866,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3614
3866
  ] }),
3615
3867
  making && /* @__PURE__ */ jsx9(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
3616
3868
  setMaking(false);
3617
- spaces.retry();
3618
- list.retry();
3619
- ask(() => go({ spaceId: here.spaceId && made.spaceId, documentId: made.id }));
3869
+ opened(made);
3620
3870
  } }),
3621
3871
  dialog
3622
3872
  ] });
@@ -3626,8 +3876,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3626
3876
  import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState10 } from "react";
3627
3877
  import { Ban as Ban2, Download as Download3, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet4, FileText as FileText4, FileType as FileType4, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
3628
3878
  import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3629
- var TextEditor3 = lazy3(() => import("./TextEditor-OLBLWC6F.js"));
3630
- var SheetView3 = lazy3(() => import("./SheetView-3UAFXGZS.js"));
3879
+ var TextEditor3 = lazy3(() => import("./TextEditor-NSICFE6U.js"));
3880
+ var SheetView3 = lazy3(() => import("./SheetView-72KXS4DM.js"));
3631
3881
  var icons4 = { docx: FileText4, markdown: FileType4, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
3632
3882
  var GuestRefused = class extends Error {
3633
3883
  constructor(reason, file = "", sharedBy = "") {