@w100n/documents 0.18.1 → 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-F4CBWEOS.js → SheetView-PUSRW7W2.js} +3 -3
- package/dist/{TextEditor-ZY4B7YIF.js → TextEditor-Z4KSBLBV.js} +3 -3
- package/dist/{chunk-2G34AIPU.js → chunk-JSJEB2CO.js} +192 -60
- package/dist/chunk-JSJEB2CO.js.map +1 -0
- package/dist/{chunk-TSB2QS56.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 +364 -389
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +123 -0
- 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 +366 -395
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-2G34AIPU.js.map +0 -1
- /package/dist/{SheetView-F4CBWEOS.js.map → SheetView-PUSRW7W2.js.map} +0 -0
- /package/dist/{TextEditor-ZY4B7YIF.js.map → TextEditor-Z4KSBLBV.js.map} +0 -0
- /package/dist/{chunk-TSB2QS56.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);
|
|
@@ -3572,10 +3585,11 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3572
3585
|
el.style.top = `${Math.max(8, Math.min(at.y, innerHeight - el.offsetHeight - 8))}px`;
|
|
3573
3586
|
el.style.left = `${Math.max(8, Math.min(at.x, innerWidth - el.offsetWidth - 8))}px`;
|
|
3574
3587
|
}, [menu, spot2]);
|
|
3575
|
-
const [naming, setNaming] = useState11(null);
|
|
3576
3588
|
const [notice, setNotice] = useState11(null);
|
|
3577
3589
|
const early = useRef6(/* @__PURE__ */ new Map());
|
|
3578
3590
|
const hover = useRef6(0);
|
|
3591
|
+
const peeking = useRef6(0);
|
|
3592
|
+
const [peek, setPeek] = useState11(null);
|
|
3579
3593
|
useEffect6(() => {
|
|
3580
3594
|
if (!menu && !spot2) return;
|
|
3581
3595
|
const close = (e) => {
|
|
@@ -3663,7 +3677,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3663
3677
|
const inside = new Map((deep.data ?? []).map((hit2) => [hit2.id, hit2.excerpt]));
|
|
3664
3678
|
const shown = all.filter((item) => matches(item, query, picked) || inside.has(item.id) && matches(item, "", picked));
|
|
3665
3679
|
const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
|
|
3666
|
-
const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
|
|
3667
3680
|
const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
|
|
3668
3681
|
const counts = /* @__PURE__ */ new Map();
|
|
3669
3682
|
for (const item of all) counts.set(item.spaceId, (counts.get(item.spaceId) ?? 0) + 1);
|
|
@@ -3678,9 +3691,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3678
3691
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
3679
3692
|
};
|
|
3680
3693
|
const size = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
3681
|
-
const failed = (retry) => /* @__PURE__ */
|
|
3694
|
+
const failed = (retry) => /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-note", children: [
|
|
3682
3695
|
t.failed,
|
|
3683
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsx13("button", { type: "button", onClick: retry, children: t.retry })
|
|
3684
3697
|
] });
|
|
3685
3698
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
3686
3699
|
const side = (which, open2) => {
|
|
@@ -3789,12 +3802,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3789
3802
|
setKept({ id: file.id, state: "failed" });
|
|
3790
3803
|
}
|
|
3791
3804
|
};
|
|
3792
|
-
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);
|
|
3793
3808
|
clearTimeout(hover.current);
|
|
3794
3809
|
hover.current = window.setTimeout(() => {
|
|
3795
3810
|
if (item.id === here.documentId) return;
|
|
3796
|
-
if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-
|
|
3797
|
-
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");
|
|
3798
3813
|
const kept2 = early.current.get(item.id);
|
|
3799
3814
|
if (kept2 && Date.now() - kept2.at < 15e3 || item.size > 5e6) return;
|
|
3800
3815
|
const next = { at: Date.now(), doc: host.document(item.id), bytes: host.content(item.id, null) };
|
|
@@ -3805,6 +3820,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3805
3820
|
early.current.set(item.id, next);
|
|
3806
3821
|
}, 150);
|
|
3807
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
|
+
};
|
|
3808
3832
|
const act = async (run2, done) => {
|
|
3809
3833
|
setMenu(null);
|
|
3810
3834
|
setSpot(null);
|
|
@@ -3823,7 +3847,6 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3823
3847
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
3824
3848
|
};
|
|
3825
3849
|
const retitle = async (item, draft) => {
|
|
3826
|
-
setNaming(null);
|
|
3827
3850
|
const ext = /\.[^.]+$/.exec(item.name)?.[0] ?? "";
|
|
3828
3851
|
const name = draft.trim() && (/\.[^.\s]+$/.test(draft.trim()) ? draft.trim() : draft.trim() + ext);
|
|
3829
3852
|
if (!name || name === item.name) return;
|
|
@@ -3935,8 +3958,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3935
3958
|
window.addEventListener("keydown", press, true);
|
|
3936
3959
|
return () => window.removeEventListener("keydown", press, true);
|
|
3937
3960
|
});
|
|
3938
|
-
let stage = /* @__PURE__ */
|
|
3939
|
-
/* @__PURE__ */
|
|
3961
|
+
let stage = /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-empty", children: [
|
|
3962
|
+
/* @__PURE__ */ jsx13(FileText4, { "aria-hidden": true }),
|
|
3940
3963
|
t.pick
|
|
3941
3964
|
] });
|
|
3942
3965
|
if (here.documentId) {
|
|
@@ -3944,9 +3967,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3944
3967
|
doc.retry();
|
|
3945
3968
|
content.retry();
|
|
3946
3969
|
});
|
|
3947
|
-
else if (!doc.data || !content.data) stage = /* @__PURE__ */
|
|
3948
|
-
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */
|
|
3949
|
-
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(
|
|
3950
3973
|
TextEditor2,
|
|
3951
3974
|
{
|
|
3952
3975
|
kind: doc.data.kind,
|
|
@@ -3983,7 +4006,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
3983
4006
|
},
|
|
3984
4007
|
doc.data.id
|
|
3985
4008
|
) });
|
|
3986
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */
|
|
4009
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx13(
|
|
3987
4010
|
PdfView,
|
|
3988
4011
|
{
|
|
3989
4012
|
bytes: content.data,
|
|
@@ -4005,7 +4028,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4005
4028
|
},
|
|
4006
4029
|
`${doc.data.id}:${versionId ?? ""}`
|
|
4007
4030
|
);
|
|
4008
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */
|
|
4031
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx13(
|
|
4009
4032
|
SlidesView,
|
|
4010
4033
|
{
|
|
4011
4034
|
html: new TextDecoder().decode(content.data),
|
|
@@ -4024,7 +4047,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4024
4047
|
},
|
|
4025
4048
|
doc.data.id
|
|
4026
4049
|
);
|
|
4027
|
-
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(
|
|
4028
4051
|
SheetView2,
|
|
4029
4052
|
{
|
|
4030
4053
|
bytes: content.data,
|
|
@@ -4051,9 +4074,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4051
4074
|
},
|
|
4052
4075
|
`${doc.data.id}:${versionId ?? ""}`
|
|
4053
4076
|
) });
|
|
4054
|
-
else stage = /* @__PURE__ */
|
|
4077
|
+
else stage = /* @__PURE__ */ jsx13("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
4055
4078
|
}
|
|
4056
|
-
const Kind = doc.data ?
|
|
4079
|
+
const Kind = doc.data ? icons3[doc.data.kind] : FileText4;
|
|
4057
4080
|
const top = Math.min(...outline.map((h) => h.level));
|
|
4058
4081
|
const chapters = outline.reduce((all2, h) => {
|
|
4059
4082
|
if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
|
|
@@ -4076,7 +4099,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4076
4099
|
if (text && host.comments && !versionId) panelTabs.push(["comments", MessagesSquare, t.comments]);
|
|
4077
4100
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
4078
4101
|
if (sharing) panelTabs.push(["sharing", Share2, t.sharing]);
|
|
4079
|
-
const listToggle = /* @__PURE__ */
|
|
4102
|
+
const listToggle = /* @__PURE__ */ jsx13(
|
|
4080
4103
|
"button",
|
|
4081
4104
|
{
|
|
4082
4105
|
ref: listButton,
|
|
@@ -4086,10 +4109,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4086
4109
|
onClick: () => side("list", !listOpen),
|
|
4087
4110
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
4088
4111
|
title: listOpen ? t.closeList : t.openList,
|
|
4089
|
-
children: listOpen ? /* @__PURE__ */
|
|
4112
|
+
children: listOpen ? /* @__PURE__ */ jsx13(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(PanelLeftOpen, { "aria-hidden": true })
|
|
4090
4113
|
}
|
|
4091
4114
|
);
|
|
4092
|
-
const panelToggle = doc.data && /* @__PURE__ */
|
|
4115
|
+
const panelToggle = doc.data && /* @__PURE__ */ jsx13(
|
|
4093
4116
|
"button",
|
|
4094
4117
|
{
|
|
4095
4118
|
ref: panelButton,
|
|
@@ -4099,16 +4122,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4099
4122
|
onClick: () => side("panel", !panelOpen),
|
|
4100
4123
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
4101
4124
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
4102
|
-
children: panelOpen ? /* @__PURE__ */
|
|
4125
|
+
children: panelOpen ? /* @__PURE__ */ jsx13(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(PanelRightOpen, { "aria-hidden": true })
|
|
4103
4126
|
}
|
|
4104
4127
|
);
|
|
4105
|
-
return /* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
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) }),
|
|
4108
4131
|
narrow && listToggle,
|
|
4109
|
-
/* @__PURE__ */
|
|
4110
|
-
/* @__PURE__ */
|
|
4111
|
-
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(
|
|
4112
4135
|
"input",
|
|
4113
4136
|
{
|
|
4114
4137
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -4126,7 +4149,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4126
4149
|
}
|
|
4127
4150
|
}
|
|
4128
4151
|
}
|
|
4129
|
-
) : /* @__PURE__ */
|
|
4152
|
+
) : /* @__PURE__ */ jsx13(
|
|
4130
4153
|
"strong",
|
|
4131
4154
|
{
|
|
4132
4155
|
className: "w100n-docs-title",
|
|
@@ -4135,31 +4158,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4135
4158
|
children: doc.data?.name ?? t.documents
|
|
4136
4159
|
}
|
|
4137
4160
|
),
|
|
4138
|
-
docbar ? /* @__PURE__ */
|
|
4139
|
-
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 }),
|
|
4140
4163
|
item
|
|
4141
|
-
] }, i)) }) : /* @__PURE__ */
|
|
4164
|
+
] }, i)) }) : /* @__PURE__ */ jsx13("span", { className: "w100n-docs-hint", children: t.hint })
|
|
4142
4165
|
] }),
|
|
4143
|
-
versionId && /* @__PURE__ */
|
|
4144
|
-
versionId && text && /* @__PURE__ */
|
|
4145
|
-
/* @__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 }),
|
|
4146
4169
|
comparing ? t.hideChanges : t.showChanges
|
|
4147
4170
|
] }),
|
|
4148
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */
|
|
4149
|
-
/* @__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 }),
|
|
4150
4173
|
t.restore
|
|
4151
4174
|
] }),
|
|
4152
|
-
restoring === "failed" && /* @__PURE__ */
|
|
4153
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */
|
|
4154
|
-
/* @__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 }),
|
|
4155
4178
|
t.copyAs
|
|
4156
4179
|
] }),
|
|
4157
|
-
copying === "failed" && /* @__PURE__ */
|
|
4158
|
-
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */
|
|
4159
|
-
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */
|
|
4160
|
-
renamed === "failed" && /* @__PURE__ */
|
|
4161
|
-
docbar && /* @__PURE__ */
|
|
4162
|
-
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(
|
|
4163
4186
|
"button",
|
|
4164
4187
|
{
|
|
4165
4188
|
type: "button",
|
|
@@ -4168,145 +4191,138 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4168
4191
|
"aria-label": t.sendChat,
|
|
4169
4192
|
title: t.sendChat,
|
|
4170
4193
|
onClick: () => host.send(doc.data.id),
|
|
4171
|
-
children: /* @__PURE__ */
|
|
4194
|
+
children: /* @__PURE__ */ jsx13(Send, { "aria-hidden": true })
|
|
4172
4195
|
}
|
|
4173
4196
|
),
|
|
4174
|
-
sharing && /* @__PURE__ */
|
|
4197
|
+
sharing && /* @__PURE__ */ jsx13("button", { type: "button", className: "w100n-docs-action w100n-docs-square", "aria-label": t.share, title: t.share, onClick: () => {
|
|
4175
4198
|
setTab("sharing");
|
|
4176
4199
|
side("panel", true);
|
|
4177
|
-
}, children: /* @__PURE__ */
|
|
4200
|
+
}, children: /* @__PURE__ */ jsx13(Share2, { "aria-hidden": true }) }),
|
|
4178
4201
|
doc.data && !versionId && actions?.(doc.data),
|
|
4179
4202
|
narrow && panelToggle,
|
|
4180
|
-
end && /* @__PURE__ */
|
|
4203
|
+
end && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
4181
4204
|
] }),
|
|
4182
|
-
/* @__PURE__ */
|
|
4183
|
-
listOpen && /* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4185
|
-
/* @__PURE__ */
|
|
4186
|
-
/* @__PURE__ */
|
|
4187
|
-
/* @__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 }),
|
|
4188
4211
|
t.documents,
|
|
4189
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ jsx13("span", { children: all.length })
|
|
4190
4213
|
] }),
|
|
4191
|
-
host.create && /* @__PURE__ */
|
|
4214
|
+
host.create && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
4192
4215
|
if (e.key === "Escape" && adding) {
|
|
4193
4216
|
e.stopPropagation();
|
|
4194
4217
|
setAdding(false);
|
|
4195
4218
|
}
|
|
4196
4219
|
}, children: [
|
|
4197
|
-
/* @__PURE__ */
|
|
4198
|
-
/* @__PURE__ */
|
|
4199
|
-
/* @__PURE__ */
|
|
4200
|
-
/* @__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 })
|
|
4201
4224
|
] }),
|
|
4202
|
-
adding && /* @__PURE__ */
|
|
4203
|
-
/* @__PURE__ */
|
|
4225
|
+
adding && /* @__PURE__ */ jsxs13("div", { role: "menu", className: "w100n-docs-menu", children: [
|
|
4226
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4204
4227
|
setAdding(false);
|
|
4205
4228
|
setMaking(true);
|
|
4206
4229
|
}, children: [
|
|
4207
|
-
/* @__PURE__ */
|
|
4208
|
-
/* @__PURE__ */
|
|
4230
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(FilePlus, { "aria-hidden": true }) }),
|
|
4231
|
+
/* @__PURE__ */ jsx13("b", { children: t.newTitle })
|
|
4209
4232
|
] }),
|
|
4210
|
-
/* @__PURE__ */
|
|
4233
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4211
4234
|
setAdding(false);
|
|
4212
4235
|
upload.current.click();
|
|
4213
4236
|
}, children: [
|
|
4214
|
-
/* @__PURE__ */
|
|
4215
|
-
/* @__PURE__ */
|
|
4237
|
+
/* @__PURE__ */ jsx13("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx13(Upload, { "aria-hidden": true }) }),
|
|
4238
|
+
/* @__PURE__ */ jsx13("b", { children: t.uploadFile })
|
|
4216
4239
|
] })
|
|
4217
4240
|
] }),
|
|
4218
|
-
/* @__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) => {
|
|
4219
4242
|
const file = e.target.files?.[0];
|
|
4220
4243
|
e.target.value = "";
|
|
4221
4244
|
if (file) void send(file);
|
|
4222
4245
|
} })
|
|
4223
4246
|
] }),
|
|
4224
|
-
/* @__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 }) })
|
|
4225
4248
|
] }),
|
|
4226
|
-
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */
|
|
4249
|
+
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
|
|
4227
4250
|
if (e.key !== "Escape" || !picking) return;
|
|
4228
4251
|
e.stopPropagation();
|
|
4229
4252
|
setPicking(false);
|
|
4230
4253
|
e.currentTarget.querySelector("button").focus();
|
|
4231
4254
|
}, children: [
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
space ? /* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4235
|
-
!space && /* @__PURE__ */
|
|
4236
|
-
/* @__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 })
|
|
4237
4260
|
] }),
|
|
4238
|
-
picking && /* @__PURE__ */
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4241
|
-
/* @__PURE__ */
|
|
4242
|
-
!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 })
|
|
4243
4266
|
] }),
|
|
4244
|
-
groups.map((group) => /* @__PURE__ */
|
|
4245
|
-
group && /* @__PURE__ */
|
|
4246
|
-
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */
|
|
4247
|
-
/* @__PURE__ */
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
!spaceId && counts.get(item.id) ? /* @__PURE__ */
|
|
4250
|
-
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 })
|
|
4251
4274
|
] }, item.id))
|
|
4252
4275
|
] }, group))
|
|
4253
4276
|
] })
|
|
4254
4277
|
] }),
|
|
4255
|
-
/* @__PURE__ */
|
|
4256
|
-
/* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4259
|
-
/* @__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" })
|
|
4260
4283
|
] }),
|
|
4261
|
-
present.length > 1 && /* @__PURE__ */
|
|
4284
|
+
present.length > 1 && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
4262
4285
|
if (e.key !== "Escape" || !typing) return;
|
|
4263
4286
|
e.stopPropagation();
|
|
4264
4287
|
setTyping(false);
|
|
4265
4288
|
e.currentTarget.querySelector("button").focus();
|
|
4266
4289
|
}, children: [
|
|
4267
|
-
/* @__PURE__ */
|
|
4268
|
-
/* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
picked.length > 0 && /* @__PURE__ */
|
|
4271
|
-
/* @__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 })
|
|
4272
4295
|
] }),
|
|
4273
|
-
typing && /* @__PURE__ */
|
|
4296
|
+
typing && /* @__PURE__ */ jsxs13("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
|
|
4274
4297
|
present.map((item) => {
|
|
4275
|
-
const Icon =
|
|
4298
|
+
const Icon = icons3[item];
|
|
4276
4299
|
const on = picked.includes(item);
|
|
4277
|
-
return /* @__PURE__ */
|
|
4278
|
-
/* @__PURE__ */
|
|
4279
|
-
/* @__PURE__ */
|
|
4280
|
-
/* @__PURE__ */
|
|
4281
|
-
/* @__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 })
|
|
4282
4305
|
] }, item);
|
|
4283
4306
|
}),
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__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 })
|
|
4287
4310
|
] })
|
|
4288
4311
|
] })
|
|
4289
4312
|
] })
|
|
4290
4313
|
] }),
|
|
4291
|
-
/* @__PURE__ */
|
|
4292
|
-
setShape(key);
|
|
4293
|
-
localStorage.setItem("w100n-docs-view", key);
|
|
4294
|
-
}, children: [
|
|
4295
|
-
/* @__PURE__ */ jsx12(Icon, { "aria-hidden": true }),
|
|
4296
|
-
label
|
|
4297
|
-
] }, key)) }),
|
|
4298
|
-
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: [
|
|
4299
4315
|
t.kinds[item],
|
|
4300
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx13(X6, { "aria-hidden": true })
|
|
4301
4317
|
] }, item)) })
|
|
4302
4318
|
] }),
|
|
4303
|
-
/* @__PURE__ */
|
|
4304
|
-
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 }),
|
|
4305
4321
|
list.error && failed(list.retry),
|
|
4306
|
-
list.loading && !list.data && /* @__PURE__ */
|
|
4307
|
-
notice && /* @__PURE__ */
|
|
4308
|
-
list.data && !shown.length && /* @__PURE__ */
|
|
4309
|
-
|
|
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(
|
|
4310
4326
|
Tree,
|
|
4311
4327
|
{
|
|
4312
4328
|
items: shown,
|
|
@@ -4316,11 +4332,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4316
4332
|
current: here.documentId,
|
|
4317
4333
|
t,
|
|
4318
4334
|
edit,
|
|
4335
|
+
hits: query.trim() ? inside : void 0,
|
|
4319
4336
|
onEdit: (text2) => setEdit(text2 === null ? null : edit && { ...edit, text: text2 }),
|
|
4320
4337
|
onEditDone: commit,
|
|
4321
4338
|
onOpen: open,
|
|
4322
4339
|
onMenu: (item, e) => {
|
|
4323
4340
|
setSpot(null);
|
|
4341
|
+
setPeek(null);
|
|
4324
4342
|
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
4325
4343
|
},
|
|
4326
4344
|
onFolderMenu: host.create || host.makeFolder ? (at, key, e) => {
|
|
@@ -4331,86 +4349,43 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4331
4349
|
const item = all.find((x) => x.id === id);
|
|
4332
4350
|
if (item) moveTo(item, to);
|
|
4333
4351
|
} : void 0,
|
|
4334
|
-
onWarm: (item) =>
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
/* @__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: [
|
|
4340
|
-
/* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
4341
|
-
/* @__PURE__ */ jsx12("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ jsx12(
|
|
4342
|
-
"input",
|
|
4343
|
-
{
|
|
4344
|
-
className: "w100n-docs-field",
|
|
4345
|
-
autoFocus: true,
|
|
4346
|
-
value: naming.text,
|
|
4347
|
-
"aria-label": t.rename,
|
|
4348
|
-
onFocus: (e) => e.currentTarget.select(),
|
|
4349
|
-
onChange: (e) => setNaming({ ...naming, text: e.target.value }),
|
|
4350
|
-
onBlur: () => void retitle(item, naming.text),
|
|
4351
|
-
onKeyDown: (e) => {
|
|
4352
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
4353
|
-
if (e.key === "Escape") {
|
|
4354
|
-
e.stopPropagation();
|
|
4355
|
-
setNaming(null);
|
|
4356
|
-
}
|
|
4357
|
-
}
|
|
4352
|
+
onWarm: (item, at) => {
|
|
4353
|
+
if (item) warm(item, at);
|
|
4354
|
+
else {
|
|
4355
|
+
clearTimeout(hover.current);
|
|
4356
|
+
setPeek(null);
|
|
4358
4357
|
}
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
{
|
|
4363
|
-
type: "button",
|
|
4364
|
-
className: "w100n-docs-card",
|
|
4365
|
-
"aria-current": item.id === here.documentId,
|
|
4366
|
-
onClick: () => open(item),
|
|
4367
|
-
title: item.name,
|
|
4368
|
-
onPointerEnter: () => warm(item),
|
|
4369
|
-
onPointerLeave: () => clearTimeout(hover.current),
|
|
4370
|
-
onContextMenu: (e) => {
|
|
4371
|
-
e.preventDefault();
|
|
4372
|
-
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
4373
|
-
},
|
|
4374
|
-
children: [
|
|
4375
|
-
/* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
4376
|
-
/* @__PURE__ */ jsxs12("span", { className: "w100n-docs-card-text", children: [
|
|
4377
|
-
/* @__PURE__ */ jsx12("b", { children: item.name }),
|
|
4378
|
-
/* @__PURE__ */ jsx12("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
4379
|
-
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) })
|
|
4380
|
-
] })
|
|
4381
|
-
]
|
|
4382
|
-
},
|
|
4383
|
-
item.id
|
|
4384
|
-
)) })
|
|
4385
|
-
] }, folder2))
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
)
|
|
4386
4361
|
] })
|
|
4387
4362
|
] }),
|
|
4388
4363
|
!narrow && !listOpen && listToggle,
|
|
4389
|
-
/* @__PURE__ */
|
|
4364
|
+
/* @__PURE__ */ jsxs13("main", { className: "w100n-docs-stage", children: [
|
|
4390
4365
|
!narrow && !panelOpen && panelToggle,
|
|
4391
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-bare", children: stage })
|
|
4392
4367
|
] }),
|
|
4393
|
-
doc.data && panelOpen && /* @__PURE__ */
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
/* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
4397
|
-
(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 })
|
|
4398
4373
|
] }, key)) }),
|
|
4399
|
-
/* @__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 }) })
|
|
4400
4375
|
] }) }),
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
tab === "outline" && (outline.length ? /* @__PURE__ */
|
|
4403
|
-
now && /* @__PURE__ */
|
|
4404
|
-
/* @__PURE__ */
|
|
4405
|
-
/* @__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: [
|
|
4406
4381
|
Math.round(now.progress * 100),
|
|
4407
4382
|
"% ",
|
|
4408
4383
|
t.read
|
|
4409
4384
|
] })
|
|
4410
4385
|
] }),
|
|
4411
|
-
outline.length > 8 && /* @__PURE__ */
|
|
4412
|
-
/* @__PURE__ */
|
|
4413
|
-
/* @__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 })
|
|
4414
4389
|
] }),
|
|
4415
4390
|
chapters.map((c, i) => {
|
|
4416
4391
|
const subs = words.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -4418,13 +4393,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4418
4393
|
const opened2 = words.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
4419
4394
|
const named = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
4420
4395
|
const mark = c.subs.findIndex((s) => s.id === now?.id);
|
|
4421
|
-
return /* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
4425
|
-
/* @__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 })
|
|
4426
4401
|
] }),
|
|
4427
|
-
c.subs.length > 0 && /* @__PURE__ */
|
|
4402
|
+
c.subs.length > 0 && /* @__PURE__ */ jsxs13(
|
|
4428
4403
|
"button",
|
|
4429
4404
|
{
|
|
4430
4405
|
type: "button",
|
|
@@ -4434,13 +4409,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4434
4409
|
title: opened2 ? t.hideSections : t.showSections,
|
|
4435
4410
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened2 }),
|
|
4436
4411
|
children: [
|
|
4437
|
-
/* @__PURE__ */
|
|
4438
|
-
opened2 ? /* @__PURE__ */
|
|
4412
|
+
/* @__PURE__ */ jsx13("small", { children: c.subs.length }),
|
|
4413
|
+
opened2 ? /* @__PURE__ */ jsx13(ChevronDown3, { "aria-hidden": true }) : /* @__PURE__ */ jsx13(ChevronRight3, { "aria-hidden": true })
|
|
4439
4414
|
]
|
|
4440
4415
|
}
|
|
4441
4416
|
)
|
|
4442
4417
|
] }),
|
|
4443
|
-
opened2 && subs.length > 0 && /* @__PURE__ */
|
|
4418
|
+
opened2 && subs.length > 0 && /* @__PURE__ */ jsx13("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs13(
|
|
4444
4419
|
"button",
|
|
4445
4420
|
{
|
|
4446
4421
|
type: "button",
|
|
@@ -4449,7 +4424,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4449
4424
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
4450
4425
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
4451
4426
|
children: [
|
|
4452
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsx13("i", { "aria-hidden": true }),
|
|
4453
4428
|
s.text
|
|
4454
4429
|
]
|
|
4455
4430
|
},
|
|
@@ -4457,47 +4432,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4457
4432
|
)) })
|
|
4458
4433
|
] }, c.head.id);
|
|
4459
4434
|
})
|
|
4460
|
-
] }) : /* @__PURE__ */
|
|
4461
|
-
tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */
|
|
4462
|
-
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: [
|
|
4463
4438
|
versions.error && failed(versions.retry),
|
|
4464
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */
|
|
4439
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ jsxs13(
|
|
4465
4440
|
"button",
|
|
4466
4441
|
{
|
|
4467
4442
|
type: "button",
|
|
4468
4443
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
4469
4444
|
onClick: () => view(item.current ? null : item.id),
|
|
4470
4445
|
children: [
|
|
4471
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsxs13("b", { children: [
|
|
4472
4447
|
date(item.createdAt),
|
|
4473
|
-
item.current && /* @__PURE__ */
|
|
4448
|
+
item.current && /* @__PURE__ */ jsx13("span", { className: "w100n-docs-badge", children: t.current })
|
|
4474
4449
|
] }),
|
|
4475
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx13("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
4476
4451
|
]
|
|
4477
4452
|
},
|
|
4478
4453
|
item.id
|
|
4479
4454
|
))
|
|
4480
4455
|
] }),
|
|
4481
|
-
tab === "details" && /* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4485
|
-
/* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
doc.data.updatedBy && /* @__PURE__ */
|
|
4489
|
-
/* @__PURE__ */
|
|
4490
|
-
/* @__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 })
|
|
4491
4466
|
] }),
|
|
4492
|
-
/* @__PURE__ */
|
|
4493
|
-
/* @__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(", ") })
|
|
4494
4469
|
] }),
|
|
4495
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */
|
|
4496
|
-
/* @__PURE__ */
|
|
4497
|
-
/* @__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 }),
|
|
4498
4473
|
t.exportAs
|
|
4499
4474
|
] }),
|
|
4500
|
-
/* @__PURE__ */
|
|
4475
|
+
/* @__PURE__ */ jsx13("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs13(
|
|
4501
4476
|
"button",
|
|
4502
4477
|
{
|
|
4503
4478
|
type: "button",
|
|
@@ -4505,22 +4480,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4505
4480
|
disabled: exporting === "busy",
|
|
4506
4481
|
onClick: () => void exportAs(doc.data, format),
|
|
4507
4482
|
children: [
|
|
4508
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx13(FileDown, { "aria-hidden": true }),
|
|
4509
4484
|
format.toUpperCase()
|
|
4510
4485
|
]
|
|
4511
4486
|
},
|
|
4512
4487
|
format
|
|
4513
4488
|
)) }),
|
|
4514
|
-
exporting === "failed" && /* @__PURE__ */
|
|
4489
|
+
exporting === "failed" && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
4515
4490
|
] }),
|
|
4516
|
-
tab === "comments" && /* @__PURE__ */
|
|
4517
|
-
tab === "sharing" && sharing && /* @__PURE__ */
|
|
4518
|
-
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: [
|
|
4519
4494
|
signatures.error && failed(signatures.retry),
|
|
4520
|
-
signatures.data?.length === 0 && /* @__PURE__ */
|
|
4495
|
+
signatures.data?.length === 0 && /* @__PURE__ */ jsx13("p", { className: "w100n-docs-muted", children: t.noSignatures }),
|
|
4521
4496
|
(signatures.data ?? []).map((entry) => {
|
|
4522
4497
|
const signed = versions.data?.find((v) => v.id === entry.versionId);
|
|
4523
|
-
return /* @__PURE__ */
|
|
4498
|
+
return /* @__PURE__ */ jsxs13(
|
|
4524
4499
|
"button",
|
|
4525
4500
|
{
|
|
4526
4501
|
type: "button",
|
|
@@ -4528,15 +4503,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4528
4503
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
4529
4504
|
onClick: () => view(signed.current ? null : signed.id),
|
|
4530
4505
|
children: [
|
|
4531
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsxs13("b", { children: [
|
|
4532
4507
|
entry.signer.name,
|
|
4533
|
-
/* @__PURE__ */
|
|
4508
|
+
/* @__PURE__ */ jsxs13("span", { className: "w100n-docs-badge", children: [
|
|
4534
4509
|
t.page,
|
|
4535
4510
|
" ",
|
|
4536
4511
|
entry.page
|
|
4537
4512
|
] })
|
|
4538
4513
|
] }),
|
|
4539
|
-
/* @__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 ") })
|
|
4540
4515
|
]
|
|
4541
4516
|
},
|
|
4542
4517
|
entry.id
|
|
@@ -4547,7 +4522,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4547
4522
|
] })
|
|
4548
4523
|
] })
|
|
4549
4524
|
] }),
|
|
4550
|
-
jump && /* @__PURE__ */
|
|
4525
|
+
jump && /* @__PURE__ */ jsx13(
|
|
4551
4526
|
Jump,
|
|
4552
4527
|
{
|
|
4553
4528
|
mode: jump,
|
|
@@ -4560,18 +4535,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4560
4535
|
place: (item) => [!spaceId && names2.get(item.spaceId), item.folder].filter(Boolean).join(" / ")
|
|
4561
4536
|
}
|
|
4562
4537
|
),
|
|
4563
|
-
making && /* @__PURE__ */
|
|
4538
|
+
making && /* @__PURE__ */ jsx13(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
|
|
4564
4539
|
setMaking(false);
|
|
4565
4540
|
opened(made);
|
|
4566
4541
|
} }),
|
|
4567
|
-
menu && /* @__PURE__ */
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
menu.item.createdAt && /* @__PURE__ */ jsx12("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
|
|
4572
|
-
/* @__PURE__ */ jsx12("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
|
|
4573
|
-
] }),
|
|
4574
|
-
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(
|
|
4575
4546
|
"button",
|
|
4576
4547
|
{
|
|
4577
4548
|
type: "button",
|
|
@@ -4580,100 +4551,99 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4580
4551
|
onClick: () => moveTo(menu.item, { spaceId: menu.item.spaceId, folder: folder2 }),
|
|
4581
4552
|
style: { paddingLeft: 10 + 14 * (folder2 ? folder2.split("/").length : 0) },
|
|
4582
4553
|
children: [
|
|
4583
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsx13(Folder2, { "aria-hidden": true }),
|
|
4584
4555
|
folder2 ? folder2.split("/").pop() : names2.get(menu.item.spaceId) ?? t.topLevel
|
|
4585
4556
|
]
|
|
4586
4557
|
},
|
|
4587
4558
|
folder2
|
|
4588
|
-
)) }) : menu.sure ? /* @__PURE__ */
|
|
4589
|
-
/* @__PURE__ */
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
/* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4593
|
-
/* @__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 }),
|
|
4594
4565
|
t.trash
|
|
4595
4566
|
] })
|
|
4596
4567
|
] })
|
|
4597
|
-
] }) : /* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4568
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4569
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4599
4570
|
setMenu(null);
|
|
4600
4571
|
open(menu.item);
|
|
4601
4572
|
}, children: [
|
|
4602
|
-
/* @__PURE__ */
|
|
4573
|
+
/* @__PURE__ */ jsx13(FileText4, { "aria-hidden": true }),
|
|
4603
4574
|
t.openFile
|
|
4604
4575
|
] }),
|
|
4605
|
-
host.href && /* @__PURE__ */
|
|
4576
|
+
host.href && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4606
4577
|
setMenu(null);
|
|
4607
4578
|
window.open(host.href(menu.item.id), "_blank", "noopener");
|
|
4608
4579
|
}, children: [
|
|
4609
|
-
/* @__PURE__ */
|
|
4580
|
+
/* @__PURE__ */ jsx13(ExternalLink2, { "aria-hidden": true }),
|
|
4610
4581
|
t.openTab
|
|
4611
4582
|
] }),
|
|
4612
|
-
host.href && /* @__PURE__ */
|
|
4613
|
-
/* @__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 }),
|
|
4614
4585
|
t.copyLink
|
|
4615
4586
|
] }),
|
|
4616
|
-
host.send && /* @__PURE__ */
|
|
4587
|
+
host.send && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4617
4588
|
setMenu(null);
|
|
4618
4589
|
host.send(menu.item.id);
|
|
4619
4590
|
}, children: [
|
|
4620
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx13(Send, { "aria-hidden": true }),
|
|
4621
4592
|
t.sendChat
|
|
4622
4593
|
] }),
|
|
4623
|
-
/* @__PURE__ */
|
|
4624
|
-
host.rename && /* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4595
|
+
host.rename && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4625
4596
|
const item = menu.item;
|
|
4626
4597
|
setMenu(null);
|
|
4627
|
-
|
|
4628
|
-
else setNaming({ id: item.id, text: item.name.replace(/\.[^.]+$/, "") });
|
|
4598
|
+
setEdit({ key: `file:${item.id}`, text: item.name.replace(/\.[^.]+$/, ""), run: (text2) => retitle(item, text2) });
|
|
4629
4599
|
}, children: [
|
|
4630
|
-
/* @__PURE__ */
|
|
4600
|
+
/* @__PURE__ */ jsx13(Pencil, { "aria-hidden": true }),
|
|
4631
4601
|
t.rename
|
|
4632
4602
|
] }),
|
|
4633
|
-
host.move && dirs.data?.has(menu.item.spaceId) && /* @__PURE__ */
|
|
4634
|
-
/* @__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 }),
|
|
4635
4605
|
t.moveTo
|
|
4636
4606
|
] }),
|
|
4637
|
-
host.create && /* @__PURE__ */
|
|
4638
|
-
/* @__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 }),
|
|
4639
4609
|
t.makeCopy
|
|
4640
4610
|
] }),
|
|
4641
|
-
/* @__PURE__ */
|
|
4642
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
|
|
4612
|
+
/* @__PURE__ */ jsx13(Download3, { "aria-hidden": true }),
|
|
4643
4613
|
t.download
|
|
4644
4614
|
] }),
|
|
4645
|
-
host.saveTemplate && /* @__PURE__ */
|
|
4646
|
-
/* @__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 }),
|
|
4647
4617
|
t.saveTemplate
|
|
4648
4618
|
] }),
|
|
4649
|
-
/* @__PURE__ */
|
|
4619
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4650
4620
|
setMenu(null);
|
|
4651
4621
|
open(menu.item);
|
|
4652
4622
|
setTab("details");
|
|
4653
4623
|
side("panel", true);
|
|
4654
4624
|
}, children: [
|
|
4655
|
-
/* @__PURE__ */
|
|
4625
|
+
/* @__PURE__ */ jsx13(Info, { "aria-hidden": true }),
|
|
4656
4626
|
t.details
|
|
4657
4627
|
] }),
|
|
4658
|
-
host.remove && /* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__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 }),
|
|
4662
4632
|
t.trash
|
|
4663
4633
|
] })
|
|
4664
4634
|
] })
|
|
4665
4635
|
] })
|
|
4666
4636
|
] }),
|
|
4667
|
-
spot2 && /* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
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(" / ") })
|
|
4671
4641
|
] }),
|
|
4672
|
-
spot2.sure ? /* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
/* @__PURE__ */
|
|
4675
|
-
/* @__PURE__ */
|
|
4676
|
-
/* @__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: () => {
|
|
4677
4647
|
const at = spot2.at;
|
|
4678
4648
|
const inside2 = doc.data && doc.data.spaceId === at.spaceId && `${doc.data.folder ?? ""}/`.startsWith(`${at.folder}/`);
|
|
4679
4649
|
void act(() => host.removeFolder(at), t.trashed).then(() => {
|
|
@@ -4681,42 +4651,42 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4681
4651
|
if (inside2) go({ spaceId: here.spaceId, documentId: null });
|
|
4682
4652
|
});
|
|
4683
4653
|
}, children: [
|
|
4684
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx13(Trash24, { "aria-hidden": true }),
|
|
4685
4655
|
t.trash
|
|
4686
4656
|
] })
|
|
4687
4657
|
] })
|
|
4688
|
-
] }) : /* @__PURE__ */
|
|
4689
|
-
host.create && /* @__PURE__ */
|
|
4658
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4659
|
+
host.create && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4690
4660
|
const at = spot2.at;
|
|
4691
4661
|
setSpot(null);
|
|
4692
4662
|
void note(t.untitled, true, at);
|
|
4693
4663
|
}, children: [
|
|
4694
|
-
/* @__PURE__ */
|
|
4664
|
+
/* @__PURE__ */ jsx13(FilePlus, { "aria-hidden": true }),
|
|
4695
4665
|
t.newNoteHere
|
|
4696
4666
|
] }),
|
|
4697
|
-
host.makeFolder && /* @__PURE__ */
|
|
4667
|
+
host.makeFolder && /* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4698
4668
|
const at = spot2.at;
|
|
4699
4669
|
setSpot(null);
|
|
4700
4670
|
setEdit({ key: `new:${spot2.key}`, text: t.newFolder, run: (name) => act(() => host.makeFolder(at, name)).then(refresh) });
|
|
4701
4671
|
}, children: [
|
|
4702
|
-
/* @__PURE__ */
|
|
4672
|
+
/* @__PURE__ */ jsx13(FolderPlus, { "aria-hidden": true }),
|
|
4703
4673
|
t.newFolder
|
|
4704
4674
|
] }),
|
|
4705
|
-
spot2.at.folder && host.renameFolder && /* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
4707
|
-
/* @__PURE__ */
|
|
4675
|
+
spot2.at.folder && host.renameFolder && /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
4676
|
+
/* @__PURE__ */ jsx13("hr", {}),
|
|
4677
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", role: "menuitem", onClick: () => {
|
|
4708
4678
|
const at = spot2.at;
|
|
4709
4679
|
setSpot(null);
|
|
4710
4680
|
setEdit({ key: `dir:${spot2.key}`, text: folderNamed(at), run: (name) => name === folderNamed(at) ? Promise.resolve() : act(() => host.renameFolder(at, name)).then(refresh) });
|
|
4711
4681
|
}, children: [
|
|
4712
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx13(Pencil, { "aria-hidden": true }),
|
|
4713
4683
|
t.renameFolder
|
|
4714
4684
|
] })
|
|
4715
4685
|
] }),
|
|
4716
|
-
spot2.at.folder && host.removeFolder && /* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
4719
|
-
/* @__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 }),
|
|
4720
4690
|
t.trashFolder
|
|
4721
4691
|
] })
|
|
4722
4692
|
] })
|
|
@@ -4728,21 +4698,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
|
|
|
4728
4698
|
|
|
4729
4699
|
// src/FilePreview.tsx
|
|
4730
4700
|
import { useState as useState12 } from "react";
|
|
4731
|
-
import { jsx as
|
|
4701
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
4732
4702
|
function FilePreview({ url, name, mimeType, size = 0, bytes, pdfWorker }) {
|
|
4733
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)))) }));
|
|
4734
4704
|
const kind = kindOf(name, mimeType);
|
|
4735
4705
|
if (!kind) return null;
|
|
4736
|
-
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: "" } }) });
|
|
4737
4707
|
}
|
|
4738
4708
|
|
|
4739
4709
|
// src/GuestDocument.tsx
|
|
4740
4710
|
import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState13 } from "react";
|
|
4741
|
-
import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet5, FileText as FileText5, FileType as
|
|
4742
|
-
import { Fragment as Fragment12, jsx as
|
|
4743
|
-
var TextEditor3 = lazy3(() => import("./TextEditor-
|
|
4744
|
-
var SheetView3 = lazy3(() => import("./SheetView-
|
|
4745
|
-
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 };
|
|
4746
4716
|
var GuestRefused = class extends Error {
|
|
4747
4717
|
constructor(reason, file = "", sharedBy = "") {
|
|
4748
4718
|
super(reason);
|
|
@@ -4800,18 +4770,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4800
4770
|
};
|
|
4801
4771
|
const top = (file2, badge) => {
|
|
4802
4772
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
4803
|
-
const Kind = kind2 ?
|
|
4804
|
-
return /* @__PURE__ */
|
|
4805
|
-
brand && /* @__PURE__ */
|
|
4806
|
-
file2 && /* @__PURE__ */
|
|
4807
|
-
/* @__PURE__ */
|
|
4808
|
-
/* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
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) })
|
|
4811
4781
|
] }),
|
|
4812
|
-
badge && /* @__PURE__ */
|
|
4813
|
-
file2.download && /* @__PURE__ */
|
|
4814
|
-
(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(
|
|
4815
4785
|
"button",
|
|
4816
4786
|
{
|
|
4817
4787
|
type: "button",
|
|
@@ -4822,25 +4792,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4822
4792
|
"aria-label": t.pdfCopy,
|
|
4823
4793
|
title: t.pdfCopy,
|
|
4824
4794
|
children: [
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4795
|
+
/* @__PURE__ */ jsx15(FileDown2, { "aria-hidden": true }),
|
|
4796
|
+
/* @__PURE__ */ jsx15("span", { children: t.pdfCopy })
|
|
4827
4797
|
]
|
|
4828
4798
|
}
|
|
4829
4799
|
),
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4832
|
-
/* @__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 })
|
|
4833
4803
|
] })
|
|
4834
4804
|
] })
|
|
4835
4805
|
] })
|
|
4836
4806
|
] });
|
|
4837
4807
|
};
|
|
4838
|
-
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: [
|
|
4839
4809
|
top(null, null),
|
|
4840
|
-
/* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__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 }),
|
|
4844
4814
|
form
|
|
4845
4815
|
] }) })
|
|
4846
4816
|
] });
|
|
@@ -4856,7 +4826,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4856
4826
|
password ? Lock2 : UserRound,
|
|
4857
4827
|
refused.file || t.documents,
|
|
4858
4828
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
4859
|
-
/* @__PURE__ */
|
|
4829
|
+
/* @__PURE__ */ jsxs14("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
4860
4830
|
e.preventDefault();
|
|
4861
4831
|
if (!typed.trim()) return;
|
|
4862
4832
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -4866,7 +4836,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4866
4836
|
}
|
|
4867
4837
|
setTyped("");
|
|
4868
4838
|
}, children: [
|
|
4869
|
-
/* @__PURE__ */
|
|
4839
|
+
/* @__PURE__ */ jsx15(
|
|
4870
4840
|
"input",
|
|
4871
4841
|
{
|
|
4872
4842
|
className: "w100n-share-input",
|
|
@@ -4879,21 +4849,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4879
4849
|
onChange: (e) => setTyped(e.target.value)
|
|
4880
4850
|
}
|
|
4881
4851
|
),
|
|
4882
|
-
refused.reason === "wrong" && /* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
/* @__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 }),
|
|
4885
4855
|
t.openDoc
|
|
4886
4856
|
] })
|
|
4887
4857
|
] })
|
|
4888
4858
|
);
|
|
4889
4859
|
}
|
|
4890
4860
|
if (refused?.reason === "busy") return gate("slate", Ban2, t.failed, t.tooMany);
|
|
4891
|
-
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 }));
|
|
4892
4862
|
}
|
|
4893
4863
|
const file = opened.data;
|
|
4894
|
-
if (!file) return /* @__PURE__ */
|
|
4864
|
+
if (!file) return /* @__PURE__ */ jsxs14("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
4895
4865
|
top(null, null),
|
|
4896
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsx15("div", { className: "w100n-docs-empty", children: t.loading })
|
|
4897
4867
|
] });
|
|
4898
4868
|
const kind = kindOf(file.name, file.mimeType);
|
|
4899
4869
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -4901,23 +4871,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
4901
4871
|
const rights = { view: true, comment: talk, edit: false };
|
|
4902
4872
|
const quiet2 = () => {
|
|
4903
4873
|
};
|
|
4904
|
-
let stage = /* @__PURE__ */
|
|
4905
|
-
if (text) stage = /* @__PURE__ */
|
|
4906
|
-
else if (kind === "pdf") stage = /* @__PURE__ */
|
|
4907
|
-
else if (kind === "slides") stage = /* @__PURE__ */
|
|
4908
|
-
else if (kind === "sheet") stage = /* @__PURE__ */
|
|
4909
|
-
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: [
|
|
4910
4880
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
4911
|
-
saving === "failed" && /* @__PURE__ */
|
|
4912
|
-
/* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
talk && /* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
/* @__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) })
|
|
4918
4888
|
] }),
|
|
4919
|
-
/* @__PURE__ */
|
|
4920
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsx15("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
4890
|
+
/* @__PURE__ */ jsx15("div", { ref: setSlot })
|
|
4921
4891
|
] }) })
|
|
4922
4892
|
] })
|
|
4923
4893
|
] });
|
|
@@ -4928,6 +4898,7 @@ export {
|
|
|
4928
4898
|
FilePreview,
|
|
4929
4899
|
GuestDocument,
|
|
4930
4900
|
GuestRefused,
|
|
4901
|
+
PreviewCard,
|
|
4931
4902
|
SlidesView,
|
|
4932
4903
|
kindOf,
|
|
4933
4904
|
kinds,
|