@w100n/documents 0.16.4 → 0.18.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/{Compare-M57FG4R3.js → Compare-RHAUAKUJ.js} +2 -2
- package/dist/{SheetView-OEKOHMKW.js → SheetView-43JDIP7D.js} +5 -5
- package/dist/{TextEditor-5S7FSLIZ.js → TextEditor-CYS4U5XA.js} +119 -27
- package/dist/TextEditor-CYS4U5XA.js.map +1 -0
- package/dist/{chunk-VNXZVOPN.js → chunk-BWU6FPPZ.js} +956 -1
- package/dist/chunk-BWU6FPPZ.js.map +1 -0
- package/dist/{chunk-3D2G5NBI.js → chunk-DATYTA4H.js} +2 -2
- package/dist/{chunk-EQLBYW42.js → chunk-GSIPTCQH.js} +9 -1
- package/dist/chunk-GSIPTCQH.js.map +1 -0
- package/dist/chunk-Z5STMOD6.js +39 -0
- package/dist/chunk-Z5STMOD6.js.map +1 -0
- package/dist/{chunk-AKJGYZME.js → chunk-ZCSHH24C.js} +67 -832
- package/dist/chunk-ZCSHH24C.js.map +1 -0
- package/dist/collab.cjs +197 -2
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.d.cts +1 -1
- package/dist/collab.d.ts +1 -1
- package/dist/collab.js +3 -3
- package/dist/index.cjs +1437 -543
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +330 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1080 -497
- package/dist/index.js.map +1 -1
- package/dist/kinds.d.cts +1 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/memory.cjs +34 -5
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts +1 -1
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +34 -5
- package/dist/memory.js.map +1 -1
- package/dist/{types-BUO0OzOl.d.cts → types-DyonaPQf.d.cts} +12 -1
- package/dist/{types-BUO0OzOl.d.ts → types-DyonaPQf.d.ts} +12 -1
- package/package.json +1 -1
- package/dist/TextEditor-5S7FSLIZ.js.map +0 -1
- package/dist/chunk-AKJGYZME.js.map +0 -1
- package/dist/chunk-EQLBYW42.js.map +0 -1
- package/dist/chunk-VNXZVOPN.js.map +0 -1
- /package/dist/{Compare-M57FG4R3.js.map → Compare-RHAUAKUJ.js.map} +0 -0
- /package/dist/{SheetView-OEKOHMKW.js.map → SheetView-43JDIP7D.js.map} +0 -0
- /package/dist/{chunk-3D2G5NBI.js.map → chunk-DATYTA4H.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,38 @@ var init_text = __esm({
|
|
|
67
67
|
"src/text.ts"() {
|
|
68
68
|
"use strict";
|
|
69
69
|
en2 = {
|
|
70
|
+
elsewhere: "Other",
|
|
71
|
+
newFolder: "New folder",
|
|
72
|
+
newNoteHere: "New note here",
|
|
73
|
+
renameFolder: "Rename folder",
|
|
74
|
+
trashFolder: "Move folder to trash",
|
|
75
|
+
folderTrashAsk: "Move {name} and everything in it to trash?",
|
|
76
|
+
moveTo: "Move to",
|
|
77
|
+
folderActions: "Folder actions",
|
|
78
|
+
folderName: "Folder name",
|
|
79
|
+
topLevel: "Top level",
|
|
80
|
+
wikiCreate: "Create \u201C{name}\u201D",
|
|
81
|
+
wikiNew: "new note",
|
|
82
|
+
wikiKeys: "\u2191\u2193 pick \xB7 \u21B5 link \xB7 | alias",
|
|
83
|
+
tree: "Tree",
|
|
84
|
+
cards: "Cards",
|
|
85
|
+
openNote: "Open note",
|
|
86
|
+
findNote: "Type a note name",
|
|
87
|
+
createNote: "Create note \u201C{name}\u201D",
|
|
88
|
+
noNote: "No notes match",
|
|
89
|
+
keysOpen: "\u2191\u2193 move \xB7 \u21B5 open \xB7 esc close",
|
|
90
|
+
commands: "Commands",
|
|
91
|
+
newNote: "New note",
|
|
92
|
+
searchAll: "Search in all notes",
|
|
93
|
+
showOutline: "Show outline",
|
|
94
|
+
showLinks: "Show backlinks",
|
|
95
|
+
showVersions: "Show versions",
|
|
96
|
+
showComments: "Show comments",
|
|
97
|
+
keysRun: "\u2191\u2193 move \xB7 \u21B5 run \xB7 esc close",
|
|
98
|
+
links: "Links",
|
|
99
|
+
linked: "Linked mentions",
|
|
100
|
+
unlinked: "Unlinked mentions",
|
|
101
|
+
noBacklinks: "Nothing links here yet",
|
|
70
102
|
documents: "Documents",
|
|
71
103
|
hint: "Files of your projects: read, edit and comment in one place",
|
|
72
104
|
loose: "Without a folder",
|
|
@@ -420,6 +452,38 @@ var init_text = __esm({
|
|
|
420
452
|
uploadFailed: "Could not upload the file"
|
|
421
453
|
};
|
|
422
454
|
pl2 = {
|
|
455
|
+
elsewhere: "Inne",
|
|
456
|
+
newFolder: "Nowy folder",
|
|
457
|
+
newNoteHere: "Nowa notatka tutaj",
|
|
458
|
+
renameFolder: "Zmie\u0144 nazw\u0119 folderu",
|
|
459
|
+
trashFolder: "Przenie\u015B folder do kosza",
|
|
460
|
+
folderTrashAsk: "Przenie\u015B\u0107 {name} z ca\u0142\u0105 zawarto\u015Bci\u0105 do kosza?",
|
|
461
|
+
moveTo: "Przenie\u015B do",
|
|
462
|
+
folderActions: "Dzia\u0142ania na folderze",
|
|
463
|
+
folderName: "Nazwa folderu",
|
|
464
|
+
topLevel: "Najwy\u017Cszy poziom",
|
|
465
|
+
wikiCreate: "Utw\xF3rz \u201E{name}\u201D",
|
|
466
|
+
wikiNew: "nowa notatka",
|
|
467
|
+
wikiKeys: "\u2191\u2193 wyb\xF3r \xB7 \u21B5 link \xB7 | alias",
|
|
468
|
+
tree: "Drzewo",
|
|
469
|
+
cards: "Karty",
|
|
470
|
+
openNote: "Otw\xF3rz notatk\u0119",
|
|
471
|
+
findNote: "Wpisz nazw\u0119 notatki",
|
|
472
|
+
createNote: "Utw\xF3rz notatk\u0119 \u201E{name}\u201D",
|
|
473
|
+
noNote: "Brak pasuj\u0105cych notatek",
|
|
474
|
+
keysOpen: "\u2191\u2193 ruch \xB7 \u21B5 otw\xF3rz \xB7 esc zamknij",
|
|
475
|
+
commands: "Polecenia",
|
|
476
|
+
newNote: "Nowa notatka",
|
|
477
|
+
searchAll: "Szukaj we wszystkich notatkach",
|
|
478
|
+
showOutline: "Poka\u017C spis",
|
|
479
|
+
showLinks: "Poka\u017C odno\u015Bniki",
|
|
480
|
+
showVersions: "Poka\u017C wersje",
|
|
481
|
+
showComments: "Poka\u017C komentarze",
|
|
482
|
+
keysRun: "\u2191\u2193 ruch \xB7 \u21B5 uruchom \xB7 esc zamknij",
|
|
483
|
+
links: "Odno\u015Bniki",
|
|
484
|
+
linked: "Linki do tej notatki",
|
|
485
|
+
unlinked: "Wzmianki bez linku",
|
|
486
|
+
noBacklinks: "Nic tu jeszcze nie linkuje",
|
|
423
487
|
documents: "Dokumenty",
|
|
424
488
|
hint: "Pliki Twoich projekt\xF3w: czytaj, edytuj i komentuj w jednym miejscu",
|
|
425
489
|
loose: "Bez folderu",
|
|
@@ -773,6 +837,38 @@ var init_text = __esm({
|
|
|
773
837
|
uploadFailed: "Nie uda\u0142o si\u0119 wgra\u0107 pliku"
|
|
774
838
|
};
|
|
775
839
|
uk2 = {
|
|
840
|
+
elsewhere: "\u0406\u043D\u0448\u0435",
|
|
841
|
+
newFolder: "\u041D\u043E\u0432\u0430 \u043F\u0430\u043F\u043A\u0430",
|
|
842
|
+
newNoteHere: "\u041D\u043E\u0432\u0430 \u043D\u043E\u0442\u0430\u0442\u043A\u0430 \u0442\u0443\u0442",
|
|
843
|
+
renameFolder: "\u041F\u0435\u0440\u0435\u0439\u043C\u0435\u043D\u0443\u0432\u0430\u0442\u0438 \u043F\u0430\u043F\u043A\u0443",
|
|
844
|
+
trashFolder: "\u041F\u0430\u043F\u043A\u0443 \u0432 \u043A\u043E\u0448\u0438\u043A",
|
|
845
|
+
folderTrashAsk: "\u041F\u0435\u0440\u0435\u043C\u0456\u0441\u0442\u0438\u0442\u0438 {name} \u0437 \u0443\u0441\u0456\u043C \u0432\u043C\u0456\u0441\u0442\u043E\u043C \u0443 \u043A\u043E\u0448\u0438\u043A?",
|
|
846
|
+
moveTo: "\u041F\u0435\u0440\u0435\u043D\u0435\u0441\u0442\u0438 \u0432",
|
|
847
|
+
folderActions: "\u0414\u0456\u0457 \u0437 \u043F\u0430\u043F\u043A\u043E\u044E",
|
|
848
|
+
folderName: "\u041D\u0430\u0437\u0432\u0430 \u043F\u0430\u043F\u043A\u0438",
|
|
849
|
+
topLevel: "\u0412\u0435\u0440\u0445\u043D\u0456\u0439 \u0440\u0456\u0432\u0435\u043D\u044C",
|
|
850
|
+
wikiCreate: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \xAB{name}\xBB",
|
|
851
|
+
wikiNew: "\u043D\u043E\u0432\u0430 \u043D\u043E\u0442\u0430\u0442\u043A\u0430",
|
|
852
|
+
wikiKeys: "\u2191\u2193 \u0432\u0438\u0431\u0456\u0440 \xB7 \u21B5 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \xB7 | \u043F\u0456\u0434\u043F\u0438\u0441",
|
|
853
|
+
tree: "\u0414\u0435\u0440\u0435\u0432\u043E",
|
|
854
|
+
cards: "\u041A\u0430\u0440\u0442\u043A\u0438",
|
|
855
|
+
openNote: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u043D\u043E\u0442\u0430\u0442\u043A\u0443",
|
|
856
|
+
findNote: "\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u043D\u0430\u0437\u0432\u0443 \u043D\u043E\u0442\u0430\u0442\u043A\u0438",
|
|
857
|
+
createNote: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u043D\u043E\u0442\u0430\u0442\u043A\u0443 \xAB{name}\xBB",
|
|
858
|
+
noNote: "\u041D\u0435\u043C\u0430\u0454 \u0442\u0430\u043A\u0438\u0445 \u043D\u043E\u0442\u0430\u0442\u043E\u043A",
|
|
859
|
+
keysOpen: "\u2191\u2193 \u0440\u0443\u0445 \xB7 \u21B5 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \xB7 esc \u0437\u0430\u043A\u0440\u0438\u0442\u0438",
|
|
860
|
+
commands: "\u041A\u043E\u043C\u0430\u043D\u0434\u0438",
|
|
861
|
+
newNote: "\u041D\u043E\u0432\u0430 \u043D\u043E\u0442\u0430\u0442\u043A\u0430",
|
|
862
|
+
searchAll: "\u0428\u0443\u043A\u0430\u0442\u0438 \u0432 \u0443\u0441\u0456\u0445 \u043D\u043E\u0442\u0430\u0442\u043A\u0430\u0445",
|
|
863
|
+
showOutline: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0437\u043C\u0456\u0441\u0442",
|
|
864
|
+
showLinks: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
865
|
+
showVersions: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0432\u0435\u0440\u0441\u0456\u0457",
|
|
866
|
+
showComments: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456",
|
|
867
|
+
keysRun: "\u2191\u2193 \u0440\u0443\u0445 \xB7 \u21B5 \u0432\u0438\u043A\u043E\u043D\u0430\u0442\u0438 \xB7 esc \u0437\u0430\u043A\u0440\u0438\u0442\u0438",
|
|
868
|
+
links: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
869
|
+
linked: "\u041F\u043E\u0441\u0438\u043B\u0430\u044E\u0442\u044C\u0441\u044F \u0441\u044E\u0434\u0438",
|
|
870
|
+
unlinked: "\u0417\u0433\u0430\u0434\u043A\u0438 \u0431\u0435\u0437 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
871
|
+
noBacklinks: "\u0421\u044E\u0434\u0438 \u0449\u0435 \u043D\u0456\u0449\u043E \u043D\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u0454\u0442\u044C\u0441\u044F",
|
|
776
872
|
documents: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0438",
|
|
777
873
|
hint: "\u0424\u0430\u0439\u043B\u0438 \u0432\u0430\u0448\u0438\u0445 \u043F\u0440\u043E\u0454\u043A\u0442\u0456\u0432: \u0447\u0438\u0442\u0430\u0439\u0442\u0435, \u0440\u0435\u0434\u0430\u0433\u0443\u0439\u0442\u0435 \u0439 \u043A\u043E\u043C\u0435\u043D\u0442\u0443\u0439\u0442\u0435 \u0432 \u043E\u0434\u043D\u043E\u043C\u0443 \u043C\u0456\u0441\u0446\u0456",
|
|
778
874
|
loose: "\u0411\u0435\u0437 \u0442\u0435\u043A\u0438",
|
|
@@ -1354,11 +1450,11 @@ function rebuild(pr, tag, order2, set) {
|
|
|
1354
1450
|
}
|
|
1355
1451
|
for (const name in set) if (!seen2.has(name) && set[name] !== null) out.push({ name, xml: set[name] });
|
|
1356
1452
|
if (!out.length) return "";
|
|
1357
|
-
const
|
|
1453
|
+
const rank2 = (name) => {
|
|
1358
1454
|
const i = order2.indexOf(name);
|
|
1359
1455
|
return i === -1 ? order2.length : i;
|
|
1360
1456
|
};
|
|
1361
|
-
const sorted = out.map((p, i) => ({ p, i })).sort((a, b) =>
|
|
1457
|
+
const sorted = out.map((p, i) => ({ p, i })).sort((a, b) => rank2(a.p.name) - rank2(b.p.name) || a.i - b.i);
|
|
1362
1458
|
const open = root ? opened(pr, root) : `<${tag}>`;
|
|
1363
1459
|
return open + sorted.map((x) => x.p.xml).join("") + `</${tag}>`;
|
|
1364
1460
|
}
|
|
@@ -2670,8 +2766,8 @@ var init_read = __esm({
|
|
|
2670
2766
|
const pr = kid(el, "w:tblPr");
|
|
2671
2767
|
const jc = pr && kid(pr, "w:jc");
|
|
2672
2768
|
const bd = pr && kid(pr, "w:tblBorders");
|
|
2673
|
-
const
|
|
2674
|
-
const node = { type: "table", attrs: { align: align(jc ? attr(s, jc, "w:val") : null), indent: 0, borders:
|
|
2769
|
+
const bare4 = !!bd && bd.kids.length > 0 && bd.kids.every((k) => /^(none|nil)$/.test(attr(s, k, "w:val") ?? ""));
|
|
2770
|
+
const node = { type: "table", attrs: { align: align(jc ? attr(s, jc, "w:val") : null), indent: 0, borders: bare4 ? "none" : null, ref }, content: [] };
|
|
2675
2771
|
const b = this.block("tbl", el, node, ref);
|
|
2676
2772
|
const grid3 = kid(el, "w:tblGrid");
|
|
2677
2773
|
b.cols = grid3 ? grid3.kids.filter((k) => k.name === "w:gridCol").length : 0;
|
|
@@ -4182,7 +4278,7 @@ function decide(editor, accept, id) {
|
|
|
4182
4278
|
}
|
|
4183
4279
|
if (tr.docChanged) editor.view.dispatch(tr);
|
|
4184
4280
|
}
|
|
4185
|
-
function kit(kind, t, live) {
|
|
4281
|
+
function kit(kind, t, live, wiki) {
|
|
4186
4282
|
return [
|
|
4187
4283
|
import_starter_kit.default.configure({ trailingNode: false, link: { openOnClick: false, autolink: true, defaultProtocol: "https" }, dropcursor: { color: "#8b5cf6", width: 2 }, ...live ? { undoRedo: false } : {} }),
|
|
4188
4284
|
import_extension_list.TaskList,
|
|
@@ -4210,6 +4306,8 @@ function kit(kind, t, live) {
|
|
|
4210
4306
|
Formula,
|
|
4211
4307
|
Footnote,
|
|
4212
4308
|
EndNotes,
|
|
4309
|
+
WikiLink.configure({ known: wiki?.known ?? (() => true) }),
|
|
4310
|
+
...kind === "markdown" && wiki ? [WikiAsk, Reveal] : [],
|
|
4213
4311
|
...kind === "docx" ? [Pager, Locks.configure({ label: t.locked }), revision("insertion", "ins"), revision("deletion", "del"), Suggest] : [],
|
|
4214
4312
|
...live ? [import_extension_collaboration.default.configure({ document: live.doc }), import_extension_collaboration_caret.default.configure({ provider: live.link, user: live.user })] : []
|
|
4215
4313
|
];
|
|
@@ -4253,7 +4351,7 @@ function locate(doc, list) {
|
|
|
4253
4351
|
return range ? [{ id: c.id, from: range.from, to: range.to }] : [];
|
|
4254
4352
|
});
|
|
4255
4353
|
}
|
|
4256
|
-
var import_core2, import_extension_collaboration, import_extension_collaboration_caret, import_extension_highlight, import_extension_image, import_extension_list, import_extension_table, import_extension_text_style, import_state2, import_transform, import_view2, import_starter_kit, import_y_tiptap, notes, blocks, changed, Cells, searching, lookup, Search2, replace, cleanPaste, Blocks, PageBreak, Formula, Footnote, EndNotes, headings, Toc, revision, seen, suggesting, Suggest, Note, locks, locked, scan, Locks, paint, remap, Notes, script, textblocks, align2, spacing, indent, clear;
|
|
4354
|
+
var import_core2, import_extension_collaboration, import_extension_collaboration_caret, import_extension_highlight, import_extension_image, import_extension_list, import_extension_table, import_extension_text_style, import_state2, import_transform, import_view2, import_starter_kit, import_y_tiptap, notes, blocks, changed, Cells, searching, lookup, Search2, replace, cleanPaste, Blocks, PageBreak, Formula, Footnote, wikiName, WikiLink, wikiAsk, WikiAsk, signs, syntax, Reveal, EndNotes, headings, Toc, revision, seen, suggesting, Suggest, Note, locks, locked, scan, Locks, paint, remap, Notes, script, textblocks, align2, spacing, indent, clear;
|
|
4257
4355
|
var init_extensions = __esm({
|
|
4258
4356
|
"src/editor/extensions.ts"() {
|
|
4259
4357
|
"use strict";
|
|
@@ -4450,6 +4548,95 @@ var init_extensions = __esm({
|
|
|
4450
4548
|
parseHTML: () => [{ tag: "sup[data-footnote]" }],
|
|
4451
4549
|
renderHTML: ({ node }) => ["sup", { "data-footnote": "", "data-note-id": node.attrs.id ?? void 0, title: node.attrs.text, class: "w100n-fn", contenteditable: "false" }]
|
|
4452
4550
|
});
|
|
4551
|
+
wikiName = (target) => target.split("#")[0].trim().replace(/\.md$/i, "");
|
|
4552
|
+
WikiLink = import_core2.Node.create({
|
|
4553
|
+
name: "wikilink",
|
|
4554
|
+
group: "inline",
|
|
4555
|
+
inline: true,
|
|
4556
|
+
atom: true,
|
|
4557
|
+
selectable: true,
|
|
4558
|
+
addOptions: () => ({ known: () => true }),
|
|
4559
|
+
addAttributes: () => ({
|
|
4560
|
+
target: { default: "", parseHTML: (el) => el.getAttribute("data-wiki") ?? "" },
|
|
4561
|
+
alias: { default: null, parseHTML: (el) => el.getAttribute("data-alias") }
|
|
4562
|
+
}),
|
|
4563
|
+
parseHTML: () => [{ tag: "span[data-wiki]" }],
|
|
4564
|
+
renderHTML: ({ node }) => [
|
|
4565
|
+
"span",
|
|
4566
|
+
{ "data-wiki": node.attrs.target, "data-alias": node.attrs.alias ?? void 0, class: "w100n-wiki", contenteditable: "false" },
|
|
4567
|
+
node.attrs.alias || wikiName(node.attrs.target) || node.attrs.target
|
|
4568
|
+
],
|
|
4569
|
+
addProseMirrorPlugins() {
|
|
4570
|
+
const known = this.options.known;
|
|
4571
|
+
return [new import_state2.Plugin({
|
|
4572
|
+
props: {
|
|
4573
|
+
decorations(state) {
|
|
4574
|
+
const found = [];
|
|
4575
|
+
state.doc.descendants((node, pos) => {
|
|
4576
|
+
if (node.type.name === "wikilink" && !known(node.attrs.target)) found.push(import_view2.Decoration.node(pos, pos + node.nodeSize, { class: "is-missing" }));
|
|
4577
|
+
});
|
|
4578
|
+
return import_view2.DecorationSet.create(state.doc, found);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
})];
|
|
4582
|
+
}
|
|
4583
|
+
});
|
|
4584
|
+
wikiAsk = new import_state2.PluginKey("wikiAsk");
|
|
4585
|
+
WikiAsk = import_core2.Extension.create({
|
|
4586
|
+
name: "wikiAsk",
|
|
4587
|
+
addProseMirrorPlugins() {
|
|
4588
|
+
return [new import_state2.Plugin({
|
|
4589
|
+
key: wikiAsk,
|
|
4590
|
+
state: {
|
|
4591
|
+
init: () => null,
|
|
4592
|
+
apply(tr, _old, _before, state) {
|
|
4593
|
+
const { $from, empty } = state.selection;
|
|
4594
|
+
if (!empty || !$from.parent.isTextblock || $from.parent.type.spec.code) return null;
|
|
4595
|
+
const before = $from.parent.textBetween(0, $from.parentOffset, void 0, "\uFFFC");
|
|
4596
|
+
const m = /\[\[([^[\]\n|\ufffc]*)$/.exec(before);
|
|
4597
|
+
return m ? { from: $from.pos - m[0].length, query: m[1] } : null;
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
})];
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4603
|
+
signs = { bold: "**", italic: "*", strike: "~~", code: "`" };
|
|
4604
|
+
syntax = (text, pos, side2) => import_view2.Decoration.widget(pos, () => {
|
|
4605
|
+
const el = document.createElement("span");
|
|
4606
|
+
el.className = "w100n-syntax";
|
|
4607
|
+
el.textContent = text;
|
|
4608
|
+
return el;
|
|
4609
|
+
}, { side: side2, key: `${text}:${pos}:${side2}` });
|
|
4610
|
+
Reveal = import_core2.Extension.create({
|
|
4611
|
+
name: "reveal",
|
|
4612
|
+
addProseMirrorPlugins: () => [new import_state2.Plugin({
|
|
4613
|
+
props: {
|
|
4614
|
+
decorations(state) {
|
|
4615
|
+
const { $from, empty } = state.selection;
|
|
4616
|
+
if (!empty || !$from.parent.isTextblock) return null;
|
|
4617
|
+
const found = [];
|
|
4618
|
+
const start = $from.start();
|
|
4619
|
+
if ($from.parent.type.name === "heading") found.push(syntax(`${"#".repeat($from.parent.attrs.level)} `, start, -1));
|
|
4620
|
+
const at2 = $from.parentOffset;
|
|
4621
|
+
for (const [name, sign] of Object.entries(signs)) {
|
|
4622
|
+
let from = -1;
|
|
4623
|
+
let offset = 0;
|
|
4624
|
+
$from.parent.forEach((child) => {
|
|
4625
|
+
const end = offset + child.nodeSize;
|
|
4626
|
+
if (child.marks.some((m) => m.type.name === name)) {
|
|
4627
|
+
if (from < 0) from = offset;
|
|
4628
|
+
if (from <= at2 && at2 <= end && (end === $from.parent.content.size || !$from.parent.childAfter(end).node?.marks.some((m) => m.type.name === name))) {
|
|
4629
|
+
found.push(syntax(sign, start + from, -1), syntax(sign, start + end, 1));
|
|
4630
|
+
}
|
|
4631
|
+
} else from = -1;
|
|
4632
|
+
offset = end;
|
|
4633
|
+
});
|
|
4634
|
+
}
|
|
4635
|
+
return import_view2.DecorationSet.create(state.doc, found);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
})]
|
|
4639
|
+
});
|
|
4453
4640
|
EndNotes = import_core2.Extension.create({
|
|
4454
4641
|
name: "endNotes",
|
|
4455
4642
|
addProseMirrorPlugins: () => [new import_state2.Plugin({
|
|
@@ -4767,11 +4954,46 @@ var init_extensions = __esm({
|
|
|
4767
4954
|
}
|
|
4768
4955
|
});
|
|
4769
4956
|
|
|
4957
|
+
// src/editor/wiki.ts
|
|
4958
|
+
function findNote(notes3, target) {
|
|
4959
|
+
const name = wikiName(target).toLowerCase();
|
|
4960
|
+
if (!name) return null;
|
|
4961
|
+
const path = (n) => [n.folder, bare2(n.name)].filter(Boolean).join("/").toLowerCase();
|
|
4962
|
+
const byPath = notes3.find((n) => path(n) === name);
|
|
4963
|
+
if (byPath) return byPath;
|
|
4964
|
+
const byName = notes3.filter((n) => bare2(n.name).toLowerCase() === name);
|
|
4965
|
+
byName.sort((a, b) => path(a).length - path(b).length);
|
|
4966
|
+
return byName[0] ?? null;
|
|
4967
|
+
}
|
|
4968
|
+
function linkTo(notes3, note) {
|
|
4969
|
+
const name = bare2(note.name);
|
|
4970
|
+
return notes3.filter((n) => bare2(n.name).toLowerCase() === name.toLowerCase()).length > 1 ? [note.folder, name].filter(Boolean).join("/") : name;
|
|
4971
|
+
}
|
|
4972
|
+
function suggest(notes3, query, self) {
|
|
4973
|
+
const q = query.trim().toLowerCase();
|
|
4974
|
+
const scored = notes3.filter((n) => n.id !== self).map((n) => {
|
|
4975
|
+
const name = bare2(n.name).toLowerCase();
|
|
4976
|
+
const at2 = q ? name.indexOf(q) : 0;
|
|
4977
|
+
const word = q ? name.split(/[\s_-]+/).some((w) => w.startsWith(q)) : true;
|
|
4978
|
+
return { n, rank: !q ? 1 : name.startsWith(q) ? 0 : word ? 1 : at2 >= 0 ? 2 : -1 };
|
|
4979
|
+
}).filter((x) => x.rank >= 0);
|
|
4980
|
+
scored.sort((a, b) => a.rank - b.rank || bare2(a.n.name).localeCompare(bare2(b.n.name)));
|
|
4981
|
+
return scored.slice(0, 8).map((x) => x.n);
|
|
4982
|
+
}
|
|
4983
|
+
var bare2;
|
|
4984
|
+
var init_wiki = __esm({
|
|
4985
|
+
"src/editor/wiki.ts"() {
|
|
4986
|
+
"use strict";
|
|
4987
|
+
init_extensions();
|
|
4988
|
+
bare2 = (name) => name.replace(/\.(md|markdown)$/i, "");
|
|
4989
|
+
}
|
|
4990
|
+
});
|
|
4991
|
+
|
|
4770
4992
|
// package.json
|
|
4771
4993
|
var version;
|
|
4772
4994
|
var init_package = __esm({
|
|
4773
4995
|
"package.json"() {
|
|
4774
|
-
version = "0.
|
|
4996
|
+
version = "0.18.0";
|
|
4775
4997
|
}
|
|
4776
4998
|
});
|
|
4777
4999
|
|
|
@@ -4798,6 +5020,7 @@ function inline3(tokens = [], outer = []) {
|
|
|
4798
5020
|
else if (token2.type === "br") out.push({ type: "hardBreak" });
|
|
4799
5021
|
else if (token2.type === "math") out.push({ type: "math", attrs: { latex: token2.text } });
|
|
4800
5022
|
else if (token2.type === "footnoteRef") out.push({ type: "footnote", attrs: { id: token2.id, text: notes2.get(token2.id) ?? "" } });
|
|
5023
|
+
else if (token2.type === "wikilink") out.push({ type: "wikilink", attrs: { target: token2.target, alias: token2.alias } });
|
|
4801
5024
|
else if (token2.type === "link") wrap(token2.tokens, { type: "link", attrs: { href: token2.href } });
|
|
4802
5025
|
else if (token2.type === "image") out.push({ type: "image", attrs: { src: token2.href, alt: token2.text || null, title: token2.title || null }, ...marks2().length ? { marks: marks2() } : {} });
|
|
4803
5026
|
else if (token2.type === "html") {
|
|
@@ -5008,6 +5231,9 @@ function serializer(style, hints, before, cell2 = false) {
|
|
|
5008
5231
|
footnote(state, node) {
|
|
5009
5232
|
state.write(`[^${node.attrs.id}]`);
|
|
5010
5233
|
},
|
|
5234
|
+
wikilink(state, node) {
|
|
5235
|
+
state.write(`[[${node.attrs.target}${node.attrs.alias ? `|${node.attrs.alias}` : ""}]]`);
|
|
5236
|
+
},
|
|
5011
5237
|
blockquote(state, node) {
|
|
5012
5238
|
state.wrapBlock("> ", null, node, () => state.renderContent(node));
|
|
5013
5239
|
},
|
|
@@ -5180,6 +5406,10 @@ var init_markdown = __esm({
|
|
|
5180
5406
|
const m = /^\[\^([^\]\s]+)\]/.exec(src);
|
|
5181
5407
|
return m ? { type: "footnoteRef", raw: m[0], id: m[1] } : void 0;
|
|
5182
5408
|
} },
|
|
5409
|
+
{ name: "wikilink", level: "inline", start: (src) => at(src, /\[\[/), tokenizer(src) {
|
|
5410
|
+
const m = /^\[\[([^[\]\n|]+?)(?:\|([^[\]\n]+?))?\]\]/.exec(src);
|
|
5411
|
+
return m ? { type: "wikilink", raw: m[0], target: m[1].trim(), alias: m[2]?.trim() ?? null } : void 0;
|
|
5412
|
+
} },
|
|
5183
5413
|
{ name: "math", level: "inline", start: (src) => at(src, /\$/), tokenizer(src) {
|
|
5184
5414
|
const m = /^\$\$([^$]+?)\$\$|^\$(?![\s$])((?:\\.|[^$\\\n])*?[^\s\\])\$(?!\d)/.exec(src);
|
|
5185
5415
|
return m ? { type: "math", raw: m[0], text: (m[1] ?? m[2]).trim() } : void 0;
|
|
@@ -6577,9 +6807,9 @@ function place(xml, name, value3) {
|
|
|
6577
6807
|
const found = find2(xml, name);
|
|
6578
6808
|
if (found) return xml.slice(0, found.start) + (value3 ?? "") + xml.slice(found.end);
|
|
6579
6809
|
if (value3 === null) return xml;
|
|
6580
|
-
const
|
|
6810
|
+
const rank2 = order.indexOf(name);
|
|
6581
6811
|
let at2 = -1;
|
|
6582
|
-
for (const later of order.slice(
|
|
6812
|
+
for (const later of order.slice(rank2 + 1)) {
|
|
6583
6813
|
const f = find2(xml, later);
|
|
6584
6814
|
if (f && (at2 < 0 || f.start < at2)) at2 = f.start;
|
|
6585
6815
|
}
|
|
@@ -8130,7 +8360,7 @@ var TextEditor_exports = {};
|
|
|
8130
8360
|
__export(TextEditor_exports, {
|
|
8131
8361
|
default: () => TextEditor
|
|
8132
8362
|
});
|
|
8133
|
-
function TextEditor({ kind, bytes, t, language, rights, host, together, documentId, onSaved, onOutline, onReading, onPanel, slot, head: head2, file, guard }) {
|
|
8363
|
+
function TextEditor({ kind, bytes, t, language, rights, host, together, documentId, onSaved, onOutline, onReading, onPanel, slot, head: head2, file, guard, wiki }) {
|
|
8134
8364
|
const docx2 = kind === "docx";
|
|
8135
8365
|
const can = { edit: !!host?.save && !!rights?.edit, comment: !!host?.comment && !!rights && (rights.comment || rights.edit) };
|
|
8136
8366
|
const source = useLoad(async () => {
|
|
@@ -8181,13 +8411,23 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
|
|
|
8181
8411
|
useRestore(pop !== null);
|
|
8182
8412
|
useRestore(editing !== null);
|
|
8183
8413
|
useRestore(dropping !== null);
|
|
8414
|
+
const wikiRef = (0, import_react11.useRef)(wiki);
|
|
8415
|
+
wikiRef.current = wiki;
|
|
8416
|
+
const wikiKeys = (0, import_react11.useRef)(null);
|
|
8417
|
+
const [ask, setAsk] = (0, import_react11.useState)(null);
|
|
8418
|
+
const [askAt, setAskAt] = (0, import_react11.useState)(0);
|
|
8419
|
+
const [shut, setShut] = (0, import_react11.useState)(null);
|
|
8184
8420
|
const editor = (0, import_react10.useEditor)({
|
|
8185
|
-
extensions: kit(kind, t, shared),
|
|
8421
|
+
extensions: kit(kind, t, shared, docx2 || !wiki ? void 0 : { known: (target) => !!findNote(wikiRef.current?.notes ?? [], target) }),
|
|
8186
8422
|
content: shared ? null : source.data?.doc ?? null,
|
|
8187
8423
|
editable: can.edit && (!live || !!shared),
|
|
8188
8424
|
immediatelyRender: true,
|
|
8189
8425
|
shouldRerenderOnTransaction: false,
|
|
8190
|
-
editorProps: {
|
|
8426
|
+
editorProps: {
|
|
8427
|
+
attributes: { class: "w100n-docs-prose w100n-text-body", "aria-label": t.documentText, spellcheck: String(spell), lang: language },
|
|
8428
|
+
transformPastedHTML: cleanPaste,
|
|
8429
|
+
handleKeyDown: (view, event) => !!wikiAsk.getState(view.state) && !!wikiKeys.current?.(event.key)
|
|
8430
|
+
},
|
|
8191
8431
|
onCreate: ({ editor: made2 }) => {
|
|
8192
8432
|
if (source.data && !live) baseline.current = { bytes, doc: made2.state.doc, base: source.data.md && track(source.data.md, made2.state.doc) };
|
|
8193
8433
|
}
|
|
@@ -8287,8 +8527,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8287
8527
|
(0, import_react11.useEffect)(() => {
|
|
8288
8528
|
if (!editor || !source.data) return;
|
|
8289
8529
|
const have = new Map(notes.getState(editor.state).spots.map((s) => [s.id, s]));
|
|
8290
|
-
const
|
|
8291
|
-
const found2 = locate(editor.state.doc,
|
|
8530
|
+
const fresh3 = open.filter((c) => !have.has(c.id));
|
|
8531
|
+
const found2 = locate(editor.state.doc, fresh3.map((c) => ({ id: c.id, quote: c.quote, anchor: anchors2.current.get(c.id) })));
|
|
8292
8532
|
editor.view.dispatch(editor.state.tr.setMeta(notes, { spots: [...open.flatMap((c) => have.get(c.id) ?? []), ...found2] }));
|
|
8293
8533
|
}, [editor, source.data, openIds]);
|
|
8294
8534
|
(0, import_react11.useEffect)(() => {
|
|
@@ -8408,7 +8648,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8408
8648
|
}, [editor, pop, query]);
|
|
8409
8649
|
(0, import_react11.useEffect)(() => {
|
|
8410
8650
|
const press = (e) => {
|
|
8411
|
-
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "p") return;
|
|
8651
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "p" || !docx2 && wiki) return;
|
|
8412
8652
|
e.preventDefault();
|
|
8413
8653
|
e.stopPropagation();
|
|
8414
8654
|
print();
|
|
@@ -8433,6 +8673,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8433
8673
|
window.removeEventListener("scroll", off, true);
|
|
8434
8674
|
};
|
|
8435
8675
|
}, [pop]);
|
|
8676
|
+
const wikied = !!wiki;
|
|
8677
|
+
(0, import_react11.useEffect)(() => {
|
|
8678
|
+
if (!editor || !wikied) return;
|
|
8679
|
+
const sync = () => {
|
|
8680
|
+
const next = wikiAsk.getState(editor.state) ?? null;
|
|
8681
|
+
setAsk((prev) => prev?.from === next?.from && prev?.query === next?.query ? prev : next);
|
|
8682
|
+
};
|
|
8683
|
+
editor.on("transaction", sync);
|
|
8684
|
+
return () => {
|
|
8685
|
+
editor.off("transaction", sync);
|
|
8686
|
+
};
|
|
8687
|
+
}, [editor, wikied]);
|
|
8688
|
+
(0, import_react11.useEffect)(() => setAskAt(0), [ask?.query]);
|
|
8689
|
+
const roster = wiki?.notes.map((n) => `${n.id}:${n.name}:${n.folder ?? ""}`).join("|");
|
|
8690
|
+
(0, import_react11.useEffect)(() => {
|
|
8691
|
+
if (editor && !editor.isDestroyed) editor.view.dispatch(editor.state.tr.setMeta("wiki", true));
|
|
8692
|
+
}, [editor, roster]);
|
|
8436
8693
|
if (source.error) return docx2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
|
|
8437
8694
|
if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
8438
8695
|
const save2 = async (auto = false) => {
|
|
@@ -8453,8 +8710,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8453
8710
|
await host.save(documentId, out, auto ? t.autosavedNote : t.editedNote, auto);
|
|
8454
8711
|
baseline.current = { bytes: md ? out : was.bytes, doc, base: md ? md.base : null };
|
|
8455
8712
|
if (!md && editor.state.doc === doc) {
|
|
8456
|
-
const
|
|
8457
|
-
if (editor.state.doc === doc && renew(
|
|
8713
|
+
const fresh3 = (await readDocx(out)).doc;
|
|
8714
|
+
if (editor.state.doc === doc && renew(fresh3)) baseline.current = { bytes: out, doc: editor.state.doc, base: null };
|
|
8458
8715
|
}
|
|
8459
8716
|
setUnsetup(false);
|
|
8460
8717
|
setSaving("done");
|
|
@@ -8465,13 +8722,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8465
8722
|
return false;
|
|
8466
8723
|
}
|
|
8467
8724
|
};
|
|
8468
|
-
const renew = (
|
|
8725
|
+
const renew = (fresh3) => {
|
|
8469
8726
|
const at2 = [];
|
|
8470
8727
|
const refs3 = [];
|
|
8471
8728
|
editor.state.doc.descendants((node, pos) => {
|
|
8472
8729
|
if (node.isBlock) at2.push(pos);
|
|
8473
8730
|
});
|
|
8474
|
-
editor.schema.nodeFromJSON(
|
|
8731
|
+
editor.schema.nodeFromJSON(fresh3).descendants((node) => {
|
|
8475
8732
|
if (node.isBlock) refs3.push(node.type.name, node.attrs.ref);
|
|
8476
8733
|
});
|
|
8477
8734
|
if (refs3.length !== at2.length * 2 || at2.some((pos, i) => editor.state.doc.nodeAt(pos).type.name !== refs3[i * 2])) return false;
|
|
@@ -8699,7 +8956,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8699
8956
|
const at2 = editor.state.selection.$from.before(1);
|
|
8700
8957
|
editor.chain().focus().insertContentAt(at2, { type: "toc", attrs: { entries: JSON.stringify(entries(editor.state.doc, !docx2, at2 - 1)) } }).run();
|
|
8701
8958
|
};
|
|
8702
|
-
const
|
|
8959
|
+
const suggest2 = () => editor.view.dispatch(editor.state.tr.setMeta(suggesting, { on: !state.suggest, me: host?.me.name ?? "" }));
|
|
8703
8960
|
const aligns = [[import_lucide_react5.AlignLeft, t.alignLeft, "left"], [import_lucide_react5.AlignCenter, t.alignCenter, "center"], [import_lucide_react5.AlignRight, t.alignRight, "right"], [import_lucide_react5.AlignJustify, t.justify, "justify"]];
|
|
8704
8961
|
const lines2 = [[1, t.single], [1.15, "1.15"], [1.5, "1.5"], [2, t.double]];
|
|
8705
8962
|
const menus = [
|
|
@@ -8776,7 +9033,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8776
9033
|
item(t.indent, () => indent(editor, 1), { keys: `${mod}]` })
|
|
8777
9034
|
] : []],
|
|
8778
9035
|
["tools", t.menuTools, [
|
|
8779
|
-
docx2 && can.edit && item(t.suggest,
|
|
9036
|
+
docx2 && can.edit && item(t.suggest, suggest2, { on: state.suggest }),
|
|
8780
9037
|
docx2 && can.edit && state.revs.length > 0 && item(t.acceptAll, () => decide(editor, true)),
|
|
8781
9038
|
docx2 && can.edit && state.revs.length > 0 && item(t.rejectAll, () => decide(editor, false)),
|
|
8782
9039
|
!!host?.comments && (can.comment || open.length > 0) && item(t.comments, () => onPanel?.("comments")),
|
|
@@ -9180,7 +9437,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9180
9437
|
tool(import_lucide_react5.RemoveFormatting, t.clearFormat, () => clear(editor)),
|
|
9181
9438
|
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9182
9439
|
gap,
|
|
9183
|
-
tool(import_lucide_react5.FilePenLine, t.suggest,
|
|
9440
|
+
tool(import_lucide_react5.FilePenLine, t.suggest, suggest2, state.suggest)
|
|
9184
9441
|
] })
|
|
9185
9442
|
] });
|
|
9186
9443
|
const context = can.edit && (state.table ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
@@ -9219,6 +9476,39 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9219
9476
|
if (e.target.closest("button")) e.preventDefault();
|
|
9220
9477
|
};
|
|
9221
9478
|
const sheet2 = docx2 ? { "--page-w": `${page.width}px`, "--page-h": `${page.height}px`, "--mt": `${page.margins[0]}px`, "--mr": `${page.margins[1]}px`, "--mb": `${page.margins[2]}px`, "--ml": `${page.margins[3]}px` } : void 0;
|
|
9479
|
+
const asking = wiki && ask && shut !== ask.from ? ask : null;
|
|
9480
|
+
const offers = asking ? suggest(wiki.notes, asking.query, documentId) : [];
|
|
9481
|
+
const fresh2 = asking?.query.trim() ?? "";
|
|
9482
|
+
const options = [
|
|
9483
|
+
...offers.map((note) => ({ note })),
|
|
9484
|
+
...fresh2 && wiki?.create && !offers.some((n) => n.name.replace(/\.(md|markdown)$/i, "").toLowerCase() === fresh2.toLowerCase()) ? [{ make: fresh2 }] : []
|
|
9485
|
+
];
|
|
9486
|
+
const choose = async (option) => {
|
|
9487
|
+
const from = asking.from;
|
|
9488
|
+
let target;
|
|
9489
|
+
if ("note" in option) target = linkTo(wiki.notes, option.note);
|
|
9490
|
+
else {
|
|
9491
|
+
if (!await wiki.create(option.make)) return;
|
|
9492
|
+
target = option.make;
|
|
9493
|
+
}
|
|
9494
|
+
editor.chain().focus().command(({ tr, state: now }) => {
|
|
9495
|
+
tr.replaceWith(from, now.selection.from, now.schema.nodes.wikilink.create({ target }));
|
|
9496
|
+
return true;
|
|
9497
|
+
}).run();
|
|
9498
|
+
};
|
|
9499
|
+
wikiKeys.current = !asking || !options.length ? null : (key2) => {
|
|
9500
|
+
if (key2 === "ArrowDown" || key2 === "ArrowUp") setAskAt((askAt + (key2 === "ArrowDown" ? 1 : options.length - 1)) % options.length);
|
|
9501
|
+
else if (key2 === "Enter" || key2 === "Tab") void choose(options[Math.min(askAt, options.length - 1)]);
|
|
9502
|
+
else if (key2 === "Escape") setShut(asking.from);
|
|
9503
|
+
else return false;
|
|
9504
|
+
return true;
|
|
9505
|
+
};
|
|
9506
|
+
const askSpot = asking && options.length ? editor.view.coordsAtPos(asking.from) : null;
|
|
9507
|
+
const follow2 = (target) => {
|
|
9508
|
+
const note = findNote(wiki.notes, target);
|
|
9509
|
+
if (note) return wiki.open(note.id);
|
|
9510
|
+
if (wiki.create) void wiki.create(wikiName(target)).then((id) => id && wiki.open(id));
|
|
9511
|
+
};
|
|
9222
9512
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: root, className: "w100n-text", "data-kind": kind, "data-docs-find": true, onKeyDown: keys2, children: [
|
|
9223
9513
|
head2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9224
9514
|
head2.menus && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-ribbon w100n-text-docbar", onKeyDown: rove, onPointerDown: keep, children: menubar }), head2.menus),
|
|
@@ -9238,6 +9528,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9238
9528
|
setSpot({ x: Math.min(e.clientX, innerWidth - 260), y: Math.min(e.clientY, innerHeight - 360) });
|
|
9239
9529
|
setPop("context");
|
|
9240
9530
|
}, onClick: (e) => {
|
|
9531
|
+
const link = wiki ? e.target.closest("[data-wiki]") : null;
|
|
9532
|
+
if (link) return follow2(link.dataset.wiki);
|
|
9241
9533
|
const atom = can.edit ? e.target.closest(".w100n-math, sup[data-footnote]") : null;
|
|
9242
9534
|
if (atom) {
|
|
9243
9535
|
const at2 = editor.view.posAtDOM(atom, 0);
|
|
@@ -9251,6 +9543,28 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9251
9543
|
setActive(id);
|
|
9252
9544
|
onPanel?.("comments");
|
|
9253
9545
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: docx2 ? `w100n-text-sheet${flow ? " is-flow" : ""}` : "w100n-docs-page w100n-text-column", style: sheet2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.EditorContent, { editor }) }) }) }),
|
|
9546
|
+
askSpot && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
9547
|
+
"span",
|
|
9548
|
+
{
|
|
9549
|
+
className: "w100n-text-pop w100n-text-menu w100n-wiki-ask",
|
|
9550
|
+
role: "listbox",
|
|
9551
|
+
"aria-label": t.link,
|
|
9552
|
+
style: { left: Math.min(askSpot.left, innerWidth - 340), top: askSpot.bottom + 6 },
|
|
9553
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
9554
|
+
children: [
|
|
9555
|
+
options.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", "aria-selected": i === Math.min(askAt, options.length - 1), onClick: () => void choose(option), children: "note" in option ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9556
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.FileText, { "aria-hidden": true }),
|
|
9557
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: option.note.name.replace(/\.(md|markdown)$/i, "") }),
|
|
9558
|
+
option.note.folder && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: option.note.folder })
|
|
9559
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9560
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Plus, { "aria-hidden": true }),
|
|
9561
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: t.wikiCreate.replace("{name}", option.make) }),
|
|
9562
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: t.wikiNew })
|
|
9563
|
+
] }) }, "note" in option ? option.note.id : "make")),
|
|
9564
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "w100n-text-hint", children: t.wikiKeys })
|
|
9565
|
+
]
|
|
9566
|
+
}
|
|
9567
|
+
),
|
|
9254
9568
|
pop === "context" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-pop w100n-text-menu w100n-text-context", role: "menu", "aria-label": t.textTools, style: { left: spot3.x, top: spot3.y }, onPointerDown: keep, children: [
|
|
9255
9569
|
rows(near),
|
|
9256
9570
|
spell && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "w100n-text-hint", children: t.spellHint })
|
|
@@ -9551,6 +9865,7 @@ var init_TextEditor = __esm({
|
|
|
9551
9865
|
init_useLoad();
|
|
9552
9866
|
init_DocxView();
|
|
9553
9867
|
init_extensions();
|
|
9868
|
+
init_wiki();
|
|
9554
9869
|
init_live();
|
|
9555
9870
|
init_markdown();
|
|
9556
9871
|
init_math();
|
|
@@ -10743,15 +11058,15 @@ function changes2(before, after) {
|
|
|
10743
11058
|
}
|
|
10744
11059
|
function Compare({ host, documentId, kind, older, t }) {
|
|
10745
11060
|
const rows = useLoad(async (signal) => changes2(await textOf2(kind, older), await textOf2(kind, await host.content(documentId, null, { signal }))), [host, documentId, older]);
|
|
10746
|
-
if (rows.error) return /* @__PURE__ */ (0,
|
|
10747
|
-
if (!rows.data) return /* @__PURE__ */ (0,
|
|
11061
|
+
if (rows.error) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
|
|
11062
|
+
if (!rows.data) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
10748
11063
|
const added = rows.data.filter((r) => r.op === "+").length, removed = rows.data.filter((r) => r.op === "-").length, edited = rows.data.filter((r) => r.op === "~").length;
|
|
10749
|
-
return /* @__PURE__ */ (0,
|
|
10750
|
-
/* @__PURE__ */ (0,
|
|
10751
|
-
rows.data.map((r, i) => /* @__PURE__ */ (0,
|
|
11064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-page w100n-compare", children: [
|
|
11065
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-compare-sum", children: added + removed + edited ? t.changeCount.replace("{added}", String(added)).replace("{edited}", String(edited)).replace("{removed}", String(removed)) : t.noChanges }),
|
|
11066
|
+
rows.data.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { "data-op": r.op, children: r.parts.map((p, k) => p.op === "=" ? p.text : p.op === "+" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ins", { children: p.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("del", { children: p.text }, k)) }, i))
|
|
10752
11067
|
] }) });
|
|
10753
11068
|
}
|
|
10754
|
-
var
|
|
11069
|
+
var import_jsx_runtime16, words2, alike;
|
|
10755
11070
|
var init_Compare = __esm({
|
|
10756
11071
|
"src/Compare.tsx"() {
|
|
10757
11072
|
"use strict";
|
|
@@ -10759,7 +11074,7 @@ var init_Compare = __esm({
|
|
|
10759
11074
|
init_diff();
|
|
10760
11075
|
init_markdown();
|
|
10761
11076
|
init_useLoad();
|
|
10762
|
-
|
|
11077
|
+
import_jsx_runtime16 = require("react/jsx-runtime");
|
|
10763
11078
|
words2 = (text) => text.split(/(\s+)/).filter(Boolean);
|
|
10764
11079
|
alike = (a, b) => {
|
|
10765
11080
|
const x = a.split(/\s+/).filter(Boolean), y = b.split(/\s+/).filter(Boolean);
|
|
@@ -11675,7 +11990,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
11675
11990
|
};
|
|
11676
11991
|
const fit = (box2, pad = 0) => box2.w > pad && box2.h > pad ? Math.min((box2.w - pad) / deck.width, (box2.h - pad) / deck.height) : 0.5;
|
|
11677
11992
|
const byKey = (a, b) => deck.slides[a].key < deck.slides[b].key ? -1 : 1;
|
|
11678
|
-
const
|
|
11993
|
+
const around3 = (i) => [i - 1, i, i + 1].filter((k) => k >= 0 && k < count).sort(byKey);
|
|
11679
11994
|
const caption = (i) => `${t.slide} ${i + 1}${deck.slides[i].title ? `: ${deck.slides[i].title}` : ""}`;
|
|
11680
11995
|
const post = (id, msg) => frames.current.get(id)?.contentWindow?.postMessage(msg, "*");
|
|
11681
11996
|
const frame = (id, page, scale, title, hidden = false, still = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w100n-slides-frame", "data-hidden": hidden || void 0, style: { width: Math.round(deck.width * scale), height: Math.round(deck.height * scale) }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -12014,7 +12329,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12014
12329
|
s.key
|
|
12015
12330
|
)) }) }),
|
|
12016
12331
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w100n-slides-main", children: [
|
|
12017
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: stageRef, className: "w100n-slides-stage", style: { "--w100n-ratio": `${deck.width} / ${deck.height}` }, children:
|
|
12332
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: stageRef, className: "w100n-slides-stage", style: { "--w100n-ratio": `${deck.width} / ${deck.height}` }, children: around3(index).map((i) => {
|
|
12018
12333
|
const id = `m:${deck.slides[i].key}:${epoch}`;
|
|
12019
12334
|
return frame(id, frozen2(deck.slides[i], id, "edit"), fit(stageBox, 32), caption(i), i !== index);
|
|
12020
12335
|
}) }),
|
|
@@ -12041,7 +12356,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12041
12356
|
back();
|
|
12042
12357
|
},
|
|
12043
12358
|
children: [
|
|
12044
|
-
|
|
12359
|
+
around3(nav.at).map((i) => {
|
|
12045
12360
|
const id = `p:${deck.slides[i].key}:${epoch}`;
|
|
12046
12361
|
return frame(id, frozen2(deck.slides[i], id, "present"), fit(showBox), caption(i), i !== nav.at, true);
|
|
12047
12362
|
}),
|
|
@@ -12832,11 +13147,11 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
12832
13147
|
try {
|
|
12833
13148
|
const { write: write4 } = await Promise.resolve().then(() => (init_pdfWrite(), pdfWrite_exports));
|
|
12834
13149
|
const changed2 = fields();
|
|
12835
|
-
const
|
|
13150
|
+
const signs2 = marks2.flatMap((m) => m.kind === "sign" ? [m] : []);
|
|
12836
13151
|
const out = await write4(bytes, marks2, changed2);
|
|
12837
|
-
const note = [marks2.length >
|
|
13152
|
+
const note = [marks2.length > signs2.length && `${t.marksNote} ${marks2.length - signs2.length}`, changed2.length > 0 && t.formNote, signs2.length > 0 && t.signedNote].filter(Boolean).join(", ");
|
|
12838
13153
|
const { versionId } = await store(documentId, out, note);
|
|
12839
|
-
for (const s of
|
|
13154
|
+
for (const s of signs2) await host.sign?.(documentId, { versionId, page: s.page, method: s.method });
|
|
12840
13155
|
setClean(marks2);
|
|
12841
13156
|
setFilled(false);
|
|
12842
13157
|
pdf.annotationStorage.resetModified();
|
|
@@ -13303,14 +13618,195 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13303
13618
|
}
|
|
13304
13619
|
|
|
13305
13620
|
// src/DocumentsWorkspace.tsx
|
|
13306
|
-
var
|
|
13621
|
+
var import_react19 = require("react");
|
|
13307
13622
|
var import_react_dom4 = require("react-dom");
|
|
13308
|
-
var
|
|
13309
|
-
init_focus();
|
|
13623
|
+
var import_lucide_react13 = require("lucide-react");
|
|
13310
13624
|
|
|
13311
|
-
// src/
|
|
13625
|
+
// src/Backlinks.tsx
|
|
13312
13626
|
var import_lucide_react8 = require("lucide-react");
|
|
13627
|
+
init_wiki();
|
|
13628
|
+
init_useLoad();
|
|
13629
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
13630
|
+
var wikis = /\[\[([^[\]\n|]+?)(?:\|([^[\]\n]+?))?\]\]/g;
|
|
13631
|
+
var around2 = (text, from, to) => ({
|
|
13632
|
+
before: text.slice(Math.max(0, from - 70), from).replace(/^\S*\s/, "").replace(/\s+/g, " "),
|
|
13633
|
+
hit: text.slice(from, to),
|
|
13634
|
+
after: text.slice(to, to + 90).replace(/\s\S*$/, "").replace(/\s+/g, " ")
|
|
13635
|
+
});
|
|
13636
|
+
function mentions(current, notes3, texts2) {
|
|
13637
|
+
const name = current.name.replace(/\.(md|markdown)$/i, "");
|
|
13638
|
+
const plain4 = new RegExp(`(^|[^\\p{L}\\p{N}])(${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})(?![\\p{L}\\p{N}])`, "iu");
|
|
13639
|
+
const linked = [];
|
|
13640
|
+
const unlinked = [];
|
|
13641
|
+
for (const item of notes3) {
|
|
13642
|
+
if (item.id === current.id) continue;
|
|
13643
|
+
const text = texts2.get(item.id);
|
|
13644
|
+
if (!text) continue;
|
|
13645
|
+
let link = null;
|
|
13646
|
+
for (const m2 of text.matchAll(wikis)) {
|
|
13647
|
+
if (findNote(notes3, m2[1])?.id !== current.id) continue;
|
|
13648
|
+
link = { item, ...around2(text, m2.index, m2.index + m2[0].length), hit: m2[2] ?? m2[1] };
|
|
13649
|
+
break;
|
|
13650
|
+
}
|
|
13651
|
+
if (link) {
|
|
13652
|
+
linked.push(link);
|
|
13653
|
+
continue;
|
|
13654
|
+
}
|
|
13655
|
+
const bare4 = text.replace(wikis, (m2) => " ".repeat(m2.length));
|
|
13656
|
+
const m = plain4.exec(bare4);
|
|
13657
|
+
if (m) unlinked.push({ item, ...around2(text, m.index + m[1].length, m.index + m[0].length) });
|
|
13658
|
+
}
|
|
13659
|
+
return { linked, unlinked };
|
|
13660
|
+
}
|
|
13661
|
+
function Backlinks({ host, current, notes: notes3, t, onOpen }) {
|
|
13662
|
+
const others = notes3.filter((item) => item.id !== current.id);
|
|
13663
|
+
const found = useLoad(async (signal) => {
|
|
13664
|
+
const texts2 = /* @__PURE__ */ new Map();
|
|
13665
|
+
const queue = [...others];
|
|
13666
|
+
const reader = new TextDecoder();
|
|
13667
|
+
await Promise.all(Array.from({ length: 6 }, async () => {
|
|
13668
|
+
for (let item = queue.shift(); item; item = queue.shift()) {
|
|
13669
|
+
try {
|
|
13670
|
+
texts2.set(item.id, reader.decode(await host.content(item.id, null, { signal })));
|
|
13671
|
+
} catch {
|
|
13672
|
+
if (signal.aborted) return;
|
|
13673
|
+
}
|
|
13674
|
+
}
|
|
13675
|
+
}));
|
|
13676
|
+
return mentions(current, notes3, texts2);
|
|
13677
|
+
}, [host, current.id, current.name, others.map((item) => `${item.id}:${item.updatedAt}`).join()]);
|
|
13678
|
+
if (found.loading && !found.data) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.loading });
|
|
13679
|
+
if (found.error) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.failed });
|
|
13680
|
+
const { linked, unlinked } = found.data;
|
|
13681
|
+
const card = (m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-links-card", onClick: () => onOpen(m.item), children: [
|
|
13682
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("b", { children: [
|
|
13683
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.FileType, { "aria-hidden": true }),
|
|
13684
|
+
m.item.name.replace(/\.(md|markdown)$/i, "")
|
|
13685
|
+
] }),
|
|
13686
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("small", { children: [
|
|
13687
|
+
"\u2026",
|
|
13688
|
+
m.before,
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("mark", { children: m.hit }),
|
|
13690
|
+
m.after,
|
|
13691
|
+
"\u2026"
|
|
13692
|
+
] }),
|
|
13693
|
+
m.item.folder && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "w100n-links-folder", children: m.item.folder })
|
|
13694
|
+
] }, m.item.id);
|
|
13695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-links", children: [
|
|
13696
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13697
|
+
t.linked,
|
|
13698
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: linked.length })
|
|
13699
|
+
] }),
|
|
13700
|
+
linked.length ? linked.map(card) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.noBacklinks }),
|
|
13701
|
+
unlinked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
13702
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13703
|
+
t.unlinked,
|
|
13704
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: unlinked.length })
|
|
13705
|
+
] }),
|
|
13706
|
+
unlinked.map(card)
|
|
13707
|
+
] })
|
|
13708
|
+
] });
|
|
13709
|
+
}
|
|
13710
|
+
|
|
13711
|
+
// src/DocumentsWorkspace.tsx
|
|
13712
|
+
init_focus();
|
|
13713
|
+
|
|
13714
|
+
// src/Jump.tsx
|
|
13313
13715
|
var import_react14 = require("react");
|
|
13716
|
+
var import_lucide_react9 = require("lucide-react");
|
|
13717
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
13718
|
+
var bare3 = (name) => name.replace(/\.(md|markdown)$/i, "");
|
|
13719
|
+
function rank(item, q) {
|
|
13720
|
+
const name = bare3(item.name).toLowerCase();
|
|
13721
|
+
if (!q) return 2;
|
|
13722
|
+
if (name.startsWith(q)) return 0;
|
|
13723
|
+
if (name.split(/[\s_.-]+/).some((w) => w.startsWith(q))) return 1;
|
|
13724
|
+
if (name.includes(q)) return 2;
|
|
13725
|
+
let at2 = 0;
|
|
13726
|
+
for (const ch of q) {
|
|
13727
|
+
at2 = name.indexOf(ch, at2) + 1;
|
|
13728
|
+
if (!at2) return -1;
|
|
13729
|
+
}
|
|
13730
|
+
return 3;
|
|
13731
|
+
}
|
|
13732
|
+
var lit = (text, q) => {
|
|
13733
|
+
const at2 = q ? text.toLowerCase().indexOf(q) : -1;
|
|
13734
|
+
return at2 < 0 ? text : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
13735
|
+
text.slice(0, at2),
|
|
13736
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("mark", { children: text.slice(at2, at2 + q.length) }),
|
|
13737
|
+
text.slice(at2 + q.length)
|
|
13738
|
+
] });
|
|
13739
|
+
};
|
|
13740
|
+
function Jump({ mode, items, actions, t, place: place2, onOpen, onCreate, onClose }) {
|
|
13741
|
+
const [query, setQuery] = (0, import_react14.useState)("");
|
|
13742
|
+
const [at2, setAt] = (0, import_react14.useState)(0);
|
|
13743
|
+
const q = query.trim().toLowerCase();
|
|
13744
|
+
const found = mode === "open" ? items.map((item) => ({ item, r: rank(item, q) })).filter((x) => x.r >= 0).sort((a, b) => a.r - b.r || bare3(a.item.name).localeCompare(bare3(b.item.name))).slice(0, 30).map((x) => x.item) : [];
|
|
13745
|
+
const doing = mode === "run" ? actions.filter((a) => !q || a.label.toLowerCase().includes(q)) : [];
|
|
13746
|
+
const make2 = mode === "open" && onCreate && query.trim() && !found.some((item) => bare3(item.name).toLowerCase() === q);
|
|
13747
|
+
const total = found.length + doing.length + (make2 ? 1 : 0);
|
|
13748
|
+
const pick = Math.min(at2, Math.max(0, total - 1));
|
|
13749
|
+
const go = (i) => {
|
|
13750
|
+
onClose();
|
|
13751
|
+
if (i < found.length) onOpen(found[i]);
|
|
13752
|
+
else if (mode === "run") doing[i]?.run();
|
|
13753
|
+
else if (make2) onCreate(query.trim());
|
|
13754
|
+
};
|
|
13755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-jump-back", onPointerDown: (e) => {
|
|
13756
|
+
if (e.target === e.currentTarget) onClose();
|
|
13757
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-jump", role: "dialog", "aria-modal": true, "aria-label": mode === "open" ? t.openNote : t.commands, children: [
|
|
13758
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-jump-field", children: [
|
|
13759
|
+
mode === "open" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Search, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Command, { "aria-hidden": true }),
|
|
13760
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
13761
|
+
"input",
|
|
13762
|
+
{
|
|
13763
|
+
autoFocus: true,
|
|
13764
|
+
value: query,
|
|
13765
|
+
placeholder: mode === "open" ? t.findNote : t.commands,
|
|
13766
|
+
"aria-label": mode === "open" ? t.findNote : t.commands,
|
|
13767
|
+
onChange: (e) => {
|
|
13768
|
+
setQuery(e.target.value);
|
|
13769
|
+
setAt(0);
|
|
13770
|
+
},
|
|
13771
|
+
onKeyDown: (e) => {
|
|
13772
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
13773
|
+
e.preventDefault();
|
|
13774
|
+
if (total) setAt((pick + (e.key === "ArrowDown" ? 1 : total - 1)) % total);
|
|
13775
|
+
} else if (e.key === "Enter") {
|
|
13776
|
+
e.preventDefault();
|
|
13777
|
+
if (total) go(pick);
|
|
13778
|
+
} else if (e.key === "Escape") {
|
|
13779
|
+
e.stopPropagation();
|
|
13780
|
+
onClose();
|
|
13781
|
+
}
|
|
13782
|
+
}
|
|
13783
|
+
}
|
|
13784
|
+
)
|
|
13785
|
+
] }),
|
|
13786
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-jump-list", role: "listbox", "aria-label": mode === "open" ? t.openNote : t.commands, children: [
|
|
13787
|
+
found.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "option", "aria-selected": i === pick, onPointerMove: () => setAt(i), onClick: () => go(i), children: [
|
|
13788
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileType, { "aria-hidden": true }),
|
|
13789
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: lit(bare3(item.name), q) }),
|
|
13790
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: place2(item) })
|
|
13791
|
+
] }, item.id)),
|
|
13792
|
+
doing.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "option", "aria-selected": i === pick, onPointerMove: () => setAt(i), onClick: () => go(i), children: [
|
|
13793
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(a.icon, { "aria-hidden": true }),
|
|
13794
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: lit(a.label, q) }),
|
|
13795
|
+
a.keys && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("kbd", { children: a.keys })
|
|
13796
|
+
] }, a.id)),
|
|
13797
|
+
make2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "option", "aria-selected": pick === found.length, onPointerMove: () => setAt(found.length), onClick: () => go(found.length), children: [
|
|
13798
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Plus, { "aria-hidden": true }),
|
|
13799
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: t.createNote.replace("{name}", query.trim()) })
|
|
13800
|
+
] }),
|
|
13801
|
+
!total && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.noNote })
|
|
13802
|
+
] }),
|
|
13803
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-jump-keys", children: mode === "open" ? t.keysOpen : t.keysRun })
|
|
13804
|
+
] }) });
|
|
13805
|
+
}
|
|
13806
|
+
|
|
13807
|
+
// src/NewDocument.tsx
|
|
13808
|
+
var import_lucide_react10 = require("lucide-react");
|
|
13809
|
+
var import_react15 = require("react");
|
|
13314
13810
|
|
|
13315
13811
|
// src/blank.ts
|
|
13316
13812
|
var import_fflate2 = require("fflate");
|
|
@@ -13436,19 +13932,19 @@ function blank4(kind, name, template = "blank") {
|
|
|
13436
13932
|
// src/NewDocument.tsx
|
|
13437
13933
|
init_focus();
|
|
13438
13934
|
init_useLoad();
|
|
13439
|
-
var
|
|
13440
|
-
var icons2 = { docx:
|
|
13935
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
13936
|
+
var icons2 = { docx: import_lucide_react10.FileText, markdown: import_lucide_react10.FileType, sheet: import_lucide_react10.FileSpreadsheet, slides: import_lucide_react10.Presentation };
|
|
13441
13937
|
var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
|
|
13442
13938
|
function NewDocument({ host, t, onClose, onMade }) {
|
|
13443
|
-
const id = (0,
|
|
13444
|
-
const [kind, setKind] = (0,
|
|
13445
|
-
const [template, setTemplate] = (0,
|
|
13446
|
-
const [name, setName] = (0,
|
|
13447
|
-
const [team, setTeam] = (0,
|
|
13939
|
+
const id = (0, import_react15.useId)();
|
|
13940
|
+
const [kind, setKind] = (0, import_react15.useState)("docx");
|
|
13941
|
+
const [template, setTemplate] = (0, import_react15.useState)("blank");
|
|
13942
|
+
const [name, setName] = (0, import_react15.useState)("");
|
|
13943
|
+
const [team, setTeam] = (0, import_react15.useState)(null);
|
|
13448
13944
|
const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
|
|
13449
13945
|
const ours2 = (shared.data ?? []).filter((item) => item.kind === kind);
|
|
13450
13946
|
const stem = (file) => file.replace(/\.[^.]+$/, "");
|
|
13451
|
-
const [state, setState] = (0,
|
|
13947
|
+
const [state, setState] = (0, import_react15.useState)("idle");
|
|
13452
13948
|
useRestore(true);
|
|
13453
13949
|
const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
|
|
13454
13950
|
const make2 = async () => {
|
|
@@ -13462,77 +13958,77 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13462
13958
|
setState("failed");
|
|
13463
13959
|
}
|
|
13464
13960
|
};
|
|
13465
|
-
return /* @__PURE__ */ (0,
|
|
13961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
13466
13962
|
if (e.key === "Escape") {
|
|
13467
13963
|
e.stopPropagation();
|
|
13468
13964
|
onClose();
|
|
13469
13965
|
}
|
|
13470
|
-
}, children: /* @__PURE__ */ (0,
|
|
13966
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
|
|
13471
13967
|
e.preventDefault();
|
|
13472
13968
|
void make2();
|
|
13473
13969
|
}, children: [
|
|
13474
|
-
/* @__PURE__ */ (0,
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
13476
|
-
/* @__PURE__ */ (0,
|
|
13477
|
-
/* @__PURE__ */ (0,
|
|
13970
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-new-head", children: [
|
|
13971
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-new-tile", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Plus, { "aria-hidden": true }) }),
|
|
13972
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
|
|
13973
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.X, { "aria-hidden": true }) })
|
|
13478
13974
|
] }),
|
|
13479
|
-
/* @__PURE__ */ (0,
|
|
13975
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
|
|
13480
13976
|
const Icon = icons2[item];
|
|
13481
|
-
return /* @__PURE__ */ (0,
|
|
13977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
|
|
13482
13978
|
setKind(item);
|
|
13483
13979
|
setTeam(null);
|
|
13484
13980
|
if (item === "sheet" || item === "slides") setTemplate("blank");
|
|
13485
13981
|
}, children: [
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13487
|
-
/* @__PURE__ */ (0,
|
|
13488
|
-
/* @__PURE__ */ (0,
|
|
13489
|
-
/* @__PURE__ */ (0,
|
|
13982
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { "aria-hidden": true }) }),
|
|
13983
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
13984
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: t.newKinds[item] }),
|
|
13985
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: t.kindHints[item] })
|
|
13490
13986
|
] })
|
|
13491
13987
|
] }, item);
|
|
13492
13988
|
}) }),
|
|
13493
|
-
/* @__PURE__ */ (0,
|
|
13494
|
-
/* @__PURE__ */ (0,
|
|
13989
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-caption", children: t.startFrom }),
|
|
13990
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "radio", "aria-checked": !team && template === item, onClick: () => {
|
|
13495
13991
|
setTeam(null);
|
|
13496
13992
|
setTemplate(item);
|
|
13497
13993
|
}, children: [
|
|
13498
|
-
/* @__PURE__ */ (0,
|
|
13499
|
-
/* @__PURE__ */ (0,
|
|
13500
|
-
/* @__PURE__ */ (0,
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13503
|
-
/* @__PURE__ */ (0,
|
|
13504
|
-
/* @__PURE__ */ (0,
|
|
13994
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Plus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
13995
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-head": true }),
|
|
13996
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13997
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13998
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-accent": true }),
|
|
13999
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
14000
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13505
14001
|
] }) }),
|
|
13506
|
-
/* @__PURE__ */ (0,
|
|
14002
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.templates[item] })
|
|
13507
14003
|
] }, item)) }),
|
|
13508
|
-
ours2.length > 0 && /* @__PURE__ */ (0,
|
|
13509
|
-
/* @__PURE__ */ (0,
|
|
13510
|
-
/* @__PURE__ */ (0,
|
|
13511
|
-
/* @__PURE__ */ (0,
|
|
13512
|
-
/* @__PURE__ */ (0,
|
|
13513
|
-
/* @__PURE__ */ (0,
|
|
13514
|
-
/* @__PURE__ */ (0,
|
|
13515
|
-
/* @__PURE__ */ (0,
|
|
13516
|
-
/* @__PURE__ */ (0,
|
|
14004
|
+
ours2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
14005
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
|
|
14006
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": t.teamTemplates, className: "w100n-new-templates", children: ours2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "radio", "aria-checked": team?.id === item.id, onClick: () => setTeam(item), children: [
|
|
14007
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "w100n-new-sheet", children: [
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-head": true }),
|
|
14009
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
14010
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-accent": true }),
|
|
14011
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
14012
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13517
14013
|
] }),
|
|
13518
|
-
/* @__PURE__ */ (0,
|
|
14014
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { title: item.name, children: stem(item.name) })
|
|
13519
14015
|
] }, item.id)) })
|
|
13520
14016
|
] }),
|
|
13521
|
-
/* @__PURE__ */ (0,
|
|
13522
|
-
/* @__PURE__ */ (0,
|
|
13523
|
-
/* @__PURE__ */ (0,
|
|
13524
|
-
/* @__PURE__ */ (0,
|
|
14017
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-new-fields", children: [
|
|
14018
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { children: [
|
|
14019
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-caption", children: t.name }),
|
|
14020
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template] })
|
|
13525
14021
|
] }),
|
|
13526
|
-
host.createIn && /* @__PURE__ */ (0,
|
|
13527
|
-
/* @__PURE__ */ (0,
|
|
13528
|
-
/* @__PURE__ */ (0,
|
|
14022
|
+
host.createIn && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
14023
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-caption", children: t.savesTo }),
|
|
14024
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
|
|
13529
14025
|
] })
|
|
13530
14026
|
] }),
|
|
13531
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13532
|
-
/* @__PURE__ */ (0,
|
|
13533
|
-
/* @__PURE__ */ (0,
|
|
13534
|
-
/* @__PURE__ */ (0,
|
|
13535
|
-
/* @__PURE__ */ (0,
|
|
14027
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
|
|
14028
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-pdf-dialog-end", children: [
|
|
14029
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
|
|
14030
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
|
|
14031
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Check, { "aria-hidden": true }),
|
|
13536
14032
|
state === "busy" ? t.making : t.make
|
|
13537
14033
|
] })
|
|
13538
14034
|
] })
|
|
@@ -13540,10 +14036,10 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13540
14036
|
}
|
|
13541
14037
|
|
|
13542
14038
|
// src/Sharing.tsx
|
|
13543
|
-
var
|
|
13544
|
-
var
|
|
14039
|
+
var import_react16 = require("react");
|
|
14040
|
+
var import_lucide_react11 = require("lucide-react");
|
|
13545
14041
|
init_useLoad();
|
|
13546
|
-
var
|
|
14042
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
13547
14043
|
var blank5 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
|
|
13548
14044
|
var local = (iso) => {
|
|
13549
14045
|
const at2 = new Date(iso);
|
|
@@ -13551,9 +14047,9 @@ var local = (iso) => {
|
|
|
13551
14047
|
};
|
|
13552
14048
|
function Sharing({ host, doc, t, language, team }) {
|
|
13553
14049
|
const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
|
|
13554
|
-
const [form, setForm] = (0,
|
|
13555
|
-
const [state, setState] = (0,
|
|
13556
|
-
const [copied, setCopied] = (0,
|
|
14050
|
+
const [form, setForm] = (0, import_react16.useState)(null);
|
|
14051
|
+
const [state, setState] = (0, import_react16.useState)("idle");
|
|
14052
|
+
const [copied, setCopied] = (0, import_react16.useState)(null);
|
|
13557
14053
|
const text = doc.kind === "docx" || doc.kind === "markdown";
|
|
13558
14054
|
const rules = new Intl.PluralRules(language);
|
|
13559
14055
|
const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
|
|
@@ -13615,31 +14111,31 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13615
14111
|
setCopied(null);
|
|
13616
14112
|
}
|
|
13617
14113
|
};
|
|
13618
|
-
if (form) return /* @__PURE__ */ (0,
|
|
13619
|
-
/* @__PURE__ */ (0,
|
|
13620
|
-
/* @__PURE__ */ (0,
|
|
14114
|
+
if (form) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share", children: [
|
|
14115
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14116
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13621
14117
|
form.id ? t.changeLink : t.newLink
|
|
13622
14118
|
] }),
|
|
13623
|
-
text && /* @__PURE__ */ (0,
|
|
13624
|
-
/* @__PURE__ */ (0,
|
|
13625
|
-
/* @__PURE__ */ (0,
|
|
13626
|
-
/* @__PURE__ */ (0,
|
|
13627
|
-
/* @__PURE__ */ (0,
|
|
14119
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-field", children: [
|
|
14120
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.guestsCan }),
|
|
14121
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-chips", children: [
|
|
14122
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
|
|
14123
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
13628
14124
|
t.canRead
|
|
13629
14125
|
] }),
|
|
13630
|
-
/* @__PURE__ */ (0,
|
|
13631
|
-
/* @__PURE__ */ (0,
|
|
14126
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
|
|
14127
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.MessageSquarePlus, { "aria-hidden": true }),
|
|
13632
14128
|
t.canComment
|
|
13633
14129
|
] })
|
|
13634
14130
|
] })
|
|
13635
14131
|
] }),
|
|
13636
|
-
/* @__PURE__ */ (0,
|
|
13637
|
-
/* @__PURE__ */ (0,
|
|
13638
|
-
/* @__PURE__ */ (0,
|
|
13639
|
-
key2 === "day" && /* @__PURE__ */ (0,
|
|
14132
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-field", children: [
|
|
14133
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.linkWorks }),
|
|
14134
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key2, label]) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", "aria-pressed": form.works === key2, onClick: () => setForm({ ...form, works: key2 }), children: [
|
|
14135
|
+
key2 === "day" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.CalendarDays, { "aria-hidden": true }),
|
|
13640
14136
|
label
|
|
13641
14137
|
] }, key2)) }),
|
|
13642
|
-
form.works === "day" && /* @__PURE__ */ (0,
|
|
14138
|
+
form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13643
14139
|
"input",
|
|
13644
14140
|
{
|
|
13645
14141
|
type: "date",
|
|
@@ -13651,14 +14147,14 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13651
14147
|
}
|
|
13652
14148
|
)
|
|
13653
14149
|
] }),
|
|
13654
|
-
/* @__PURE__ */ (0,
|
|
13655
|
-
/* @__PURE__ */ (0,
|
|
13656
|
-
/* @__PURE__ */ (0,
|
|
13657
|
-
/* @__PURE__ */ (0,
|
|
13658
|
-
/* @__PURE__ */ (0,
|
|
14150
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14151
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
|
|
14152
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14153
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.passwordOn }),
|
|
14154
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.passwordHint })
|
|
13659
14155
|
] })
|
|
13660
14156
|
] }),
|
|
13661
|
-
form.password && /* @__PURE__ */ (0,
|
|
14157
|
+
form.password && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13662
14158
|
"input",
|
|
13663
14159
|
{
|
|
13664
14160
|
type: "password",
|
|
@@ -13670,120 +14166,120 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13670
14166
|
onChange: (e) => setForm({ ...form, secret: e.target.value })
|
|
13671
14167
|
}
|
|
13672
14168
|
),
|
|
13673
|
-
/* @__PURE__ */ (0,
|
|
13674
|
-
/* @__PURE__ */ (0,
|
|
13675
|
-
/* @__PURE__ */ (0,
|
|
13676
|
-
/* @__PURE__ */ (0,
|
|
13677
|
-
/* @__PURE__ */ (0,
|
|
14169
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14170
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
|
|
14171
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14172
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.downloadFile }),
|
|
14173
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.downloadHint })
|
|
13678
14174
|
] })
|
|
13679
14175
|
] }),
|
|
13680
|
-
/* @__PURE__ */ (0,
|
|
13681
|
-
/* @__PURE__ */ (0,
|
|
13682
|
-
/* @__PURE__ */ (0,
|
|
13683
|
-
/* @__PURE__ */ (0,
|
|
13684
|
-
/* @__PURE__ */ (0,
|
|
14176
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14177
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
|
|
14178
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14179
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.askName }),
|
|
14180
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.askNameHint })
|
|
13685
14181
|
] })
|
|
13686
14182
|
] }),
|
|
13687
|
-
/* @__PURE__ */ (0,
|
|
13688
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13689
|
-
/* @__PURE__ */ (0,
|
|
13690
|
-
/* @__PURE__ */ (0,
|
|
14183
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", children: t.lastSaved }),
|
|
14184
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
14185
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
14186
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
13691
14187
|
setForm(null);
|
|
13692
14188
|
setState("idle");
|
|
13693
14189
|
}, children: t.cancel }),
|
|
13694
|
-
/* @__PURE__ */ (0,
|
|
13695
|
-
/* @__PURE__ */ (0,
|
|
14190
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
|
|
14191
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13696
14192
|
form.id ? t.saveLink : t.makeLink
|
|
13697
14193
|
] })
|
|
13698
14194
|
] })
|
|
13699
14195
|
] });
|
|
13700
14196
|
const on2 = links.data ?? [];
|
|
13701
|
-
return /* @__PURE__ */ (0,
|
|
13702
|
-
/* @__PURE__ */ (0,
|
|
13703
|
-
/* @__PURE__ */ (0,
|
|
14197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share", children: [
|
|
14198
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14199
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13704
14200
|
t.guestLinks,
|
|
13705
|
-
on2.length > 0 && /* @__PURE__ */ (0,
|
|
14201
|
+
on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: on2.filter((l) => !l.ended).length })
|
|
13706
14202
|
] }),
|
|
13707
|
-
links.error && /* @__PURE__ */ (0,
|
|
14203
|
+
links.error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
13708
14204
|
t.failed,
|
|
13709
|
-
/* @__PURE__ */ (0,
|
|
14205
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
|
|
13710
14206
|
] }),
|
|
13711
|
-
links.data && !on2.length && /* @__PURE__ */ (0,
|
|
13712
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13713
|
-
on2.map((l) => /* @__PURE__ */ (0,
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
13715
|
-
/* @__PURE__ */ (0,
|
|
13716
|
-
/* @__PURE__ */ (0,
|
|
13717
|
-
/* @__PURE__ */ (0,
|
|
13718
|
-
/* @__PURE__ */ (0,
|
|
14207
|
+
links.data && !on2.length && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", children: t.noLinks }),
|
|
14208
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
14209
|
+
on2.map((l) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
|
|
14210
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { children: [
|
|
14211
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }) }),
|
|
14212
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14213
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: l.comment ? t.commentLink : t.viewLink }),
|
|
14214
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
|
|
13719
14215
|
t.madeBy.replace("{name}", l.createdBy.name),
|
|
13720
14216
|
" \xB7 ",
|
|
13721
14217
|
day(l.createdAt)
|
|
13722
14218
|
] })
|
|
13723
14219
|
] })
|
|
13724
14220
|
] }),
|
|
13725
|
-
/* @__PURE__ */ (0,
|
|
13726
|
-
/* @__PURE__ */ (0,
|
|
13727
|
-
/* @__PURE__ */ (0,
|
|
14221
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-chips", children: [
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14223
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Clock, { "aria-hidden": true }),
|
|
13728
14224
|
l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
|
|
13729
14225
|
] }),
|
|
13730
|
-
l.download && /* @__PURE__ */ (0,
|
|
13731
|
-
/* @__PURE__ */ (0,
|
|
14226
|
+
l.download && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14227
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
|
|
13732
14228
|
t.downloadOn
|
|
13733
14229
|
] }),
|
|
13734
|
-
l.password && /* @__PURE__ */ (0,
|
|
13735
|
-
/* @__PURE__ */ (0,
|
|
14230
|
+
l.password && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14231
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Lock, { "aria-hidden": true }),
|
|
13736
14232
|
t.passwordOn
|
|
13737
14233
|
] }),
|
|
13738
|
-
/* @__PURE__ */ (0,
|
|
13739
|
-
/* @__PURE__ */ (0,
|
|
14234
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14235
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
13740
14236
|
count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
|
|
13741
14237
|
] })
|
|
13742
14238
|
] }),
|
|
13743
|
-
/* @__PURE__ */ (0,
|
|
13744
|
-
/* @__PURE__ */ (0,
|
|
13745
|
-
/* @__PURE__ */ (0,
|
|
13746
|
-
/* @__PURE__ */ (0,
|
|
14239
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-url", children: [
|
|
14240
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: l.url.replace(/^https?:\/\//, "") }),
|
|
14241
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy2(l), children: [
|
|
14242
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Copy, { "aria-hidden": true }),
|
|
13747
14243
|
copied === l.id ? t.copied : t.copy
|
|
13748
14244
|
] })
|
|
13749
14245
|
] }),
|
|
13750
|
-
l.guests.length > 0 && /* @__PURE__ */ (0,
|
|
13751
|
-
/* @__PURE__ */ (0,
|
|
13752
|
-
/* @__PURE__ */ (0,
|
|
13753
|
-
/* @__PURE__ */ (0,
|
|
14246
|
+
l.guests.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
14247
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
|
|
14248
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: g.name || t.unnamed }),
|
|
14249
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
|
|
13754
14250
|
g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
|
|
13755
14251
|
" \xB7 ",
|
|
13756
14252
|
ago(g.lastAt)
|
|
13757
14253
|
] })
|
|
13758
14254
|
] }, i)) }),
|
|
13759
|
-
/* @__PURE__ */ (0,
|
|
13760
|
-
/* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
14255
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-tools", children: [
|
|
14256
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
|
|
14257
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Clock, { "aria-hidden": true }),
|
|
13762
14258
|
t.changeLink
|
|
13763
14259
|
] }),
|
|
13764
|
-
/* @__PURE__ */ (0,
|
|
13765
|
-
/* @__PURE__ */ (0,
|
|
14260
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
|
|
14261
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Ban, { "aria-hidden": true }),
|
|
13766
14262
|
t.turnOff
|
|
13767
14263
|
] })
|
|
13768
14264
|
] })
|
|
13769
14265
|
] }, l.id)),
|
|
13770
|
-
/* @__PURE__ */ (0,
|
|
14266
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
|
|
13771
14267
|
setState("idle");
|
|
13772
14268
|
setForm(blank5);
|
|
13773
14269
|
}, children: [
|
|
13774
|
-
/* @__PURE__ */ (0,
|
|
14270
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Plus, { "aria-hidden": true }),
|
|
13775
14271
|
t.newLink
|
|
13776
14272
|
] }),
|
|
13777
|
-
team && /* @__PURE__ */ (0,
|
|
13778
|
-
/* @__PURE__ */ (0,
|
|
13779
|
-
/* @__PURE__ */ (0,
|
|
14273
|
+
team && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
14274
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14275
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Users, { "aria-hidden": true }),
|
|
13780
14276
|
t.inTeam
|
|
13781
14277
|
] }),
|
|
13782
|
-
/* @__PURE__ */ (0,
|
|
13783
|
-
/* @__PURE__ */ (0,
|
|
13784
|
-
/* @__PURE__ */ (0,
|
|
13785
|
-
/* @__PURE__ */ (0,
|
|
13786
|
-
/* @__PURE__ */ (0,
|
|
14278
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-team", children: [
|
|
14279
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-share-tile", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Users, { "aria-hidden": true }) }),
|
|
14280
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14281
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.peopleOf.replace("{space}", team) }),
|
|
14282
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.teamHint })
|
|
13787
14283
|
] })
|
|
13788
14284
|
] })
|
|
13789
14285
|
] })
|
|
@@ -13794,7 +14290,7 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13794
14290
|
init_text();
|
|
13795
14291
|
|
|
13796
14292
|
// src/Thumb.tsx
|
|
13797
|
-
var
|
|
14293
|
+
var import_react17 = require("react");
|
|
13798
14294
|
|
|
13799
14295
|
// src/preview.ts
|
|
13800
14296
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -13847,12 +14343,12 @@ function preview(host, doc) {
|
|
|
13847
14343
|
}
|
|
13848
14344
|
|
|
13849
14345
|
// src/Thumb.tsx
|
|
13850
|
-
var
|
|
14346
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13851
14347
|
function Thumb({ host, item, label }) {
|
|
13852
|
-
const box2 = (0,
|
|
13853
|
-
const [seen2, setSeen] = (0,
|
|
13854
|
-
const [shot, setShot] = (0,
|
|
13855
|
-
(0,
|
|
14348
|
+
const box2 = (0, import_react17.useRef)(null);
|
|
14349
|
+
const [seen2, setSeen] = (0, import_react17.useState)(false);
|
|
14350
|
+
const [shot, setShot] = (0, import_react17.useState)(null);
|
|
14351
|
+
(0, import_react17.useEffect)(() => {
|
|
13856
14352
|
if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
|
|
13857
14353
|
const watch = new IntersectionObserver((entries2) => {
|
|
13858
14354
|
if (entries2.some((entry2) => entry2.isIntersecting)) setSeen(true);
|
|
@@ -13860,7 +14356,7 @@ function Thumb({ host, item, label }) {
|
|
|
13860
14356
|
watch.observe(box2.current);
|
|
13861
14357
|
return () => watch.disconnect();
|
|
13862
14358
|
}, [item.thumbnailUrl, item.excerpt]);
|
|
13863
|
-
(0,
|
|
14359
|
+
(0, import_react17.useEffect)(() => {
|
|
13864
14360
|
if (!seen2) return;
|
|
13865
14361
|
let live = true;
|
|
13866
14362
|
void preview(host, item).then((found) => {
|
|
@@ -13873,53 +14369,227 @@ function Thumb({ host, item, label }) {
|
|
|
13873
14369
|
const text = item.excerpt ?? shot?.text ?? "";
|
|
13874
14370
|
const lines2 = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
|
|
13875
14371
|
const image = item.thumbnailUrl ?? shot?.image;
|
|
13876
|
-
return /* @__PURE__ */ (0,
|
|
13877
|
-
image ? /* @__PURE__ */ (0,
|
|
13878
|
-
/* @__PURE__ */ (0,
|
|
14372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { ref: box2, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
|
|
14373
|
+
image ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines2.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
14374
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: lines2[0] }),
|
|
13879
14375
|
lines2.slice(1, 14).join(" ")
|
|
13880
|
-
] }) : /* @__PURE__ */ (0,
|
|
13881
|
-
/* @__PURE__ */ (0,
|
|
13882
|
-
/* @__PURE__ */ (0,
|
|
13883
|
-
/* @__PURE__ */ (0,
|
|
13884
|
-
/* @__PURE__ */ (0,
|
|
13885
|
-
/* @__PURE__ */ (0,
|
|
14376
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
14377
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14378
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14379
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14380
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14381
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {})
|
|
13886
14382
|
] }) }),
|
|
13887
|
-
label && /* @__PURE__ */ (0,
|
|
14383
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
13888
14384
|
] });
|
|
13889
14385
|
}
|
|
13890
14386
|
|
|
14387
|
+
// src/Tree.tsx
|
|
14388
|
+
var import_react18 = require("react");
|
|
14389
|
+
var import_lucide_react12 = require("lucide-react");
|
|
14390
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
14391
|
+
var icons3 = { docx: import_lucide_react12.FileText, markdown: import_lucide_react12.FileType, pdf: import_lucide_react12.Files, sheet: import_lucide_react12.FileSpreadsheet, slides: import_lucide_react12.Presentation };
|
|
14392
|
+
var dragged = "application/x-w100n-document";
|
|
14393
|
+
function grow(items, folders, names2, spaceId, other) {
|
|
14394
|
+
const root = { key: "", name: "", at: spaceId ? { spaceId, folder: "" } : null, folders: [], files: [], count: 0 };
|
|
14395
|
+
const step = (from, name, at2, count) => {
|
|
14396
|
+
const key2 = `${from.key}/${name}`;
|
|
14397
|
+
let next = from.folders.find((f) => f.key === key2);
|
|
14398
|
+
if (!next) from.folders.push(next = { key: key2, name, at: at2, folders: [], files: [], count: 0 });
|
|
14399
|
+
if (count) next.count++;
|
|
14400
|
+
return next;
|
|
14401
|
+
};
|
|
14402
|
+
const reach = (space, folder2, count) => {
|
|
14403
|
+
if (count) root.count++;
|
|
14404
|
+
let at2 = spaceId ? root : step(root, names2.get(space) ?? other, { spaceId: space, folder: "" }, count);
|
|
14405
|
+
let path = "";
|
|
14406
|
+
for (const part of folder2.split("/").filter(Boolean)) {
|
|
14407
|
+
path = path ? `${path}/${part}` : part;
|
|
14408
|
+
at2 = step(at2, part, { spaceId: space, folder: path }, count);
|
|
14409
|
+
}
|
|
14410
|
+
return at2;
|
|
14411
|
+
};
|
|
14412
|
+
if (!spaceId) {
|
|
14413
|
+
for (const id of names2.keys()) if (folders.has(id)) reach(id, "", false);
|
|
14414
|
+
}
|
|
14415
|
+
for (const [space, paths] of folders) for (const path of paths) reach(space, path, false);
|
|
14416
|
+
for (const item of items) reach(item.spaceId, item.folder ?? "", true).files.push(item);
|
|
14417
|
+
const sort = (b) => {
|
|
14418
|
+
b.folders.sort((x, y) => x.name.localeCompare(y.name));
|
|
14419
|
+
b.files.sort((x, y) => x.name.localeCompare(y.name));
|
|
14420
|
+
b.folders.forEach(sort);
|
|
14421
|
+
};
|
|
14422
|
+
sort(root);
|
|
14423
|
+
return root;
|
|
14424
|
+
}
|
|
14425
|
+
var remembered = () => {
|
|
14426
|
+
try {
|
|
14427
|
+
return new Set(JSON.parse(localStorage.getItem("w100n-docs-closed") ?? "[]"));
|
|
14428
|
+
} catch {
|
|
14429
|
+
return /* @__PURE__ */ new Set();
|
|
14430
|
+
}
|
|
14431
|
+
};
|
|
14432
|
+
function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen, onMenu, onFolderMenu, onMove, onEdit, onEditDone, onWarm }) {
|
|
14433
|
+
const [closed2, setClosed] = (0, import_react18.useState)(remembered);
|
|
14434
|
+
const [over, setOver] = (0, import_react18.useState)(null);
|
|
14435
|
+
const flip = (key2) => {
|
|
14436
|
+
const next = new Set(closed2);
|
|
14437
|
+
if (!next.delete(key2)) next.add(key2);
|
|
14438
|
+
setClosed(next);
|
|
14439
|
+
localStorage.setItem("w100n-docs-closed", JSON.stringify([...next]));
|
|
14440
|
+
};
|
|
14441
|
+
const field = (pad, label) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
14442
|
+
"input",
|
|
14443
|
+
{
|
|
14444
|
+
className: "w100n-tree-row w100n-tree-input",
|
|
14445
|
+
style: { paddingLeft: pad },
|
|
14446
|
+
autoFocus: true,
|
|
14447
|
+
value: edit.text,
|
|
14448
|
+
"aria-label": label,
|
|
14449
|
+
onFocus: (e) => e.currentTarget.select(),
|
|
14450
|
+
onChange: (e) => onEdit(e.target.value),
|
|
14451
|
+
onBlur: onEditDone,
|
|
14452
|
+
onKeyDown: (e) => {
|
|
14453
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
14454
|
+
if (e.key === "Escape") {
|
|
14455
|
+
e.stopPropagation();
|
|
14456
|
+
onEdit(null);
|
|
14457
|
+
}
|
|
14458
|
+
}
|
|
14459
|
+
}
|
|
14460
|
+
);
|
|
14461
|
+
const target = (b) => onMove && b.at ? {
|
|
14462
|
+
onDragOver: (e) => {
|
|
14463
|
+
if (!e.dataTransfer.types.includes(dragged)) return;
|
|
14464
|
+
e.preventDefault();
|
|
14465
|
+
e.stopPropagation();
|
|
14466
|
+
setOver(b.key);
|
|
14467
|
+
},
|
|
14468
|
+
onDragLeave: () => setOver(null),
|
|
14469
|
+
onDrop: (e) => {
|
|
14470
|
+
const id = e.dataTransfer.getData(dragged);
|
|
14471
|
+
setOver(null);
|
|
14472
|
+
if (!id) return;
|
|
14473
|
+
e.preventDefault();
|
|
14474
|
+
e.stopPropagation();
|
|
14475
|
+
onMove(id, b.at);
|
|
14476
|
+
}
|
|
14477
|
+
} : {};
|
|
14478
|
+
const branch = (b, depth) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
14479
|
+
edit?.key === `new:${b.key}` && field(24 + depth * 16, t.folderName),
|
|
14480
|
+
b.folders.map((f) => {
|
|
14481
|
+
const open = !closed2.has(f.key) || edit?.key === `new:${f.key}`;
|
|
14482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { role: "group", "aria-label": f.name, "data-over": over === f.key || void 0, ...target(f), children: [
|
|
14483
|
+
edit?.key === `dir:${f.key}` ? field(24 + depth * 16, t.renameFolder) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
14484
|
+
"button",
|
|
14485
|
+
{
|
|
14486
|
+
type: "button",
|
|
14487
|
+
className: "w100n-tree-row",
|
|
14488
|
+
"aria-expanded": open,
|
|
14489
|
+
style: { paddingLeft: 24 + depth * 16 },
|
|
14490
|
+
onClick: () => flip(f.key),
|
|
14491
|
+
onContextMenu: onFolderMenu && f.at ? (e) => {
|
|
14492
|
+
e.preventDefault();
|
|
14493
|
+
e.stopPropagation();
|
|
14494
|
+
onFolderMenu(f.at, f.key, e);
|
|
14495
|
+
} : void 0,
|
|
14496
|
+
children: [
|
|
14497
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react12.ChevronDown, { "aria-hidden": true, className: "w100n-tree-fold" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react12.ChevronRight, { "aria-hidden": true, className: "w100n-tree-fold" }),
|
|
14498
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react12.Folder, { "aria-hidden": true }),
|
|
14499
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: f.name }),
|
|
14500
|
+
f.count > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("small", { children: f.count })
|
|
14501
|
+
]
|
|
14502
|
+
}
|
|
14503
|
+
),
|
|
14504
|
+
open && branch(f, depth + 1)
|
|
14505
|
+
] }, f.key);
|
|
14506
|
+
}),
|
|
14507
|
+
b.files.map((item) => {
|
|
14508
|
+
const Icon = icons3[item.kind];
|
|
14509
|
+
if (edit?.key === `file:${item.id}`) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: field(24 + depth * 16, t.rename) }, item.id);
|
|
14510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
14511
|
+
"button",
|
|
14512
|
+
{
|
|
14513
|
+
type: "button",
|
|
14514
|
+
className: "w100n-tree-row",
|
|
14515
|
+
"aria-current": item.id === current,
|
|
14516
|
+
title: item.name,
|
|
14517
|
+
style: { paddingLeft: 24 + depth * 16 },
|
|
14518
|
+
draggable: !!onMove,
|
|
14519
|
+
onDragStart: (e) => {
|
|
14520
|
+
e.dataTransfer.setData(dragged, item.id);
|
|
14521
|
+
e.dataTransfer.effectAllowed = "move";
|
|
14522
|
+
},
|
|
14523
|
+
onClick: () => onOpen(item),
|
|
14524
|
+
onPointerEnter: () => onWarm(item),
|
|
14525
|
+
onPointerLeave: () => onWarm(null),
|
|
14526
|
+
onContextMenu: (e) => {
|
|
14527
|
+
e.preventDefault();
|
|
14528
|
+
e.stopPropagation();
|
|
14529
|
+
onMenu(item, e);
|
|
14530
|
+
},
|
|
14531
|
+
children: [
|
|
14532
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": true }),
|
|
14533
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: item.name.replace(/\.[^.]+$/, "") }),
|
|
14534
|
+
item.kind !== "markdown" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("small", { className: "w100n-tree-kind", children: t.kinds[item.kind] })
|
|
14535
|
+
]
|
|
14536
|
+
},
|
|
14537
|
+
item.id
|
|
14538
|
+
);
|
|
14539
|
+
})
|
|
14540
|
+
] });
|
|
14541
|
+
const root = grow(items, folders, names2, spaceId, t.elsewhere);
|
|
14542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
14543
|
+
"nav",
|
|
14544
|
+
{
|
|
14545
|
+
className: "w100n-tree",
|
|
14546
|
+
"aria-label": t.tree,
|
|
14547
|
+
"data-over": over === "" || void 0,
|
|
14548
|
+
...target(root),
|
|
14549
|
+
onContextMenu: onFolderMenu && root.at ? (e) => {
|
|
14550
|
+
e.preventDefault();
|
|
14551
|
+
onFolderMenu(root.at, "", e);
|
|
14552
|
+
} : void 0,
|
|
14553
|
+
children: branch(root, 0)
|
|
14554
|
+
}
|
|
14555
|
+
);
|
|
14556
|
+
}
|
|
14557
|
+
|
|
13891
14558
|
// src/DocumentsWorkspace.tsx
|
|
13892
14559
|
init_useLoad();
|
|
13893
|
-
var
|
|
13894
|
-
var TextEditor3 = (0,
|
|
13895
|
-
var SheetView3 = (0,
|
|
13896
|
-
var Compare2 = (0,
|
|
13897
|
-
var
|
|
14560
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
14561
|
+
var TextEditor3 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
14562
|
+
var SheetView3 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
14563
|
+
var Compare2 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_Compare(), Compare_exports)));
|
|
14564
|
+
var icons4 = { docx: import_lucide_react13.FileText, markdown: import_lucide_react13.FileType, pdf: import_lucide_react13.Files, sheet: import_lucide_react13.FileSpreadsheet, slides: import_lucide_react13.Presentation };
|
|
13898
14565
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place: place2, onPlace, start, end, aside, actions }) {
|
|
13899
14566
|
const t = texts[language];
|
|
13900
|
-
const [own, setOwn] = (0,
|
|
14567
|
+
const [own, setOwn] = (0, import_react19.useState)({ spaceId: null, documentId: null });
|
|
13901
14568
|
const here = place2 ?? own;
|
|
13902
14569
|
const go = (next) => {
|
|
13903
14570
|
setOwn(next);
|
|
13904
14571
|
onPlace?.(next);
|
|
13905
14572
|
};
|
|
13906
|
-
const [query, setQuery] = (0,
|
|
13907
|
-
const [picked, setPicked] = (0,
|
|
13908
|
-
const [typing, setTyping] = (0,
|
|
13909
|
-
const [menusAt, setMenusAt] = (0,
|
|
13910
|
-
const [renaming, setRenaming] = (0,
|
|
13911
|
-
const [renamed2, setRenamed] = (0,
|
|
13912
|
-
const [statusAt, setStatusAt] = (0,
|
|
13913
|
-
const [listOpen, setListOpen] = (0,
|
|
13914
|
-
const [
|
|
13915
|
-
const [
|
|
13916
|
-
const
|
|
13917
|
-
const
|
|
13918
|
-
const
|
|
13919
|
-
const
|
|
13920
|
-
const
|
|
13921
|
-
const
|
|
13922
|
-
(0,
|
|
14573
|
+
const [query, setQuery] = (0, import_react19.useState)("");
|
|
14574
|
+
const [picked, setPicked] = (0, import_react19.useState)([]);
|
|
14575
|
+
const [typing, setTyping] = (0, import_react19.useState)(false);
|
|
14576
|
+
const [menusAt, setMenusAt] = (0, import_react19.useState)(null);
|
|
14577
|
+
const [renaming, setRenaming] = (0, import_react19.useState)(null);
|
|
14578
|
+
const [renamed2, setRenamed] = (0, import_react19.useState)("idle");
|
|
14579
|
+
const [statusAt, setStatusAt] = (0, import_react19.useState)(null);
|
|
14580
|
+
const [listOpen, setListOpen] = (0, import_react19.useState)(true);
|
|
14581
|
+
const [shape3, setShape] = (0, import_react19.useState)(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-view") === "tree" ? "tree" : "cards");
|
|
14582
|
+
const [jump, setJump] = (0, import_react19.useState)(null);
|
|
14583
|
+
const finder = (0, import_react19.useRef)(null);
|
|
14584
|
+
const [panelOpen, setPanelOpen] = (0, import_react19.useState)(true);
|
|
14585
|
+
const [narrow, setNarrow] = (0, import_react19.useState)(false);
|
|
14586
|
+
const body = (0, import_react19.useRef)(null);
|
|
14587
|
+
const listButton = (0, import_react19.useRef)(null);
|
|
14588
|
+
const panelButton = (0, import_react19.useRef)(null);
|
|
14589
|
+
const listClose = (0, import_react19.useRef)(null);
|
|
14590
|
+
const panel = (0, import_react19.useRef)(null);
|
|
14591
|
+
const guard = (0, import_react19.useRef)(null);
|
|
14592
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
13923
14593
|
const el = body.current;
|
|
13924
14594
|
let was = false;
|
|
13925
14595
|
const check = () => {
|
|
@@ -13937,9 +14607,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13937
14607
|
watch.observe(el);
|
|
13938
14608
|
return () => watch.disconnect();
|
|
13939
14609
|
}, [here.documentId]);
|
|
13940
|
-
const [picking, setPicking] = (0,
|
|
13941
|
-
const [adding, setAdding] = (0,
|
|
13942
|
-
(0,
|
|
14610
|
+
const [picking, setPicking] = (0, import_react19.useState)(false);
|
|
14611
|
+
const [adding, setAdding] = (0, import_react19.useState)(false);
|
|
14612
|
+
(0, import_react19.useEffect)(() => {
|
|
13943
14613
|
if (!adding) return;
|
|
13944
14614
|
const close = (e) => {
|
|
13945
14615
|
if (!e.target.closest(".w100n-docs-new")) setAdding(false);
|
|
@@ -13947,7 +14617,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13947
14617
|
document.addEventListener("pointerdown", close);
|
|
13948
14618
|
return () => document.removeEventListener("pointerdown", close);
|
|
13949
14619
|
}, [adding]);
|
|
13950
|
-
(0,
|
|
14620
|
+
(0, import_react19.useEffect)(() => {
|
|
13951
14621
|
if (!typing) return;
|
|
13952
14622
|
const close = (e) => {
|
|
13953
14623
|
if (!e.target.closest(".w100n-docs-types")) setTyping(false);
|
|
@@ -13955,7 +14625,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13955
14625
|
document.addEventListener("pointerdown", close);
|
|
13956
14626
|
return () => document.removeEventListener("pointerdown", close);
|
|
13957
14627
|
}, [typing]);
|
|
13958
|
-
(0,
|
|
14628
|
+
(0, import_react19.useEffect)(() => {
|
|
13959
14629
|
if (!picking) return;
|
|
13960
14630
|
const close = (e) => {
|
|
13961
14631
|
if (!e.target.closest(".w100n-docs-picker")) setPicking(false);
|
|
@@ -13963,17 +14633,20 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13963
14633
|
document.addEventListener("pointerdown", close);
|
|
13964
14634
|
return () => document.removeEventListener("pointerdown", close);
|
|
13965
14635
|
}, [picking]);
|
|
13966
|
-
const [menu, setMenu] = (0,
|
|
13967
|
-
const [
|
|
13968
|
-
const [
|
|
13969
|
-
const
|
|
13970
|
-
const
|
|
13971
|
-
(0,
|
|
13972
|
-
|
|
14636
|
+
const [menu, setMenu] = (0, import_react19.useState)(null);
|
|
14637
|
+
const [spot3, setSpot] = (0, import_react19.useState)(null);
|
|
14638
|
+
const [edit, setEdit] = (0, import_react19.useState)(null);
|
|
14639
|
+
const [naming, setNaming] = (0, import_react19.useState)(null);
|
|
14640
|
+
const [notice, setNotice] = (0, import_react19.useState)(null);
|
|
14641
|
+
const early = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
|
|
14642
|
+
const hover = (0, import_react19.useRef)(0);
|
|
14643
|
+
(0, import_react19.useEffect)(() => {
|
|
14644
|
+
if (!menu && !spot3) return;
|
|
13973
14645
|
const close = (e) => {
|
|
13974
14646
|
if (e.type === "pointerdown" && e.target.closest(".w100n-docs-context")) return;
|
|
13975
14647
|
if (e.type === "keydown" && e.key !== "Escape") return;
|
|
13976
14648
|
setMenu(null);
|
|
14649
|
+
setSpot(null);
|
|
13977
14650
|
};
|
|
13978
14651
|
document.addEventListener("pointerdown", close);
|
|
13979
14652
|
window.addEventListener("keydown", close);
|
|
@@ -13983,23 +14656,23 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13983
14656
|
window.removeEventListener("keydown", close);
|
|
13984
14657
|
window.removeEventListener("scroll", close, true);
|
|
13985
14658
|
};
|
|
13986
|
-
}, [menu]);
|
|
13987
|
-
const [tab, setTab] = (0,
|
|
13988
|
-
const [outline2, setOutline] = (0,
|
|
13989
|
-
const [reading, setReading] = (0,
|
|
13990
|
-
const [hunt, setHunt] = (0,
|
|
13991
|
-
const [fold, setFold] = (0,
|
|
13992
|
-
const [version2, setVersion] = (0,
|
|
14659
|
+
}, [menu, spot3]);
|
|
14660
|
+
const [tab, setTab] = (0, import_react19.useState)("outline");
|
|
14661
|
+
const [outline2, setOutline] = (0, import_react19.useState)([]);
|
|
14662
|
+
const [reading, setReading] = (0, import_react19.useState)(null);
|
|
14663
|
+
const [hunt, setHunt] = (0, import_react19.useState)("");
|
|
14664
|
+
const [fold, setFold] = (0, import_react19.useState)({});
|
|
14665
|
+
const [version2, setVersion] = (0, import_react19.useState)({ documentId: null, id: null });
|
|
13993
14666
|
const versionId = version2.documentId === here.documentId ? version2.id : null;
|
|
13994
|
-
const [comparing, setComparing] = (0,
|
|
13995
|
-
const [restoring, setRestoring] = (0,
|
|
13996
|
-
const [exporting, setExporting] = (0,
|
|
13997
|
-
const [copying, setCopying] = (0,
|
|
13998
|
-
const [kept, setKept] = (0,
|
|
13999
|
-
const [box2, setBox] = (0,
|
|
14000
|
-
const [making, setMaking] = (0,
|
|
14001
|
-
const [sending, setSending] = (0,
|
|
14002
|
-
const upload = (0,
|
|
14667
|
+
const [comparing, setComparing] = (0, import_react19.useState)(false);
|
|
14668
|
+
const [restoring, setRestoring] = (0, import_react19.useState)("idle");
|
|
14669
|
+
const [exporting, setExporting] = (0, import_react19.useState)("idle");
|
|
14670
|
+
const [copying, setCopying] = (0, import_react19.useState)("idle");
|
|
14671
|
+
const [kept, setKept] = (0, import_react19.useState)(null);
|
|
14672
|
+
const [box2, setBox] = (0, import_react19.useState)(null);
|
|
14673
|
+
const [making, setMaking] = (0, import_react19.useState)(false);
|
|
14674
|
+
const [sending, setSending] = (0, import_react19.useState)("idle");
|
|
14675
|
+
const upload = (0, import_react19.useRef)(null);
|
|
14003
14676
|
const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
|
|
14004
14677
|
const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
|
|
14005
14678
|
const spaceId = here.spaceId ?? single;
|
|
@@ -14010,11 +14683,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14010
14683
|
const all2 = await host.spaces({ signal });
|
|
14011
14684
|
return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
|
|
14012
14685
|
}, [host, spaceId]);
|
|
14013
|
-
(
|
|
14686
|
+
const dirs = useLoad(async (signal) => {
|
|
14687
|
+
if (!host.folders) return /* @__PURE__ */ new Map();
|
|
14688
|
+
const ids = spaceId ? [spaceId] : (await host.spaces({ signal })).map((item) => item.id);
|
|
14689
|
+
return new Map(await Promise.all(ids.map(async (id) => [id, await host.folders(id, { signal })])));
|
|
14690
|
+
}, [host, spaceId]);
|
|
14691
|
+
(0, import_react19.useEffect)(() => {
|
|
14014
14692
|
const sync = () => {
|
|
14015
14693
|
if (document.visibilityState !== "visible") return;
|
|
14016
14694
|
spaces.retry();
|
|
14017
14695
|
list.retry();
|
|
14696
|
+
dirs.retry();
|
|
14018
14697
|
};
|
|
14019
14698
|
const timer = window.setInterval(sync, 3e4);
|
|
14020
14699
|
window.addEventListener("focus", sync);
|
|
@@ -14063,9 +14742,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14063
14742
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
14064
14743
|
};
|
|
14065
14744
|
const size2 = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
14066
|
-
const failed = (retry) => /* @__PURE__ */ (0,
|
|
14745
|
+
const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
14067
14746
|
t.failed,
|
|
14068
|
-
/* @__PURE__ */ (0,
|
|
14747
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: retry, children: t.retry })
|
|
14069
14748
|
] });
|
|
14070
14749
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
14071
14750
|
const side2 = (which, open2) => {
|
|
@@ -14077,12 +14756,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14077
14756
|
if (which === "list") (open2 ? listClose : listButton).current?.focus();
|
|
14078
14757
|
else (open2 ? panel.current?.querySelector('[aria-selected="true"]') : panelButton.current)?.focus();
|
|
14079
14758
|
};
|
|
14759
|
+
const leave = (then) => {
|
|
14760
|
+
const save2 = doc.data?.kind === "markdown" ? guard.current : null;
|
|
14761
|
+
if (!save2) return ask(then);
|
|
14762
|
+
void save2().then((ok) => {
|
|
14763
|
+
if (!ok) return ask(then);
|
|
14764
|
+
guard.current = null;
|
|
14765
|
+
then();
|
|
14766
|
+
});
|
|
14767
|
+
};
|
|
14080
14768
|
const open = (item) => {
|
|
14081
14769
|
if (item.id === here.documentId) {
|
|
14082
14770
|
if (narrow) setListOpen(false);
|
|
14083
14771
|
return;
|
|
14084
14772
|
}
|
|
14085
|
-
|
|
14773
|
+
leave(() => {
|
|
14086
14774
|
setOutline([]);
|
|
14087
14775
|
setHunt("");
|
|
14088
14776
|
setFold({});
|
|
@@ -14183,6 +14871,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14183
14871
|
};
|
|
14184
14872
|
const act = async (run3, done) => {
|
|
14185
14873
|
setMenu(null);
|
|
14874
|
+
setSpot(null);
|
|
14186
14875
|
setNotice(null);
|
|
14187
14876
|
try {
|
|
14188
14877
|
await run3();
|
|
@@ -14239,8 +14928,79 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14239
14928
|
setSending("failed");
|
|
14240
14929
|
}
|
|
14241
14930
|
};
|
|
14242
|
-
|
|
14243
|
-
|
|
14931
|
+
const refresh = () => {
|
|
14932
|
+
list.retry();
|
|
14933
|
+
dirs.retry();
|
|
14934
|
+
};
|
|
14935
|
+
const moveTo = (item, to) => {
|
|
14936
|
+
if (item.spaceId === to.spaceId && (item.folder ?? "") === to.folder) return setMenu(null);
|
|
14937
|
+
void act(() => host.move(item.id, to)).then(refresh);
|
|
14938
|
+
};
|
|
14939
|
+
const folderNamed = (at2) => at2.folder.split("/").pop() || names2.get(at2.spaceId) || t.topLevel;
|
|
14940
|
+
const commit = () => {
|
|
14941
|
+
if (!edit) return;
|
|
14942
|
+
setEdit(null);
|
|
14943
|
+
const text2 = edit.text.trim();
|
|
14944
|
+
if (text2) void edit.run(text2);
|
|
14945
|
+
};
|
|
14946
|
+
const notes3 = doc.data?.kind === "markdown" ? all.filter((item) => item.kind === "markdown" && item.spaceId === doc.data.spaceId) : [];
|
|
14947
|
+
const note = async (name, show, at2) => {
|
|
14948
|
+
try {
|
|
14949
|
+
const made2 = await host.create({ name: `${name}.md`, bytes: new TextEncoder().encode("").buffer, mimeType: "text/markdown", near: at2 ? void 0 : here.documentId ?? void 0, at: at2 });
|
|
14950
|
+
list.retry();
|
|
14951
|
+
if (show) opened2(made2);
|
|
14952
|
+
return made2.id;
|
|
14953
|
+
} catch {
|
|
14954
|
+
setNotice(t.actionFailed);
|
|
14955
|
+
return null;
|
|
14956
|
+
}
|
|
14957
|
+
};
|
|
14958
|
+
const wiki = doc.data?.kind === "markdown" ? {
|
|
14959
|
+
notes: notes3.map(({ id, name, folder: folder2 }) => ({ id, name, folder: folder2 })),
|
|
14960
|
+
open: (id) => {
|
|
14961
|
+
const item = all.find((x) => x.id === id);
|
|
14962
|
+
if (item) open(item);
|
|
14963
|
+
},
|
|
14964
|
+
create: host.create ? (name) => note(name, false) : void 0
|
|
14965
|
+
} : void 0;
|
|
14966
|
+
const panelOn = (next) => {
|
|
14967
|
+
setTab(next);
|
|
14968
|
+
side2("panel", true);
|
|
14969
|
+
};
|
|
14970
|
+
const current = doc.data && all.find((item) => item.id === doc.data.id);
|
|
14971
|
+
const commands = [
|
|
14972
|
+
...host.create ? [{ id: "new", label: t.newNote, icon: import_lucide_react13.FilePlus, keys: "\u2318N", run: () => void note(t.untitled, true) }] : [],
|
|
14973
|
+
{ id: "open", label: t.openNote, icon: import_lucide_react13.Search, keys: "\u2318O", run: () => setJump("open") },
|
|
14974
|
+
{ id: "search", label: t.searchAll, icon: import_lucide_react13.Search, run: () => {
|
|
14975
|
+
side2("list", true);
|
|
14976
|
+
requestAnimationFrame(() => finder.current?.focus());
|
|
14977
|
+
} },
|
|
14978
|
+
...doc.data ? [
|
|
14979
|
+
{ id: "outline", label: t.showOutline, icon: import_lucide_react13.ListTree, run: () => panelOn("outline") },
|
|
14980
|
+
...doc.data.kind === "markdown" ? [{ id: "links", label: t.showLinks, icon: import_lucide_react13.Link2, run: () => panelOn("links") }] : [],
|
|
14981
|
+
{ id: "versions", label: t.showVersions, icon: import_lucide_react13.History, run: () => panelOn("versions") },
|
|
14982
|
+
...text && host.comments ? [{ id: "comments", label: t.showComments, icon: import_lucide_react13.MessagesSquare, run: () => panelOn("comments") }] : [],
|
|
14983
|
+
...host.send && !doc.data.id.includes(":") ? [{ id: "send", label: t.sendChat, icon: import_lucide_react13.Send, run: () => host.send(doc.data.id) }] : [],
|
|
14984
|
+
...host.rename && doc.data.rights.edit ? [{ id: "rename", label: t.rename, icon: import_lucide_react13.Pencil, run: () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) }] : [],
|
|
14985
|
+
...host.remove && current ? [{ id: "trash", label: t.trash, icon: import_lucide_react13.Trash2, run: () => void drop2(current) }] : []
|
|
14986
|
+
] : []
|
|
14987
|
+
];
|
|
14988
|
+
(0, import_react19.useEffect)(() => {
|
|
14989
|
+
const press = (e) => {
|
|
14990
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return;
|
|
14991
|
+
const key2 = e.key.toLowerCase();
|
|
14992
|
+
if (key2 === "o" || key2 === "p" && doc.data?.kind !== "docx" && doc.data?.kind !== "pdf" || key2 === "n" && host.create && doc.data?.kind === "markdown") {
|
|
14993
|
+
e.preventDefault();
|
|
14994
|
+
e.stopPropagation();
|
|
14995
|
+
if (key2 === "n") void note(t.untitled, true);
|
|
14996
|
+
else setJump(key2 === "o" ? "open" : "run");
|
|
14997
|
+
}
|
|
14998
|
+
};
|
|
14999
|
+
window.addEventListener("keydown", press, true);
|
|
15000
|
+
return () => window.removeEventListener("keydown", press, true);
|
|
15001
|
+
});
|
|
15002
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-empty", children: [
|
|
15003
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileText, { "aria-hidden": true }),
|
|
14244
15004
|
t.pick
|
|
14245
15005
|
] });
|
|
14246
15006
|
if (here.documentId) {
|
|
@@ -14248,9 +15008,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14248
15008
|
doc.retry();
|
|
14249
15009
|
content.retry();
|
|
14250
15010
|
});
|
|
14251
|
-
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0,
|
|
14252
|
-
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ (0,
|
|
14253
|
-
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0,
|
|
15011
|
+
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
15012
|
+
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Compare2, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
|
|
15013
|
+
else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14254
15014
|
TextEditor3,
|
|
14255
15015
|
{
|
|
14256
15016
|
kind: doc.data.kind,
|
|
@@ -14271,6 +15031,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14271
15031
|
slot: tab === "comments" && panelOpen ? box2 : null,
|
|
14272
15032
|
head: docbar ? { menus: menusAt, status: statusAt } : void 0,
|
|
14273
15033
|
guard,
|
|
15034
|
+
wiki: versionId ? void 0 : wiki,
|
|
14274
15035
|
file: versionId ? void 0 : {
|
|
14275
15036
|
formats: host.exportAs ? doc.data.exports ?? [] : [],
|
|
14276
15037
|
download: (f) => void exportAs(doc.data, f),
|
|
@@ -14286,7 +15047,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14286
15047
|
},
|
|
14287
15048
|
doc.data.id
|
|
14288
15049
|
) });
|
|
14289
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
15050
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14290
15051
|
PdfView,
|
|
14291
15052
|
{
|
|
14292
15053
|
bytes: content.data,
|
|
@@ -14308,7 +15069,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14308
15069
|
},
|
|
14309
15070
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14310
15071
|
);
|
|
14311
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0,
|
|
15072
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14312
15073
|
SlidesView,
|
|
14313
15074
|
{
|
|
14314
15075
|
html: new TextDecoder().decode(content.data),
|
|
@@ -14318,8 +15079,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14318
15079
|
theme,
|
|
14319
15080
|
onOutline: setOutline,
|
|
14320
15081
|
guard,
|
|
14321
|
-
onSaveRequest: host.save && !versionId ? async (bytes,
|
|
14322
|
-
await host.save(doc.data.id, bytes,
|
|
15082
|
+
onSaveRequest: host.save && !versionId ? async (bytes, note2) => {
|
|
15083
|
+
await host.save(doc.data.id, bytes, note2);
|
|
14323
15084
|
versions.retry();
|
|
14324
15085
|
doc.retry();
|
|
14325
15086
|
list.retry();
|
|
@@ -14327,7 +15088,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14327
15088
|
},
|
|
14328
15089
|
doc.data.id
|
|
14329
15090
|
);
|
|
14330
|
-
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
15091
|
+
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14331
15092
|
SheetView3,
|
|
14332
15093
|
{
|
|
14333
15094
|
bytes: content.data,
|
|
@@ -14345,8 +15106,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14345
15106
|
doc.retry();
|
|
14346
15107
|
list.retry();
|
|
14347
15108
|
},
|
|
14348
|
-
onSaveRequest: versionId || !host.save ? void 0 : async (bytes,
|
|
14349
|
-
await host.save(doc.data.id, bytes,
|
|
15109
|
+
onSaveRequest: versionId || !host.save ? void 0 : async (bytes, note2) => {
|
|
15110
|
+
await host.save(doc.data.id, bytes, note2);
|
|
14350
15111
|
versions.retry();
|
|
14351
15112
|
doc.retry();
|
|
14352
15113
|
list.retry();
|
|
@@ -14354,9 +15115,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14354
15115
|
},
|
|
14355
15116
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14356
15117
|
) });
|
|
14357
|
-
else stage = /* @__PURE__ */ (0,
|
|
15118
|
+
else stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
14358
15119
|
}
|
|
14359
|
-
const Kind = doc.data ?
|
|
15120
|
+
const Kind = doc.data ? icons4[doc.data.kind] : import_lucide_react13.FileText;
|
|
14360
15121
|
const top = Math.min(...outline2.map((h) => h.level));
|
|
14361
15122
|
const chapters = outline2.reduce((all2, h) => {
|
|
14362
15123
|
if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
|
|
@@ -14369,12 +15130,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14369
15130
|
const hit = (h) => words3.every((w) => h.text.toLocaleLowerCase().includes(w));
|
|
14370
15131
|
const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
14371
15132
|
const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
|
|
14372
|
-
const panelTabs = [
|
|
14373
|
-
|
|
14374
|
-
|
|
15133
|
+
const panelTabs = [
|
|
15134
|
+
["outline", import_lucide_react13.ListTree, t.outline],
|
|
15135
|
+
...doc.data?.kind === "markdown" ? [["links", import_lucide_react13.Link2, t.links]] : [],
|
|
15136
|
+
["versions", import_lucide_react13.History, t.versions],
|
|
15137
|
+
["details", import_lucide_react13.Info, t.details]
|
|
15138
|
+
];
|
|
15139
|
+
if (pdf && host.signatures) panelTabs.push(["signatures", import_lucide_react13.Signature, t.signatures]);
|
|
15140
|
+
if (text && host.comments && !versionId) panelTabs.push(["comments", import_lucide_react13.MessagesSquare, t.comments]);
|
|
14375
15141
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
14376
|
-
if (sharing) panelTabs.push(["sharing",
|
|
14377
|
-
const listToggle = /* @__PURE__ */ (0,
|
|
15142
|
+
if (sharing) panelTabs.push(["sharing", import_lucide_react13.Share2, t.sharing]);
|
|
15143
|
+
const listToggle = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14378
15144
|
"button",
|
|
14379
15145
|
{
|
|
14380
15146
|
ref: listButton,
|
|
@@ -14384,10 +15150,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14384
15150
|
onClick: () => side2("list", !listOpen),
|
|
14385
15151
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
14386
15152
|
title: listOpen ? t.closeList : t.openList,
|
|
14387
|
-
children: listOpen ? /* @__PURE__ */ (0,
|
|
15153
|
+
children: listOpen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.PanelLeftOpen, { "aria-hidden": true })
|
|
14388
15154
|
}
|
|
14389
15155
|
);
|
|
14390
|
-
const panelToggle = doc.data && /* @__PURE__ */ (0,
|
|
15156
|
+
const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14391
15157
|
"button",
|
|
14392
15158
|
{
|
|
14393
15159
|
ref: panelButton,
|
|
@@ -14397,16 +15163,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14397
15163
|
onClick: () => side2("panel", !panelOpen),
|
|
14398
15164
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
14399
15165
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
14400
|
-
children: panelOpen ? /* @__PURE__ */ (0,
|
|
15166
|
+
children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.PanelRightOpen, { "aria-hidden": true })
|
|
14401
15167
|
}
|
|
14402
15168
|
);
|
|
14403
|
-
return /* @__PURE__ */ (0,
|
|
14404
|
-
/* @__PURE__ */ (0,
|
|
14405
|
-
start && /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs", "data-theme": theme, children: [
|
|
15170
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: "w100n-docs-bar", children: [
|
|
15171
|
+
start && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
|
|
14406
15172
|
narrow && listToggle,
|
|
14407
|
-
/* @__PURE__ */ (0,
|
|
14408
|
-
/* @__PURE__ */ (0,
|
|
14409
|
-
renaming !== null && doc.data ? /* @__PURE__ */ (0,
|
|
15173
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Kind, { "aria-hidden": true }) }),
|
|
15174
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
15175
|
+
renaming !== null && doc.data ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14410
15176
|
"input",
|
|
14411
15177
|
{
|
|
14412
15178
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -14424,7 +15190,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14424
15190
|
}
|
|
14425
15191
|
}
|
|
14426
15192
|
}
|
|
14427
|
-
) : /* @__PURE__ */ (0,
|
|
15193
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14428
15194
|
"strong",
|
|
14429
15195
|
{
|
|
14430
15196
|
className: "w100n-docs-title",
|
|
@@ -14433,31 +15199,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14433
15199
|
children: doc.data?.name ?? t.documents
|
|
14434
15200
|
}
|
|
14435
15201
|
),
|
|
14436
|
-
docbar ? /* @__PURE__ */ (0,
|
|
14437
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
15202
|
+
docbar ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
15203
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronRight, { "aria-hidden": true }),
|
|
14438
15204
|
item
|
|
14439
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
15205
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
|
|
14440
15206
|
] }),
|
|
14441
|
-
versionId && /* @__PURE__ */ (0,
|
|
14442
|
-
versionId && text && /* @__PURE__ */ (0,
|
|
14443
|
-
/* @__PURE__ */ (0,
|
|
15207
|
+
versionId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
|
|
15208
|
+
versionId && text && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
|
|
15209
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDiff, { "aria-hidden": true }),
|
|
14444
15210
|
comparing ? t.hideChanges : t.showChanges
|
|
14445
15211
|
] }),
|
|
14446
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0,
|
|
14447
|
-
/* @__PURE__ */ (0,
|
|
15212
|
+
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
|
|
15213
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.RotateCcw, { "aria-hidden": true }),
|
|
14448
15214
|
t.restore
|
|
14449
15215
|
] }),
|
|
14450
|
-
restoring === "failed" && /* @__PURE__ */ (0,
|
|
14451
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0,
|
|
14452
|
-
/* @__PURE__ */ (0,
|
|
15216
|
+
restoring === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
|
|
15217
|
+
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
|
|
15218
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileSpreadsheet, { "aria-hidden": true }),
|
|
14453
15219
|
t.copyAs
|
|
14454
15220
|
] }),
|
|
14455
|
-
copying === "failed" && /* @__PURE__ */ (0,
|
|
14456
|
-
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ (0,
|
|
14457
|
-
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0,
|
|
14458
|
-
renamed2 === "failed" && /* @__PURE__ */ (0,
|
|
14459
|
-
docbar && /* @__PURE__ */ (0,
|
|
14460
|
-
host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ (0,
|
|
15221
|
+
copying === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.copyFailed }),
|
|
15222
|
+
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
|
|
15223
|
+
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
|
|
15224
|
+
renamed2 === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.renameFailed }),
|
|
15225
|
+
docbar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { ref: setStatusAt, className: "w100n-docs-status" }),
|
|
15226
|
+
host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14461
15227
|
"button",
|
|
14462
15228
|
{
|
|
14463
15229
|
type: "button",
|
|
@@ -14467,146 +15233,182 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14467
15233
|
title: t.sendChat,
|
|
14468
15234
|
onClick: () => host.send(doc.data.id),
|
|
14469
15235
|
children: [
|
|
14470
|
-
/* @__PURE__ */ (0,
|
|
14471
|
-
/* @__PURE__ */ (0,
|
|
15236
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Send, { "aria-hidden": true }),
|
|
15237
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: t.sendChat })
|
|
14472
15238
|
]
|
|
14473
15239
|
}
|
|
14474
15240
|
),
|
|
14475
|
-
sharing && /* @__PURE__ */ (0,
|
|
15241
|
+
sharing && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
|
|
14476
15242
|
setTab("sharing");
|
|
14477
15243
|
side2("panel", true);
|
|
14478
15244
|
}, children: [
|
|
14479
|
-
/* @__PURE__ */ (0,
|
|
14480
|
-
/* @__PURE__ */ (0,
|
|
15245
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Share2, { "aria-hidden": true }),
|
|
15246
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: t.share })
|
|
14481
15247
|
] }),
|
|
14482
15248
|
doc.data && !versionId && actions?.(doc.data),
|
|
14483
15249
|
narrow && panelToggle,
|
|
14484
|
-
end && /* @__PURE__ */ (0,
|
|
15250
|
+
end && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
14485
15251
|
] }),
|
|
14486
|
-
/* @__PURE__ */ (0,
|
|
14487
|
-
listOpen && /* @__PURE__ */ (0,
|
|
14488
|
-
/* @__PURE__ */ (0,
|
|
14489
|
-
/* @__PURE__ */ (0,
|
|
14490
|
-
/* @__PURE__ */ (0,
|
|
14491
|
-
/* @__PURE__ */ (0,
|
|
15252
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: body, className: "w100n-docs-body", children: [
|
|
15253
|
+
listOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
|
|
15254
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-head", children: [
|
|
15255
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
15256
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
15257
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Files, { "aria-hidden": true }),
|
|
14492
15258
|
t.documents,
|
|
14493
|
-
/* @__PURE__ */ (0,
|
|
15259
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: all.length })
|
|
14494
15260
|
] }),
|
|
14495
|
-
host.create && /* @__PURE__ */ (0,
|
|
15261
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
14496
15262
|
if (e.key === "Escape" && adding) {
|
|
14497
15263
|
e.stopPropagation();
|
|
14498
15264
|
setAdding(false);
|
|
14499
15265
|
}
|
|
14500
15266
|
}, children: [
|
|
14501
|
-
/* @__PURE__ */ (0,
|
|
14502
|
-
/* @__PURE__ */ (0,
|
|
14503
|
-
/* @__PURE__ */ (0,
|
|
14504
|
-
/* @__PURE__ */ (0,
|
|
15267
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
|
|
15268
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Plus, { "aria-hidden": true }),
|
|
15269
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: sending === "busy" ? t.uploading : t.create }),
|
|
15270
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14505
15271
|
] }),
|
|
14506
|
-
adding && /* @__PURE__ */ (0,
|
|
14507
|
-
/* @__PURE__ */ (0,
|
|
15272
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "menu", className: "w100n-docs-menu", children: [
|
|
15273
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14508
15274
|
setAdding(false);
|
|
14509
15275
|
setMaking(true);
|
|
14510
15276
|
}, children: [
|
|
14511
|
-
/* @__PURE__ */ (0,
|
|
14512
|
-
/* @__PURE__ */ (0,
|
|
15277
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FilePlus, { "aria-hidden": true }) }),
|
|
15278
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.newTitle })
|
|
14513
15279
|
] }),
|
|
14514
|
-
/* @__PURE__ */ (0,
|
|
15280
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14515
15281
|
setAdding(false);
|
|
14516
15282
|
upload.current.click();
|
|
14517
15283
|
}, children: [
|
|
14518
|
-
/* @__PURE__ */ (0,
|
|
14519
|
-
/* @__PURE__ */ (0,
|
|
15284
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Upload, { "aria-hidden": true }) }),
|
|
15285
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.uploadFile })
|
|
14520
15286
|
] })
|
|
14521
15287
|
] }),
|
|
14522
|
-
/* @__PURE__ */ (0,
|
|
15288
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
|
|
14523
15289
|
const file = e.target.files?.[0];
|
|
14524
15290
|
e.target.value = "";
|
|
14525
15291
|
if (file) void send(file);
|
|
14526
15292
|
} })
|
|
14527
15293
|
] }),
|
|
14528
|
-
/* @__PURE__ */ (0,
|
|
15294
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side2("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.X, { "aria-hidden": true }) })
|
|
14529
15295
|
] }),
|
|
14530
|
-
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0,
|
|
15296
|
+
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
|
|
14531
15297
|
if (e.key !== "Escape" || !picking) return;
|
|
14532
15298
|
e.stopPropagation();
|
|
14533
15299
|
setPicking(false);
|
|
14534
15300
|
e.currentTarget.querySelector("button").focus();
|
|
14535
15301
|
}, children: [
|
|
14536
|
-
/* @__PURE__ */ (0,
|
|
14537
|
-
space ? /* @__PURE__ */ (0,
|
|
14538
|
-
/* @__PURE__ */ (0,
|
|
14539
|
-
!space && /* @__PURE__ */ (0,
|
|
14540
|
-
/* @__PURE__ */ (0,
|
|
15302
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
|
|
15303
|
+
space ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.LayoutGrid, { "aria-hidden": true }) }),
|
|
15304
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: space?.name ?? t.allProjects }),
|
|
15305
|
+
!space && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: all.length }),
|
|
15306
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14541
15307
|
] }),
|
|
14542
|
-
picking && /* @__PURE__ */ (0,
|
|
14543
|
-
/* @__PURE__ */ (0,
|
|
14544
|
-
/* @__PURE__ */ (0,
|
|
14545
|
-
/* @__PURE__ */ (0,
|
|
14546
|
-
!spaceId && /* @__PURE__ */ (0,
|
|
15308
|
+
picking && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "listbox", className: "w100n-docs-menu", children: [
|
|
15309
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
|
|
15310
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.LayoutGrid, { "aria-hidden": true }) }),
|
|
15311
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.allProjects }),
|
|
15312
|
+
!spaceId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Check, { "aria-hidden": true })
|
|
14547
15313
|
] }),
|
|
14548
|
-
groups2.map((group) => /* @__PURE__ */ (0,
|
|
14549
|
-
group && /* @__PURE__ */ (0,
|
|
14550
|
-
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0,
|
|
14551
|
-
/* @__PURE__ */ (0,
|
|
14552
|
-
/* @__PURE__ */ (0,
|
|
14553
|
-
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0,
|
|
14554
|
-
item.id === spaceId && /* @__PURE__ */ (0,
|
|
15314
|
+
groups2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "group", "aria-label": group || void 0, children: [
|
|
15315
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-menu-caption", children: group }),
|
|
15316
|
+
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
|
|
15317
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
|
|
15318
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: item.name }),
|
|
15319
|
+
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
|
|
15320
|
+
item.id === spaceId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Check, { "aria-hidden": true })
|
|
14555
15321
|
] }, item.id))
|
|
14556
15322
|
] }, group))
|
|
14557
15323
|
] })
|
|
14558
15324
|
] }),
|
|
14559
|
-
/* @__PURE__ */ (0,
|
|
14560
|
-
/* @__PURE__ */ (0,
|
|
14561
|
-
/* @__PURE__ */ (0,
|
|
14562
|
-
/* @__PURE__ */ (0,
|
|
15325
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-filters", children: [
|
|
15326
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
15327
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Search, { "aria-hidden": true }),
|
|
15328
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { ref: finder, value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search }),
|
|
15329
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("kbd", { children: "\u2318O" })
|
|
14563
15330
|
] }),
|
|
14564
|
-
present.length > 1 && /* @__PURE__ */ (0,
|
|
15331
|
+
present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
14565
15332
|
if (e.key !== "Escape" || !typing) return;
|
|
14566
15333
|
e.stopPropagation();
|
|
14567
15334
|
setTyping(false);
|
|
14568
15335
|
e.currentTarget.querySelector("button").focus();
|
|
14569
15336
|
}, children: [
|
|
14570
|
-
/* @__PURE__ */ (0,
|
|
14571
|
-
/* @__PURE__ */ (0,
|
|
14572
|
-
/* @__PURE__ */ (0,
|
|
14573
|
-
picked.length > 0 && /* @__PURE__ */ (0,
|
|
14574
|
-
/* @__PURE__ */ (0,
|
|
15337
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
|
|
15338
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ListFilter, { "aria-hidden": true }),
|
|
15339
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.typeFilter }),
|
|
15340
|
+
picked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: picked.length }),
|
|
15341
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14575
15342
|
] }),
|
|
14576
|
-
typing && /* @__PURE__ */ (0,
|
|
15343
|
+
typing && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
|
|
14577
15344
|
present.map((item) => {
|
|
14578
|
-
const Icon =
|
|
15345
|
+
const Icon = icons4[item];
|
|
14579
15346
|
const on2 = picked.includes(item);
|
|
14580
|
-
return /* @__PURE__ */ (0,
|
|
14581
|
-
/* @__PURE__ */ (0,
|
|
14582
|
-
/* @__PURE__ */ (0,
|
|
14583
|
-
/* @__PURE__ */ (0,
|
|
14584
|
-
/* @__PURE__ */ (0,
|
|
15347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "option", "aria-selected": on2, onClick: () => setPicked(on2 ? picked.filter((k) => k !== item) : [...picked, item]), children: [
|
|
15348
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-box", children: on2 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Check, { "aria-hidden": true }) }),
|
|
15349
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-hidden": true }) }),
|
|
15350
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.kinds[item] }),
|
|
15351
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
|
|
14585
15352
|
] }, item);
|
|
14586
15353
|
}),
|
|
14587
|
-
/* @__PURE__ */ (0,
|
|
14588
|
-
/* @__PURE__ */ (0,
|
|
14589
|
-
/* @__PURE__ */ (0,
|
|
15354
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-menu-foot", children: [
|
|
15355
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
|
|
15356
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
|
|
14590
15357
|
] })
|
|
14591
15358
|
] })
|
|
14592
15359
|
] })
|
|
14593
15360
|
] }),
|
|
14594
|
-
|
|
15361
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-shape", role: "radiogroup", "aria-label": t.tree, children: [["tree", import_lucide_react13.FolderTree, t.tree], ["cards", import_lucide_react13.LayoutGrid, t.cards]].map(([key2, Icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "radio", "aria-checked": shape3 === key2, onClick: () => {
|
|
15362
|
+
setShape(key2);
|
|
15363
|
+
localStorage.setItem("w100n-docs-view", key2);
|
|
15364
|
+
}, children: [
|
|
15365
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-hidden": true }),
|
|
15366
|
+
label
|
|
15367
|
+
] }, key2)) }),
|
|
15368
|
+
picked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
|
|
14595
15369
|
t.kinds[item],
|
|
14596
|
-
/* @__PURE__ */ (0,
|
|
15370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.X, { "aria-hidden": true })
|
|
14597
15371
|
] }, item)) })
|
|
14598
15372
|
] }),
|
|
14599
|
-
/* @__PURE__ */ (0,
|
|
14600
|
-
sending === "failed" && /* @__PURE__ */ (0,
|
|
15373
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-cards", children: [
|
|
15374
|
+
sending === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
|
|
14601
15375
|
list.error && failed(list.retry),
|
|
14602
|
-
list.loading && !list.data && /* @__PURE__ */ (0,
|
|
14603
|
-
notice && /* @__PURE__ */ (0,
|
|
14604
|
-
list.data && !shown.length && /* @__PURE__ */ (0,
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
/* @__PURE__ */ (
|
|
15376
|
+
list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
|
|
15377
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", role: "status", children: notice }),
|
|
15378
|
+
list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
|
|
15379
|
+
shape3 === "tree" && list.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
15380
|
+
Tree,
|
|
15381
|
+
{
|
|
15382
|
+
items: shown,
|
|
15383
|
+
folders: query.trim() || picked.length ? /* @__PURE__ */ new Map() : dirs.data ?? /* @__PURE__ */ new Map(),
|
|
15384
|
+
names: names2,
|
|
15385
|
+
spaceId,
|
|
15386
|
+
current: here.documentId,
|
|
15387
|
+
t,
|
|
15388
|
+
edit,
|
|
15389
|
+
onEdit: (text2) => setEdit(text2 === null ? null : edit && { ...edit, text: text2 }),
|
|
15390
|
+
onEditDone: commit,
|
|
15391
|
+
onOpen: open,
|
|
15392
|
+
onMenu: (item, e) => {
|
|
15393
|
+
setSpot(null);
|
|
15394
|
+
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
15395
|
+
},
|
|
15396
|
+
onFolderMenu: host.create || host.makeFolder ? (at2, key2, e) => {
|
|
15397
|
+
setMenu(null);
|
|
15398
|
+
setSpot({ at: at2, key: key2, x: Math.min(e.clientX, innerWidth - 250), y: Math.min(e.clientY, innerHeight - 260), sure: false });
|
|
15399
|
+
} : void 0,
|
|
15400
|
+
onMove: host.move ? (id, to) => {
|
|
15401
|
+
const item = all.find((x) => x.id === id);
|
|
15402
|
+
if (item) moveTo(item, to);
|
|
15403
|
+
} : void 0,
|
|
15404
|
+
onWarm: (item) => item ? warm(item) : clearTimeout(hover.current)
|
|
15405
|
+
}
|
|
15406
|
+
),
|
|
15407
|
+
shape3 === "cards" && folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
|
|
15408
|
+
folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
|
|
15409
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => naming?.id === item.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-card", children: [
|
|
15410
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
15411
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14610
15412
|
"input",
|
|
14611
15413
|
{
|
|
14612
15414
|
className: "w100n-docs-field",
|
|
@@ -14625,7 +15427,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14625
15427
|
}
|
|
14626
15428
|
}
|
|
14627
15429
|
) })
|
|
14628
|
-
] }, item.id) : /* @__PURE__ */ (0,
|
|
15430
|
+
] }, item.id) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14629
15431
|
"button",
|
|
14630
15432
|
{
|
|
14631
15433
|
type: "button",
|
|
@@ -14640,11 +15442,11 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14640
15442
|
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
14641
15443
|
},
|
|
14642
15444
|
children: [
|
|
14643
|
-
/* @__PURE__ */ (0,
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
14646
|
-
/* @__PURE__ */ (0,
|
|
14647
|
-
inside2.get(item.id) && /* @__PURE__ */ (0,
|
|
15445
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
15446
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-docs-card-text", children: [
|
|
15447
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: item.name }),
|
|
15448
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
15449
|
+
inside2.get(item.id) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { className: "w100n-docs-hit", children: inside2.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("mark", { children: part }, i) : part) })
|
|
14648
15450
|
] })
|
|
14649
15451
|
]
|
|
14650
15452
|
},
|
|
@@ -14654,31 +15456,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14654
15456
|
] })
|
|
14655
15457
|
] }),
|
|
14656
15458
|
!narrow && !listOpen && listToggle,
|
|
14657
|
-
/* @__PURE__ */ (0,
|
|
15459
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("main", { className: "w100n-docs-stage", children: [
|
|
14658
15460
|
!narrow && !panelOpen && panelToggle,
|
|
14659
|
-
/* @__PURE__ */ (0,
|
|
15461
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-bare", children: stage })
|
|
14660
15462
|
] }),
|
|
14661
|
-
doc.data && panelOpen && /* @__PURE__ */ (0,
|
|
14662
|
-
/* @__PURE__ */ (0,
|
|
14663
|
-
/* @__PURE__ */ (0,
|
|
14664
|
-
/* @__PURE__ */ (0,
|
|
14665
|
-
(panelTabs.length < 4 || tab === key2 && panelTabs.length < 5) && /* @__PURE__ */ (0,
|
|
15463
|
+
doc.data && panelOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
|
|
15464
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-head", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
15465
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key2, Icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "tab", "aria-selected": tab === key2, tabIndex: tab === key2 ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key2), children: [
|
|
15466
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-hidden": true }),
|
|
15467
|
+
(panelTabs.length < 4 || tab === key2 && panelTabs.length < 5) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: label })
|
|
14666
15468
|
] }, key2)) }),
|
|
14667
|
-
/* @__PURE__ */ (0,
|
|
15469
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => side2("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.X, { "aria-hidden": true }) })
|
|
14668
15470
|
] }) }),
|
|
14669
|
-
/* @__PURE__ */ (0,
|
|
14670
|
-
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0,
|
|
14671
|
-
now && /* @__PURE__ */ (0,
|
|
14672
|
-
/* @__PURE__ */ (0,
|
|
14673
|
-
/* @__PURE__ */ (0,
|
|
15471
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key2]) => key2 === tab)?.[2], children: [
|
|
15472
|
+
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
|
|
15473
|
+
now && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-reading", children: [
|
|
15474
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
|
|
15475
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("small", { children: [
|
|
14674
15476
|
Math.round(now.progress * 100),
|
|
14675
15477
|
"% ",
|
|
14676
15478
|
t.read
|
|
14677
15479
|
] })
|
|
14678
15480
|
] }),
|
|
14679
|
-
outline2.length > 8 && /* @__PURE__ */ (0,
|
|
14680
|
-
/* @__PURE__ */ (0,
|
|
14681
|
-
/* @__PURE__ */ (0,
|
|
15481
|
+
outline2.length > 8 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
15482
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Search, { "aria-hidden": true }),
|
|
15483
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
|
|
14682
15484
|
] }),
|
|
14683
15485
|
chapters.map((c, i) => {
|
|
14684
15486
|
const subs = words3.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -14686,13 +15488,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14686
15488
|
const opened3 = words3.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
14687
15489
|
const named3 = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
14688
15490
|
const mark = c.subs.findIndex((s) => s.id === now?.id);
|
|
14689
|
-
return /* @__PURE__ */ (0,
|
|
14690
|
-
/* @__PURE__ */ (0,
|
|
14691
|
-
/* @__PURE__ */ (0,
|
|
14692
|
-
/* @__PURE__ */ (0,
|
|
14693
|
-
/* @__PURE__ */ (0,
|
|
15491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
|
|
15492
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-chapter-row", children: [
|
|
15493
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
15494
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-chapter-num", children: named3 ? named3[1] : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Bookmark, { "aria-hidden": true }) }),
|
|
15495
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: named3 ? named3[2] : c.head.text })
|
|
14694
15496
|
] }),
|
|
14695
|
-
c.subs.length > 0 && /* @__PURE__ */ (0,
|
|
15497
|
+
c.subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14696
15498
|
"button",
|
|
14697
15499
|
{
|
|
14698
15500
|
type: "button",
|
|
@@ -14702,13 +15504,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14702
15504
|
title: opened3 ? t.hideSections : t.showSections,
|
|
14703
15505
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened3 }),
|
|
14704
15506
|
children: [
|
|
14705
|
-
/* @__PURE__ */ (0,
|
|
14706
|
-
opened3 ? /* @__PURE__ */ (0,
|
|
15507
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: c.subs.length }),
|
|
15508
|
+
opened3 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronRight, { "aria-hidden": true })
|
|
14707
15509
|
]
|
|
14708
15510
|
}
|
|
14709
15511
|
)
|
|
14710
15512
|
] }),
|
|
14711
|
-
opened3 && subs.length > 0 && /* @__PURE__ */ (0,
|
|
15513
|
+
opened3 && subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14712
15514
|
"button",
|
|
14713
15515
|
{
|
|
14714
15516
|
type: "button",
|
|
@@ -14717,7 +15519,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14717
15519
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
14718
15520
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
14719
15521
|
children: [
|
|
14720
|
-
/* @__PURE__ */ (0,
|
|
15522
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", { "aria-hidden": true }),
|
|
14721
15523
|
s.text
|
|
14722
15524
|
]
|
|
14723
15525
|
},
|
|
@@ -14725,46 +15527,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14725
15527
|
)) })
|
|
14726
15528
|
] }, c.head.id);
|
|
14727
15529
|
})
|
|
14728
|
-
] }) : /* @__PURE__ */ (0,
|
|
14729
|
-
tab === "
|
|
15530
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.noOutline })),
|
|
15531
|
+
tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Backlinks, { host, current: doc.data, notes: notes3, t, onOpen: open }),
|
|
15532
|
+
tab === "versions" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14730
15533
|
versions.error && failed(versions.retry),
|
|
14731
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */ (0,
|
|
15534
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14732
15535
|
"button",
|
|
14733
15536
|
{
|
|
14734
15537
|
type: "button",
|
|
14735
15538
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
14736
15539
|
onClick: () => view(item.current ? null : item.id),
|
|
14737
15540
|
children: [
|
|
14738
|
-
/* @__PURE__ */ (0,
|
|
15541
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14739
15542
|
date(item.createdAt),
|
|
14740
|
-
item.current && /* @__PURE__ */ (0,
|
|
15543
|
+
item.current && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: t.current })
|
|
14741
15544
|
] }),
|
|
14742
|
-
/* @__PURE__ */ (0,
|
|
15545
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
14743
15546
|
]
|
|
14744
15547
|
},
|
|
14745
15548
|
item.id
|
|
14746
15549
|
))
|
|
14747
15550
|
] }),
|
|
14748
|
-
tab === "details" && /* @__PURE__ */ (0,
|
|
14749
|
-
/* @__PURE__ */ (0,
|
|
14750
|
-
/* @__PURE__ */ (0,
|
|
14751
|
-
/* @__PURE__ */ (0,
|
|
14752
|
-
/* @__PURE__ */ (0,
|
|
14753
|
-
/* @__PURE__ */ (0,
|
|
14754
|
-
/* @__PURE__ */ (0,
|
|
14755
|
-
doc.data.updatedBy && /* @__PURE__ */ (0,
|
|
14756
|
-
/* @__PURE__ */ (0,
|
|
14757
|
-
/* @__PURE__ */ (0,
|
|
15551
|
+
tab === "details" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("dl", { className: "w100n-docs-details", children: [
|
|
15552
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.kind }),
|
|
15553
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: t.kinds[doc.data.kind] }),
|
|
15554
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.size }),
|
|
15555
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: size2(doc.data.size) }),
|
|
15556
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.updated }),
|
|
15557
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: date(doc.data.updatedAt) }),
|
|
15558
|
+
doc.data.updatedBy && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15559
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.by }),
|
|
15560
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: doc.data.updatedBy.name })
|
|
14758
15561
|
] }),
|
|
14759
|
-
/* @__PURE__ */ (0,
|
|
14760
|
-
/* @__PURE__ */ (0,
|
|
15562
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.rights }),
|
|
15563
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
|
|
14761
15564
|
] }),
|
|
14762
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0,
|
|
14763
|
-
/* @__PURE__ */ (0,
|
|
14764
|
-
/* @__PURE__ */ (0,
|
|
15565
|
+
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-about", children: [
|
|
15566
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
15567
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDown, { "aria-hidden": true }),
|
|
14765
15568
|
t.exportAs
|
|
14766
15569
|
] }),
|
|
14767
|
-
/* @__PURE__ */ (0,
|
|
15570
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14768
15571
|
"button",
|
|
14769
15572
|
{
|
|
14770
15573
|
type: "button",
|
|
@@ -14772,22 +15575,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14772
15575
|
disabled: exporting === "busy",
|
|
14773
15576
|
onClick: () => void exportAs(doc.data, format),
|
|
14774
15577
|
children: [
|
|
14775
|
-
/* @__PURE__ */ (0,
|
|
15578
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDown, { "aria-hidden": true }),
|
|
14776
15579
|
format.toUpperCase()
|
|
14777
15580
|
]
|
|
14778
15581
|
},
|
|
14779
15582
|
format
|
|
14780
15583
|
)) }),
|
|
14781
|
-
exporting === "failed" && /* @__PURE__ */ (0,
|
|
15584
|
+
exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
14782
15585
|
] }),
|
|
14783
|
-
tab === "comments" && /* @__PURE__ */ (0,
|
|
14784
|
-
tab === "sharing" && sharing && /* @__PURE__ */ (0,
|
|
14785
|
-
tab === "signatures" && /* @__PURE__ */ (0,
|
|
15586
|
+
tab === "comments" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: setBox }),
|
|
15587
|
+
tab === "sharing" && sharing && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
|
|
15588
|
+
tab === "signatures" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14786
15589
|
signatures.error && failed(signatures.retry),
|
|
14787
|
-
signatures.data?.length === 0 && /* @__PURE__ */ (0,
|
|
15590
|
+
signatures.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.noSignatures }),
|
|
14788
15591
|
(signatures.data ?? []).map((entry2) => {
|
|
14789
15592
|
const signed = versions.data?.find((v) => v.id === entry2.versionId);
|
|
14790
|
-
return /* @__PURE__ */ (0,
|
|
15593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14791
15594
|
"button",
|
|
14792
15595
|
{
|
|
14793
15596
|
type: "button",
|
|
@@ -14795,15 +15598,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14795
15598
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
14796
15599
|
onClick: () => view(signed.current ? null : signed.id),
|
|
14797
15600
|
children: [
|
|
14798
|
-
/* @__PURE__ */ (0,
|
|
15601
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14799
15602
|
entry2.signer.name,
|
|
14800
|
-
/* @__PURE__ */ (0,
|
|
15603
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-docs-badge", children: [
|
|
14801
15604
|
t.page,
|
|
14802
15605
|
" ",
|
|
14803
15606
|
entry2.page
|
|
14804
15607
|
] })
|
|
14805
15608
|
] }),
|
|
14806
|
-
/* @__PURE__ */ (0,
|
|
15609
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [date(entry2.signedAt), t.methods[entry2.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
|
|
14807
15610
|
]
|
|
14808
15611
|
},
|
|
14809
15612
|
entry2.id
|
|
@@ -14814,113 +15617,204 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14814
15617
|
] })
|
|
14815
15618
|
] })
|
|
14816
15619
|
] }),
|
|
14817
|
-
|
|
15620
|
+
jump && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
15621
|
+
Jump,
|
|
15622
|
+
{
|
|
15623
|
+
mode: jump,
|
|
15624
|
+
items: all,
|
|
15625
|
+
actions: commands,
|
|
15626
|
+
t,
|
|
15627
|
+
onClose: () => setJump(null),
|
|
15628
|
+
onOpen: open,
|
|
15629
|
+
onCreate: host.create ? (name) => void note(name, true) : void 0,
|
|
15630
|
+
place: (item) => [!spaceId && names2.get(item.spaceId), item.folder].filter(Boolean).join(" / ")
|
|
15631
|
+
}
|
|
15632
|
+
),
|
|
15633
|
+
making && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made2) => {
|
|
14818
15634
|
setMaking(false);
|
|
14819
15635
|
opened2(made2);
|
|
14820
15636
|
} }),
|
|
14821
|
-
menu && /* @__PURE__ */ (0,
|
|
14822
|
-
/* @__PURE__ */ (0,
|
|
14823
|
-
/* @__PURE__ */ (0,
|
|
14824
|
-
/* @__PURE__ */ (0,
|
|
14825
|
-
menu.item.createdAt && /* @__PURE__ */ (0,
|
|
14826
|
-
/* @__PURE__ */ (0,
|
|
15637
|
+
menu && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
|
|
15638
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-head", children: [
|
|
15639
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: menu.item.name }),
|
|
15640
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [t.kinds[menu.item.kind], size2(menu.item.size), names2.get(menu.item.spaceId), menu.item.folder].filter(Boolean).join(" \xB7 ") }),
|
|
15641
|
+
menu.item.createdAt && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
|
|
15642
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
|
|
14827
15643
|
] }),
|
|
14828
|
-
menu.
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
15644
|
+
menu.moving ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-context-list", children: ["", ...dirs.data.get(menu.item.spaceId)].map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
15645
|
+
"button",
|
|
15646
|
+
{
|
|
15647
|
+
type: "button",
|
|
15648
|
+
role: "menuitem",
|
|
15649
|
+
disabled: (menu.item.folder ?? "") === folder2,
|
|
15650
|
+
onClick: () => moveTo(menu.item, { spaceId: menu.item.spaceId, folder: folder2 }),
|
|
15651
|
+
style: { paddingLeft: 10 + 14 * (folder2 ? folder2.split("/").length : 0) },
|
|
15652
|
+
children: [
|
|
15653
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Folder, { "aria-hidden": true }),
|
|
15654
|
+
folder2 ? folder2.split("/").pop() : names2.get(menu.item.spaceId) ?? t.topLevel
|
|
15655
|
+
]
|
|
15656
|
+
},
|
|
15657
|
+
folder2
|
|
15658
|
+
)) }) : menu.sure ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-ask", children: [
|
|
15659
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
|
|
15660
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
15661
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
|
|
15662
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
|
|
15663
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
14834
15664
|
t.trash
|
|
14835
15665
|
] })
|
|
14836
15666
|
] })
|
|
14837
|
-
] }) : /* @__PURE__ */ (0,
|
|
14838
|
-
/* @__PURE__ */ (0,
|
|
15667
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15668
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14839
15669
|
setMenu(null);
|
|
14840
15670
|
open(menu.item);
|
|
14841
15671
|
}, children: [
|
|
14842
|
-
/* @__PURE__ */ (0,
|
|
15672
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileText, { "aria-hidden": true }),
|
|
14843
15673
|
t.openFile
|
|
14844
15674
|
] }),
|
|
14845
|
-
host.href && /* @__PURE__ */ (0,
|
|
15675
|
+
host.href && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14846
15676
|
setMenu(null);
|
|
14847
15677
|
window.open(host.href(menu.item.id), "_blank", "noopener");
|
|
14848
15678
|
}, children: [
|
|
14849
|
-
/* @__PURE__ */ (0,
|
|
15679
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ExternalLink, { "aria-hidden": true }),
|
|
14850
15680
|
t.openTab
|
|
14851
15681
|
] }),
|
|
14852
|
-
host.href && /* @__PURE__ */ (0,
|
|
14853
|
-
/* @__PURE__ */ (0,
|
|
15682
|
+
host.href && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => navigator.clipboard.writeText(host.href(menu.item.id)), t.linkCopied), children: [
|
|
15683
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Link, { "aria-hidden": true }),
|
|
14854
15684
|
t.copyLink
|
|
14855
15685
|
] }),
|
|
14856
|
-
host.send && /* @__PURE__ */ (0,
|
|
15686
|
+
host.send && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14857
15687
|
setMenu(null);
|
|
14858
15688
|
host.send(menu.item.id);
|
|
14859
15689
|
}, children: [
|
|
14860
|
-
/* @__PURE__ */ (0,
|
|
15690
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Send, { "aria-hidden": true }),
|
|
14861
15691
|
t.sendChat
|
|
14862
15692
|
] }),
|
|
14863
|
-
/* @__PURE__ */ (0,
|
|
14864
|
-
host.rename && /* @__PURE__ */ (0,
|
|
15693
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15694
|
+
host.rename && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
15695
|
+
const item = menu.item;
|
|
14865
15696
|
setMenu(null);
|
|
14866
|
-
|
|
15697
|
+
if (shape3 === "tree") setEdit({ key: `file:${item.id}`, text: item.name.replace(/\.[^.]+$/, ""), run: (text2) => retitle(item, text2) });
|
|
15698
|
+
else setNaming({ id: item.id, text: item.name.replace(/\.[^.]+$/, "") });
|
|
14867
15699
|
}, children: [
|
|
14868
|
-
/* @__PURE__ */ (0,
|
|
15700
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Pencil, { "aria-hidden": true }),
|
|
14869
15701
|
t.rename
|
|
14870
15702
|
] }),
|
|
14871
|
-
host.
|
|
14872
|
-
/* @__PURE__ */ (0,
|
|
15703
|
+
host.move && dirs.data?.has(menu.item.spaceId) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", "aria-haspopup": "menu", onClick: () => setMenu({ ...menu, moving: true }), children: [
|
|
15704
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FolderInput, { "aria-hidden": true }),
|
|
15705
|
+
t.moveTo
|
|
15706
|
+
] }),
|
|
15707
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(async () => copy2(await host.document(menu.item.id))), children: [
|
|
15708
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Copy, { "aria-hidden": true }),
|
|
14873
15709
|
t.makeCopy
|
|
14874
15710
|
] }),
|
|
14875
|
-
/* @__PURE__ */ (0,
|
|
14876
|
-
/* @__PURE__ */ (0,
|
|
15711
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
|
|
15712
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Download, { "aria-hidden": true }),
|
|
14877
15713
|
t.download
|
|
14878
15714
|
] }),
|
|
14879
|
-
host.saveTemplate && /* @__PURE__ */ (0,
|
|
14880
|
-
/* @__PURE__ */ (0,
|
|
15715
|
+
host.saveTemplate && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
|
|
15716
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Bookmark, { "aria-hidden": true }),
|
|
14881
15717
|
t.saveTemplate
|
|
14882
15718
|
] }),
|
|
14883
|
-
/* @__PURE__ */ (0,
|
|
15719
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14884
15720
|
setMenu(null);
|
|
14885
15721
|
open(menu.item);
|
|
14886
15722
|
setTab("details");
|
|
14887
15723
|
side2("panel", true);
|
|
14888
15724
|
}, children: [
|
|
14889
|
-
/* @__PURE__ */ (0,
|
|
15725
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Info, { "aria-hidden": true }),
|
|
14890
15726
|
t.details
|
|
14891
15727
|
] }),
|
|
14892
|
-
host.remove && /* @__PURE__ */ (0,
|
|
14893
|
-
/* @__PURE__ */ (0,
|
|
14894
|
-
/* @__PURE__ */ (0,
|
|
14895
|
-
/* @__PURE__ */ (0,
|
|
15728
|
+
host.remove && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15729
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15730
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
|
|
15731
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
14896
15732
|
t.trash
|
|
14897
15733
|
] })
|
|
14898
15734
|
] })
|
|
14899
15735
|
] })
|
|
14900
15736
|
] }),
|
|
15737
|
+
spot3 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.folderActions, style: { left: spot3.x, top: spot3.y }, children: [
|
|
15738
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-head", children: [
|
|
15739
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: folderNamed(spot3.at) }),
|
|
15740
|
+
spot3.at.folder && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [names2.get(spot3.at.spaceId), ...spot3.at.folder.split("/").slice(0, -1)].filter(Boolean).join(" / ") })
|
|
15741
|
+
] }),
|
|
15742
|
+
spot3.sure ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-ask", children: [
|
|
15743
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: t.folderTrashAsk.replace("{name}", folderNamed(spot3.at)) }),
|
|
15744
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
15745
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setSpot({ ...spot3, sure: false }), children: t.cancel }),
|
|
15746
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => {
|
|
15747
|
+
const at2 = spot3.at;
|
|
15748
|
+
const inside3 = doc.data && doc.data.spaceId === at2.spaceId && `${doc.data.folder ?? ""}/`.startsWith(`${at2.folder}/`);
|
|
15749
|
+
void act(() => host.removeFolder(at2), t.trashed).then(() => {
|
|
15750
|
+
refresh();
|
|
15751
|
+
if (inside3) go({ spaceId: here.spaceId, documentId: null });
|
|
15752
|
+
});
|
|
15753
|
+
}, children: [
|
|
15754
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
15755
|
+
t.trash
|
|
15756
|
+
] })
|
|
15757
|
+
] })
|
|
15758
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15759
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
15760
|
+
const at2 = spot3.at;
|
|
15761
|
+
setSpot(null);
|
|
15762
|
+
void note(t.untitled, true, at2);
|
|
15763
|
+
}, children: [
|
|
15764
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FilePlus, { "aria-hidden": true }),
|
|
15765
|
+
t.newNoteHere
|
|
15766
|
+
] }),
|
|
15767
|
+
host.makeFolder && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
15768
|
+
const at2 = spot3.at;
|
|
15769
|
+
setSpot(null);
|
|
15770
|
+
setEdit({ key: `new:${spot3.key}`, text: t.newFolder, run: (name) => act(() => host.makeFolder(at2, name)).then(refresh) });
|
|
15771
|
+
}, children: [
|
|
15772
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FolderPlus, { "aria-hidden": true }),
|
|
15773
|
+
t.newFolder
|
|
15774
|
+
] }),
|
|
15775
|
+
spot3.at.folder && host.renameFolder && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15776
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15777
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
15778
|
+
const at2 = spot3.at;
|
|
15779
|
+
setSpot(null);
|
|
15780
|
+
setEdit({ key: `dir:${spot3.key}`, text: folderNamed(at2), run: (name) => name === folderNamed(at2) ? Promise.resolve() : act(() => host.renameFolder(at2, name)).then(refresh) });
|
|
15781
|
+
}, children: [
|
|
15782
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Pencil, { "aria-hidden": true }),
|
|
15783
|
+
t.renameFolder
|
|
15784
|
+
] })
|
|
15785
|
+
] }),
|
|
15786
|
+
spot3.at.folder && host.removeFolder && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15787
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15788
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setSpot({ ...spot3, sure: true }), children: [
|
|
15789
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
15790
|
+
t.trashFolder
|
|
15791
|
+
] })
|
|
15792
|
+
] })
|
|
15793
|
+
] })
|
|
15794
|
+
] }),
|
|
14901
15795
|
dialog
|
|
14902
15796
|
] });
|
|
14903
15797
|
}
|
|
14904
15798
|
|
|
14905
15799
|
// src/FilePreview.tsx
|
|
14906
|
-
var
|
|
14907
|
-
var
|
|
15800
|
+
var import_react20 = require("react");
|
|
15801
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
14908
15802
|
function FilePreview({ url, name, mimeType, size: size2 = 0, bytes, pdfWorker }) {
|
|
14909
|
-
const [source] = (0,
|
|
15803
|
+
const [source] = (0, import_react20.useState)(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
|
|
14910
15804
|
const kind = kindOf(name, mimeType);
|
|
14911
15805
|
if (!kind) return null;
|
|
14912
|
-
return /* @__PURE__ */ (0,
|
|
15806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w100n-preview", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size: size2, updatedAt: "" } }) });
|
|
14913
15807
|
}
|
|
14914
15808
|
|
|
14915
15809
|
// src/GuestDocument.tsx
|
|
14916
|
-
var
|
|
14917
|
-
var
|
|
15810
|
+
var import_react21 = require("react");
|
|
15811
|
+
var import_lucide_react14 = require("lucide-react");
|
|
14918
15812
|
init_text();
|
|
14919
15813
|
init_useLoad();
|
|
14920
|
-
var
|
|
14921
|
-
var TextEditor4 = (0,
|
|
14922
|
-
var SheetView4 = (0,
|
|
14923
|
-
var
|
|
15814
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
15815
|
+
var TextEditor4 = (0, import_react21.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
15816
|
+
var SheetView4 = (0, import_react21.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
15817
|
+
var icons5 = { docx: import_lucide_react14.FileText, markdown: import_lucide_react14.FileType, pdf: import_lucide_react14.Files, sheet: import_lucide_react14.FileSpreadsheet, slides: import_lucide_react14.Presentation };
|
|
14924
15818
|
var GuestRefused = class extends Error {
|
|
14925
15819
|
constructor(reason, file = "", sharedBy = "") {
|
|
14926
15820
|
super(reason);
|
|
@@ -14929,7 +15823,7 @@ var GuestRefused = class extends Error {
|
|
|
14929
15823
|
this.sharedBy = sharedBy;
|
|
14930
15824
|
}
|
|
14931
15825
|
};
|
|
14932
|
-
var
|
|
15826
|
+
var remembered2 = () => {
|
|
14933
15827
|
try {
|
|
14934
15828
|
return localStorage.getItem("w100n-guest-name") ?? "";
|
|
14935
15829
|
} catch {
|
|
@@ -14945,14 +15839,14 @@ var remember = (name) => {
|
|
|
14945
15839
|
};
|
|
14946
15840
|
function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
14947
15841
|
const t = texts[language];
|
|
14948
|
-
const [ask, setAsk] = (0,
|
|
14949
|
-
const [typed, setTyped] = (0,
|
|
14950
|
-
const [name, setName] = (0,
|
|
14951
|
-
const named3 = (0,
|
|
14952
|
-
const [slot, setSlot] = (0,
|
|
14953
|
-
const [saving, setSaving] = (0,
|
|
15842
|
+
const [ask, setAsk] = (0, import_react21.useState)(() => ({ name: remembered2() || void 0 }));
|
|
15843
|
+
const [typed, setTyped] = (0, import_react21.useState)("");
|
|
15844
|
+
const [name, setName] = (0, import_react21.useState)(remembered2);
|
|
15845
|
+
const named3 = (0, import_react21.useRef)(name);
|
|
15846
|
+
const [slot, setSlot] = (0, import_react21.useState)(null);
|
|
15847
|
+
const [saving, setSaving] = (0, import_react21.useState)("idle");
|
|
14954
15848
|
const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
|
|
14955
|
-
const [notes3] = (0,
|
|
15849
|
+
const [notes3] = (0, import_react21.useState)(() => ({
|
|
14956
15850
|
me: { id: "", name: "" },
|
|
14957
15851
|
spaces: async () => [],
|
|
14958
15852
|
documents: async () => [],
|
|
@@ -14978,18 +15872,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14978
15872
|
};
|
|
14979
15873
|
const top = (file2, badge) => {
|
|
14980
15874
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
14981
|
-
const Kind = kind2 ?
|
|
14982
|
-
return /* @__PURE__ */ (0,
|
|
14983
|
-
brand && /* @__PURE__ */ (0,
|
|
14984
|
-
file2 && /* @__PURE__ */ (0,
|
|
14985
|
-
/* @__PURE__ */ (0,
|
|
14986
|
-
/* @__PURE__ */ (0,
|
|
14987
|
-
/* @__PURE__ */ (0,
|
|
14988
|
-
file2.sharedBy && /* @__PURE__ */ (0,
|
|
15875
|
+
const Kind = kind2 ? icons5[kind2] : import_lucide_react14.FileText;
|
|
15876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
|
|
15877
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-guest-brand", children: brand }),
|
|
15878
|
+
file2 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
15879
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Kind, { "aria-hidden": true }) }),
|
|
15880
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
15881
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
|
|
15882
|
+
file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
|
|
14989
15883
|
] }),
|
|
14990
|
-
badge && /* @__PURE__ */ (0,
|
|
14991
|
-
file2.download && /* @__PURE__ */ (0,
|
|
14992
|
-
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0,
|
|
15884
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
|
|
15885
|
+
file2.download && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-end", children: [
|
|
15886
|
+
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
14993
15887
|
"button",
|
|
14994
15888
|
{
|
|
14995
15889
|
type: "button",
|
|
@@ -15000,41 +15894,41 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15000
15894
|
"aria-label": t.pdfCopy,
|
|
15001
15895
|
title: t.pdfCopy,
|
|
15002
15896
|
children: [
|
|
15003
|
-
/* @__PURE__ */ (0,
|
|
15004
|
-
/* @__PURE__ */ (0,
|
|
15897
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.FileDown, { "aria-hidden": true }),
|
|
15898
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.pdfCopy })
|
|
15005
15899
|
]
|
|
15006
15900
|
}
|
|
15007
15901
|
),
|
|
15008
|
-
/* @__PURE__ */ (0,
|
|
15009
|
-
/* @__PURE__ */ (0,
|
|
15010
|
-
/* @__PURE__ */ (0,
|
|
15902
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
15903
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.Download, { "aria-hidden": true }),
|
|
15904
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.download })
|
|
15011
15905
|
] })
|
|
15012
15906
|
] })
|
|
15013
15907
|
] })
|
|
15014
15908
|
] });
|
|
15015
15909
|
};
|
|
15016
|
-
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0,
|
|
15910
|
+
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15017
15911
|
top(null, null),
|
|
15018
|
-
/* @__PURE__ */ (0,
|
|
15019
|
-
/* @__PURE__ */ (0,
|
|
15020
|
-
/* @__PURE__ */ (0,
|
|
15021
|
-
/* @__PURE__ */ (0,
|
|
15912
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-guest-card", children: [
|
|
15913
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { "aria-hidden": true }) }),
|
|
15914
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { children: title }),
|
|
15915
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: body }),
|
|
15022
15916
|
form
|
|
15023
15917
|
] }) })
|
|
15024
15918
|
] });
|
|
15025
15919
|
if (opened2.error) {
|
|
15026
15920
|
const refused = opened2.error instanceof GuestRefused ? opened2.error : null;
|
|
15027
|
-
if (refused?.reason === "ended") return gate("slate",
|
|
15028
|
-
if (refused?.reason === "missing") return gate("slate",
|
|
15921
|
+
if (refused?.reason === "ended") return gate("slate", import_lucide_react14.Ban, t.endedTitle, t.endedText);
|
|
15922
|
+
if (refused?.reason === "missing") return gate("slate", import_lucide_react14.Ban, t.missingTitle, t.missingText);
|
|
15029
15923
|
if (refused?.reason === "password" || refused?.reason === "wrong" || refused?.reason === "name") {
|
|
15030
15924
|
const password = refused.reason !== "name";
|
|
15031
15925
|
const shared = refused.sharedBy ? `${t.sharedBy.replace("{name}", refused.sharedBy)}. ` : "";
|
|
15032
15926
|
return gate(
|
|
15033
15927
|
"violet",
|
|
15034
|
-
password ?
|
|
15928
|
+
password ? import_lucide_react14.Lock : import_lucide_react14.UserRound,
|
|
15035
15929
|
refused.file || t.documents,
|
|
15036
15930
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
15037
|
-
/* @__PURE__ */ (0,
|
|
15931
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
15038
15932
|
e.preventDefault();
|
|
15039
15933
|
if (!typed.trim()) return;
|
|
15040
15934
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -15044,7 +15938,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15044
15938
|
}
|
|
15045
15939
|
setTyped("");
|
|
15046
15940
|
}, children: [
|
|
15047
|
-
/* @__PURE__ */ (0,
|
|
15941
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
15048
15942
|
"input",
|
|
15049
15943
|
{
|
|
15050
15944
|
className: "w100n-share-input",
|
|
@@ -15057,21 +15951,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15057
15951
|
onChange: (e) => setTyped(e.target.value)
|
|
15058
15952
|
}
|
|
15059
15953
|
),
|
|
15060
|
-
refused.reason === "wrong" && /* @__PURE__ */ (0,
|
|
15061
|
-
/* @__PURE__ */ (0,
|
|
15062
|
-
/* @__PURE__ */ (0,
|
|
15954
|
+
refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
|
|
15955
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
|
|
15956
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.Eye, { "aria-hidden": true }),
|
|
15063
15957
|
t.openDoc
|
|
15064
15958
|
] })
|
|
15065
15959
|
] })
|
|
15066
15960
|
);
|
|
15067
15961
|
}
|
|
15068
|
-
if (refused?.reason === "busy") return gate("slate",
|
|
15069
|
-
return gate("slate",
|
|
15962
|
+
if (refused?.reason === "busy") return gate("slate", import_lucide_react14.Ban, t.failed, t.tooMany);
|
|
15963
|
+
return gate("slate", import_lucide_react14.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
|
|
15070
15964
|
}
|
|
15071
15965
|
const file = opened2.data;
|
|
15072
|
-
if (!file) return /* @__PURE__ */ (0,
|
|
15966
|
+
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15073
15967
|
top(null, null),
|
|
15074
|
-
/* @__PURE__ */ (0,
|
|
15968
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
|
|
15075
15969
|
] });
|
|
15076
15970
|
const kind = kindOf(file.name, file.mimeType);
|
|
15077
15971
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -15079,23 +15973,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15079
15973
|
const rights = { view: true, comment: talk, edit: false };
|
|
15080
15974
|
const quiet3 = () => {
|
|
15081
15975
|
};
|
|
15082
|
-
let stage = /* @__PURE__ */ (0,
|
|
15083
|
-
if (text) stage = /* @__PURE__ */ (0,
|
|
15084
|
-
else if (kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
15085
|
-
else if (kind === "slides") stage = /* @__PURE__ */ (0,
|
|
15086
|
-
else if (kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
15087
|
-
return /* @__PURE__ */ (0,
|
|
15976
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
15977
|
+
if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes3 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
|
|
15978
|
+
else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
|
|
15979
|
+
else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
|
|
15980
|
+
else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react21.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
|
|
15981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15088
15982
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
15089
|
-
saving === "failed" && /* @__PURE__ */ (0,
|
|
15090
|
-
/* @__PURE__ */ (0,
|
|
15091
|
-
/* @__PURE__ */ (0,
|
|
15092
|
-
talk && /* @__PURE__ */ (0,
|
|
15093
|
-
/* @__PURE__ */ (0,
|
|
15094
|
-
/* @__PURE__ */ (0,
|
|
15095
|
-
/* @__PURE__ */ (0,
|
|
15983
|
+
saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
|
|
15984
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
|
|
15985
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
|
|
15986
|
+
talk && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-panel-body", children: [
|
|
15987
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "w100n-share-field", children: [
|
|
15988
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.yourName }),
|
|
15989
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
|
|
15096
15990
|
] }),
|
|
15097
|
-
/* @__PURE__ */ (0,
|
|
15098
|
-
/* @__PURE__ */ (0,
|
|
15991
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
15992
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: setSlot })
|
|
15099
15993
|
] }) })
|
|
15100
15994
|
] })
|
|
15101
15995
|
] });
|