@w100n/documents 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SheetView-43JDIP7D.js → SheetView-PUSRW7W2.js} +3 -3
- package/dist/{TextEditor-CYS4U5XA.js → TextEditor-Z4KSBLBV.js} +3 -3
- package/dist/{chunk-ZCSHH24C.js → chunk-JSJEB2CO.js} +192 -60
- package/dist/chunk-JSJEB2CO.js.map +1 -0
- package/dist/{chunk-DATYTA4H.js → chunk-ZQYSBWLK.js} +2 -2
- package/dist/collab.cjs +326 -187
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.d.cts +27 -1
- package/dist/collab.d.ts +27 -1
- package/dist/collab.js +9 -1
- package/dist/index.cjs +373 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +134 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +375 -402
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-ZCSHH24C.js.map +0 -1
- /package/dist/{SheetView-43JDIP7D.js.map → SheetView-PUSRW7W2.js.map} +0 -0
- /package/dist/{TextEditor-CYS4U5XA.js.map → TextEditor-Z4KSBLBV.js.map} +0 -0
- /package/dist/{chunk-DATYTA4H.js.map → chunk-ZQYSBWLK.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2412,8 +2412,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
2412
2412
|
|
|
2413
2413
|
// src/DocumentOverlay.tsx
|
|
2414
2414
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2415
|
-
var TextEditor = lazy(() => import("./TextEditor-
|
|
2416
|
-
var SheetView = lazy(() => import("./SheetView-
|
|
2415
|
+
var TextEditor = lazy(() => import("./TextEditor-Z4KSBLBV.js"));
|
|
2416
|
+
var SheetView = lazy(() => import("./SheetView-PUSRW7W2.js"));
|
|
2417
2417
|
var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
|
|
2418
2418
|
var read = { view: true, comment: false, edit: false };
|
|
2419
2419
|
var quiet = () => {
|
|
@@ -2537,12 +2537,10 @@ import {
|
|
|
2537
2537
|
FilePlus,
|
|
2538
2538
|
FileSpreadsheet as FileSpreadsheet4,
|
|
2539
2539
|
FileText as FileText4,
|
|
2540
|
-
|
|
2541
|
-
Files as Files3,
|
|
2540
|
+
Files as Files2,
|
|
2542
2541
|
Folder as Folder2,
|
|
2543
2542
|
FolderInput,
|
|
2544
2543
|
FolderPlus,
|
|
2545
|
-
FolderTree,
|
|
2546
2544
|
History,
|
|
2547
2545
|
Info,
|
|
2548
2546
|
LayoutGrid,
|
|
@@ -2554,7 +2552,6 @@ import {
|
|
|
2554
2552
|
PanelRightClose,
|
|
2555
2553
|
PanelRightOpen,
|
|
2556
2554
|
Plus as Plus5,
|
|
2557
|
-
Presentation as Presentation4,
|
|
2558
2555
|
RotateCcw as RotateCcw2,
|
|
2559
2556
|
Search as Search3,
|
|
2560
2557
|
Share2,
|
|
@@ -3218,6 +3215,19 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
3218
3215
|
] });
|
|
3219
3216
|
}
|
|
3220
3217
|
|
|
3218
|
+
// src/PreviewCard.tsx
|
|
3219
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3220
|
+
function PreviewCard({ thumb, icon, title, lines }) {
|
|
3221
|
+
return /* @__PURE__ */ jsxs10("div", { className: "w100n-card", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx10("div", { className: "w100n-card-thumb", children: thumb }),
|
|
3223
|
+
/* @__PURE__ */ jsxs10("div", { className: "w100n-card-title", children: [
|
|
3224
|
+
icon,
|
|
3225
|
+
/* @__PURE__ */ jsx10("b", { children: title })
|
|
3226
|
+
] }),
|
|
3227
|
+
lines.filter(Boolean).map((line, i) => /* @__PURE__ */ jsx10("small", { children: line }, i))
|
|
3228
|
+
] });
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3221
3231
|
// src/Thumb.tsx
|
|
3222
3232
|
import { useEffect as useEffect5, useRef as useRef5, useState as useState9 } from "react";
|
|
3223
3233
|
|
|
@@ -3272,7 +3282,7 @@ function preview(host, doc) {
|
|
|
3272
3282
|
}
|
|
3273
3283
|
|
|
3274
3284
|
// src/Thumb.tsx
|
|
3275
|
-
import { Fragment as Fragment9, jsx as
|
|
3285
|
+
import { Fragment as Fragment9, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3276
3286
|
function Thumb({ host, item, label }) {
|
|
3277
3287
|
const box = useRef5(null);
|
|
3278
3288
|
const [seen, setSeen] = useState9(false);
|
|
@@ -3298,26 +3308,26 @@ function Thumb({ host, item, label }) {
|
|
|
3298
3308
|
const text = item.excerpt ?? shot?.text ?? "";
|
|
3299
3309
|
const lines = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
|
|
3300
3310
|
const image = item.thumbnailUrl ?? shot?.image;
|
|
3301
|
-
return /* @__PURE__ */
|
|
3302
|
-
image ? /* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3311
|
+
return /* @__PURE__ */ jsxs11("span", { ref: box, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
|
|
3312
|
+
image ? /* @__PURE__ */ jsx11("img", { src: image, alt: "" }) : /* @__PURE__ */ jsx11("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines.length ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
3313
|
+
/* @__PURE__ */ jsx11("b", { children: lines[0] }),
|
|
3304
3314
|
lines.slice(1, 14).join(" ")
|
|
3305
|
-
] }) : /* @__PURE__ */
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3309
|
-
/* @__PURE__ */
|
|
3310
|
-
/* @__PURE__ */
|
|
3315
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
3316
|
+
/* @__PURE__ */ jsx11("i", {}),
|
|
3317
|
+
/* @__PURE__ */ jsx11("i", {}),
|
|
3318
|
+
/* @__PURE__ */ jsx11("i", {}),
|
|
3319
|
+
/* @__PURE__ */ jsx11("i", {}),
|
|
3320
|
+
/* @__PURE__ */ jsx11("i", {})
|
|
3311
3321
|
] }) }),
|
|
3312
|
-
label && /* @__PURE__ */
|
|
3322
|
+
label && /* @__PURE__ */ jsx11("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
3313
3323
|
] });
|
|
3314
3324
|
}
|
|
3315
3325
|
|
|
3316
3326
|
// src/Tree.tsx
|
|
3317
3327
|
import { useState as useState10 } from "react";
|
|
3318
|
-
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, FileSpreadsheet as FileSpreadsheet3, FileText as FileText3, FileType as FileType5,
|
|
3319
|
-
import { Fragment as Fragment10, jsx as
|
|
3320
|
-
var icons3 = { docx: FileText3, markdown: FileType5, pdf:
|
|
3328
|
+
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, File, FileSpreadsheet as FileSpreadsheet3, FileText as FileText3, FileType as FileType5, Folder, Presentation as Presentation3 } from "lucide-react";
|
|
3329
|
+
import { Fragment as Fragment10, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3330
|
+
var icons3 = { docx: FileText3, markdown: FileType5, pdf: File, sheet: FileSpreadsheet3, slides: Presentation3 };
|
|
3321
3331
|
var dragged = "application/x-w100n-document";
|
|
3322
3332
|
function grow(items, folders, names2, spaceId, other) {
|
|
3323
3333
|
const root = { key: "", name: "", at: spaceId ? { spaceId, folder: "" } : null, folders: [], files: [], count: 0 };
|
|
@@ -3358,7 +3368,7 @@ var remembered = () => {
|
|
|
3358
3368
|
return /* @__PURE__ */ new Set();
|
|
3359
3369
|
}
|
|
3360
3370
|
};
|
|
3361
|
-
function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen, onMenu, onFolderMenu, onMove, onEdit, onEditDone, onWarm }) {
|
|
3371
|
+
function Tree({ items, folders, names: names2, spaceId, current, t, edit, hits, onOpen, onMenu, onFolderMenu, onMove, onEdit, onEditDone, onWarm }) {
|
|
3362
3372
|
const [closed, setClosed] = useState10(remembered);
|
|
3363
3373
|
const [over, setOver] = useState10(null);
|
|
3364
3374
|
const flip = (key) => {
|
|
@@ -3367,7 +3377,7 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3367
3377
|
setClosed(next);
|
|
3368
3378
|
localStorage.setItem("w100n-docs-closed", JSON.stringify([...next]));
|
|
3369
3379
|
};
|
|
3370
|
-
const field = (pad, label) => /* @__PURE__ */
|
|
3380
|
+
const field = (pad, label) => /* @__PURE__ */ jsx12(
|
|
3371
3381
|
"input",
|
|
3372
3382
|
{
|
|
3373
3383
|
className: "w100n-tree-row w100n-tree-input",
|
|
@@ -3404,12 +3414,12 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3404
3414
|
onMove(id, b.at);
|
|
3405
3415
|
}
|
|
3406
3416
|
} : {};
|
|
3407
|
-
const branch = (b, depth) => /* @__PURE__ */
|
|
3417
|
+
const branch = (b, depth) => /* @__PURE__ */ jsxs12(Fragment10, { children: [
|
|
3408
3418
|
edit?.key === `new:${b.key}` && field(24 + depth * 16, t.folderName),
|
|
3409
3419
|
b.folders.map((f) => {
|
|
3410
3420
|
const open = !closed.has(f.key) || edit?.key === `new:${f.key}`;
|
|
3411
|
-
return /* @__PURE__ */
|
|
3412
|
-
edit?.key === `dir:${f.key}` ? field(24 + depth * 16, t.renameFolder) : /* @__PURE__ */
|
|
3421
|
+
return /* @__PURE__ */ jsxs12("div", { role: "group", "aria-label": f.name, "data-over": over === f.key || void 0, ...target(f), children: [
|
|
3422
|
+
edit?.key === `dir:${f.key}` ? field(24 + depth * 16, t.renameFolder) : /* @__PURE__ */ jsxs12(
|
|
3413
3423
|
"button",
|
|
3414
3424
|
{
|
|
3415
3425
|
type: "button",
|
|
@@ -3423,10 +3433,10 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3423
3433
|
onFolderMenu(f.at, f.key, e);
|
|
3424
3434
|
} : void 0,
|
|
3425
3435
|
children: [
|
|
3426
|
-
open ? /* @__PURE__ */
|
|
3427
|
-
/* @__PURE__ */
|
|
3428
|
-
/* @__PURE__ */
|
|
3429
|
-
f.count > 0 && /* @__PURE__ */
|
|
3436
|
+
open ? /* @__PURE__ */ jsx12(ChevronDown2, { "aria-hidden": true, className: "w100n-tree-fold" }) : /* @__PURE__ */ jsx12(ChevronRight2, { "aria-hidden": true, className: "w100n-tree-fold" }),
|
|
3437
|
+
/* @__PURE__ */ jsx12(Folder, { "aria-hidden": true }),
|
|
3438
|
+
/* @__PURE__ */ jsx12("span", { children: f.name }),
|
|
3439
|
+
f.count > 0 && /* @__PURE__ */ jsx12("small", { children: f.count })
|
|
3430
3440
|
]
|
|
3431
3441
|
}
|
|
3432
3442
|
),
|
|
@@ -3435,8 +3445,9 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3435
3445
|
}),
|
|
3436
3446
|
b.files.map((item) => {
|
|
3437
3447
|
const Icon = icons3[item.kind];
|
|
3438
|
-
if (edit?.key === `file:${item.id}`) return /* @__PURE__ */
|
|
3439
|
-
|
|
3448
|
+
if (edit?.key === `file:${item.id}`) return /* @__PURE__ */ jsx12("div", { children: field(24 + depth * 16, t.rename) }, item.id);
|
|
3449
|
+
const hit = hits?.get(item.id);
|
|
3450
|
+
const row = /* @__PURE__ */ jsxs12(
|
|
3440
3451
|
"button",
|
|
3441
3452
|
{
|
|
3442
3453
|
type: "button",
|
|
@@ -3450,7 +3461,7 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3450
3461
|
e.dataTransfer.effectAllowed = "move";
|
|
3451
3462
|
},
|
|
3452
3463
|
onClick: () => onOpen(item),
|
|
3453
|
-
onPointerEnter: () => onWarm(item),
|
|
3464
|
+
onPointerEnter: (e) => onWarm(item, e.pointerType === "mouse" ? e.currentTarget.getBoundingClientRect() : void 0),
|
|
3454
3465
|
onPointerLeave: () => onWarm(null),
|
|
3455
3466
|
onContextMenu: (e) => {
|
|
3456
3467
|
e.preventDefault();
|
|
@@ -3458,17 +3469,21 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3458
3469
|
onMenu(item, e);
|
|
3459
3470
|
},
|
|
3460
3471
|
children: [
|
|
3461
|
-
/* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
item.kind !== "markdown" && /* @__PURE__ */
|
|
3472
|
+
/* @__PURE__ */ jsx12(Icon, { "aria-hidden": true, "data-kind": item.kind }),
|
|
3473
|
+
/* @__PURE__ */ jsx12("span", { children: item.name.replace(/\.[^.]+$/, "") }),
|
|
3474
|
+
item.kind !== "markdown" && /* @__PURE__ */ jsx12("small", { className: "w100n-tree-kind", children: t.kinds[item.kind] })
|
|
3464
3475
|
]
|
|
3465
3476
|
},
|
|
3466
3477
|
item.id
|
|
3467
3478
|
);
|
|
3479
|
+
return hit ? /* @__PURE__ */ jsxs12("div", { children: [
|
|
3480
|
+
row,
|
|
3481
|
+
/* @__PURE__ */ jsx12("small", { className: "w100n-tree-hit", style: { paddingLeft: 46 + depth * 16 }, children: hit.split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx12("mark", { children: part }, i) : part) })
|
|
3482
|
+
] }, item.id) : row;
|
|
3468
3483
|
})
|
|
3469
3484
|
] });
|
|
3470
3485
|
const root = grow(items, folders, names2, spaceId, t.elsewhere);
|
|
3471
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ jsx12(
|
|
3472
3487
|
"nav",
|
|
3473
3488
|
{
|
|
3474
3489
|
className: "w100n-tree",
|
|
@@ -3485,11 +3500,10 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
|
|
|
3485
3500
|
}
|
|
3486
3501
|
|
|
3487
3502
|
// src/DocumentsWorkspace.tsx
|
|
3488
|
-
import { Fragment as Fragment11, jsx as
|
|
3489
|
-
var TextEditor2 = lazy2(() => import("./TextEditor-
|
|
3490
|
-
var SheetView2 = lazy2(() => import("./SheetView-
|
|
3503
|
+
import { Fragment as Fragment11, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3504
|
+
var TextEditor2 = lazy2(() => import("./TextEditor-Z4KSBLBV.js"));
|
|
3505
|
+
var SheetView2 = lazy2(() => import("./SheetView-PUSRW7W2.js"));
|
|
3491
3506
|
var Compare = lazy2(() => import("./Compare-RHAUAKUJ.js"));
|
|
3492
|
-
var icons4 = { docx: FileText4, markdown: FileType6, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
|
|
3493
3507
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
|
|
3494
3508
|
const t = texts[language];
|
|
3495
3509
|
const [own, setOwn] = useState11({ spaceId: null, documentId: null });
|
|
@@ -3506,7 +3520,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3506
3520
|
const [renamed, setRenamed] = useState11("idle");
|
|
3507
3521
|
const [statusAt, setStatusAt] = useState11(null);
|
|
3508
3522
|
const [listOpen, setListOpen] = useState11(true);
|
|
3509
|
-
const [shape2, setShape] = useState11(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-view") === "tree" ? "tree" : "cards");
|
|
3510
3523
|
const [jump, setJump] = useState11(null);
|
|
3511
3524
|
const finder = useRef6(null);
|
|
3512
3525
|
const [panelOpen, setPanelOpen] = useState11(true);
|
|
@@ -3564,10 +3577,19 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3564
3577
|
const [menu, setMenu] = useState11(null);
|
|
3565
3578
|
const [spot2, setSpot] = useState11(null);
|
|
3566
3579
|
const [edit, setEdit] = useState11(null);
|
|
3567
|
-
const
|
|
3580
|
+
const popup = useRef6(null);
|
|
3581
|
+
useLayoutEffect3(() => {
|
|
3582
|
+
const el = popup.current;
|
|
3583
|
+
const at = menu ?? spot2;
|
|
3584
|
+
if (!el || !at) return;
|
|
3585
|
+
el.style.top = `${Math.max(8, Math.min(at.y, innerHeight - el.offsetHeight - 8))}px`;
|
|
3586
|
+
el.style.left = `${Math.max(8, Math.min(at.x, innerWidth - el.offsetWidth - 8))}px`;
|
|
3587
|
+
}, [menu, spot2]);
|
|
3568
3588
|
const [notice, setNotice] = useState11(null);
|
|
3569
3589
|
const early = useRef6(/* @__PURE__ */ new Map());
|
|
3570
3590
|
const hover = useRef6(0);
|
|
3591
|
+
const peeking = useRef6(0);
|
|
3592
|
+
const [peek, setPeek] = useState11(null);
|
|
3571
3593
|
useEffect6(() => {
|
|
3572
3594
|
if (!menu && !spot2) return;
|
|
3573
3595
|
const close = (e) => {
|
|
@@ -3655,7 +3677,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3655
3677
|
const inside = new Map((deep.data ?? []).map((hit2) => [hit2.id, hit2.excerpt]));
|
|
3656
3678
|
const shown = all.filter((item) => matches(item, query, picked) || inside.has(item.id) && matches(item, "", picked));
|
|
3657
3679
|
const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
|
|
3658
|
-
const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
|
|
3659
3680
|
const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
|
|
3660
3681
|
const counts = /* @__PURE__ */ new Map();
|
|
3661
3682
|
for (const item of all) counts.set(item.spaceId, (counts.get(item.spaceId) ?? 0) + 1);
|
|
@@ -3670,9 +3691,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3670
3691
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
3671
3692
|
};
|
|
3672
3693
|
const size = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
3673
|
-
const failed = (retry) => /* @__PURE__ */
|
|
3694
|
+
const failed = (retry) => /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-note", children: [
|
|
3674
3695
|
t.failed,
|
|
3675
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsx13("button", { type: "button", onClick: retry, children: t.retry })
|
|
3676
3697
|
] });
|
|
3677
3698
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
3678
3699
|
const side = (which, open2) => {
|
|
@@ -3781,12 +3802,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3781
3802
|
setKept({ id: file.id, state: "failed" });
|
|
3782
3803
|
}
|
|
3783
3804
|
};
|
|
3784
|
-
const warm = (item) => {
|
|
3805
|
+
const warm = (item, at) => {
|
|
3806
|
+
clearTimeout(peeking.current);
|
|
3807
|
+
if (at) peeking.current = window.setTimeout(() => setPeek({ item, x: Math.min(at.right + 8, innerWidth - 300), y: Math.min(at.top, innerHeight - 300) }), 500);
|
|
3785
3808
|
clearTimeout(hover.current);
|
|
3786
3809
|
hover.current = window.setTimeout(() => {
|
|
3787
3810
|
if (item.id === here.documentId) return;
|
|
3788
|
-
if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-
|
|
3789
|
-
if (item.kind === "sheet") void import("./SheetView-
|
|
3811
|
+
if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-Z4KSBLBV.js");
|
|
3812
|
+
if (item.kind === "sheet") void import("./SheetView-PUSRW7W2.js");
|
|
3790
3813
|
const kept2 = early.current.get(item.id);
|
|
3791
3814
|
if (kept2 && Date.now() - kept2.at < 15e3 || item.size > 5e6) return;
|
|
3792
3815
|
const next = { at: Date.now(), doc: host.document(item.id), bytes: host.content(item.id, null) };
|
|
@@ -3797,6 +3820,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3797
3820
|
early.current.set(item.id, next);
|
|
3798
3821
|
}, 150);
|
|
3799
3822
|
};
|
|
3823
|
+
const card = (item) => {
|
|
3824
|
+
const Icon = icons3[item.kind];
|
|
3825
|
+
return /* @__PURE__ */ jsx13(PreviewCard, { thumb: /* @__PURE__ */ jsx13(Thumb, { host, item, label: t.kinds[item.kind] }), icon: /* @__PURE__ */ jsx13(Icon, { "aria-hidden": true, "data-kind": item.kind }), title: item.name, lines: [
|
|
3826
|
+
[t.kinds[item.kind], size(item.size), names2.get(item.spaceId), item.folder].filter(Boolean).join(" \xB7 "),
|
|
3827
|
+
item.createdAt && [t.createdOn.replace("{when}", date(item.createdAt)), item.createdBy?.name].filter(Boolean).join(" \xB7 "),
|
|
3828
|
+
[t.updatedOn.replace("{when}", ago(item.updatedAt)), item.updatedBy?.name].filter(Boolean).join(" \xB7 "),
|
|
3829
|
+
inside.get(item.id)?.split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx13("mark", { children: part }, i) : part)
|
|
3830
|
+
] });
|
|
3831
|
+
};
|
|
3800
3832
|
const act = async (run2, done) => {
|
|
3801
3833
|
setMenu(null);
|
|
3802
3834
|
setSpot(null);
|
|
@@ -3815,7 +3847,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3815
3847
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
3816
3848
|
};
|
|
3817
3849
|
const retitle = async (item, draft) => {
|
|
3818
|
-
setNaming(null);
|
|
3819
3850
|
const ext = /\.[^.]+$/.exec(item.name)?.[0] ?? "";
|
|
3820
3851
|
const name = draft.trim() && (/\.[^.\s]+$/.test(draft.trim()) ? draft.trim() : draft.trim() + ext);
|
|
3821
3852
|
if (!name || name === item.name) return;
|
|
@@ -3927,8 +3958,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3927
3958
|
window.addEventListener("keydown", press, true);
|
|
3928
3959
|
return () => window.removeEventListener("keydown", press, true);
|
|
3929
3960
|
});
|
|
3930
|
-
let stage = /* @__PURE__ */
|
|
3931
|
-
/* @__PURE__ */
|
|
3961
|
+
let stage = /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-empty", children: [
|
|
3962
|
+
/* @__PURE__ */ jsx13(FileText4, { "aria-hidden": true }),
|
|
3932
3963
|
t.pick
|
|
3933
3964
|
] });
|
|
3934
3965
|
if (here.documentId) {
|
|
@@ -3936,9 +3967,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3936
3967
|
doc.retry();
|
|
3937
3968
|
content.retry();
|
|
3938
3969
|
});
|
|
3939
|
-
else if (!doc.data || !content.data) stage = /* @__PURE__ */
|
|
3940
|
-
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */
|
|
3941
|
-
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */
|
|
3970
|
+
else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.loading });
|
|
3971
|
+
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ jsx13(Suspense2, { fallback: /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx13(Compare, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
|
|
3972
|
+
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx13(Suspense2, { fallback: /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx13(
|
|
3942
3973
|
TextEditor2,
|
|
3943
3974
|
{
|
|
3944
3975
|
kind: doc.data.kind,
|
|
@@ -3975,7 +4006,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3975
4006
|
},
|
|
3976
4007
|
doc.data.id
|
|
3977
4008
|
) });
|
|
3978
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */
|
|
4009
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx13(
|
|
3979
4010
|
PdfView,
|
|
3980
4011
|
{
|
|
3981
4012
|
bytes: content.data,
|
|
@@ -3997,7 +4028,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3997
4028
|
},
|
|
3998
4029
|
`${doc.data.id}:${versionId ?? ""}`
|
|
3999
4030
|
);
|
|
4000
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */
|
|
4031
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx13(
|
|
4001
4032
|
SlidesView,
|
|
4002
4033
|
{
|
|
4003
4034
|
html: new TextDecoder().decode(content.data),
|
|
@@ -4016,7 +4047,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4016
4047
|
},
|
|
4017
4048
|
doc.data.id
|
|
4018
4049
|
);
|
|
4019
|
-
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */
|
|
4050
|
+
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ jsx13(Suspense2, { fallback: /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx13(
|
|
4020
4051
|
SheetView2,
|
|
4021
4052
|
{
|
|
4022
4053
|
bytes: content.data,
|
|
@@ -4043,9 +4074,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4043
4074
|
},
|
|
4044
4075
|
`${doc.data.id}:${versionId ?? ""}`
|
|
4045
4076
|
) });
|
|
4046
|
-
else stage = /* @__PURE__ */
|
|
4077
|
+
else stage = /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
4047
4078
|
}
|
|
4048
|
-
const Kind = doc.data ?
|
|
4079
|
+
const Kind = doc.data ? icons3[doc.data.kind] : FileText4;
|
|
4049
4080
|
const top = Math.min(...outline.map((h) => h.level));
|
|
4050
4081
|
const chapters = outline.reduce((all2, h) => {
|
|
4051
4082
|
if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
|
|
@@ -4068,7 +4099,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4068
4099
|
if (text && host.comments && !versionId) panelTabs.push(["comments", MessagesSquare, t.comments]);
|
|
4069
4100
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
4070
4101
|
if (sharing) panelTabs.push(["sharing", Share2, t.sharing]);
|
|
4071
|
-
const listToggle = /* @__PURE__ */
|
|
4102
|
+
const listToggle = /* @__PURE__ */ jsx13(
|
|
4072
4103
|
"button",
|
|
4073
4104
|
{
|
|
4074
4105
|
ref: listButton,
|
|
@@ -4078,10 +4109,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4078
4109
|
onClick: () => side("list", !listOpen),
|
|
4079
4110
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
4080
4111
|
title: listOpen ? t.closeList : t.openList,
|
|
4081
|
-
children: listOpen ? /* @__PURE__ */
|
|
4112
|
+
children: listOpen ? /* @__PURE__ */ jsx13(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(PanelLeftOpen, { "aria-hidden": true })
|
|
4082
4113
|
}
|
|
4083
4114
|
);
|
|
4084
|
-
const panelToggle = doc.data && /* @__PURE__ */
|
|
4115
|
+
const panelToggle = doc.data && /* @__PURE__ */ jsx13(
|
|
4085
4116
|
"button",
|
|
4086
4117
|
{
|
|
4087
4118
|
ref: panelButton,
|
|
@@ -4091,16 +4122,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4091
4122
|
onClick: () => side("panel", !panelOpen),
|
|
4092
4123
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
4093
4124
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
4094
|
-
children: panelOpen ? /* @__PURE__ */
|
|
4125
|
+
children: panelOpen ? /* @__PURE__ */ jsx13(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(PanelRightOpen, { "aria-hidden": true })
|
|
4095
4126
|
}
|
|
4096
4127
|
);
|
|
4097
|
-
return /* @__PURE__ */
|
|
4098
|
-
/* @__PURE__ */
|
|
4099
|
-
start && /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ jsxs13("div", { className: "w100n-docs", "data-theme": theme, children: [
|
|
4129
|
+
/* @__PURE__ */ jsxs13("header", { className: "w100n-docs-bar", children: [
|
|
4130
|
+
start && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
|
|
4100
4131
|
narrow && listToggle,
|
|
4101
|
-
/* @__PURE__ */
|
|
4102
|
-
/* @__PURE__ */
|
|
4103
|
-
renaming !== null && doc.data ? /* @__PURE__ */
|
|
4132
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx13(Kind, { "aria-hidden": true }) }),
|
|
4133
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-heading", children: [
|
|
4134
|
+
renaming !== null && doc.data ? /* @__PURE__ */ jsx13(
|
|
4104
4135
|
"input",
|
|
4105
4136
|
{
|
|
4106
4137
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -4118,7 +4149,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4118
4149
|
}
|
|
4119
4150
|
}
|
|
4120
4151
|
}
|
|
4121
|
-
) : /* @__PURE__ */
|
|
4152
|
+
) : /* @__PURE__ */ jsx13(
|
|
4122
4153
|
"strong",
|
|
4123
4154
|
{
|
|
4124
4155
|
className: "w100n-docs-title",
|
|
@@ -4127,184 +4158,171 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4127
4158
|
children: doc.data?.name ?? t.documents
|
|
4128
4159
|
}
|
|
4129
4160
|
),
|
|
4130
|
-
docbar ? /* @__PURE__ */
|
|
4131
|
-
i > 0 && /* @__PURE__ */
|
|
4161
|
+
docbar ? /* @__PURE__ */ jsx13("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ jsx13("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs13("span", { children: [
|
|
4162
|
+
i > 0 && /* @__PURE__ */ jsx13(ChevronRight3, { "aria-hidden": true }),
|
|
4132
4163
|
item
|
|
4133
|
-
] }, i)) }) : /* @__PURE__ */
|
|
4164
|
+
] }, i)) }) : /* @__PURE__ */ jsx13("span", { className: "w100n-docs-hint", children: t.hint })
|
|
4134
4165
|
] }),
|
|
4135
|
-
versionId && /* @__PURE__ */
|
|
4136
|
-
versionId && text && /* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4166
|
+
versionId && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
|
|
4167
|
+
versionId && text && /* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
|
|
4168
|
+
/* @__PURE__ */ jsx13(FileDiff, { "aria-hidden": true }),
|
|
4138
4169
|
comparing ? t.hideChanges : t.showChanges
|
|
4139
4170
|
] }),
|
|
4140
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */
|
|
4141
|
-
/* @__PURE__ */
|
|
4171
|
+
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
|
|
4172
|
+
/* @__PURE__ */ jsx13(RotateCcw2, { "aria-hidden": true }),
|
|
4142
4173
|
t.restore
|
|
4143
4174
|
] }),
|
|
4144
|
-
restoring === "failed" && /* @__PURE__ */
|
|
4145
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4175
|
+
restoring === "failed" && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
|
|
4176
|
+
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
|
|
4177
|
+
/* @__PURE__ */ jsx13(FileSpreadsheet4, { "aria-hidden": true }),
|
|
4147
4178
|
t.copyAs
|
|
4148
4179
|
] }),
|
|
4149
|
-
copying === "failed" && /* @__PURE__ */
|
|
4150
|
-
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */
|
|
4151
|
-
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */
|
|
4152
|
-
renamed === "failed" && /* @__PURE__ */
|
|
4153
|
-
docbar && /* @__PURE__ */
|
|
4154
|
-
host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */
|
|
4180
|
+
copying === "failed" && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-muted", children: t.copyFailed }),
|
|
4181
|
+
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
|
|
4182
|
+
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
|
|
4183
|
+
renamed === "failed" && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-muted", children: t.renameFailed }),
|
|
4184
|
+
docbar && /* @__PURE__ */ jsx13("span", { ref: setStatusAt, className: "w100n-docs-status" }),
|
|
4185
|
+
host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ jsx13(
|
|
4155
4186
|
"button",
|
|
4156
4187
|
{
|
|
4157
4188
|
type: "button",
|
|
4158
|
-
className: "w100n-docs-action",
|
|
4189
|
+
className: "w100n-docs-action w100n-docs-square",
|
|
4159
4190
|
"data-tone": "blue",
|
|
4160
4191
|
"aria-label": t.sendChat,
|
|
4161
4192
|
title: t.sendChat,
|
|
4162
4193
|
onClick: () => host.send(doc.data.id),
|
|
4163
|
-
children:
|
|
4164
|
-
/* @__PURE__ */ jsx12(Send, { "aria-hidden": true }),
|
|
4165
|
-
/* @__PURE__ */ jsx12("span", { children: t.sendChat })
|
|
4166
|
-
]
|
|
4194
|
+
children: /* @__PURE__ */ jsx13(Send, { "aria-hidden": true })
|
|
4167
4195
|
}
|
|
4168
4196
|
),
|
|
4169
|
-
sharing && /* @__PURE__ */
|
|
4197
|
+
sharing && /* @__PURE__ */ jsx13("button", { type: "button", className: "w100n-docs-action w100n-docs-square", "aria-label": t.share, title: t.share, onClick: () => {
|
|
4170
4198
|
setTab("sharing");
|
|
4171
4199
|
side("panel", true);
|
|
4172
|
-
}, children:
|
|
4173
|
-
/* @__PURE__ */ jsx12(Share2, { "aria-hidden": true }),
|
|
4174
|
-
/* @__PURE__ */ jsx12("span", { children: t.share })
|
|
4175
|
-
] }),
|
|
4200
|
+
}, children: /* @__PURE__ */ jsx13(Share2, { "aria-hidden": true }) }),
|
|
4176
4201
|
doc.data && !versionId && actions?.(doc.data),
|
|
4177
4202
|
narrow && panelToggle,
|
|
4178
|
-
end && /* @__PURE__ */
|
|
4203
|
+
end && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
4179
4204
|
] }),
|
|
4180
|
-
/* @__PURE__ */
|
|
4181
|
-
listOpen && /* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4183
|
-
/* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4185
|
-
/* @__PURE__ */
|
|
4205
|
+
/* @__PURE__ */ jsxs13("div", { ref: body, className: "w100n-docs-body", children: [
|
|
4206
|
+
listOpen && /* @__PURE__ */ jsxs13("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
|
|
4207
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-head", children: [
|
|
4208
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-row", children: [
|
|
4209
|
+
/* @__PURE__ */ jsxs13("p", { className: "w100n-docs-caption", children: [
|
|
4210
|
+
/* @__PURE__ */ jsx13(Files2, { "aria-hidden": true }),
|
|
4186
4211
|
t.documents,
|
|
4187
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ jsx13("span", { children: all.length })
|
|
4188
4213
|
] }),
|
|
4189
|
-
host.create && /* @__PURE__ */
|
|
4214
|
+
host.create && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
4190
4215
|
if (e.key === "Escape" && adding) {
|
|
4191
4216
|
e.stopPropagation();
|
|
4192
4217
|
setAdding(false);
|
|
4193
4218
|
}
|
|
4194
4219
|
}, children: [
|
|
4195
|
-
/* @__PURE__ */
|
|
4196
|
-
/* @__PURE__ */
|
|
4197
|
-
/* @__PURE__ */
|
|
4198
|
-
/* @__PURE__ */
|
|
4220
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
|
|
4221
|
+
/* @__PURE__ */ jsx13(Plus5, { "aria-hidden": true }),
|
|
4222
|
+
/* @__PURE__ */ jsx13("span", { children: sending === "busy" ? t.uploading : t.create }),
|
|
4223
|
+
/* @__PURE__ */ jsx13(ChevronDown3, { "aria-hidden": true })
|
|
4199
4224
|
] }),
|
|
4200
|
-
adding && /* @__PURE__ */
|
|
4201
|
-
/* @__PURE__ */
|
|
4225
|
+
adding && /* @__PURE__ */ jsxs13("div", { role: "menu", className: "w100n-docs-menu", children: [
|
|
4226
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4202
4227
|
setAdding(false);
|
|
4203
4228
|
setMaking(true);
|
|
4204
4229
|
}, children: [
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4230
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(FilePlus, { "aria-hidden": true }) }),
|
|
4231
|
+
/* @__PURE__ */ jsx13("b", { children: t.newTitle })
|
|
4207
4232
|
] }),
|
|
4208
|
-
/* @__PURE__ */
|
|
4233
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4209
4234
|
setAdding(false);
|
|
4210
4235
|
upload.current.click();
|
|
4211
4236
|
}, children: [
|
|
4212
|
-
/* @__PURE__ */
|
|
4213
|
-
/* @__PURE__ */
|
|
4237
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(Upload, { "aria-hidden": true }) }),
|
|
4238
|
+
/* @__PURE__ */ jsx13("b", { children: t.uploadFile })
|
|
4214
4239
|
] })
|
|
4215
4240
|
] }),
|
|
4216
|
-
/* @__PURE__ */
|
|
4241
|
+
/* @__PURE__ */ jsx13("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
|
|
4217
4242
|
const file = e.target.files?.[0];
|
|
4218
4243
|
e.target.value = "";
|
|
4219
4244
|
if (file) void send(file);
|
|
4220
4245
|
} })
|
|
4221
4246
|
] }),
|
|
4222
|
-
/* @__PURE__ */
|
|
4247
|
+
/* @__PURE__ */ jsx13("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx13(X6, { "aria-hidden": true }) })
|
|
4223
4248
|
] }),
|
|
4224
|
-
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */
|
|
4249
|
+
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
|
|
4225
4250
|
if (e.key !== "Escape" || !picking) return;
|
|
4226
4251
|
e.stopPropagation();
|
|
4227
4252
|
setPicking(false);
|
|
4228
4253
|
e.currentTarget.querySelector("button").focus();
|
|
4229
4254
|
}, children: [
|
|
4230
|
-
/* @__PURE__ */
|
|
4231
|
-
space ? /* @__PURE__ */
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
!space && /* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4255
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
|
|
4256
|
+
space ? /* @__PURE__ */ jsx13("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(LayoutGrid, { "aria-hidden": true }) }),
|
|
4257
|
+
/* @__PURE__ */ jsx13("b", { children: space?.name ?? t.allProjects }),
|
|
4258
|
+
!space && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-count", children: all.length }),
|
|
4259
|
+
/* @__PURE__ */ jsx13(ChevronDown3, { "aria-hidden": true })
|
|
4235
4260
|
] }),
|
|
4236
|
-
picking && /* @__PURE__ */
|
|
4237
|
-
/* @__PURE__ */
|
|
4238
|
-
/* @__PURE__ */
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
!spaceId && /* @__PURE__ */
|
|
4261
|
+
picking && /* @__PURE__ */ jsxs13("div", { role: "listbox", className: "w100n-docs-menu", children: [
|
|
4262
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
|
|
4263
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(LayoutGrid, { "aria-hidden": true }) }),
|
|
4264
|
+
/* @__PURE__ */ jsx13("b", { children: t.allProjects }),
|
|
4265
|
+
!spaceId && /* @__PURE__ */ jsx13(Check2, { "aria-hidden": true })
|
|
4241
4266
|
] }),
|
|
4242
|
-
groups.map((group) => /* @__PURE__ */
|
|
4243
|
-
group && /* @__PURE__ */
|
|
4244
|
-
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */
|
|
4246
|
-
/* @__PURE__ */
|
|
4247
|
-
!spaceId && counts.get(item.id) ? /* @__PURE__ */
|
|
4248
|
-
item.id === spaceId && /* @__PURE__ */
|
|
4267
|
+
groups.map((group) => /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": group || void 0, children: [
|
|
4268
|
+
group && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-menu-caption", children: group }),
|
|
4269
|
+
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ jsxs13("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
|
|
4270
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
|
|
4271
|
+
/* @__PURE__ */ jsx13("b", { children: item.name }),
|
|
4272
|
+
!spaceId && counts.get(item.id) ? /* @__PURE__ */ jsx13("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
|
|
4273
|
+
item.id === spaceId && /* @__PURE__ */ jsx13(Check2, { "aria-hidden": true })
|
|
4249
4274
|
] }, item.id))
|
|
4250
4275
|
] }, group))
|
|
4251
4276
|
] })
|
|
4252
4277
|
] }),
|
|
4253
|
-
/* @__PURE__ */
|
|
4254
|
-
/* @__PURE__ */
|
|
4255
|
-
/* @__PURE__ */
|
|
4256
|
-
/* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4278
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-filters", children: [
|
|
4279
|
+
/* @__PURE__ */ jsxs13("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
4280
|
+
/* @__PURE__ */ jsx13(Search3, { "aria-hidden": true }),
|
|
4281
|
+
/* @__PURE__ */ jsx13("input", { ref: finder, value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search }),
|
|
4282
|
+
/* @__PURE__ */ jsx13("kbd", { children: "\u2318O" })
|
|
4258
4283
|
] }),
|
|
4259
|
-
present.length > 1 && /* @__PURE__ */
|
|
4284
|
+
present.length > 1 && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
4260
4285
|
if (e.key !== "Escape" || !typing) return;
|
|
4261
4286
|
e.stopPropagation();
|
|
4262
4287
|
setTyping(false);
|
|
4263
4288
|
e.currentTarget.querySelector("button").focus();
|
|
4264
4289
|
}, children: [
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
/* @__PURE__ */
|
|
4268
|
-
picked.length > 0 && /* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4290
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
|
|
4291
|
+
/* @__PURE__ */ jsx13(ListFilter, { "aria-hidden": true }),
|
|
4292
|
+
/* @__PURE__ */ jsx13("b", { children: t.typeFilter }),
|
|
4293
|
+
picked.length > 0 && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-badge", children: picked.length }),
|
|
4294
|
+
/* @__PURE__ */ jsx13(ChevronDown3, { "aria-hidden": true })
|
|
4270
4295
|
] }),
|
|
4271
|
-
typing && /* @__PURE__ */
|
|
4296
|
+
typing && /* @__PURE__ */ jsxs13("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
|
|
4272
4297
|
present.map((item) => {
|
|
4273
|
-
const Icon =
|
|
4298
|
+
const Icon = icons3[item];
|
|
4274
4299
|
const on = picked.includes(item);
|
|
4275
|
-
return /* @__PURE__ */
|
|
4276
|
-
/* @__PURE__ */
|
|
4277
|
-
/* @__PURE__ */
|
|
4278
|
-
/* @__PURE__ */
|
|
4279
|
-
/* @__PURE__ */
|
|
4300
|
+
return /* @__PURE__ */ jsxs13("button", { type: "button", role: "option", "aria-selected": on, onClick: () => setPicked(on ? picked.filter((k) => k !== item) : [...picked, item]), children: [
|
|
4301
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-box", children: on && /* @__PURE__ */ jsx13(Check2, { "aria-hidden": true }) }),
|
|
4302
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx13(Icon, { "aria-hidden": true }) }),
|
|
4303
|
+
/* @__PURE__ */ jsx13("b", { children: t.kinds[item] }),
|
|
4304
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
|
|
4280
4305
|
] }, item);
|
|
4281
4306
|
}),
|
|
4282
|
-
/* @__PURE__ */
|
|
4283
|
-
/* @__PURE__ */
|
|
4284
|
-
/* @__PURE__ */
|
|
4307
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-menu-foot", children: [
|
|
4308
|
+
/* @__PURE__ */ jsx13("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
|
|
4309
|
+
/* @__PURE__ */ jsx13("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
|
|
4285
4310
|
] })
|
|
4286
4311
|
] })
|
|
4287
4312
|
] })
|
|
4288
4313
|
] }),
|
|
4289
|
-
/* @__PURE__ */
|
|
4290
|
-
setShape(key);
|
|
4291
|
-
localStorage.setItem("w100n-docs-view", key);
|
|
4292
|
-
}, children: [
|
|
4293
|
-
/* @__PURE__ */ jsx12(Icon, { "aria-hidden": true }),
|
|
4294
|
-
label
|
|
4295
|
-
] }, key)) }),
|
|
4296
|
-
picked.length > 0 && /* @__PURE__ */ jsx12("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
|
|
4314
|
+
picked.length > 0 && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs13("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
|
|
4297
4315
|
t.kinds[item],
|
|
4298
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx13(X6, { "aria-hidden": true })
|
|
4299
4317
|
] }, item)) })
|
|
4300
4318
|
] }),
|
|
4301
|
-
/* @__PURE__ */
|
|
4302
|
-
sending === "failed" && /* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-cards", children: [
|
|
4320
|
+
sending === "failed" && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
|
|
4303
4321
|
list.error && failed(list.retry),
|
|
4304
|
-
list.loading && !list.data && /* @__PURE__ */
|
|
4305
|
-
notice && /* @__PURE__ */
|
|
4306
|
-
list.data && !shown.length && /* @__PURE__ */
|
|
4307
|
-
|
|
4322
|
+
list.loading && !list.data && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.loading }),
|
|
4323
|
+
notice && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", role: "status", children: notice }),
|
|
4324
|
+
list.data && !shown.length && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
|
|
4325
|
+
list.data && /* @__PURE__ */ jsx13(
|
|
4308
4326
|
Tree,
|
|
4309
4327
|
{
|
|
4310
4328
|
items: shown,
|
|
@@ -4314,11 +4332,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4314
4332
|
current: here.documentId,
|
|
4315
4333
|
t,
|
|
4316
4334
|
edit,
|
|
4335
|
+
hits: query.trim() ? inside : void 0,
|
|
4317
4336
|
onEdit: (text2) => setEdit(text2 === null ? null : edit && { ...edit, text: text2 }),
|
|
4318
4337
|
onEditDone: commit,
|
|
4319
4338
|
onOpen: open,
|
|
4320
4339
|
onMenu: (item, e) => {
|
|
4321
4340
|
setSpot(null);
|
|
4341
|
+
setPeek(null);
|
|
4322
4342
|
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
4323
4343
|
},
|
|
4324
4344
|
onFolderMenu: host.create || host.makeFolder ? (at, key, e) => {
|
|
@@ -4329,86 +4349,43 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4329
4349
|
const item = all.find((x) => x.id === id);
|
|
4330
4350
|
if (item) moveTo(item, to);
|
|
4331
4351
|
} : void 0,
|
|
4332
|
-
onWarm: (item) =>
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
/* @__PURE__ */ jsx12("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => naming?.id === item.id ? /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-card", children: [
|
|
4338
|
-
/* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
4339
|
-
/* @__PURE__ */ jsx12("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ jsx12(
|
|
4340
|
-
"input",
|
|
4341
|
-
{
|
|
4342
|
-
className: "w100n-docs-field",
|
|
4343
|
-
autoFocus: true,
|
|
4344
|
-
value: naming.text,
|
|
4345
|
-
"aria-label": t.rename,
|
|
4346
|
-
onFocus: (e) => e.currentTarget.select(),
|
|
4347
|
-
onChange: (e) => setNaming({ ...naming, text: e.target.value }),
|
|
4348
|
-
onBlur: () => void retitle(item, naming.text),
|
|
4349
|
-
onKeyDown: (e) => {
|
|
4350
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
4351
|
-
if (e.key === "Escape") {
|
|
4352
|
-
e.stopPropagation();
|
|
4353
|
-
setNaming(null);
|
|
4354
|
-
}
|
|
4355
|
-
}
|
|
4352
|
+
onWarm: (item, at) => {
|
|
4353
|
+
if (item) warm(item, at);
|
|
4354
|
+
else {
|
|
4355
|
+
clearTimeout(hover.current);
|
|
4356
|
+
setPeek(null);
|
|
4356
4357
|
}
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
{
|
|
4361
|
-
type: "button",
|
|
4362
|
-
className: "w100n-docs-card",
|
|
4363
|
-
"aria-current": item.id === here.documentId,
|
|
4364
|
-
onClick: () => open(item),
|
|
4365
|
-
title: item.name,
|
|
4366
|
-
onPointerEnter: () => warm(item),
|
|
4367
|
-
onPointerLeave: () => clearTimeout(hover.current),
|
|
4368
|
-
onContextMenu: (e) => {
|
|
4369
|
-
e.preventDefault();
|
|
4370
|
-
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
4371
|
-
},
|
|
4372
|
-
children: [
|
|
4373
|
-
/* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
4374
|
-
/* @__PURE__ */ jsxs12("span", { className: "w100n-docs-card-text", children: [
|
|
4375
|
-
/* @__PURE__ */ jsx12("b", { children: item.name }),
|
|
4376
|
-
/* @__PURE__ */ jsx12("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
4377
|
-
inside.get(item.id) && /* @__PURE__ */ jsx12("small", { className: "w100n-docs-hit", children: inside.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx12("mark", { children: part }, i) : part) })
|
|
4378
|
-
] })
|
|
4379
|
-
]
|
|
4380
|
-
},
|
|
4381
|
-
item.id
|
|
4382
|
-
)) })
|
|
4383
|
-
] }, folder2))
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
)
|
|
4384
4361
|
] })
|
|
4385
4362
|
] }),
|
|
4386
4363
|
!narrow && !listOpen && listToggle,
|
|
4387
|
-
/* @__PURE__ */
|
|
4364
|
+
/* @__PURE__ */ jsxs13("main", { className: "w100n-docs-stage", children: [
|
|
4388
4365
|
!narrow && !panelOpen && panelToggle,
|
|
4389
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-bare", children: stage })
|
|
4390
4367
|
] }),
|
|
4391
|
-
doc.data && panelOpen && /* @__PURE__ */
|
|
4392
|
-
/* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
(panelTabs.length < 4 || tab === key && panelTabs.length < 5) && /* @__PURE__ */
|
|
4368
|
+
doc.data && panelOpen && /* @__PURE__ */ jsxs13("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
|
|
4369
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-row", children: [
|
|
4370
|
+
/* @__PURE__ */ jsx13("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__ */ jsxs13("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
|
|
4371
|
+
/* @__PURE__ */ jsx13(Icon, { "aria-hidden": true }),
|
|
4372
|
+
(panelTabs.length < 4 || tab === key && panelTabs.length < 5) && /* @__PURE__ */ jsx13("span", { children: label })
|
|
4396
4373
|
] }, key)) }),
|
|
4397
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx13(X6, { "aria-hidden": true }) })
|
|
4398
4375
|
] }) }),
|
|
4399
|
-
/* @__PURE__ */
|
|
4400
|
-
tab === "outline" && (outline.length ? /* @__PURE__ */
|
|
4401
|
-
now && /* @__PURE__ */
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
/* @__PURE__ */
|
|
4376
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
|
|
4377
|
+
tab === "outline" && (outline.length ? /* @__PURE__ */ jsxs13("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
|
|
4378
|
+
now && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-reading", children: [
|
|
4379
|
+
/* @__PURE__ */ jsx13("span", { children: /* @__PURE__ */ jsx13("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
|
|
4380
|
+
/* @__PURE__ */ jsxs13("small", { children: [
|
|
4404
4381
|
Math.round(now.progress * 100),
|
|
4405
4382
|
"% ",
|
|
4406
4383
|
t.read
|
|
4407
4384
|
] })
|
|
4408
4385
|
] }),
|
|
4409
|
-
outline.length > 8 && /* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4411
|
-
/* @__PURE__ */
|
|
4386
|
+
outline.length > 8 && /* @__PURE__ */ jsxs13("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
4387
|
+
/* @__PURE__ */ jsx13(Search3, { "aria-hidden": true }),
|
|
4388
|
+
/* @__PURE__ */ jsx13("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
|
|
4412
4389
|
] }),
|
|
4413
4390
|
chapters.map((c, i) => {
|
|
4414
4391
|
const subs = words.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -4416,13 +4393,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4416
4393
|
const opened2 = words.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
4417
4394
|
const named = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
4418
4395
|
const mark = c.subs.findIndex((s) => s.id === now?.id);
|
|
4419
|
-
return /* @__PURE__ */
|
|
4420
|
-
/* @__PURE__ */
|
|
4421
|
-
/* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4396
|
+
return /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
|
|
4397
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-chapter-row", children: [
|
|
4398
|
+
/* @__PURE__ */ jsxs13("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: [
|
|
4399
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-chapter-num", children: named ? named[1] : /* @__PURE__ */ jsx13(Bookmark, { "aria-hidden": true }) }),
|
|
4400
|
+
/* @__PURE__ */ jsx13("b", { children: named ? named[2] : c.head.text })
|
|
4424
4401
|
] }),
|
|
4425
|
-
c.subs.length > 0 && /* @__PURE__ */
|
|
4402
|
+
c.subs.length > 0 && /* @__PURE__ */ jsxs13(
|
|
4426
4403
|
"button",
|
|
4427
4404
|
{
|
|
4428
4405
|
type: "button",
|
|
@@ -4432,13 +4409,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4432
4409
|
title: opened2 ? t.hideSections : t.showSections,
|
|
4433
4410
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened2 }),
|
|
4434
4411
|
children: [
|
|
4435
|
-
/* @__PURE__ */
|
|
4436
|
-
opened2 ? /* @__PURE__ */
|
|
4412
|
+
/* @__PURE__ */ jsx13("small", { children: c.subs.length }),
|
|
4413
|
+
opened2 ? /* @__PURE__ */ jsx13(ChevronDown3, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(ChevronRight3, { "aria-hidden": true })
|
|
4437
4414
|
]
|
|
4438
4415
|
}
|
|
4439
4416
|
)
|
|
4440
4417
|
] }),
|
|
4441
|
-
opened2 && subs.length > 0 && /* @__PURE__ */
|
|
4418
|
+
opened2 && subs.length > 0 && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs13(
|
|
4442
4419
|
"button",
|
|
4443
4420
|
{
|
|
4444
4421
|
type: "button",
|
|
@@ -4447,7 +4424,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4447
4424
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
4448
4425
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
4449
4426
|
children: [
|
|
4450
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsx13("i", { "aria-hidden": true }),
|
|
4451
4428
|
s.text
|
|
4452
4429
|
]
|
|
4453
4430
|
},
|
|
@@ -4455,47 +4432,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4455
4432
|
)) })
|
|
4456
4433
|
] }, c.head.id);
|
|
4457
4434
|
})
|
|
4458
|
-
] }) : /* @__PURE__ */
|
|
4459
|
-
tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */
|
|
4460
|
-
tab === "versions" && /* @__PURE__ */
|
|
4435
|
+
] }) : /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.noOutline })),
|
|
4436
|
+
tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */ jsx13(Backlinks, { host, current: doc.data, notes, t, onOpen: open }),
|
|
4437
|
+
tab === "versions" && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-versions", children: [
|
|
4461
4438
|
versions.error && failed(versions.retry),
|
|
4462
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */
|
|
4439
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ jsxs13(
|
|
4463
4440
|
"button",
|
|
4464
4441
|
{
|
|
4465
4442
|
type: "button",
|
|
4466
4443
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
4467
4444
|
onClick: () => view(item.current ? null : item.id),
|
|
4468
4445
|
children: [
|
|
4469
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsxs13("b", { children: [
|
|
4470
4447
|
date(item.createdAt),
|
|
4471
|
-
item.current && /* @__PURE__ */
|
|
4448
|
+
item.current && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-badge", children: t.current })
|
|
4472
4449
|
] }),
|
|
4473
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx13("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
4474
4451
|
]
|
|
4475
4452
|
},
|
|
4476
4453
|
item.id
|
|
4477
4454
|
))
|
|
4478
4455
|
] }),
|
|
4479
|
-
tab === "details" && /* @__PURE__ */
|
|
4480
|
-
/* @__PURE__ */
|
|
4481
|
-
/* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
doc.data.updatedBy && /* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
/* @__PURE__ */
|
|
4456
|
+
tab === "details" && /* @__PURE__ */ jsxs13("dl", { className: "w100n-docs-details", children: [
|
|
4457
|
+
/* @__PURE__ */ jsx13("dt", { children: t.kind }),
|
|
4458
|
+
/* @__PURE__ */ jsx13("dd", { children: t.kinds[doc.data.kind] }),
|
|
4459
|
+
/* @__PURE__ */ jsx13("dt", { children: t.size }),
|
|
4460
|
+
/* @__PURE__ */ jsx13("dd", { children: size(doc.data.size) }),
|
|
4461
|
+
/* @__PURE__ */ jsx13("dt", { children: t.updated }),
|
|
4462
|
+
/* @__PURE__ */ jsx13("dd", { children: date(doc.data.updatedAt) }),
|
|
4463
|
+
doc.data.updatedBy && /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4464
|
+
/* @__PURE__ */ jsx13("dt", { children: t.by }),
|
|
4465
|
+
/* @__PURE__ */ jsx13("dd", { children: doc.data.updatedBy.name })
|
|
4489
4466
|
] }),
|
|
4490
|
-
/* @__PURE__ */
|
|
4491
|
-
/* @__PURE__ */
|
|
4467
|
+
/* @__PURE__ */ jsx13("dt", { children: t.rights }),
|
|
4468
|
+
/* @__PURE__ */ jsx13("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
|
|
4492
4469
|
] }),
|
|
4493
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */
|
|
4494
|
-
/* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */
|
|
4470
|
+
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-about", children: [
|
|
4471
|
+
/* @__PURE__ */ jsxs13("p", { className: "w100n-docs-caption", children: [
|
|
4472
|
+
/* @__PURE__ */ jsx13(FileDown, { "aria-hidden": true }),
|
|
4496
4473
|
t.exportAs
|
|
4497
4474
|
] }),
|
|
4498
|
-
/* @__PURE__ */
|
|
4475
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs13(
|
|
4499
4476
|
"button",
|
|
4500
4477
|
{
|
|
4501
4478
|
type: "button",
|
|
@@ -4503,22 +4480,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4503
4480
|
disabled: exporting === "busy",
|
|
4504
4481
|
onClick: () => void exportAs(doc.data, format),
|
|
4505
4482
|
children: [
|
|
4506
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx13(FileDown, { "aria-hidden": true }),
|
|
4507
4484
|
format.toUpperCase()
|
|
4508
4485
|
]
|
|
4509
4486
|
},
|
|
4510
4487
|
format
|
|
4511
4488
|
)) }),
|
|
4512
|
-
exporting === "failed" && /* @__PURE__ */
|
|
4489
|
+
exporting === "failed" && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
4513
4490
|
] }),
|
|
4514
|
-
tab === "comments" && /* @__PURE__ */
|
|
4515
|
-
tab === "sharing" && sharing && /* @__PURE__ */
|
|
4516
|
-
tab === "signatures" && /* @__PURE__ */
|
|
4491
|
+
tab === "comments" && /* @__PURE__ */ jsx13("div", { ref: setBox }),
|
|
4492
|
+
tab === "sharing" && sharing && /* @__PURE__ */ jsx13(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
|
|
4493
|
+
tab === "signatures" && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-versions", children: [
|
|
4517
4494
|
signatures.error && failed(signatures.retry),
|
|
4518
|
-
signatures.data?.length === 0 && /* @__PURE__ */
|
|
4495
|
+
signatures.data?.length === 0 && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.noSignatures }),
|
|
4519
4496
|
(signatures.data ?? []).map((entry) => {
|
|
4520
4497
|
const signed = versions.data?.find((v) => v.id === entry.versionId);
|
|
4521
|
-
return /* @__PURE__ */
|
|
4498
|
+
return /* @__PURE__ */ jsxs13(
|
|
4522
4499
|
"button",
|
|
4523
4500
|
{
|
|
4524
4501
|
type: "button",
|
|
@@ -4526,15 +4503,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4526
4503
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
4527
4504
|
onClick: () => view(signed.current ? null : signed.id),
|
|
4528
4505
|
children: [
|
|
4529
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsxs13("b", { children: [
|
|
4530
4507
|
entry.signer.name,
|
|
4531
|
-
/* @__PURE__ */
|
|
4508
|
+
/* @__PURE__ */ jsxs13("span", { className: "w100n-docs-badge", children: [
|
|
4532
4509
|
t.page,
|
|
4533
4510
|
" ",
|
|
4534
4511
|
entry.page
|
|
4535
4512
|
] })
|
|
4536
4513
|
] }),
|
|
4537
|
-
/* @__PURE__ */
|
|
4514
|
+
/* @__PURE__ */ jsx13("small", { children: [date(entry.signedAt), t.methods[entry.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
|
|
4538
4515
|
]
|
|
4539
4516
|
},
|
|
4540
4517
|
entry.id
|
|
@@ -4545,7 +4522,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4545
4522
|
] })
|
|
4546
4523
|
] })
|
|
4547
4524
|
] }),
|
|
4548
|
-
jump && /* @__PURE__ */
|
|
4525
|
+
jump && /* @__PURE__ */ jsx13(
|
|
4549
4526
|
Jump,
|
|
4550
4527
|
{
|
|
4551
4528
|
mode: jump,
|
|
@@ -4558,18 +4535,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4558
4535
|
place: (item) => [!spaceId && names2.get(item.spaceId), item.folder].filter(Boolean).join(" / ")
|
|
4559
4536
|
}
|
|
4560
4537
|
),
|
|
4561
|
-
making && /* @__PURE__ */
|
|
4538
|
+
making && /* @__PURE__ */ jsx13(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
|
|
4562
4539
|
setMaking(false);
|
|
4563
4540
|
opened(made);
|
|
4564
4541
|
} }),
|
|
4565
|
-
menu && /* @__PURE__ */
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
menu.item.createdAt && /* @__PURE__ */ jsx12("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
|
|
4570
|
-
/* @__PURE__ */ jsx12("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
|
|
4571
|
-
] }),
|
|
4572
|
-
menu.moving ? /* @__PURE__ */ jsx12("div", { className: "w100n-docs-context-list", children: ["", ...dirs.data.get(menu.item.spaceId)].map((folder2) => /* @__PURE__ */ jsxs12(
|
|
4542
|
+
peek && !menu && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-peek", role: "tooltip", style: { left: peek.x, top: peek.y }, children: card(peek.item) }),
|
|
4543
|
+
menu && /* @__PURE__ */ jsxs13("div", { ref: popup, className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
|
|
4544
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-context-head", children: card(menu.item) }),
|
|
4545
|
+
menu.moving ? /* @__PURE__ */ jsx13("div", { className: "w100n-docs-context-list", children: ["", ...dirs.data.get(menu.item.spaceId)].map((folder2) => /* @__PURE__ */ jsxs13(
|
|
4573
4546
|
"button",
|
|
4574
4547
|
{
|
|
4575
4548
|
type: "button",
|
|
@@ -4578,100 +4551,99 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4578
4551
|
onClick: () => moveTo(menu.item, { spaceId: menu.item.spaceId, folder: folder2 }),
|
|
4579
4552
|
style: { paddingLeft: 10 + 14 * (folder2 ? folder2.split("/").length : 0) },
|
|
4580
4553
|
children: [
|
|
4581
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsx13(Folder2, { "aria-hidden": true }),
|
|
4582
4555
|
folder2 ? folder2.split("/").pop() : names2.get(menu.item.spaceId) ?? t.topLevel
|
|
4583
4556
|
]
|
|
4584
4557
|
},
|
|
4585
4558
|
folder2
|
|
4586
|
-
)) }) : menu.sure ? /* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
/* @__PURE__ */
|
|
4589
|
-
/* @__PURE__ */
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
/* @__PURE__ */
|
|
4559
|
+
)) }) : menu.sure ? /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-context-ask", children: [
|
|
4560
|
+
/* @__PURE__ */ jsx13("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
|
|
4561
|
+
/* @__PURE__ */ jsxs13("span", { className: "w100n-pdf-dialog-end", children: [
|
|
4562
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
|
|
4563
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
|
|
4564
|
+
/* @__PURE__ */ jsx13(Trash24, { "aria-hidden": true }),
|
|
4592
4565
|
t.trash
|
|
4593
4566
|
] })
|
|
4594
4567
|
] })
|
|
4595
|
-
] }) : /* @__PURE__ */
|
|
4596
|
-
/* @__PURE__ */
|
|
4568
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4569
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4597
4570
|
setMenu(null);
|
|
4598
4571
|
open(menu.item);
|
|
4599
4572
|
}, children: [
|
|
4600
|
-
/* @__PURE__ */
|
|
4573
|
+
/* @__PURE__ */ jsx13(FileText4, { "aria-hidden": true }),
|
|
4601
4574
|
t.openFile
|
|
4602
4575
|
] }),
|
|
4603
|
-
host.href && /* @__PURE__ */
|
|
4576
|
+
host.href && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4604
4577
|
setMenu(null);
|
|
4605
4578
|
window.open(host.href(menu.item.id), "_blank", "noopener");
|
|
4606
4579
|
}, children: [
|
|
4607
|
-
/* @__PURE__ */
|
|
4580
|
+
/* @__PURE__ */ jsx13(ExternalLink2, { "aria-hidden": true }),
|
|
4608
4581
|
t.openTab
|
|
4609
4582
|
] }),
|
|
4610
|
-
host.href && /* @__PURE__ */
|
|
4611
|
-
/* @__PURE__ */
|
|
4583
|
+
host.href && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => void act(() => navigator.clipboard.writeText(host.href(menu.item.id)), t.linkCopied), children: [
|
|
4584
|
+
/* @__PURE__ */ jsx13(Link2, { "aria-hidden": true }),
|
|
4612
4585
|
t.copyLink
|
|
4613
4586
|
] }),
|
|
4614
|
-
host.send && /* @__PURE__ */
|
|
4587
|
+
host.send && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4615
4588
|
setMenu(null);
|
|
4616
4589
|
host.send(menu.item.id);
|
|
4617
4590
|
}, children: [
|
|
4618
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx13(Send, { "aria-hidden": true }),
|
|
4619
4592
|
t.sendChat
|
|
4620
4593
|
] }),
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
host.rename && /* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4595
|
+
host.rename && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4623
4596
|
const item = menu.item;
|
|
4624
4597
|
setMenu(null);
|
|
4625
|
-
|
|
4626
|
-
else setNaming({ id: item.id, text: item.name.replace(/\.[^.]+$/, "") });
|
|
4598
|
+
setEdit({ key: `file:${item.id}`, text: item.name.replace(/\.[^.]+$/, ""), run: (text2) => retitle(item, text2) });
|
|
4627
4599
|
}, children: [
|
|
4628
|
-
/* @__PURE__ */
|
|
4600
|
+
/* @__PURE__ */ jsx13(Pencil, { "aria-hidden": true }),
|
|
4629
4601
|
t.rename
|
|
4630
4602
|
] }),
|
|
4631
|
-
host.move && dirs.data?.has(menu.item.spaceId) && /* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4603
|
+
host.move && dirs.data?.has(menu.item.spaceId) && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", "aria-haspopup": "menu", onClick: () => setMenu({ ...menu, moving: true }), children: [
|
|
4604
|
+
/* @__PURE__ */ jsx13(FolderInput, { "aria-hidden": true }),
|
|
4633
4605
|
t.moveTo
|
|
4634
4606
|
] }),
|
|
4635
|
-
host.create && /* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4607
|
+
host.create && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => void act(async () => copy(await host.document(menu.item.id))), children: [
|
|
4608
|
+
/* @__PURE__ */ jsx13(Copy3, { "aria-hidden": true }),
|
|
4637
4609
|
t.makeCopy
|
|
4638
4610
|
] }),
|
|
4639
|
-
/* @__PURE__ */
|
|
4640
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
|
|
4612
|
+
/* @__PURE__ */ jsx13(Download3, { "aria-hidden": true }),
|
|
4641
4613
|
t.download
|
|
4642
4614
|
] }),
|
|
4643
|
-
host.saveTemplate && /* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4615
|
+
host.saveTemplate && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
|
|
4616
|
+
/* @__PURE__ */ jsx13(Bookmark, { "aria-hidden": true }),
|
|
4645
4617
|
t.saveTemplate
|
|
4646
4618
|
] }),
|
|
4647
|
-
/* @__PURE__ */
|
|
4619
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4648
4620
|
setMenu(null);
|
|
4649
4621
|
open(menu.item);
|
|
4650
4622
|
setTab("details");
|
|
4651
4623
|
side("panel", true);
|
|
4652
4624
|
}, children: [
|
|
4653
|
-
/* @__PURE__ */
|
|
4625
|
+
/* @__PURE__ */ jsx13(Info, { "aria-hidden": true }),
|
|
4654
4626
|
t.details
|
|
4655
4627
|
] }),
|
|
4656
|
-
host.remove && /* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4628
|
+
host.remove && /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4629
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4630
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
|
|
4631
|
+
/* @__PURE__ */ jsx13(Trash24, { "aria-hidden": true }),
|
|
4660
4632
|
t.trash
|
|
4661
4633
|
] })
|
|
4662
4634
|
] })
|
|
4663
4635
|
] })
|
|
4664
4636
|
] }),
|
|
4665
|
-
spot2 && /* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
spot2.at.folder && /* @__PURE__ */
|
|
4637
|
+
spot2 && /* @__PURE__ */ jsxs13("div", { ref: popup, className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.folderActions, style: { left: spot2.x, top: spot2.y }, children: [
|
|
4638
|
+
/* @__PURE__ */ jsxs13("div", { className: "w100n-docs-context-head", children: [
|
|
4639
|
+
/* @__PURE__ */ jsx13("b", { children: folderNamed(spot2.at) }),
|
|
4640
|
+
spot2.at.folder && /* @__PURE__ */ jsx13("small", { children: [names2.get(spot2.at.spaceId), ...spot2.at.folder.split("/").slice(0, -1)].filter(Boolean).join(" / ") })
|
|
4669
4641
|
] }),
|
|
4670
|
-
spot2.sure ? /* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
/* @__PURE__ */
|
|
4642
|
+
spot2.sure ? /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-context-ask", children: [
|
|
4643
|
+
/* @__PURE__ */ jsx13("p", { children: t.folderTrashAsk.replace("{name}", folderNamed(spot2.at)) }),
|
|
4644
|
+
/* @__PURE__ */ jsxs13("span", { className: "w100n-pdf-dialog-end", children: [
|
|
4645
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: "w100n-pdf-link", onClick: () => setSpot({ ...spot2, sure: false }), children: t.cancel }),
|
|
4646
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => {
|
|
4675
4647
|
const at = spot2.at;
|
|
4676
4648
|
const inside2 = doc.data && doc.data.spaceId === at.spaceId && `${doc.data.folder ?? ""}/`.startsWith(`${at.folder}/`);
|
|
4677
4649
|
void act(() => host.removeFolder(at), t.trashed).then(() => {
|
|
@@ -4679,42 +4651,42 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4679
4651
|
if (inside2) go({ spaceId: here.spaceId, documentId: null });
|
|
4680
4652
|
});
|
|
4681
4653
|
}, children: [
|
|
4682
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx13(Trash24, { "aria-hidden": true }),
|
|
4683
4655
|
t.trash
|
|
4684
4656
|
] })
|
|
4685
4657
|
] })
|
|
4686
|
-
] }) : /* @__PURE__ */
|
|
4687
|
-
host.create && /* @__PURE__ */
|
|
4658
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4659
|
+
host.create && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4688
4660
|
const at = spot2.at;
|
|
4689
4661
|
setSpot(null);
|
|
4690
4662
|
void note(t.untitled, true, at);
|
|
4691
4663
|
}, children: [
|
|
4692
|
-
/* @__PURE__ */
|
|
4664
|
+
/* @__PURE__ */ jsx13(FilePlus, { "aria-hidden": true }),
|
|
4693
4665
|
t.newNoteHere
|
|
4694
4666
|
] }),
|
|
4695
|
-
host.makeFolder && /* @__PURE__ */
|
|
4667
|
+
host.makeFolder && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4696
4668
|
const at = spot2.at;
|
|
4697
4669
|
setSpot(null);
|
|
4698
4670
|
setEdit({ key: `new:${spot2.key}`, text: t.newFolder, run: (name) => act(() => host.makeFolder(at, name)).then(refresh) });
|
|
4699
4671
|
}, children: [
|
|
4700
|
-
/* @__PURE__ */
|
|
4672
|
+
/* @__PURE__ */ jsx13(FolderPlus, { "aria-hidden": true }),
|
|
4701
4673
|
t.newFolder
|
|
4702
4674
|
] }),
|
|
4703
|
-
spot2.at.folder && host.renameFolder && /* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4675
|
+
spot2.at.folder && host.renameFolder && /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4676
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4677
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4706
4678
|
const at = spot2.at;
|
|
4707
4679
|
setSpot(null);
|
|
4708
4680
|
setEdit({ key: `dir:${spot2.key}`, text: folderNamed(at), run: (name) => name === folderNamed(at) ? Promise.resolve() : act(() => host.renameFolder(at, name)).then(refresh) });
|
|
4709
4681
|
}, children: [
|
|
4710
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx13(Pencil, { "aria-hidden": true }),
|
|
4711
4683
|
t.renameFolder
|
|
4712
4684
|
] })
|
|
4713
4685
|
] }),
|
|
4714
|
-
spot2.at.folder && host.removeFolder && /* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4686
|
+
spot2.at.folder && host.removeFolder && /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4687
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4688
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setSpot({ ...spot2, sure: true }), children: [
|
|
4689
|
+
/* @__PURE__ */ jsx13(Trash24, { "aria-hidden": true }),
|
|
4718
4690
|
t.trashFolder
|
|
4719
4691
|
] })
|
|
4720
4692
|
] })
|
|
@@ -4726,21 +4698,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4726
4698
|
|
|
4727
4699
|
// src/FilePreview.tsx
|
|
4728
4700
|
import { useState as useState12 } from "react";
|
|
4729
|
-
import { jsx as
|
|
4701
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
4730
4702
|
function FilePreview({ url, name, mimeType, size = 0, bytes, pdfWorker }) {
|
|
4731
4703
|
const [source] = useState12(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
|
|
4732
4704
|
const kind = kindOf(name, mimeType);
|
|
4733
4705
|
if (!kind) return null;
|
|
4734
|
-
return /* @__PURE__ */
|
|
4706
|
+
return /* @__PURE__ */ jsx14("span", { className: "w100n-preview", children: /* @__PURE__ */ jsx14(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size, updatedAt: "" } }) });
|
|
4735
4707
|
}
|
|
4736
4708
|
|
|
4737
4709
|
// src/GuestDocument.tsx
|
|
4738
4710
|
import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState13 } from "react";
|
|
4739
|
-
import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet5, FileText as FileText5, FileType as
|
|
4740
|
-
import { Fragment as Fragment12, jsx as
|
|
4741
|
-
var TextEditor3 = lazy3(() => import("./TextEditor-
|
|
4742
|
-
var SheetView3 = lazy3(() => import("./SheetView-
|
|
4743
|
-
var
|
|
4711
|
+
import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet5, FileText as FileText5, FileType as FileType6, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
|
|
4712
|
+
import { Fragment as Fragment12, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4713
|
+
var TextEditor3 = lazy3(() => import("./TextEditor-Z4KSBLBV.js"));
|
|
4714
|
+
var SheetView3 = lazy3(() => import("./SheetView-PUSRW7W2.js"));
|
|
4715
|
+
var icons4 = { docx: FileText5, markdown: FileType6, pdf: Files3, sheet: FileSpreadsheet5, slides: Presentation4 };
|
|
4744
4716
|
var GuestRefused = class extends Error {
|
|
4745
4717
|
constructor(reason, file = "", sharedBy = "") {
|
|
4746
4718
|
super(reason);
|
|
@@ -4798,18 +4770,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4798
4770
|
};
|
|
4799
4771
|
const top = (file2, badge) => {
|
|
4800
4772
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
4801
|
-
const Kind = kind2 ?
|
|
4802
|
-
return /* @__PURE__ */
|
|
4803
|
-
brand && /* @__PURE__ */
|
|
4804
|
-
file2 && /* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4806
|
-
/* @__PURE__ */
|
|
4807
|
-
/* @__PURE__ */
|
|
4808
|
-
file2.sharedBy && /* @__PURE__ */
|
|
4773
|
+
const Kind = kind2 ? icons4[kind2] : FileText5;
|
|
4774
|
+
return /* @__PURE__ */ jsxs14("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
|
|
4775
|
+
brand && /* @__PURE__ */ jsx15("span", { className: "w100n-guest-brand", children: brand }),
|
|
4776
|
+
file2 && /* @__PURE__ */ jsxs14(Fragment12, { children: [
|
|
4777
|
+
/* @__PURE__ */ jsx15("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ jsx15(Kind, { "aria-hidden": true }) }),
|
|
4778
|
+
/* @__PURE__ */ jsxs14("div", { className: "w100n-docs-heading", children: [
|
|
4779
|
+
/* @__PURE__ */ jsx15("strong", { className: "w100n-docs-title", children: file2.name }),
|
|
4780
|
+
file2.sharedBy && /* @__PURE__ */ jsx15("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
|
|
4809
4781
|
] }),
|
|
4810
|
-
badge && /* @__PURE__ */
|
|
4811
|
-
file2.download && /* @__PURE__ */
|
|
4812
|
-
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */
|
|
4782
|
+
badge && /* @__PURE__ */ jsx15("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
|
|
4783
|
+
file2.download && /* @__PURE__ */ jsxs14("div", { className: "w100n-docs-end", children: [
|
|
4784
|
+
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ jsxs14(
|
|
4813
4785
|
"button",
|
|
4814
4786
|
{
|
|
4815
4787
|
type: "button",
|
|
@@ -4820,25 +4792,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4820
4792
|
"aria-label": t.pdfCopy,
|
|
4821
4793
|
title: t.pdfCopy,
|
|
4822
4794
|
children: [
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
/* @__PURE__ */
|
|
4795
|
+
/* @__PURE__ */ jsx15(FileDown2, { "aria-hidden": true }),
|
|
4796
|
+
/* @__PURE__ */ jsx15("span", { children: t.pdfCopy })
|
|
4825
4797
|
]
|
|
4826
4798
|
}
|
|
4827
4799
|
),
|
|
4828
|
-
/* @__PURE__ */
|
|
4829
|
-
/* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
4800
|
+
/* @__PURE__ */ jsxs14("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
|
|
4801
|
+
/* @__PURE__ */ jsx15(Download4, { "aria-hidden": true }),
|
|
4802
|
+
/* @__PURE__ */ jsx15("span", { children: t.download })
|
|
4831
4803
|
] })
|
|
4832
4804
|
] })
|
|
4833
4805
|
] })
|
|
4834
4806
|
] });
|
|
4835
4807
|
};
|
|
4836
|
-
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */
|
|
4808
|
+
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ jsxs14("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
4837
4809
|
top(null, null),
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
/* @__PURE__ */
|
|
4840
|
-
/* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx15("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ jsxs14("div", { className: "w100n-guest-card", children: [
|
|
4811
|
+
/* @__PURE__ */ jsx15("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ jsx15(Icon, { "aria-hidden": true }) }),
|
|
4812
|
+
/* @__PURE__ */ jsx15("h2", { children: title }),
|
|
4813
|
+
/* @__PURE__ */ jsx15("p", { children: body }),
|
|
4842
4814
|
form
|
|
4843
4815
|
] }) })
|
|
4844
4816
|
] });
|
|
@@ -4854,7 +4826,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4854
4826
|
password ? Lock2 : UserRound,
|
|
4855
4827
|
refused.file || t.documents,
|
|
4856
4828
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
4857
|
-
/* @__PURE__ */
|
|
4829
|
+
/* @__PURE__ */ jsxs14("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
4858
4830
|
e.preventDefault();
|
|
4859
4831
|
if (!typed.trim()) return;
|
|
4860
4832
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -4864,7 +4836,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4864
4836
|
}
|
|
4865
4837
|
setTyped("");
|
|
4866
4838
|
}, children: [
|
|
4867
|
-
/* @__PURE__ */
|
|
4839
|
+
/* @__PURE__ */ jsx15(
|
|
4868
4840
|
"input",
|
|
4869
4841
|
{
|
|
4870
4842
|
className: "w100n-share-input",
|
|
@@ -4877,21 +4849,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4877
4849
|
onChange: (e) => setTyped(e.target.value)
|
|
4878
4850
|
}
|
|
4879
4851
|
),
|
|
4880
|
-
refused.reason === "wrong" && /* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4852
|
+
refused.reason === "wrong" && /* @__PURE__ */ jsx15("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
|
|
4853
|
+
/* @__PURE__ */ jsxs14("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
|
|
4854
|
+
/* @__PURE__ */ jsx15(Eye2, { "aria-hidden": true }),
|
|
4883
4855
|
t.openDoc
|
|
4884
4856
|
] })
|
|
4885
4857
|
] })
|
|
4886
4858
|
);
|
|
4887
4859
|
}
|
|
4888
4860
|
if (refused?.reason === "busy") return gate("slate", Ban2, t.failed, t.tooMany);
|
|
4889
|
-
return gate("slate", Ban2, t.failed, "", /* @__PURE__ */
|
|
4861
|
+
return gate("slate", Ban2, t.failed, "", /* @__PURE__ */ jsx15("button", { type: "button", className: "w100n-docs-action", onClick: opened.retry, children: t.retry }));
|
|
4890
4862
|
}
|
|
4891
4863
|
const file = opened.data;
|
|
4892
|
-
if (!file) return /* @__PURE__ */
|
|
4864
|
+
if (!file) return /* @__PURE__ */ jsxs14("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
4893
4865
|
top(null, null),
|
|
4894
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsx15("div", { className: "w100n-docs-empty", children: t.loading })
|
|
4895
4867
|
] });
|
|
4896
4868
|
const kind = kindOf(file.name, file.mimeType);
|
|
4897
4869
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -4899,23 +4871,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4899
4871
|
const rights = { view: true, comment: talk, edit: false };
|
|
4900
4872
|
const quiet2 = () => {
|
|
4901
4873
|
};
|
|
4902
|
-
let stage = /* @__PURE__ */
|
|
4903
|
-
if (text) stage = /* @__PURE__ */
|
|
4904
|
-
else if (kind === "pdf") stage = /* @__PURE__ */
|
|
4905
|
-
else if (kind === "slides") stage = /* @__PURE__ */
|
|
4906
|
-
else if (kind === "sheet") stage = /* @__PURE__ */
|
|
4907
|
-
return /* @__PURE__ */
|
|
4874
|
+
let stage = /* @__PURE__ */ jsx15("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
4875
|
+
if (text) stage = /* @__PURE__ */ jsx15(Suspense3, { fallback: /* @__PURE__ */ jsx15("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx15(TextEditor3, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes : void 0, documentId: file.id, onOutline: quiet2, slot: talk ? slot : null }) });
|
|
4876
|
+
else if (kind === "pdf") stage = /* @__PURE__ */ jsx15(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet2 });
|
|
4877
|
+
else if (kind === "slides") stage = /* @__PURE__ */ jsx15(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet2 });
|
|
4878
|
+
else if (kind === "sheet") stage = /* @__PURE__ */ jsx15(Suspense3, { fallback: /* @__PURE__ */ jsx15("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx15(SheetView3, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
|
|
4879
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
4908
4880
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
4909
|
-
saving === "failed" && /* @__PURE__ */
|
|
4910
|
-
/* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
4912
|
-
talk && /* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4881
|
+
saving === "failed" && /* @__PURE__ */ jsx15("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
|
|
4882
|
+
/* @__PURE__ */ jsxs14("div", { className: "w100n-docs-body w100n-guest-body", children: [
|
|
4883
|
+
/* @__PURE__ */ jsx15("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ jsx15("div", { className: "w100n-docs-bare", children: stage }) }),
|
|
4884
|
+
talk && /* @__PURE__ */ jsx15("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ jsxs14("div", { className: "w100n-docs-panel-body", children: [
|
|
4885
|
+
/* @__PURE__ */ jsxs14("label", { className: "w100n-share-field", children: [
|
|
4886
|
+
/* @__PURE__ */ jsx15("span", { children: t.yourName }),
|
|
4887
|
+
/* @__PURE__ */ jsx15("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
|
|
4916
4888
|
] }),
|
|
4917
|
-
/* @__PURE__ */
|
|
4918
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsx15("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
4890
|
+
/* @__PURE__ */ jsx15("div", { ref: setSlot })
|
|
4919
4891
|
] }) })
|
|
4920
4892
|
] })
|
|
4921
4893
|
] });
|
|
@@ -4926,6 +4898,7 @@ export {
|
|
|
4926
4898
|
FilePreview,
|
|
4927
4899
|
GuestDocument,
|
|
4928
4900
|
GuestRefused,
|
|
4901
|
+
PreviewCard,
|
|
4929
4902
|
SlidesView,
|
|
4930
4903
|
kindOf,
|
|
4931
4904
|
kinds,
|