@w100n/documents 0.16.4 → 0.17.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-SBLAFGTL.js} +5 -5
- package/dist/{TextEditor-5S7FSLIZ.js → TextEditor-X2GSL4QM.js} +119 -27
- package/dist/TextEditor-X2GSL4QM.js.map +1 -0
- package/dist/{chunk-AKJGYZME.js → chunk-A6AHJCEK.js} +67 -832
- package/dist/chunk-A6AHJCEK.js.map +1 -0
- package/dist/{chunk-3D2G5NBI.js → chunk-ASTNK6WZ.js} +2 -2
- package/dist/{chunk-VNXZVOPN.js → chunk-B7C6NBBQ.js} +929 -1
- package/dist/chunk-B7C6NBBQ.js.map +1 -0
- package/dist/chunk-FFXAOK4A.js +39 -0
- package/dist/chunk-FFXAOK4A.js.map +1 -0
- package/dist/{chunk-EQLBYW42.js → chunk-GSIPTCQH.js} +9 -1
- package/dist/chunk-GSIPTCQH.js.map +1 -0
- package/dist/collab.cjs +170 -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 +1204 -540
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +313 -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 +871 -494
- 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 +3 -2
- 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 +3 -2
- package/dist/memory.js.map +1 -1
- package/dist/{types-BUO0OzOl.d.cts → types-CHmV8GLx.d.cts} +1 -0
- package/dist/{types-BUO0OzOl.d.ts → types-CHmV8GLx.d.ts} +1 -0
- 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-SBLAFGTL.js.map} +0 -0
- /package/dist/{chunk-3D2G5NBI.js.map → chunk-ASTNK6WZ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,29 @@ var init_text = __esm({
|
|
|
67
67
|
"src/text.ts"() {
|
|
68
68
|
"use strict";
|
|
69
69
|
en2 = {
|
|
70
|
+
elsewhere: "Other",
|
|
71
|
+
wikiCreate: "Create \u201C{name}\u201D",
|
|
72
|
+
wikiNew: "new note",
|
|
73
|
+
wikiKeys: "\u2191\u2193 pick \xB7 \u21B5 link \xB7 | alias",
|
|
74
|
+
tree: "Tree",
|
|
75
|
+
cards: "Cards",
|
|
76
|
+
openNote: "Open note",
|
|
77
|
+
findNote: "Type a note name",
|
|
78
|
+
createNote: "Create note \u201C{name}\u201D",
|
|
79
|
+
noNote: "No notes match",
|
|
80
|
+
keysOpen: "\u2191\u2193 move \xB7 \u21B5 open \xB7 esc close",
|
|
81
|
+
commands: "Commands",
|
|
82
|
+
newNote: "New note",
|
|
83
|
+
searchAll: "Search in all notes",
|
|
84
|
+
showOutline: "Show outline",
|
|
85
|
+
showLinks: "Show backlinks",
|
|
86
|
+
showVersions: "Show versions",
|
|
87
|
+
showComments: "Show comments",
|
|
88
|
+
keysRun: "\u2191\u2193 move \xB7 \u21B5 run \xB7 esc close",
|
|
89
|
+
links: "Links",
|
|
90
|
+
linked: "Linked mentions",
|
|
91
|
+
unlinked: "Unlinked mentions",
|
|
92
|
+
noBacklinks: "Nothing links here yet",
|
|
70
93
|
documents: "Documents",
|
|
71
94
|
hint: "Files of your projects: read, edit and comment in one place",
|
|
72
95
|
loose: "Without a folder",
|
|
@@ -420,6 +443,29 @@ var init_text = __esm({
|
|
|
420
443
|
uploadFailed: "Could not upload the file"
|
|
421
444
|
};
|
|
422
445
|
pl2 = {
|
|
446
|
+
elsewhere: "Inne",
|
|
447
|
+
wikiCreate: "Utw\xF3rz \u201E{name}\u201D",
|
|
448
|
+
wikiNew: "nowa notatka",
|
|
449
|
+
wikiKeys: "\u2191\u2193 wyb\xF3r \xB7 \u21B5 link \xB7 | alias",
|
|
450
|
+
tree: "Drzewo",
|
|
451
|
+
cards: "Karty",
|
|
452
|
+
openNote: "Otw\xF3rz notatk\u0119",
|
|
453
|
+
findNote: "Wpisz nazw\u0119 notatki",
|
|
454
|
+
createNote: "Utw\xF3rz notatk\u0119 \u201E{name}\u201D",
|
|
455
|
+
noNote: "Brak pasuj\u0105cych notatek",
|
|
456
|
+
keysOpen: "\u2191\u2193 ruch \xB7 \u21B5 otw\xF3rz \xB7 esc zamknij",
|
|
457
|
+
commands: "Polecenia",
|
|
458
|
+
newNote: "Nowa notatka",
|
|
459
|
+
searchAll: "Szukaj we wszystkich notatkach",
|
|
460
|
+
showOutline: "Poka\u017C spis",
|
|
461
|
+
showLinks: "Poka\u017C odno\u015Bniki",
|
|
462
|
+
showVersions: "Poka\u017C wersje",
|
|
463
|
+
showComments: "Poka\u017C komentarze",
|
|
464
|
+
keysRun: "\u2191\u2193 ruch \xB7 \u21B5 uruchom \xB7 esc zamknij",
|
|
465
|
+
links: "Odno\u015Bniki",
|
|
466
|
+
linked: "Linki do tej notatki",
|
|
467
|
+
unlinked: "Wzmianki bez linku",
|
|
468
|
+
noBacklinks: "Nic tu jeszcze nie linkuje",
|
|
423
469
|
documents: "Dokumenty",
|
|
424
470
|
hint: "Pliki Twoich projekt\xF3w: czytaj, edytuj i komentuj w jednym miejscu",
|
|
425
471
|
loose: "Bez folderu",
|
|
@@ -773,6 +819,29 @@ var init_text = __esm({
|
|
|
773
819
|
uploadFailed: "Nie uda\u0142o si\u0119 wgra\u0107 pliku"
|
|
774
820
|
};
|
|
775
821
|
uk2 = {
|
|
822
|
+
elsewhere: "\u0406\u043D\u0448\u0435",
|
|
823
|
+
wikiCreate: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \xAB{name}\xBB",
|
|
824
|
+
wikiNew: "\u043D\u043E\u0432\u0430 \u043D\u043E\u0442\u0430\u0442\u043A\u0430",
|
|
825
|
+
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",
|
|
826
|
+
tree: "\u0414\u0435\u0440\u0435\u0432\u043E",
|
|
827
|
+
cards: "\u041A\u0430\u0440\u0442\u043A\u0438",
|
|
828
|
+
openNote: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u043D\u043E\u0442\u0430\u0442\u043A\u0443",
|
|
829
|
+
findNote: "\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u043D\u0430\u0437\u0432\u0443 \u043D\u043E\u0442\u0430\u0442\u043A\u0438",
|
|
830
|
+
createNote: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u043D\u043E\u0442\u0430\u0442\u043A\u0443 \xAB{name}\xBB",
|
|
831
|
+
noNote: "\u041D\u0435\u043C\u0430\u0454 \u0442\u0430\u043A\u0438\u0445 \u043D\u043E\u0442\u0430\u0442\u043E\u043A",
|
|
832
|
+
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",
|
|
833
|
+
commands: "\u041A\u043E\u043C\u0430\u043D\u0434\u0438",
|
|
834
|
+
newNote: "\u041D\u043E\u0432\u0430 \u043D\u043E\u0442\u0430\u0442\u043A\u0430",
|
|
835
|
+
searchAll: "\u0428\u0443\u043A\u0430\u0442\u0438 \u0432 \u0443\u0441\u0456\u0445 \u043D\u043E\u0442\u0430\u0442\u043A\u0430\u0445",
|
|
836
|
+
showOutline: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0437\u043C\u0456\u0441\u0442",
|
|
837
|
+
showLinks: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
838
|
+
showVersions: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0432\u0435\u0440\u0441\u0456\u0457",
|
|
839
|
+
showComments: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456",
|
|
840
|
+
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",
|
|
841
|
+
links: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
842
|
+
linked: "\u041F\u043E\u0441\u0438\u043B\u0430\u044E\u0442\u044C\u0441\u044F \u0441\u044E\u0434\u0438",
|
|
843
|
+
unlinked: "\u0417\u0433\u0430\u0434\u043A\u0438 \u0431\u0435\u0437 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
|
|
844
|
+
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
845
|
documents: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0438",
|
|
777
846
|
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
847
|
loose: "\u0411\u0435\u0437 \u0442\u0435\u043A\u0438",
|
|
@@ -1354,11 +1423,11 @@ function rebuild(pr, tag, order2, set) {
|
|
|
1354
1423
|
}
|
|
1355
1424
|
for (const name in set) if (!seen2.has(name) && set[name] !== null) out.push({ name, xml: set[name] });
|
|
1356
1425
|
if (!out.length) return "";
|
|
1357
|
-
const
|
|
1426
|
+
const rank2 = (name) => {
|
|
1358
1427
|
const i = order2.indexOf(name);
|
|
1359
1428
|
return i === -1 ? order2.length : i;
|
|
1360
1429
|
};
|
|
1361
|
-
const sorted = out.map((p, i) => ({ p, i })).sort((a, b) =>
|
|
1430
|
+
const sorted = out.map((p, i) => ({ p, i })).sort((a, b) => rank2(a.p.name) - rank2(b.p.name) || a.i - b.i);
|
|
1362
1431
|
const open = root ? opened(pr, root) : `<${tag}>`;
|
|
1363
1432
|
return open + sorted.map((x) => x.p.xml).join("") + `</${tag}>`;
|
|
1364
1433
|
}
|
|
@@ -2670,8 +2739,8 @@ var init_read = __esm({
|
|
|
2670
2739
|
const pr = kid(el, "w:tblPr");
|
|
2671
2740
|
const jc = pr && kid(pr, "w:jc");
|
|
2672
2741
|
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:
|
|
2742
|
+
const bare4 = !!bd && bd.kids.length > 0 && bd.kids.every((k) => /^(none|nil)$/.test(attr(s, k, "w:val") ?? ""));
|
|
2743
|
+
const node = { type: "table", attrs: { align: align(jc ? attr(s, jc, "w:val") : null), indent: 0, borders: bare4 ? "none" : null, ref }, content: [] };
|
|
2675
2744
|
const b = this.block("tbl", el, node, ref);
|
|
2676
2745
|
const grid3 = kid(el, "w:tblGrid");
|
|
2677
2746
|
b.cols = grid3 ? grid3.kids.filter((k) => k.name === "w:gridCol").length : 0;
|
|
@@ -4182,7 +4251,7 @@ function decide(editor, accept, id) {
|
|
|
4182
4251
|
}
|
|
4183
4252
|
if (tr.docChanged) editor.view.dispatch(tr);
|
|
4184
4253
|
}
|
|
4185
|
-
function kit(kind, t, live) {
|
|
4254
|
+
function kit(kind, t, live, wiki) {
|
|
4186
4255
|
return [
|
|
4187
4256
|
import_starter_kit.default.configure({ trailingNode: false, link: { openOnClick: false, autolink: true, defaultProtocol: "https" }, dropcursor: { color: "#8b5cf6", width: 2 }, ...live ? { undoRedo: false } : {} }),
|
|
4188
4257
|
import_extension_list.TaskList,
|
|
@@ -4210,6 +4279,8 @@ function kit(kind, t, live) {
|
|
|
4210
4279
|
Formula,
|
|
4211
4280
|
Footnote,
|
|
4212
4281
|
EndNotes,
|
|
4282
|
+
WikiLink.configure({ known: wiki?.known ?? (() => true) }),
|
|
4283
|
+
...kind === "markdown" && wiki ? [WikiAsk, Reveal] : [],
|
|
4213
4284
|
...kind === "docx" ? [Pager, Locks.configure({ label: t.locked }), revision("insertion", "ins"), revision("deletion", "del"), Suggest] : [],
|
|
4214
4285
|
...live ? [import_extension_collaboration.default.configure({ document: live.doc }), import_extension_collaboration_caret.default.configure({ provider: live.link, user: live.user })] : []
|
|
4215
4286
|
];
|
|
@@ -4253,7 +4324,7 @@ function locate(doc, list) {
|
|
|
4253
4324
|
return range ? [{ id: c.id, from: range.from, to: range.to }] : [];
|
|
4254
4325
|
});
|
|
4255
4326
|
}
|
|
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;
|
|
4327
|
+
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
4328
|
var init_extensions = __esm({
|
|
4258
4329
|
"src/editor/extensions.ts"() {
|
|
4259
4330
|
"use strict";
|
|
@@ -4450,6 +4521,95 @@ var init_extensions = __esm({
|
|
|
4450
4521
|
parseHTML: () => [{ tag: "sup[data-footnote]" }],
|
|
4451
4522
|
renderHTML: ({ node }) => ["sup", { "data-footnote": "", "data-note-id": node.attrs.id ?? void 0, title: node.attrs.text, class: "w100n-fn", contenteditable: "false" }]
|
|
4452
4523
|
});
|
|
4524
|
+
wikiName = (target) => target.split("#")[0].trim().replace(/\.md$/i, "");
|
|
4525
|
+
WikiLink = import_core2.Node.create({
|
|
4526
|
+
name: "wikilink",
|
|
4527
|
+
group: "inline",
|
|
4528
|
+
inline: true,
|
|
4529
|
+
atom: true,
|
|
4530
|
+
selectable: true,
|
|
4531
|
+
addOptions: () => ({ known: () => true }),
|
|
4532
|
+
addAttributes: () => ({
|
|
4533
|
+
target: { default: "", parseHTML: (el) => el.getAttribute("data-wiki") ?? "" },
|
|
4534
|
+
alias: { default: null, parseHTML: (el) => el.getAttribute("data-alias") }
|
|
4535
|
+
}),
|
|
4536
|
+
parseHTML: () => [{ tag: "span[data-wiki]" }],
|
|
4537
|
+
renderHTML: ({ node }) => [
|
|
4538
|
+
"span",
|
|
4539
|
+
{ "data-wiki": node.attrs.target, "data-alias": node.attrs.alias ?? void 0, class: "w100n-wiki", contenteditable: "false" },
|
|
4540
|
+
node.attrs.alias || wikiName(node.attrs.target) || node.attrs.target
|
|
4541
|
+
],
|
|
4542
|
+
addProseMirrorPlugins() {
|
|
4543
|
+
const known = this.options.known;
|
|
4544
|
+
return [new import_state2.Plugin({
|
|
4545
|
+
props: {
|
|
4546
|
+
decorations(state) {
|
|
4547
|
+
const found = [];
|
|
4548
|
+
state.doc.descendants((node, pos) => {
|
|
4549
|
+
if (node.type.name === "wikilink" && !known(node.attrs.target)) found.push(import_view2.Decoration.node(pos, pos + node.nodeSize, { class: "is-missing" }));
|
|
4550
|
+
});
|
|
4551
|
+
return import_view2.DecorationSet.create(state.doc, found);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
})];
|
|
4555
|
+
}
|
|
4556
|
+
});
|
|
4557
|
+
wikiAsk = new import_state2.PluginKey("wikiAsk");
|
|
4558
|
+
WikiAsk = import_core2.Extension.create({
|
|
4559
|
+
name: "wikiAsk",
|
|
4560
|
+
addProseMirrorPlugins() {
|
|
4561
|
+
return [new import_state2.Plugin({
|
|
4562
|
+
key: wikiAsk,
|
|
4563
|
+
state: {
|
|
4564
|
+
init: () => null,
|
|
4565
|
+
apply(tr, _old, _before, state) {
|
|
4566
|
+
const { $from, empty } = state.selection;
|
|
4567
|
+
if (!empty || !$from.parent.isTextblock || $from.parent.type.spec.code) return null;
|
|
4568
|
+
const before = $from.parent.textBetween(0, $from.parentOffset, void 0, "\uFFFC");
|
|
4569
|
+
const m = /\[\[([^[\]\n|\ufffc]*)$/.exec(before);
|
|
4570
|
+
return m ? { from: $from.pos - m[0].length, query: m[1] } : null;
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
})];
|
|
4574
|
+
}
|
|
4575
|
+
});
|
|
4576
|
+
signs = { bold: "**", italic: "*", strike: "~~", code: "`" };
|
|
4577
|
+
syntax = (text, pos, side2) => import_view2.Decoration.widget(pos, () => {
|
|
4578
|
+
const el = document.createElement("span");
|
|
4579
|
+
el.className = "w100n-syntax";
|
|
4580
|
+
el.textContent = text;
|
|
4581
|
+
return el;
|
|
4582
|
+
}, { side: side2, key: `${text}:${pos}:${side2}` });
|
|
4583
|
+
Reveal = import_core2.Extension.create({
|
|
4584
|
+
name: "reveal",
|
|
4585
|
+
addProseMirrorPlugins: () => [new import_state2.Plugin({
|
|
4586
|
+
props: {
|
|
4587
|
+
decorations(state) {
|
|
4588
|
+
const { $from, empty } = state.selection;
|
|
4589
|
+
if (!empty || !$from.parent.isTextblock) return null;
|
|
4590
|
+
const found = [];
|
|
4591
|
+
const start = $from.start();
|
|
4592
|
+
if ($from.parent.type.name === "heading") found.push(syntax(`${"#".repeat($from.parent.attrs.level)} `, start, -1));
|
|
4593
|
+
const at2 = $from.parentOffset;
|
|
4594
|
+
for (const [name, sign] of Object.entries(signs)) {
|
|
4595
|
+
let from = -1;
|
|
4596
|
+
let offset = 0;
|
|
4597
|
+
$from.parent.forEach((child) => {
|
|
4598
|
+
const end = offset + child.nodeSize;
|
|
4599
|
+
if (child.marks.some((m) => m.type.name === name)) {
|
|
4600
|
+
if (from < 0) from = offset;
|
|
4601
|
+
if (from <= at2 && at2 <= end && (end === $from.parent.content.size || !$from.parent.childAfter(end).node?.marks.some((m) => m.type.name === name))) {
|
|
4602
|
+
found.push(syntax(sign, start + from, -1), syntax(sign, start + end, 1));
|
|
4603
|
+
}
|
|
4604
|
+
} else from = -1;
|
|
4605
|
+
offset = end;
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
return import_view2.DecorationSet.create(state.doc, found);
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
})]
|
|
4612
|
+
});
|
|
4453
4613
|
EndNotes = import_core2.Extension.create({
|
|
4454
4614
|
name: "endNotes",
|
|
4455
4615
|
addProseMirrorPlugins: () => [new import_state2.Plugin({
|
|
@@ -4767,11 +4927,46 @@ var init_extensions = __esm({
|
|
|
4767
4927
|
}
|
|
4768
4928
|
});
|
|
4769
4929
|
|
|
4930
|
+
// src/editor/wiki.ts
|
|
4931
|
+
function findNote(notes3, target) {
|
|
4932
|
+
const name = wikiName(target).toLowerCase();
|
|
4933
|
+
if (!name) return null;
|
|
4934
|
+
const path = (n) => [n.folder, bare2(n.name)].filter(Boolean).join("/").toLowerCase();
|
|
4935
|
+
const byPath = notes3.find((n) => path(n) === name);
|
|
4936
|
+
if (byPath) return byPath;
|
|
4937
|
+
const byName = notes3.filter((n) => bare2(n.name).toLowerCase() === name);
|
|
4938
|
+
byName.sort((a, b) => path(a).length - path(b).length);
|
|
4939
|
+
return byName[0] ?? null;
|
|
4940
|
+
}
|
|
4941
|
+
function linkTo(notes3, note) {
|
|
4942
|
+
const name = bare2(note.name);
|
|
4943
|
+
return notes3.filter((n) => bare2(n.name).toLowerCase() === name.toLowerCase()).length > 1 ? [note.folder, name].filter(Boolean).join("/") : name;
|
|
4944
|
+
}
|
|
4945
|
+
function suggest(notes3, query, self) {
|
|
4946
|
+
const q = query.trim().toLowerCase();
|
|
4947
|
+
const scored = notes3.filter((n) => n.id !== self).map((n) => {
|
|
4948
|
+
const name = bare2(n.name).toLowerCase();
|
|
4949
|
+
const at2 = q ? name.indexOf(q) : 0;
|
|
4950
|
+
const word = q ? name.split(/[\s_-]+/).some((w) => w.startsWith(q)) : true;
|
|
4951
|
+
return { n, rank: !q ? 1 : name.startsWith(q) ? 0 : word ? 1 : at2 >= 0 ? 2 : -1 };
|
|
4952
|
+
}).filter((x) => x.rank >= 0);
|
|
4953
|
+
scored.sort((a, b) => a.rank - b.rank || bare2(a.n.name).localeCompare(bare2(b.n.name)));
|
|
4954
|
+
return scored.slice(0, 8).map((x) => x.n);
|
|
4955
|
+
}
|
|
4956
|
+
var bare2;
|
|
4957
|
+
var init_wiki = __esm({
|
|
4958
|
+
"src/editor/wiki.ts"() {
|
|
4959
|
+
"use strict";
|
|
4960
|
+
init_extensions();
|
|
4961
|
+
bare2 = (name) => name.replace(/\.(md|markdown)$/i, "");
|
|
4962
|
+
}
|
|
4963
|
+
});
|
|
4964
|
+
|
|
4770
4965
|
// package.json
|
|
4771
4966
|
var version;
|
|
4772
4967
|
var init_package = __esm({
|
|
4773
4968
|
"package.json"() {
|
|
4774
|
-
version = "0.
|
|
4969
|
+
version = "0.17.0";
|
|
4775
4970
|
}
|
|
4776
4971
|
});
|
|
4777
4972
|
|
|
@@ -4798,6 +4993,7 @@ function inline3(tokens = [], outer = []) {
|
|
|
4798
4993
|
else if (token2.type === "br") out.push({ type: "hardBreak" });
|
|
4799
4994
|
else if (token2.type === "math") out.push({ type: "math", attrs: { latex: token2.text } });
|
|
4800
4995
|
else if (token2.type === "footnoteRef") out.push({ type: "footnote", attrs: { id: token2.id, text: notes2.get(token2.id) ?? "" } });
|
|
4996
|
+
else if (token2.type === "wikilink") out.push({ type: "wikilink", attrs: { target: token2.target, alias: token2.alias } });
|
|
4801
4997
|
else if (token2.type === "link") wrap(token2.tokens, { type: "link", attrs: { href: token2.href } });
|
|
4802
4998
|
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
4999
|
else if (token2.type === "html") {
|
|
@@ -5008,6 +5204,9 @@ function serializer(style, hints, before, cell2 = false) {
|
|
|
5008
5204
|
footnote(state, node) {
|
|
5009
5205
|
state.write(`[^${node.attrs.id}]`);
|
|
5010
5206
|
},
|
|
5207
|
+
wikilink(state, node) {
|
|
5208
|
+
state.write(`[[${node.attrs.target}${node.attrs.alias ? `|${node.attrs.alias}` : ""}]]`);
|
|
5209
|
+
},
|
|
5011
5210
|
blockquote(state, node) {
|
|
5012
5211
|
state.wrapBlock("> ", null, node, () => state.renderContent(node));
|
|
5013
5212
|
},
|
|
@@ -5180,6 +5379,10 @@ var init_markdown = __esm({
|
|
|
5180
5379
|
const m = /^\[\^([^\]\s]+)\]/.exec(src);
|
|
5181
5380
|
return m ? { type: "footnoteRef", raw: m[0], id: m[1] } : void 0;
|
|
5182
5381
|
} },
|
|
5382
|
+
{ name: "wikilink", level: "inline", start: (src) => at(src, /\[\[/), tokenizer(src) {
|
|
5383
|
+
const m = /^\[\[([^[\]\n|]+?)(?:\|([^[\]\n]+?))?\]\]/.exec(src);
|
|
5384
|
+
return m ? { type: "wikilink", raw: m[0], target: m[1].trim(), alias: m[2]?.trim() ?? null } : void 0;
|
|
5385
|
+
} },
|
|
5183
5386
|
{ name: "math", level: "inline", start: (src) => at(src, /\$/), tokenizer(src) {
|
|
5184
5387
|
const m = /^\$\$([^$]+?)\$\$|^\$(?![\s$])((?:\\.|[^$\\\n])*?[^\s\\])\$(?!\d)/.exec(src);
|
|
5185
5388
|
return m ? { type: "math", raw: m[0], text: (m[1] ?? m[2]).trim() } : void 0;
|
|
@@ -6577,9 +6780,9 @@ function place(xml, name, value3) {
|
|
|
6577
6780
|
const found = find2(xml, name);
|
|
6578
6781
|
if (found) return xml.slice(0, found.start) + (value3 ?? "") + xml.slice(found.end);
|
|
6579
6782
|
if (value3 === null) return xml;
|
|
6580
|
-
const
|
|
6783
|
+
const rank2 = order.indexOf(name);
|
|
6581
6784
|
let at2 = -1;
|
|
6582
|
-
for (const later of order.slice(
|
|
6785
|
+
for (const later of order.slice(rank2 + 1)) {
|
|
6583
6786
|
const f = find2(xml, later);
|
|
6584
6787
|
if (f && (at2 < 0 || f.start < at2)) at2 = f.start;
|
|
6585
6788
|
}
|
|
@@ -8130,7 +8333,7 @@ var TextEditor_exports = {};
|
|
|
8130
8333
|
__export(TextEditor_exports, {
|
|
8131
8334
|
default: () => TextEditor
|
|
8132
8335
|
});
|
|
8133
|
-
function TextEditor({ kind, bytes, t, language, rights, host, together, documentId, onSaved, onOutline, onReading, onPanel, slot, head: head2, file, guard }) {
|
|
8336
|
+
function TextEditor({ kind, bytes, t, language, rights, host, together, documentId, onSaved, onOutline, onReading, onPanel, slot, head: head2, file, guard, wiki }) {
|
|
8134
8337
|
const docx2 = kind === "docx";
|
|
8135
8338
|
const can = { edit: !!host?.save && !!rights?.edit, comment: !!host?.comment && !!rights && (rights.comment || rights.edit) };
|
|
8136
8339
|
const source = useLoad(async () => {
|
|
@@ -8181,13 +8384,23 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
|
|
|
8181
8384
|
useRestore(pop !== null);
|
|
8182
8385
|
useRestore(editing !== null);
|
|
8183
8386
|
useRestore(dropping !== null);
|
|
8387
|
+
const wikiRef = (0, import_react11.useRef)(wiki);
|
|
8388
|
+
wikiRef.current = wiki;
|
|
8389
|
+
const wikiKeys = (0, import_react11.useRef)(null);
|
|
8390
|
+
const [ask, setAsk] = (0, import_react11.useState)(null);
|
|
8391
|
+
const [askAt, setAskAt] = (0, import_react11.useState)(0);
|
|
8392
|
+
const [shut, setShut] = (0, import_react11.useState)(null);
|
|
8184
8393
|
const editor = (0, import_react10.useEditor)({
|
|
8185
|
-
extensions: kit(kind, t, shared),
|
|
8394
|
+
extensions: kit(kind, t, shared, docx2 || !wiki ? void 0 : { known: (target) => !!findNote(wikiRef.current?.notes ?? [], target) }),
|
|
8186
8395
|
content: shared ? null : source.data?.doc ?? null,
|
|
8187
8396
|
editable: can.edit && (!live || !!shared),
|
|
8188
8397
|
immediatelyRender: true,
|
|
8189
8398
|
shouldRerenderOnTransaction: false,
|
|
8190
|
-
editorProps: {
|
|
8399
|
+
editorProps: {
|
|
8400
|
+
attributes: { class: "w100n-docs-prose w100n-text-body", "aria-label": t.documentText, spellcheck: String(spell), lang: language },
|
|
8401
|
+
transformPastedHTML: cleanPaste,
|
|
8402
|
+
handleKeyDown: (view, event) => !!wikiAsk.getState(view.state) && !!wikiKeys.current?.(event.key)
|
|
8403
|
+
},
|
|
8191
8404
|
onCreate: ({ editor: made2 }) => {
|
|
8192
8405
|
if (source.data && !live) baseline.current = { bytes, doc: made2.state.doc, base: source.data.md && track(source.data.md, made2.state.doc) };
|
|
8193
8406
|
}
|
|
@@ -8287,8 +8500,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8287
8500
|
(0, import_react11.useEffect)(() => {
|
|
8288
8501
|
if (!editor || !source.data) return;
|
|
8289
8502
|
const have = new Map(notes.getState(editor.state).spots.map((s) => [s.id, s]));
|
|
8290
|
-
const
|
|
8291
|
-
const found2 = locate(editor.state.doc,
|
|
8503
|
+
const fresh3 = open.filter((c) => !have.has(c.id));
|
|
8504
|
+
const found2 = locate(editor.state.doc, fresh3.map((c) => ({ id: c.id, quote: c.quote, anchor: anchors2.current.get(c.id) })));
|
|
8292
8505
|
editor.view.dispatch(editor.state.tr.setMeta(notes, { spots: [...open.flatMap((c) => have.get(c.id) ?? []), ...found2] }));
|
|
8293
8506
|
}, [editor, source.data, openIds]);
|
|
8294
8507
|
(0, import_react11.useEffect)(() => {
|
|
@@ -8408,7 +8621,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8408
8621
|
}, [editor, pop, query]);
|
|
8409
8622
|
(0, import_react11.useEffect)(() => {
|
|
8410
8623
|
const press = (e) => {
|
|
8411
|
-
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "p") return;
|
|
8624
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "p" || !docx2 && wiki) return;
|
|
8412
8625
|
e.preventDefault();
|
|
8413
8626
|
e.stopPropagation();
|
|
8414
8627
|
print();
|
|
@@ -8433,6 +8646,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8433
8646
|
window.removeEventListener("scroll", off, true);
|
|
8434
8647
|
};
|
|
8435
8648
|
}, [pop]);
|
|
8649
|
+
const wikied = !!wiki;
|
|
8650
|
+
(0, import_react11.useEffect)(() => {
|
|
8651
|
+
if (!editor || !wikied) return;
|
|
8652
|
+
const sync = () => {
|
|
8653
|
+
const next = wikiAsk.getState(editor.state) ?? null;
|
|
8654
|
+
setAsk((prev) => prev?.from === next?.from && prev?.query === next?.query ? prev : next);
|
|
8655
|
+
};
|
|
8656
|
+
editor.on("transaction", sync);
|
|
8657
|
+
return () => {
|
|
8658
|
+
editor.off("transaction", sync);
|
|
8659
|
+
};
|
|
8660
|
+
}, [editor, wikied]);
|
|
8661
|
+
(0, import_react11.useEffect)(() => setAskAt(0), [ask?.query]);
|
|
8662
|
+
const roster = wiki?.notes.map((n) => `${n.id}:${n.name}:${n.folder ?? ""}`).join("|");
|
|
8663
|
+
(0, import_react11.useEffect)(() => {
|
|
8664
|
+
if (editor && !editor.isDestroyed) editor.view.dispatch(editor.state.tr.setMeta("wiki", true));
|
|
8665
|
+
}, [editor, roster]);
|
|
8436
8666
|
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
8667
|
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
8668
|
const save2 = async (auto = false) => {
|
|
@@ -8453,8 +8683,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8453
8683
|
await host.save(documentId, out, auto ? t.autosavedNote : t.editedNote, auto);
|
|
8454
8684
|
baseline.current = { bytes: md ? out : was.bytes, doc, base: md ? md.base : null };
|
|
8455
8685
|
if (!md && editor.state.doc === doc) {
|
|
8456
|
-
const
|
|
8457
|
-
if (editor.state.doc === doc && renew(
|
|
8686
|
+
const fresh3 = (await readDocx(out)).doc;
|
|
8687
|
+
if (editor.state.doc === doc && renew(fresh3)) baseline.current = { bytes: out, doc: editor.state.doc, base: null };
|
|
8458
8688
|
}
|
|
8459
8689
|
setUnsetup(false);
|
|
8460
8690
|
setSaving("done");
|
|
@@ -8465,13 +8695,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8465
8695
|
return false;
|
|
8466
8696
|
}
|
|
8467
8697
|
};
|
|
8468
|
-
const renew = (
|
|
8698
|
+
const renew = (fresh3) => {
|
|
8469
8699
|
const at2 = [];
|
|
8470
8700
|
const refs3 = [];
|
|
8471
8701
|
editor.state.doc.descendants((node, pos) => {
|
|
8472
8702
|
if (node.isBlock) at2.push(pos);
|
|
8473
8703
|
});
|
|
8474
|
-
editor.schema.nodeFromJSON(
|
|
8704
|
+
editor.schema.nodeFromJSON(fresh3).descendants((node) => {
|
|
8475
8705
|
if (node.isBlock) refs3.push(node.type.name, node.attrs.ref);
|
|
8476
8706
|
});
|
|
8477
8707
|
if (refs3.length !== at2.length * 2 || at2.some((pos, i) => editor.state.doc.nodeAt(pos).type.name !== refs3[i * 2])) return false;
|
|
@@ -8699,7 +8929,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8699
8929
|
const at2 = editor.state.selection.$from.before(1);
|
|
8700
8930
|
editor.chain().focus().insertContentAt(at2, { type: "toc", attrs: { entries: JSON.stringify(entries(editor.state.doc, !docx2, at2 - 1)) } }).run();
|
|
8701
8931
|
};
|
|
8702
|
-
const
|
|
8932
|
+
const suggest2 = () => editor.view.dispatch(editor.state.tr.setMeta(suggesting, { on: !state.suggest, me: host?.me.name ?? "" }));
|
|
8703
8933
|
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
8934
|
const lines2 = [[1, t.single], [1.15, "1.15"], [1.5, "1.5"], [2, t.double]];
|
|
8705
8935
|
const menus = [
|
|
@@ -8776,7 +9006,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
8776
9006
|
item(t.indent, () => indent(editor, 1), { keys: `${mod}]` })
|
|
8777
9007
|
] : []],
|
|
8778
9008
|
["tools", t.menuTools, [
|
|
8779
|
-
docx2 && can.edit && item(t.suggest,
|
|
9009
|
+
docx2 && can.edit && item(t.suggest, suggest2, { on: state.suggest }),
|
|
8780
9010
|
docx2 && can.edit && state.revs.length > 0 && item(t.acceptAll, () => decide(editor, true)),
|
|
8781
9011
|
docx2 && can.edit && state.revs.length > 0 && item(t.rejectAll, () => decide(editor, false)),
|
|
8782
9012
|
!!host?.comments && (can.comment || open.length > 0) && item(t.comments, () => onPanel?.("comments")),
|
|
@@ -9180,7 +9410,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9180
9410
|
tool(import_lucide_react5.RemoveFormatting, t.clearFormat, () => clear(editor)),
|
|
9181
9411
|
docx2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9182
9412
|
gap,
|
|
9183
|
-
tool(import_lucide_react5.FilePenLine, t.suggest,
|
|
9413
|
+
tool(import_lucide_react5.FilePenLine, t.suggest, suggest2, state.suggest)
|
|
9184
9414
|
] })
|
|
9185
9415
|
] });
|
|
9186
9416
|
const context = can.edit && (state.table ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
@@ -9219,6 +9449,39 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9219
9449
|
if (e.target.closest("button")) e.preventDefault();
|
|
9220
9450
|
};
|
|
9221
9451
|
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;
|
|
9452
|
+
const asking = wiki && ask && shut !== ask.from ? ask : null;
|
|
9453
|
+
const offers = asking ? suggest(wiki.notes, asking.query, documentId) : [];
|
|
9454
|
+
const fresh2 = asking?.query.trim() ?? "";
|
|
9455
|
+
const options = [
|
|
9456
|
+
...offers.map((note) => ({ note })),
|
|
9457
|
+
...fresh2 && wiki?.create && !offers.some((n) => n.name.replace(/\.(md|markdown)$/i, "").toLowerCase() === fresh2.toLowerCase()) ? [{ make: fresh2 }] : []
|
|
9458
|
+
];
|
|
9459
|
+
const choose = async (option) => {
|
|
9460
|
+
const from = asking.from;
|
|
9461
|
+
let target;
|
|
9462
|
+
if ("note" in option) target = linkTo(wiki.notes, option.note);
|
|
9463
|
+
else {
|
|
9464
|
+
if (!await wiki.create(option.make)) return;
|
|
9465
|
+
target = option.make;
|
|
9466
|
+
}
|
|
9467
|
+
editor.chain().focus().command(({ tr, state: now }) => {
|
|
9468
|
+
tr.replaceWith(from, now.selection.from, now.schema.nodes.wikilink.create({ target }));
|
|
9469
|
+
return true;
|
|
9470
|
+
}).run();
|
|
9471
|
+
};
|
|
9472
|
+
wikiKeys.current = !asking || !options.length ? null : (key2) => {
|
|
9473
|
+
if (key2 === "ArrowDown" || key2 === "ArrowUp") setAskAt((askAt + (key2 === "ArrowDown" ? 1 : options.length - 1)) % options.length);
|
|
9474
|
+
else if (key2 === "Enter" || key2 === "Tab") void choose(options[Math.min(askAt, options.length - 1)]);
|
|
9475
|
+
else if (key2 === "Escape") setShut(asking.from);
|
|
9476
|
+
else return false;
|
|
9477
|
+
return true;
|
|
9478
|
+
};
|
|
9479
|
+
const askSpot = asking && options.length ? editor.view.coordsAtPos(asking.from) : null;
|
|
9480
|
+
const follow2 = (target) => {
|
|
9481
|
+
const note = findNote(wiki.notes, target);
|
|
9482
|
+
if (note) return wiki.open(note.id);
|
|
9483
|
+
if (wiki.create) void wiki.create(wikiName(target)).then((id) => id && wiki.open(id));
|
|
9484
|
+
};
|
|
9222
9485
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: root, className: "w100n-text", "data-kind": kind, "data-docs-find": true, onKeyDown: keys2, children: [
|
|
9223
9486
|
head2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9224
9487
|
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 +9501,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9238
9501
|
setSpot({ x: Math.min(e.clientX, innerWidth - 260), y: Math.min(e.clientY, innerHeight - 360) });
|
|
9239
9502
|
setPop("context");
|
|
9240
9503
|
}, onClick: (e) => {
|
|
9504
|
+
const link = wiki ? e.target.closest("[data-wiki]") : null;
|
|
9505
|
+
if (link) return follow2(link.dataset.wiki);
|
|
9241
9506
|
const atom = can.edit ? e.target.closest(".w100n-math, sup[data-footnote]") : null;
|
|
9242
9507
|
if (atom) {
|
|
9243
9508
|
const at2 = editor.view.posAtDOM(atom, 0);
|
|
@@ -9251,6 +9516,28 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
9251
9516
|
setActive(id);
|
|
9252
9517
|
onPanel?.("comments");
|
|
9253
9518
|
}, 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 }) }) }) }),
|
|
9519
|
+
askSpot && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
9520
|
+
"span",
|
|
9521
|
+
{
|
|
9522
|
+
className: "w100n-text-pop w100n-text-menu w100n-wiki-ask",
|
|
9523
|
+
role: "listbox",
|
|
9524
|
+
"aria-label": t.link,
|
|
9525
|
+
style: { left: Math.min(askSpot.left, innerWidth - 340), top: askSpot.bottom + 6 },
|
|
9526
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
9527
|
+
children: [
|
|
9528
|
+
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: [
|
|
9529
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.FileText, { "aria-hidden": true }),
|
|
9530
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: option.note.name.replace(/\.(md|markdown)$/i, "") }),
|
|
9531
|
+
option.note.folder && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: option.note.folder })
|
|
9532
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
9533
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Plus, { "aria-hidden": true }),
|
|
9534
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: t.wikiCreate.replace("{name}", option.make) }),
|
|
9535
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: t.wikiNew })
|
|
9536
|
+
] }) }, "note" in option ? option.note.id : "make")),
|
|
9537
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "w100n-text-hint", children: t.wikiKeys })
|
|
9538
|
+
]
|
|
9539
|
+
}
|
|
9540
|
+
),
|
|
9254
9541
|
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
9542
|
rows(near),
|
|
9256
9543
|
spell && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "w100n-text-hint", children: t.spellHint })
|
|
@@ -9551,6 +9838,7 @@ var init_TextEditor = __esm({
|
|
|
9551
9838
|
init_useLoad();
|
|
9552
9839
|
init_DocxView();
|
|
9553
9840
|
init_extensions();
|
|
9841
|
+
init_wiki();
|
|
9554
9842
|
init_live();
|
|
9555
9843
|
init_markdown();
|
|
9556
9844
|
init_math();
|
|
@@ -10743,15 +11031,15 @@ function changes2(before, after) {
|
|
|
10743
11031
|
}
|
|
10744
11032
|
function Compare({ host, documentId, kind, older, t }) {
|
|
10745
11033
|
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,
|
|
11034
|
+
if (rows.error) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
|
|
11035
|
+
if (!rows.data) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
10748
11036
|
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,
|
|
11037
|
+
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: [
|
|
11038
|
+
/* @__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 }),
|
|
11039
|
+
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
11040
|
] }) });
|
|
10753
11041
|
}
|
|
10754
|
-
var
|
|
11042
|
+
var import_jsx_runtime16, words2, alike;
|
|
10755
11043
|
var init_Compare = __esm({
|
|
10756
11044
|
"src/Compare.tsx"() {
|
|
10757
11045
|
"use strict";
|
|
@@ -10759,7 +11047,7 @@ var init_Compare = __esm({
|
|
|
10759
11047
|
init_diff();
|
|
10760
11048
|
init_markdown();
|
|
10761
11049
|
init_useLoad();
|
|
10762
|
-
|
|
11050
|
+
import_jsx_runtime16 = require("react/jsx-runtime");
|
|
10763
11051
|
words2 = (text) => text.split(/(\s+)/).filter(Boolean);
|
|
10764
11052
|
alike = (a, b) => {
|
|
10765
11053
|
const x = a.split(/\s+/).filter(Boolean), y = b.split(/\s+/).filter(Boolean);
|
|
@@ -11675,7 +11963,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
11675
11963
|
};
|
|
11676
11964
|
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
11965
|
const byKey = (a, b) => deck.slides[a].key < deck.slides[b].key ? -1 : 1;
|
|
11678
|
-
const
|
|
11966
|
+
const around3 = (i) => [i - 1, i, i + 1].filter((k) => k >= 0 && k < count).sort(byKey);
|
|
11679
11967
|
const caption = (i) => `${t.slide} ${i + 1}${deck.slides[i].title ? `: ${deck.slides[i].title}` : ""}`;
|
|
11680
11968
|
const post = (id, msg) => frames.current.get(id)?.contentWindow?.postMessage(msg, "*");
|
|
11681
11969
|
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 +12302,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12014
12302
|
s.key
|
|
12015
12303
|
)) }) }),
|
|
12016
12304
|
/* @__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:
|
|
12305
|
+
/* @__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
12306
|
const id = `m:${deck.slides[i].key}:${epoch}`;
|
|
12019
12307
|
return frame(id, frozen2(deck.slides[i], id, "edit"), fit(stageBox, 32), caption(i), i !== index);
|
|
12020
12308
|
}) }),
|
|
@@ -12041,7 +12329,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12041
12329
|
back();
|
|
12042
12330
|
},
|
|
12043
12331
|
children: [
|
|
12044
|
-
|
|
12332
|
+
around3(nav.at).map((i) => {
|
|
12045
12333
|
const id = `p:${deck.slides[i].key}:${epoch}`;
|
|
12046
12334
|
return frame(id, frozen2(deck.slides[i], id, "present"), fit(showBox), caption(i), i !== nav.at, true);
|
|
12047
12335
|
}),
|
|
@@ -12832,11 +13120,11 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
12832
13120
|
try {
|
|
12833
13121
|
const { write: write4 } = await Promise.resolve().then(() => (init_pdfWrite(), pdfWrite_exports));
|
|
12834
13122
|
const changed2 = fields();
|
|
12835
|
-
const
|
|
13123
|
+
const signs2 = marks2.flatMap((m) => m.kind === "sign" ? [m] : []);
|
|
12836
13124
|
const out = await write4(bytes, marks2, changed2);
|
|
12837
|
-
const note = [marks2.length >
|
|
13125
|
+
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
13126
|
const { versionId } = await store(documentId, out, note);
|
|
12839
|
-
for (const s of
|
|
13127
|
+
for (const s of signs2) await host.sign?.(documentId, { versionId, page: s.page, method: s.method });
|
|
12840
13128
|
setClean(marks2);
|
|
12841
13129
|
setFilled(false);
|
|
12842
13130
|
pdf.annotationStorage.resetModified();
|
|
@@ -13303,14 +13591,195 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13303
13591
|
}
|
|
13304
13592
|
|
|
13305
13593
|
// src/DocumentsWorkspace.tsx
|
|
13306
|
-
var
|
|
13594
|
+
var import_react19 = require("react");
|
|
13307
13595
|
var import_react_dom4 = require("react-dom");
|
|
13308
|
-
var
|
|
13309
|
-
init_focus();
|
|
13596
|
+
var import_lucide_react13 = require("lucide-react");
|
|
13310
13597
|
|
|
13311
|
-
// src/
|
|
13598
|
+
// src/Backlinks.tsx
|
|
13312
13599
|
var import_lucide_react8 = require("lucide-react");
|
|
13600
|
+
init_wiki();
|
|
13601
|
+
init_useLoad();
|
|
13602
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
13603
|
+
var wikis = /\[\[([^[\]\n|]+?)(?:\|([^[\]\n]+?))?\]\]/g;
|
|
13604
|
+
var around2 = (text, from, to) => ({
|
|
13605
|
+
before: text.slice(Math.max(0, from - 70), from).replace(/^\S*\s/, "").replace(/\s+/g, " "),
|
|
13606
|
+
hit: text.slice(from, to),
|
|
13607
|
+
after: text.slice(to, to + 90).replace(/\s\S*$/, "").replace(/\s+/g, " ")
|
|
13608
|
+
});
|
|
13609
|
+
function mentions(current, notes3, texts2) {
|
|
13610
|
+
const name = current.name.replace(/\.(md|markdown)$/i, "");
|
|
13611
|
+
const plain4 = new RegExp(`(^|[^\\p{L}\\p{N}])(${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})(?![\\p{L}\\p{N}])`, "iu");
|
|
13612
|
+
const linked = [];
|
|
13613
|
+
const unlinked = [];
|
|
13614
|
+
for (const item of notes3) {
|
|
13615
|
+
if (item.id === current.id) continue;
|
|
13616
|
+
const text = texts2.get(item.id);
|
|
13617
|
+
if (!text) continue;
|
|
13618
|
+
let link = null;
|
|
13619
|
+
for (const m2 of text.matchAll(wikis)) {
|
|
13620
|
+
if (findNote(notes3, m2[1])?.id !== current.id) continue;
|
|
13621
|
+
link = { item, ...around2(text, m2.index, m2.index + m2[0].length), hit: m2[2] ?? m2[1] };
|
|
13622
|
+
break;
|
|
13623
|
+
}
|
|
13624
|
+
if (link) {
|
|
13625
|
+
linked.push(link);
|
|
13626
|
+
continue;
|
|
13627
|
+
}
|
|
13628
|
+
const bare4 = text.replace(wikis, (m2) => " ".repeat(m2.length));
|
|
13629
|
+
const m = plain4.exec(bare4);
|
|
13630
|
+
if (m) unlinked.push({ item, ...around2(text, m.index + m[1].length, m.index + m[0].length) });
|
|
13631
|
+
}
|
|
13632
|
+
return { linked, unlinked };
|
|
13633
|
+
}
|
|
13634
|
+
function Backlinks({ host, current, notes: notes3, t, onOpen }) {
|
|
13635
|
+
const others = notes3.filter((item) => item.id !== current.id);
|
|
13636
|
+
const found = useLoad(async (signal) => {
|
|
13637
|
+
const texts2 = /* @__PURE__ */ new Map();
|
|
13638
|
+
const queue = [...others];
|
|
13639
|
+
const reader = new TextDecoder();
|
|
13640
|
+
await Promise.all(Array.from({ length: 6 }, async () => {
|
|
13641
|
+
for (let item = queue.shift(); item; item = queue.shift()) {
|
|
13642
|
+
try {
|
|
13643
|
+
texts2.set(item.id, reader.decode(await host.content(item.id, null, { signal })));
|
|
13644
|
+
} catch {
|
|
13645
|
+
if (signal.aborted) return;
|
|
13646
|
+
}
|
|
13647
|
+
}
|
|
13648
|
+
}));
|
|
13649
|
+
return mentions(current, notes3, texts2);
|
|
13650
|
+
}, [host, current.id, current.name, others.map((item) => `${item.id}:${item.updatedAt}`).join()]);
|
|
13651
|
+
if (found.loading && !found.data) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.loading });
|
|
13652
|
+
if (found.error) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.failed });
|
|
13653
|
+
const { linked, unlinked } = found.data;
|
|
13654
|
+
const card = (m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-links-card", onClick: () => onOpen(m.item), children: [
|
|
13655
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("b", { children: [
|
|
13656
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react8.FileType, { "aria-hidden": true }),
|
|
13657
|
+
m.item.name.replace(/\.(md|markdown)$/i, "")
|
|
13658
|
+
] }),
|
|
13659
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("small", { children: [
|
|
13660
|
+
"\u2026",
|
|
13661
|
+
m.before,
|
|
13662
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("mark", { children: m.hit }),
|
|
13663
|
+
m.after,
|
|
13664
|
+
"\u2026"
|
|
13665
|
+
] }),
|
|
13666
|
+
m.item.folder && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "w100n-links-folder", children: m.item.folder })
|
|
13667
|
+
] }, m.item.id);
|
|
13668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-links", children: [
|
|
13669
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13670
|
+
t.linked,
|
|
13671
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: linked.length })
|
|
13672
|
+
] }),
|
|
13673
|
+
linked.length ? linked.map(card) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.noBacklinks }),
|
|
13674
|
+
unlinked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
13675
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
13676
|
+
t.unlinked,
|
|
13677
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: unlinked.length })
|
|
13678
|
+
] }),
|
|
13679
|
+
unlinked.map(card)
|
|
13680
|
+
] })
|
|
13681
|
+
] });
|
|
13682
|
+
}
|
|
13683
|
+
|
|
13684
|
+
// src/DocumentsWorkspace.tsx
|
|
13685
|
+
init_focus();
|
|
13686
|
+
|
|
13687
|
+
// src/Jump.tsx
|
|
13313
13688
|
var import_react14 = require("react");
|
|
13689
|
+
var import_lucide_react9 = require("lucide-react");
|
|
13690
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
13691
|
+
var bare3 = (name) => name.replace(/\.(md|markdown)$/i, "");
|
|
13692
|
+
function rank(item, q) {
|
|
13693
|
+
const name = bare3(item.name).toLowerCase();
|
|
13694
|
+
if (!q) return 2;
|
|
13695
|
+
if (name.startsWith(q)) return 0;
|
|
13696
|
+
if (name.split(/[\s_.-]+/).some((w) => w.startsWith(q))) return 1;
|
|
13697
|
+
if (name.includes(q)) return 2;
|
|
13698
|
+
let at2 = 0;
|
|
13699
|
+
for (const ch of q) {
|
|
13700
|
+
at2 = name.indexOf(ch, at2) + 1;
|
|
13701
|
+
if (!at2) return -1;
|
|
13702
|
+
}
|
|
13703
|
+
return 3;
|
|
13704
|
+
}
|
|
13705
|
+
var lit = (text, q) => {
|
|
13706
|
+
const at2 = q ? text.toLowerCase().indexOf(q) : -1;
|
|
13707
|
+
return at2 < 0 ? text : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
13708
|
+
text.slice(0, at2),
|
|
13709
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("mark", { children: text.slice(at2, at2 + q.length) }),
|
|
13710
|
+
text.slice(at2 + q.length)
|
|
13711
|
+
] });
|
|
13712
|
+
};
|
|
13713
|
+
function Jump({ mode, items, actions, t, place: place2, onOpen, onCreate, onClose }) {
|
|
13714
|
+
const [query, setQuery] = (0, import_react14.useState)("");
|
|
13715
|
+
const [at2, setAt] = (0, import_react14.useState)(0);
|
|
13716
|
+
const q = query.trim().toLowerCase();
|
|
13717
|
+
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) : [];
|
|
13718
|
+
const doing = mode === "run" ? actions.filter((a) => !q || a.label.toLowerCase().includes(q)) : [];
|
|
13719
|
+
const make2 = mode === "open" && onCreate && query.trim() && !found.some((item) => bare3(item.name).toLowerCase() === q);
|
|
13720
|
+
const total = found.length + doing.length + (make2 ? 1 : 0);
|
|
13721
|
+
const pick = Math.min(at2, Math.max(0, total - 1));
|
|
13722
|
+
const go = (i) => {
|
|
13723
|
+
onClose();
|
|
13724
|
+
if (i < found.length) onOpen(found[i]);
|
|
13725
|
+
else if (mode === "run") doing[i]?.run();
|
|
13726
|
+
else if (make2) onCreate(query.trim());
|
|
13727
|
+
};
|
|
13728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-jump-back", onPointerDown: (e) => {
|
|
13729
|
+
if (e.target === e.currentTarget) onClose();
|
|
13730
|
+
}, 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: [
|
|
13731
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-jump-field", children: [
|
|
13732
|
+
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 }),
|
|
13733
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
13734
|
+
"input",
|
|
13735
|
+
{
|
|
13736
|
+
autoFocus: true,
|
|
13737
|
+
value: query,
|
|
13738
|
+
placeholder: mode === "open" ? t.findNote : t.commands,
|
|
13739
|
+
"aria-label": mode === "open" ? t.findNote : t.commands,
|
|
13740
|
+
onChange: (e) => {
|
|
13741
|
+
setQuery(e.target.value);
|
|
13742
|
+
setAt(0);
|
|
13743
|
+
},
|
|
13744
|
+
onKeyDown: (e) => {
|
|
13745
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
13746
|
+
e.preventDefault();
|
|
13747
|
+
if (total) setAt((pick + (e.key === "ArrowDown" ? 1 : total - 1)) % total);
|
|
13748
|
+
} else if (e.key === "Enter") {
|
|
13749
|
+
e.preventDefault();
|
|
13750
|
+
if (total) go(pick);
|
|
13751
|
+
} else if (e.key === "Escape") {
|
|
13752
|
+
e.stopPropagation();
|
|
13753
|
+
onClose();
|
|
13754
|
+
}
|
|
13755
|
+
}
|
|
13756
|
+
}
|
|
13757
|
+
)
|
|
13758
|
+
] }),
|
|
13759
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-jump-list", role: "listbox", "aria-label": mode === "open" ? t.openNote : t.commands, children: [
|
|
13760
|
+
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: [
|
|
13761
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileType, { "aria-hidden": true }),
|
|
13762
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: lit(bare3(item.name), q) }),
|
|
13763
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: place2(item) })
|
|
13764
|
+
] }, item.id)),
|
|
13765
|
+
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: [
|
|
13766
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(a.icon, { "aria-hidden": true }),
|
|
13767
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: lit(a.label, q) }),
|
|
13768
|
+
a.keys && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("kbd", { children: a.keys })
|
|
13769
|
+
] }, a.id)),
|
|
13770
|
+
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: [
|
|
13771
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Plus, { "aria-hidden": true }),
|
|
13772
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: t.createNote.replace("{name}", query.trim()) })
|
|
13773
|
+
] }),
|
|
13774
|
+
!total && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.noNote })
|
|
13775
|
+
] }),
|
|
13776
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-jump-keys", children: mode === "open" ? t.keysOpen : t.keysRun })
|
|
13777
|
+
] }) });
|
|
13778
|
+
}
|
|
13779
|
+
|
|
13780
|
+
// src/NewDocument.tsx
|
|
13781
|
+
var import_lucide_react10 = require("lucide-react");
|
|
13782
|
+
var import_react15 = require("react");
|
|
13314
13783
|
|
|
13315
13784
|
// src/blank.ts
|
|
13316
13785
|
var import_fflate2 = require("fflate");
|
|
@@ -13436,19 +13905,19 @@ function blank4(kind, name, template = "blank") {
|
|
|
13436
13905
|
// src/NewDocument.tsx
|
|
13437
13906
|
init_focus();
|
|
13438
13907
|
init_useLoad();
|
|
13439
|
-
var
|
|
13440
|
-
var icons2 = { docx:
|
|
13908
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
13909
|
+
var icons2 = { docx: import_lucide_react10.FileText, markdown: import_lucide_react10.FileType, sheet: import_lucide_react10.FileSpreadsheet, slides: import_lucide_react10.Presentation };
|
|
13441
13910
|
var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
|
|
13442
13911
|
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,
|
|
13912
|
+
const id = (0, import_react15.useId)();
|
|
13913
|
+
const [kind, setKind] = (0, import_react15.useState)("docx");
|
|
13914
|
+
const [template, setTemplate] = (0, import_react15.useState)("blank");
|
|
13915
|
+
const [name, setName] = (0, import_react15.useState)("");
|
|
13916
|
+
const [team, setTeam] = (0, import_react15.useState)(null);
|
|
13448
13917
|
const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
|
|
13449
13918
|
const ours2 = (shared.data ?? []).filter((item) => item.kind === kind);
|
|
13450
13919
|
const stem = (file) => file.replace(/\.[^.]+$/, "");
|
|
13451
|
-
const [state, setState] = (0,
|
|
13920
|
+
const [state, setState] = (0, import_react15.useState)("idle");
|
|
13452
13921
|
useRestore(true);
|
|
13453
13922
|
const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
|
|
13454
13923
|
const make2 = async () => {
|
|
@@ -13462,77 +13931,77 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13462
13931
|
setState("failed");
|
|
13463
13932
|
}
|
|
13464
13933
|
};
|
|
13465
|
-
return /* @__PURE__ */ (0,
|
|
13934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
13466
13935
|
if (e.key === "Escape") {
|
|
13467
13936
|
e.stopPropagation();
|
|
13468
13937
|
onClose();
|
|
13469
13938
|
}
|
|
13470
|
-
}, children: /* @__PURE__ */ (0,
|
|
13939
|
+
}, 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
13940
|
e.preventDefault();
|
|
13472
13941
|
void make2();
|
|
13473
13942
|
}, children: [
|
|
13474
|
-
/* @__PURE__ */ (0,
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
13476
|
-
/* @__PURE__ */ (0,
|
|
13477
|
-
/* @__PURE__ */ (0,
|
|
13943
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-new-head", children: [
|
|
13944
|
+
/* @__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 }) }),
|
|
13945
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
|
|
13946
|
+
/* @__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
13947
|
] }),
|
|
13479
|
-
/* @__PURE__ */ (0,
|
|
13948
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
|
|
13480
13949
|
const Icon = icons2[item];
|
|
13481
|
-
return /* @__PURE__ */ (0,
|
|
13950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
|
|
13482
13951
|
setKind(item);
|
|
13483
13952
|
setTeam(null);
|
|
13484
13953
|
if (item === "sheet" || item === "slides") setTemplate("blank");
|
|
13485
13954
|
}, children: [
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13487
|
-
/* @__PURE__ */ (0,
|
|
13488
|
-
/* @__PURE__ */ (0,
|
|
13489
|
-
/* @__PURE__ */ (0,
|
|
13955
|
+
/* @__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 }) }),
|
|
13956
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
13957
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: t.newKinds[item] }),
|
|
13958
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: t.kindHints[item] })
|
|
13490
13959
|
] })
|
|
13491
13960
|
] }, item);
|
|
13492
13961
|
}) }),
|
|
13493
|
-
/* @__PURE__ */ (0,
|
|
13494
|
-
/* @__PURE__ */ (0,
|
|
13962
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-caption", children: t.startFrom }),
|
|
13963
|
+
/* @__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
13964
|
setTeam(null);
|
|
13496
13965
|
setTemplate(item);
|
|
13497
13966
|
}, children: [
|
|
13498
|
-
/* @__PURE__ */ (0,
|
|
13499
|
-
/* @__PURE__ */ (0,
|
|
13500
|
-
/* @__PURE__ */ (0,
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13503
|
-
/* @__PURE__ */ (0,
|
|
13504
|
-
/* @__PURE__ */ (0,
|
|
13967
|
+
/* @__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: [
|
|
13968
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-head": true }),
|
|
13969
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13970
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13971
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-accent": true }),
|
|
13972
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13973
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13505
13974
|
] }) }),
|
|
13506
|
-
/* @__PURE__ */ (0,
|
|
13975
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.templates[item] })
|
|
13507
13976
|
] }, 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,
|
|
13977
|
+
ours2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
13978
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
|
|
13979
|
+
/* @__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: [
|
|
13980
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "w100n-new-sheet", children: [
|
|
13981
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-head": true }),
|
|
13982
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13983
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", { "data-accent": true }),
|
|
13984
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
|
|
13985
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
|
|
13517
13986
|
] }),
|
|
13518
|
-
/* @__PURE__ */ (0,
|
|
13987
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { title: item.name, children: stem(item.name) })
|
|
13519
13988
|
] }, item.id)) })
|
|
13520
13989
|
] }),
|
|
13521
|
-
/* @__PURE__ */ (0,
|
|
13522
|
-
/* @__PURE__ */ (0,
|
|
13523
|
-
/* @__PURE__ */ (0,
|
|
13524
|
-
/* @__PURE__ */ (0,
|
|
13990
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-new-fields", children: [
|
|
13991
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { children: [
|
|
13992
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-caption", children: t.name }),
|
|
13993
|
+
/* @__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
13994
|
] }),
|
|
13526
|
-
host.createIn && /* @__PURE__ */ (0,
|
|
13527
|
-
/* @__PURE__ */ (0,
|
|
13528
|
-
/* @__PURE__ */ (0,
|
|
13995
|
+
host.createIn && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
13996
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-caption", children: t.savesTo }),
|
|
13997
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
|
|
13529
13998
|
] })
|
|
13530
13999
|
] }),
|
|
13531
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13532
|
-
/* @__PURE__ */ (0,
|
|
13533
|
-
/* @__PURE__ */ (0,
|
|
13534
|
-
/* @__PURE__ */ (0,
|
|
13535
|
-
/* @__PURE__ */ (0,
|
|
14000
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
|
|
14001
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-pdf-dialog-end", children: [
|
|
14002
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
|
|
14003
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
|
|
14004
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Check, { "aria-hidden": true }),
|
|
13536
14005
|
state === "busy" ? t.making : t.make
|
|
13537
14006
|
] })
|
|
13538
14007
|
] })
|
|
@@ -13540,10 +14009,10 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13540
14009
|
}
|
|
13541
14010
|
|
|
13542
14011
|
// src/Sharing.tsx
|
|
13543
|
-
var
|
|
13544
|
-
var
|
|
14012
|
+
var import_react16 = require("react");
|
|
14013
|
+
var import_lucide_react11 = require("lucide-react");
|
|
13545
14014
|
init_useLoad();
|
|
13546
|
-
var
|
|
14015
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
13547
14016
|
var blank5 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
|
|
13548
14017
|
var local = (iso) => {
|
|
13549
14018
|
const at2 = new Date(iso);
|
|
@@ -13551,9 +14020,9 @@ var local = (iso) => {
|
|
|
13551
14020
|
};
|
|
13552
14021
|
function Sharing({ host, doc, t, language, team }) {
|
|
13553
14022
|
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,
|
|
14023
|
+
const [form, setForm] = (0, import_react16.useState)(null);
|
|
14024
|
+
const [state, setState] = (0, import_react16.useState)("idle");
|
|
14025
|
+
const [copied, setCopied] = (0, import_react16.useState)(null);
|
|
13557
14026
|
const text = doc.kind === "docx" || doc.kind === "markdown";
|
|
13558
14027
|
const rules = new Intl.PluralRules(language);
|
|
13559
14028
|
const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
|
|
@@ -13615,31 +14084,31 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13615
14084
|
setCopied(null);
|
|
13616
14085
|
}
|
|
13617
14086
|
};
|
|
13618
|
-
if (form) return /* @__PURE__ */ (0,
|
|
13619
|
-
/* @__PURE__ */ (0,
|
|
13620
|
-
/* @__PURE__ */ (0,
|
|
14087
|
+
if (form) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share", children: [
|
|
14088
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14089
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13621
14090
|
form.id ? t.changeLink : t.newLink
|
|
13622
14091
|
] }),
|
|
13623
|
-
text && /* @__PURE__ */ (0,
|
|
13624
|
-
/* @__PURE__ */ (0,
|
|
13625
|
-
/* @__PURE__ */ (0,
|
|
13626
|
-
/* @__PURE__ */ (0,
|
|
13627
|
-
/* @__PURE__ */ (0,
|
|
14092
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-field", children: [
|
|
14093
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.guestsCan }),
|
|
14094
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-chips", children: [
|
|
14095
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
|
|
14096
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
13628
14097
|
t.canRead
|
|
13629
14098
|
] }),
|
|
13630
|
-
/* @__PURE__ */ (0,
|
|
13631
|
-
/* @__PURE__ */ (0,
|
|
14099
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
|
|
14100
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.MessageSquarePlus, { "aria-hidden": true }),
|
|
13632
14101
|
t.canComment
|
|
13633
14102
|
] })
|
|
13634
14103
|
] })
|
|
13635
14104
|
] }),
|
|
13636
|
-
/* @__PURE__ */ (0,
|
|
13637
|
-
/* @__PURE__ */ (0,
|
|
13638
|
-
/* @__PURE__ */ (0,
|
|
13639
|
-
key2 === "day" && /* @__PURE__ */ (0,
|
|
14105
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-field", children: [
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.linkWorks }),
|
|
14107
|
+
/* @__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: [
|
|
14108
|
+
key2 === "day" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.CalendarDays, { "aria-hidden": true }),
|
|
13640
14109
|
label
|
|
13641
14110
|
] }, key2)) }),
|
|
13642
|
-
form.works === "day" && /* @__PURE__ */ (0,
|
|
14111
|
+
form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13643
14112
|
"input",
|
|
13644
14113
|
{
|
|
13645
14114
|
type: "date",
|
|
@@ -13651,14 +14120,14 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13651
14120
|
}
|
|
13652
14121
|
)
|
|
13653
14122
|
] }),
|
|
13654
|
-
/* @__PURE__ */ (0,
|
|
13655
|
-
/* @__PURE__ */ (0,
|
|
13656
|
-
/* @__PURE__ */ (0,
|
|
13657
|
-
/* @__PURE__ */ (0,
|
|
13658
|
-
/* @__PURE__ */ (0,
|
|
14123
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14124
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
|
|
14125
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14126
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.passwordOn }),
|
|
14127
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.passwordHint })
|
|
13659
14128
|
] })
|
|
13660
14129
|
] }),
|
|
13661
|
-
form.password && /* @__PURE__ */ (0,
|
|
14130
|
+
form.password && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13662
14131
|
"input",
|
|
13663
14132
|
{
|
|
13664
14133
|
type: "password",
|
|
@@ -13670,120 +14139,120 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13670
14139
|
onChange: (e) => setForm({ ...form, secret: e.target.value })
|
|
13671
14140
|
}
|
|
13672
14141
|
),
|
|
13673
|
-
/* @__PURE__ */ (0,
|
|
13674
|
-
/* @__PURE__ */ (0,
|
|
13675
|
-
/* @__PURE__ */ (0,
|
|
13676
|
-
/* @__PURE__ */ (0,
|
|
13677
|
-
/* @__PURE__ */ (0,
|
|
14142
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14143
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14145
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.downloadFile }),
|
|
14146
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.downloadHint })
|
|
13678
14147
|
] })
|
|
13679
14148
|
] }),
|
|
13680
|
-
/* @__PURE__ */ (0,
|
|
13681
|
-
/* @__PURE__ */ (0,
|
|
13682
|
-
/* @__PURE__ */ (0,
|
|
13683
|
-
/* @__PURE__ */ (0,
|
|
13684
|
-
/* @__PURE__ */ (0,
|
|
14149
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-toggle", children: [
|
|
14150
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
|
|
14151
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14152
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.askName }),
|
|
14153
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.askNameHint })
|
|
13685
14154
|
] })
|
|
13686
14155
|
] }),
|
|
13687
|
-
/* @__PURE__ */ (0,
|
|
13688
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13689
|
-
/* @__PURE__ */ (0,
|
|
13690
|
-
/* @__PURE__ */ (0,
|
|
14156
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", children: t.lastSaved }),
|
|
14157
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
14158
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
14159
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
13691
14160
|
setForm(null);
|
|
13692
14161
|
setState("idle");
|
|
13693
14162
|
}, children: t.cancel }),
|
|
13694
|
-
/* @__PURE__ */ (0,
|
|
13695
|
-
/* @__PURE__ */ (0,
|
|
14163
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
|
|
14164
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13696
14165
|
form.id ? t.saveLink : t.makeLink
|
|
13697
14166
|
] })
|
|
13698
14167
|
] })
|
|
13699
14168
|
] });
|
|
13700
14169
|
const on2 = links.data ?? [];
|
|
13701
|
-
return /* @__PURE__ */ (0,
|
|
13702
|
-
/* @__PURE__ */ (0,
|
|
13703
|
-
/* @__PURE__ */ (0,
|
|
14170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share", children: [
|
|
14171
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14172
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Link, { "aria-hidden": true }),
|
|
13704
14173
|
t.guestLinks,
|
|
13705
|
-
on2.length > 0 && /* @__PURE__ */ (0,
|
|
14174
|
+
on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: on2.filter((l) => !l.ended).length })
|
|
13706
14175
|
] }),
|
|
13707
|
-
links.error && /* @__PURE__ */ (0,
|
|
14176
|
+
links.error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
13708
14177
|
t.failed,
|
|
13709
|
-
/* @__PURE__ */ (0,
|
|
14178
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
|
|
13710
14179
|
] }),
|
|
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,
|
|
14180
|
+
links.data && !on2.length && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", children: t.noLinks }),
|
|
14181
|
+
state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
|
|
14182
|
+
on2.map((l) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
|
|
14183
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { children: [
|
|
14184
|
+
/* @__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 }) }),
|
|
14185
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14186
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: l.comment ? t.commentLink : t.viewLink }),
|
|
14187
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
|
|
13719
14188
|
t.madeBy.replace("{name}", l.createdBy.name),
|
|
13720
14189
|
" \xB7 ",
|
|
13721
14190
|
day(l.createdAt)
|
|
13722
14191
|
] })
|
|
13723
14192
|
] })
|
|
13724
14193
|
] }),
|
|
13725
|
-
/* @__PURE__ */ (0,
|
|
13726
|
-
/* @__PURE__ */ (0,
|
|
13727
|
-
/* @__PURE__ */ (0,
|
|
14194
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-chips", children: [
|
|
14195
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14196
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Clock, { "aria-hidden": true }),
|
|
13728
14197
|
l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
|
|
13729
14198
|
] }),
|
|
13730
|
-
l.download && /* @__PURE__ */ (0,
|
|
13731
|
-
/* @__PURE__ */ (0,
|
|
14199
|
+
l.download && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14200
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
|
|
13732
14201
|
t.downloadOn
|
|
13733
14202
|
] }),
|
|
13734
|
-
l.password && /* @__PURE__ */ (0,
|
|
13735
|
-
/* @__PURE__ */ (0,
|
|
14203
|
+
l.password && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14204
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Lock, { "aria-hidden": true }),
|
|
13736
14205
|
t.passwordOn
|
|
13737
14206
|
] }),
|
|
13738
|
-
/* @__PURE__ */ (0,
|
|
13739
|
-
/* @__PURE__ */ (0,
|
|
14207
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14208
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
|
|
13740
14209
|
count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
|
|
13741
14210
|
] })
|
|
13742
14211
|
] }),
|
|
13743
|
-
/* @__PURE__ */ (0,
|
|
13744
|
-
/* @__PURE__ */ (0,
|
|
13745
|
-
/* @__PURE__ */ (0,
|
|
13746
|
-
/* @__PURE__ */ (0,
|
|
14212
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-url", children: [
|
|
14213
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: l.url.replace(/^https?:\/\//, "") }),
|
|
14214
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy2(l), children: [
|
|
14215
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Copy, { "aria-hidden": true }),
|
|
13747
14216
|
copied === l.id ? t.copied : t.copy
|
|
13748
14217
|
] })
|
|
13749
14218
|
] }),
|
|
13750
|
-
l.guests.length > 0 && /* @__PURE__ */ (0,
|
|
13751
|
-
/* @__PURE__ */ (0,
|
|
13752
|
-
/* @__PURE__ */ (0,
|
|
13753
|
-
/* @__PURE__ */ (0,
|
|
14219
|
+
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: [
|
|
14220
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
|
|
14221
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: g.name || t.unnamed }),
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("small", { children: [
|
|
13754
14223
|
g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
|
|
13755
14224
|
" \xB7 ",
|
|
13756
14225
|
ago(g.lastAt)
|
|
13757
14226
|
] })
|
|
13758
14227
|
] }, i)) }),
|
|
13759
|
-
/* @__PURE__ */ (0,
|
|
13760
|
-
/* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
14228
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-tools", children: [
|
|
14229
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
|
|
14230
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Clock, { "aria-hidden": true }),
|
|
13762
14231
|
t.changeLink
|
|
13763
14232
|
] }),
|
|
13764
|
-
/* @__PURE__ */ (0,
|
|
13765
|
-
/* @__PURE__ */ (0,
|
|
14233
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
|
|
14234
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Ban, { "aria-hidden": true }),
|
|
13766
14235
|
t.turnOff
|
|
13767
14236
|
] })
|
|
13768
14237
|
] })
|
|
13769
14238
|
] }, l.id)),
|
|
13770
|
-
/* @__PURE__ */ (0,
|
|
14239
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
|
|
13771
14240
|
setState("idle");
|
|
13772
14241
|
setForm(blank5);
|
|
13773
14242
|
}, children: [
|
|
13774
|
-
/* @__PURE__ */ (0,
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Plus, { "aria-hidden": true }),
|
|
13775
14244
|
t.newLink
|
|
13776
14245
|
] }),
|
|
13777
|
-
team && /* @__PURE__ */ (0,
|
|
13778
|
-
/* @__PURE__ */ (0,
|
|
13779
|
-
/* @__PURE__ */ (0,
|
|
14246
|
+
team && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
14247
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
14248
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Users, { "aria-hidden": true }),
|
|
13780
14249
|
t.inTeam
|
|
13781
14250
|
] }),
|
|
13782
|
-
/* @__PURE__ */ (0,
|
|
13783
|
-
/* @__PURE__ */ (0,
|
|
13784
|
-
/* @__PURE__ */ (0,
|
|
13785
|
-
/* @__PURE__ */ (0,
|
|
13786
|
-
/* @__PURE__ */ (0,
|
|
14251
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-share-team", children: [
|
|
14252
|
+
/* @__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 }) }),
|
|
14253
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
14254
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: t.peopleOf.replace("{space}", team) }),
|
|
14255
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { children: t.teamHint })
|
|
13787
14256
|
] })
|
|
13788
14257
|
] })
|
|
13789
14258
|
] })
|
|
@@ -13794,7 +14263,7 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13794
14263
|
init_text();
|
|
13795
14264
|
|
|
13796
14265
|
// src/Thumb.tsx
|
|
13797
|
-
var
|
|
14266
|
+
var import_react17 = require("react");
|
|
13798
14267
|
|
|
13799
14268
|
// src/preview.ts
|
|
13800
14269
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -13847,12 +14316,12 @@ function preview(host, doc) {
|
|
|
13847
14316
|
}
|
|
13848
14317
|
|
|
13849
14318
|
// src/Thumb.tsx
|
|
13850
|
-
var
|
|
14319
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13851
14320
|
function Thumb({ host, item, label }) {
|
|
13852
|
-
const box2 = (0,
|
|
13853
|
-
const [seen2, setSeen] = (0,
|
|
13854
|
-
const [shot, setShot] = (0,
|
|
13855
|
-
(0,
|
|
14321
|
+
const box2 = (0, import_react17.useRef)(null);
|
|
14322
|
+
const [seen2, setSeen] = (0, import_react17.useState)(false);
|
|
14323
|
+
const [shot, setShot] = (0, import_react17.useState)(null);
|
|
14324
|
+
(0, import_react17.useEffect)(() => {
|
|
13856
14325
|
if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
|
|
13857
14326
|
const watch = new IntersectionObserver((entries2) => {
|
|
13858
14327
|
if (entries2.some((entry2) => entry2.isIntersecting)) setSeen(true);
|
|
@@ -13860,7 +14329,7 @@ function Thumb({ host, item, label }) {
|
|
|
13860
14329
|
watch.observe(box2.current);
|
|
13861
14330
|
return () => watch.disconnect();
|
|
13862
14331
|
}, [item.thumbnailUrl, item.excerpt]);
|
|
13863
|
-
(0,
|
|
14332
|
+
(0, import_react17.useEffect)(() => {
|
|
13864
14333
|
if (!seen2) return;
|
|
13865
14334
|
let live = true;
|
|
13866
14335
|
void preview(host, item).then((found) => {
|
|
@@ -13873,53 +14342,142 @@ function Thumb({ host, item, label }) {
|
|
|
13873
14342
|
const text = item.excerpt ?? shot?.text ?? "";
|
|
13874
14343
|
const lines2 = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
|
|
13875
14344
|
const image = item.thumbnailUrl ?? shot?.image;
|
|
13876
|
-
return /* @__PURE__ */ (0,
|
|
13877
|
-
image ? /* @__PURE__ */ (0,
|
|
13878
|
-
/* @__PURE__ */ (0,
|
|
14345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { ref: box2, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
|
|
14346
|
+
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: [
|
|
14347
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: lines2[0] }),
|
|
13879
14348
|
lines2.slice(1, 14).join(" ")
|
|
13880
|
-
] }) : /* @__PURE__ */ (0,
|
|
13881
|
-
/* @__PURE__ */ (0,
|
|
13882
|
-
/* @__PURE__ */ (0,
|
|
13883
|
-
/* @__PURE__ */ (0,
|
|
13884
|
-
/* @__PURE__ */ (0,
|
|
13885
|
-
/* @__PURE__ */ (0,
|
|
14349
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
14350
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14351
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14352
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14353
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}),
|
|
14354
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {})
|
|
13886
14355
|
] }) }),
|
|
13887
|
-
label && /* @__PURE__ */ (0,
|
|
14356
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
14357
|
+
] });
|
|
14358
|
+
}
|
|
14359
|
+
|
|
14360
|
+
// src/Tree.tsx
|
|
14361
|
+
var import_react18 = require("react");
|
|
14362
|
+
var import_lucide_react12 = require("lucide-react");
|
|
14363
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
14364
|
+
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 };
|
|
14365
|
+
function grow(items, names2, bySpace, other) {
|
|
14366
|
+
const root = { key: "", name: "", folders: [], files: [], count: 0 };
|
|
14367
|
+
for (const item of items) {
|
|
14368
|
+
const path = [...bySpace ? [names2.get(item.spaceId) ?? other] : [], ...(item.folder ?? "").split("/").filter(Boolean)];
|
|
14369
|
+
let at2 = root;
|
|
14370
|
+
at2.count++;
|
|
14371
|
+
for (const part of path) {
|
|
14372
|
+
const key2 = `${at2.key}/${part}`;
|
|
14373
|
+
let next = at2.folders.find((f) => f.key === key2);
|
|
14374
|
+
if (!next) at2.folders.push(next = { key: key2, name: part, folders: [], files: [], count: 0 });
|
|
14375
|
+
next.count++;
|
|
14376
|
+
at2 = next;
|
|
14377
|
+
}
|
|
14378
|
+
at2.files.push(item);
|
|
14379
|
+
}
|
|
14380
|
+
const sort = (b) => {
|
|
14381
|
+
b.folders.sort((x, y) => x.name.localeCompare(y.name));
|
|
14382
|
+
b.files.sort((x, y) => x.name.localeCompare(y.name));
|
|
14383
|
+
b.folders.forEach(sort);
|
|
14384
|
+
};
|
|
14385
|
+
sort(root);
|
|
14386
|
+
return root;
|
|
14387
|
+
}
|
|
14388
|
+
var remembered = () => {
|
|
14389
|
+
try {
|
|
14390
|
+
return new Set(JSON.parse(localStorage.getItem("w100n-docs-closed") ?? "[]"));
|
|
14391
|
+
} catch {
|
|
14392
|
+
return /* @__PURE__ */ new Set();
|
|
14393
|
+
}
|
|
14394
|
+
};
|
|
14395
|
+
function Tree({ items, names: names2, bySpace, current, t, onOpen, onMenu, onWarm }) {
|
|
14396
|
+
const [closed2, setClosed] = (0, import_react18.useState)(remembered);
|
|
14397
|
+
const flip = (key2) => {
|
|
14398
|
+
const next = new Set(closed2);
|
|
14399
|
+
if (!next.delete(key2)) next.add(key2);
|
|
14400
|
+
setClosed(next);
|
|
14401
|
+
localStorage.setItem("w100n-docs-closed", JSON.stringify([...next]));
|
|
14402
|
+
};
|
|
14403
|
+
const branch = (b, depth) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
14404
|
+
b.folders.map((f) => {
|
|
14405
|
+
const open = !closed2.has(f.key);
|
|
14406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { role: "group", "aria-label": f.name, children: [
|
|
14407
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "w100n-tree-row", "aria-expanded": open, style: { paddingLeft: 8 + depth * 16 }, onClick: () => flip(f.key), children: [
|
|
14408
|
+
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" }),
|
|
14409
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react12.Folder, { "aria-hidden": true }),
|
|
14410
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: f.name }),
|
|
14411
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("small", { children: f.count })
|
|
14412
|
+
] }),
|
|
14413
|
+
open && branch(f, depth + 1)
|
|
14414
|
+
] }, f.key);
|
|
14415
|
+
}),
|
|
14416
|
+
b.files.map((item) => {
|
|
14417
|
+
const Icon = icons3[item.kind];
|
|
14418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
14419
|
+
"button",
|
|
14420
|
+
{
|
|
14421
|
+
type: "button",
|
|
14422
|
+
className: "w100n-tree-row",
|
|
14423
|
+
"aria-current": item.id === current,
|
|
14424
|
+
title: item.name,
|
|
14425
|
+
style: { paddingLeft: 24 + depth * 16 },
|
|
14426
|
+
onClick: () => onOpen(item),
|
|
14427
|
+
onPointerEnter: () => onWarm(item),
|
|
14428
|
+
onPointerLeave: () => onWarm(null),
|
|
14429
|
+
onContextMenu: (e) => {
|
|
14430
|
+
e.preventDefault();
|
|
14431
|
+
onMenu(item, e);
|
|
14432
|
+
},
|
|
14433
|
+
children: [
|
|
14434
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": true }),
|
|
14435
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: item.name.replace(/\.[^.]+$/, "") }),
|
|
14436
|
+
item.kind !== "markdown" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("small", { className: "w100n-tree-kind", children: t.kinds[item.kind] })
|
|
14437
|
+
]
|
|
14438
|
+
},
|
|
14439
|
+
item.id
|
|
14440
|
+
);
|
|
14441
|
+
})
|
|
13888
14442
|
] });
|
|
14443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "w100n-tree", "aria-label": t.tree, children: branch(grow(items, names2, bySpace, t.elsewhere), 0) });
|
|
13889
14444
|
}
|
|
13890
14445
|
|
|
13891
14446
|
// src/DocumentsWorkspace.tsx
|
|
13892
14447
|
init_useLoad();
|
|
13893
|
-
var
|
|
13894
|
-
var TextEditor3 = (0,
|
|
13895
|
-
var SheetView3 = (0,
|
|
13896
|
-
var Compare2 = (0,
|
|
13897
|
-
var
|
|
14448
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
14449
|
+
var TextEditor3 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
14450
|
+
var SheetView3 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
14451
|
+
var Compare2 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_Compare(), Compare_exports)));
|
|
14452
|
+
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
14453
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place: place2, onPlace, start, end, aside, actions }) {
|
|
13899
14454
|
const t = texts[language];
|
|
13900
|
-
const [own, setOwn] = (0,
|
|
14455
|
+
const [own, setOwn] = (0, import_react19.useState)({ spaceId: null, documentId: null });
|
|
13901
14456
|
const here = place2 ?? own;
|
|
13902
14457
|
const go = (next) => {
|
|
13903
14458
|
setOwn(next);
|
|
13904
14459
|
onPlace?.(next);
|
|
13905
14460
|
};
|
|
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,
|
|
14461
|
+
const [query, setQuery] = (0, import_react19.useState)("");
|
|
14462
|
+
const [picked, setPicked] = (0, import_react19.useState)([]);
|
|
14463
|
+
const [typing, setTyping] = (0, import_react19.useState)(false);
|
|
14464
|
+
const [menusAt, setMenusAt] = (0, import_react19.useState)(null);
|
|
14465
|
+
const [renaming, setRenaming] = (0, import_react19.useState)(null);
|
|
14466
|
+
const [renamed2, setRenamed] = (0, import_react19.useState)("idle");
|
|
14467
|
+
const [statusAt, setStatusAt] = (0, import_react19.useState)(null);
|
|
14468
|
+
const [listOpen, setListOpen] = (0, import_react19.useState)(true);
|
|
14469
|
+
const [shape3, setShape] = (0, import_react19.useState)(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-view") === "tree" ? "tree" : "cards");
|
|
14470
|
+
const [jump, setJump] = (0, import_react19.useState)(null);
|
|
14471
|
+
const finder = (0, import_react19.useRef)(null);
|
|
14472
|
+
const [panelOpen, setPanelOpen] = (0, import_react19.useState)(true);
|
|
14473
|
+
const [narrow, setNarrow] = (0, import_react19.useState)(false);
|
|
14474
|
+
const body = (0, import_react19.useRef)(null);
|
|
14475
|
+
const listButton = (0, import_react19.useRef)(null);
|
|
14476
|
+
const panelButton = (0, import_react19.useRef)(null);
|
|
14477
|
+
const listClose = (0, import_react19.useRef)(null);
|
|
14478
|
+
const panel = (0, import_react19.useRef)(null);
|
|
14479
|
+
const guard = (0, import_react19.useRef)(null);
|
|
14480
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
13923
14481
|
const el = body.current;
|
|
13924
14482
|
let was = false;
|
|
13925
14483
|
const check = () => {
|
|
@@ -13937,9 +14495,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13937
14495
|
watch.observe(el);
|
|
13938
14496
|
return () => watch.disconnect();
|
|
13939
14497
|
}, [here.documentId]);
|
|
13940
|
-
const [picking, setPicking] = (0,
|
|
13941
|
-
const [adding, setAdding] = (0,
|
|
13942
|
-
(0,
|
|
14498
|
+
const [picking, setPicking] = (0, import_react19.useState)(false);
|
|
14499
|
+
const [adding, setAdding] = (0, import_react19.useState)(false);
|
|
14500
|
+
(0, import_react19.useEffect)(() => {
|
|
13943
14501
|
if (!adding) return;
|
|
13944
14502
|
const close = (e) => {
|
|
13945
14503
|
if (!e.target.closest(".w100n-docs-new")) setAdding(false);
|
|
@@ -13947,7 +14505,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13947
14505
|
document.addEventListener("pointerdown", close);
|
|
13948
14506
|
return () => document.removeEventListener("pointerdown", close);
|
|
13949
14507
|
}, [adding]);
|
|
13950
|
-
(0,
|
|
14508
|
+
(0, import_react19.useEffect)(() => {
|
|
13951
14509
|
if (!typing) return;
|
|
13952
14510
|
const close = (e) => {
|
|
13953
14511
|
if (!e.target.closest(".w100n-docs-types")) setTyping(false);
|
|
@@ -13955,7 +14513,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13955
14513
|
document.addEventListener("pointerdown", close);
|
|
13956
14514
|
return () => document.removeEventListener("pointerdown", close);
|
|
13957
14515
|
}, [typing]);
|
|
13958
|
-
(0,
|
|
14516
|
+
(0, import_react19.useEffect)(() => {
|
|
13959
14517
|
if (!picking) return;
|
|
13960
14518
|
const close = (e) => {
|
|
13961
14519
|
if (!e.target.closest(".w100n-docs-picker")) setPicking(false);
|
|
@@ -13963,12 +14521,12 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13963
14521
|
document.addEventListener("pointerdown", close);
|
|
13964
14522
|
return () => document.removeEventListener("pointerdown", close);
|
|
13965
14523
|
}, [picking]);
|
|
13966
|
-
const [menu, setMenu] = (0,
|
|
13967
|
-
const [naming, setNaming] = (0,
|
|
13968
|
-
const [notice, setNotice] = (0,
|
|
13969
|
-
const early = (0,
|
|
13970
|
-
const hover = (0,
|
|
13971
|
-
(0,
|
|
14524
|
+
const [menu, setMenu] = (0, import_react19.useState)(null);
|
|
14525
|
+
const [naming, setNaming] = (0, import_react19.useState)(null);
|
|
14526
|
+
const [notice, setNotice] = (0, import_react19.useState)(null);
|
|
14527
|
+
const early = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
|
|
14528
|
+
const hover = (0, import_react19.useRef)(0);
|
|
14529
|
+
(0, import_react19.useEffect)(() => {
|
|
13972
14530
|
if (!menu) return;
|
|
13973
14531
|
const close = (e) => {
|
|
13974
14532
|
if (e.type === "pointerdown" && e.target.closest(".w100n-docs-context")) return;
|
|
@@ -13984,22 +14542,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13984
14542
|
window.removeEventListener("scroll", close, true);
|
|
13985
14543
|
};
|
|
13986
14544
|
}, [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,
|
|
14545
|
+
const [tab, setTab] = (0, import_react19.useState)("outline");
|
|
14546
|
+
const [outline2, setOutline] = (0, import_react19.useState)([]);
|
|
14547
|
+
const [reading, setReading] = (0, import_react19.useState)(null);
|
|
14548
|
+
const [hunt, setHunt] = (0, import_react19.useState)("");
|
|
14549
|
+
const [fold, setFold] = (0, import_react19.useState)({});
|
|
14550
|
+
const [version2, setVersion] = (0, import_react19.useState)({ documentId: null, id: null });
|
|
13993
14551
|
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,
|
|
14552
|
+
const [comparing, setComparing] = (0, import_react19.useState)(false);
|
|
14553
|
+
const [restoring, setRestoring] = (0, import_react19.useState)("idle");
|
|
14554
|
+
const [exporting, setExporting] = (0, import_react19.useState)("idle");
|
|
14555
|
+
const [copying, setCopying] = (0, import_react19.useState)("idle");
|
|
14556
|
+
const [kept, setKept] = (0, import_react19.useState)(null);
|
|
14557
|
+
const [box2, setBox] = (0, import_react19.useState)(null);
|
|
14558
|
+
const [making, setMaking] = (0, import_react19.useState)(false);
|
|
14559
|
+
const [sending, setSending] = (0, import_react19.useState)("idle");
|
|
14560
|
+
const upload = (0, import_react19.useRef)(null);
|
|
14003
14561
|
const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
|
|
14004
14562
|
const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
|
|
14005
14563
|
const spaceId = here.spaceId ?? single;
|
|
@@ -14010,7 +14568,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14010
14568
|
const all2 = await host.spaces({ signal });
|
|
14011
14569
|
return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
|
|
14012
14570
|
}, [host, spaceId]);
|
|
14013
|
-
(0,
|
|
14571
|
+
(0, import_react19.useEffect)(() => {
|
|
14014
14572
|
const sync = () => {
|
|
14015
14573
|
if (document.visibilityState !== "visible") return;
|
|
14016
14574
|
spaces.retry();
|
|
@@ -14063,9 +14621,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14063
14621
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
14064
14622
|
};
|
|
14065
14623
|
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,
|
|
14624
|
+
const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
14067
14625
|
t.failed,
|
|
14068
|
-
/* @__PURE__ */ (0,
|
|
14626
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: retry, children: t.retry })
|
|
14069
14627
|
] });
|
|
14070
14628
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
14071
14629
|
const side2 = (which, open2) => {
|
|
@@ -14077,12 +14635,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14077
14635
|
if (which === "list") (open2 ? listClose : listButton).current?.focus();
|
|
14078
14636
|
else (open2 ? panel.current?.querySelector('[aria-selected="true"]') : panelButton.current)?.focus();
|
|
14079
14637
|
};
|
|
14638
|
+
const leave = (then) => {
|
|
14639
|
+
const save2 = doc.data?.kind === "markdown" ? guard.current : null;
|
|
14640
|
+
if (!save2) return ask(then);
|
|
14641
|
+
void save2().then((ok) => {
|
|
14642
|
+
if (!ok) return ask(then);
|
|
14643
|
+
guard.current = null;
|
|
14644
|
+
then();
|
|
14645
|
+
});
|
|
14646
|
+
};
|
|
14080
14647
|
const open = (item) => {
|
|
14081
14648
|
if (item.id === here.documentId) {
|
|
14082
14649
|
if (narrow) setListOpen(false);
|
|
14083
14650
|
return;
|
|
14084
14651
|
}
|
|
14085
|
-
|
|
14652
|
+
leave(() => {
|
|
14086
14653
|
setOutline([]);
|
|
14087
14654
|
setHunt("");
|
|
14088
14655
|
setFold({});
|
|
@@ -14239,8 +14806,64 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14239
14806
|
setSending("failed");
|
|
14240
14807
|
}
|
|
14241
14808
|
};
|
|
14242
|
-
|
|
14243
|
-
|
|
14809
|
+
const notes3 = doc.data?.kind === "markdown" ? all.filter((item) => item.kind === "markdown" && item.spaceId === doc.data.spaceId) : [];
|
|
14810
|
+
const note = async (name, show) => {
|
|
14811
|
+
try {
|
|
14812
|
+
const made2 = await host.create({ name: `${name}.md`, bytes: new TextEncoder().encode("").buffer, mimeType: "text/markdown", near: here.documentId ?? void 0 });
|
|
14813
|
+
list.retry();
|
|
14814
|
+
if (show) opened2(made2);
|
|
14815
|
+
return made2.id;
|
|
14816
|
+
} catch {
|
|
14817
|
+
setNotice(t.actionFailed);
|
|
14818
|
+
return null;
|
|
14819
|
+
}
|
|
14820
|
+
};
|
|
14821
|
+
const wiki = doc.data?.kind === "markdown" ? {
|
|
14822
|
+
notes: notes3.map(({ id, name, folder: folder2 }) => ({ id, name, folder: folder2 })),
|
|
14823
|
+
open: (id) => {
|
|
14824
|
+
const item = all.find((x) => x.id === id);
|
|
14825
|
+
if (item) open(item);
|
|
14826
|
+
},
|
|
14827
|
+
create: host.create ? (name) => note(name, false) : void 0
|
|
14828
|
+
} : void 0;
|
|
14829
|
+
const panelOn = (next) => {
|
|
14830
|
+
setTab(next);
|
|
14831
|
+
side2("panel", true);
|
|
14832
|
+
};
|
|
14833
|
+
const current = doc.data && all.find((item) => item.id === doc.data.id);
|
|
14834
|
+
const commands = [
|
|
14835
|
+
...host.create ? [{ id: "new", label: t.newNote, icon: import_lucide_react13.FilePlus, keys: "\u2318N", run: () => void note(t.untitled, true) }] : [],
|
|
14836
|
+
{ id: "open", label: t.openNote, icon: import_lucide_react13.Search, keys: "\u2318O", run: () => setJump("open") },
|
|
14837
|
+
{ id: "search", label: t.searchAll, icon: import_lucide_react13.Search, run: () => {
|
|
14838
|
+
side2("list", true);
|
|
14839
|
+
requestAnimationFrame(() => finder.current?.focus());
|
|
14840
|
+
} },
|
|
14841
|
+
...doc.data ? [
|
|
14842
|
+
{ id: "outline", label: t.showOutline, icon: import_lucide_react13.ListTree, run: () => panelOn("outline") },
|
|
14843
|
+
...doc.data.kind === "markdown" ? [{ id: "links", label: t.showLinks, icon: import_lucide_react13.Link2, run: () => panelOn("links") }] : [],
|
|
14844
|
+
{ id: "versions", label: t.showVersions, icon: import_lucide_react13.History, run: () => panelOn("versions") },
|
|
14845
|
+
...text && host.comments ? [{ id: "comments", label: t.showComments, icon: import_lucide_react13.MessagesSquare, run: () => panelOn("comments") }] : [],
|
|
14846
|
+
...host.send && !doc.data.id.includes(":") ? [{ id: "send", label: t.sendChat, icon: import_lucide_react13.Send, run: () => host.send(doc.data.id) }] : [],
|
|
14847
|
+
...host.rename && doc.data.rights.edit ? [{ id: "rename", label: t.rename, icon: import_lucide_react13.Pencil, run: () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) }] : [],
|
|
14848
|
+
...host.remove && current ? [{ id: "trash", label: t.trash, icon: import_lucide_react13.Trash2, run: () => void drop2(current) }] : []
|
|
14849
|
+
] : []
|
|
14850
|
+
];
|
|
14851
|
+
(0, import_react19.useEffect)(() => {
|
|
14852
|
+
const press = (e) => {
|
|
14853
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return;
|
|
14854
|
+
const key2 = e.key.toLowerCase();
|
|
14855
|
+
if (key2 === "o" || key2 === "p" && doc.data?.kind !== "docx" && doc.data?.kind !== "pdf" || key2 === "n" && host.create && doc.data?.kind === "markdown") {
|
|
14856
|
+
e.preventDefault();
|
|
14857
|
+
e.stopPropagation();
|
|
14858
|
+
if (key2 === "n") void note(t.untitled, true);
|
|
14859
|
+
else setJump(key2 === "o" ? "open" : "run");
|
|
14860
|
+
}
|
|
14861
|
+
};
|
|
14862
|
+
window.addEventListener("keydown", press, true);
|
|
14863
|
+
return () => window.removeEventListener("keydown", press, true);
|
|
14864
|
+
});
|
|
14865
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-empty", children: [
|
|
14866
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileText, { "aria-hidden": true }),
|
|
14244
14867
|
t.pick
|
|
14245
14868
|
] });
|
|
14246
14869
|
if (here.documentId) {
|
|
@@ -14248,9 +14871,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14248
14871
|
doc.retry();
|
|
14249
14872
|
content.retry();
|
|
14250
14873
|
});
|
|
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,
|
|
14874
|
+
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
|
|
14875
|
+
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) });
|
|
14876
|
+
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
14877
|
TextEditor3,
|
|
14255
14878
|
{
|
|
14256
14879
|
kind: doc.data.kind,
|
|
@@ -14271,6 +14894,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14271
14894
|
slot: tab === "comments" && panelOpen ? box2 : null,
|
|
14272
14895
|
head: docbar ? { menus: menusAt, status: statusAt } : void 0,
|
|
14273
14896
|
guard,
|
|
14897
|
+
wiki: versionId ? void 0 : wiki,
|
|
14274
14898
|
file: versionId ? void 0 : {
|
|
14275
14899
|
formats: host.exportAs ? doc.data.exports ?? [] : [],
|
|
14276
14900
|
download: (f) => void exportAs(doc.data, f),
|
|
@@ -14286,7 +14910,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14286
14910
|
},
|
|
14287
14911
|
doc.data.id
|
|
14288
14912
|
) });
|
|
14289
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
14913
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14290
14914
|
PdfView,
|
|
14291
14915
|
{
|
|
14292
14916
|
bytes: content.data,
|
|
@@ -14308,7 +14932,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14308
14932
|
},
|
|
14309
14933
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14310
14934
|
);
|
|
14311
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0,
|
|
14935
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14312
14936
|
SlidesView,
|
|
14313
14937
|
{
|
|
14314
14938
|
html: new TextDecoder().decode(content.data),
|
|
@@ -14318,8 +14942,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14318
14942
|
theme,
|
|
14319
14943
|
onOutline: setOutline,
|
|
14320
14944
|
guard,
|
|
14321
|
-
onSaveRequest: host.save && !versionId ? async (bytes,
|
|
14322
|
-
await host.save(doc.data.id, bytes,
|
|
14945
|
+
onSaveRequest: host.save && !versionId ? async (bytes, note2) => {
|
|
14946
|
+
await host.save(doc.data.id, bytes, note2);
|
|
14323
14947
|
versions.retry();
|
|
14324
14948
|
doc.retry();
|
|
14325
14949
|
list.retry();
|
|
@@ -14327,7 +14951,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14327
14951
|
},
|
|
14328
14952
|
doc.data.id
|
|
14329
14953
|
);
|
|
14330
|
-
else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
14954
|
+
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
14955
|
SheetView3,
|
|
14332
14956
|
{
|
|
14333
14957
|
bytes: content.data,
|
|
@@ -14345,8 +14969,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14345
14969
|
doc.retry();
|
|
14346
14970
|
list.retry();
|
|
14347
14971
|
},
|
|
14348
|
-
onSaveRequest: versionId || !host.save ? void 0 : async (bytes,
|
|
14349
|
-
await host.save(doc.data.id, bytes,
|
|
14972
|
+
onSaveRequest: versionId || !host.save ? void 0 : async (bytes, note2) => {
|
|
14973
|
+
await host.save(doc.data.id, bytes, note2);
|
|
14350
14974
|
versions.retry();
|
|
14351
14975
|
doc.retry();
|
|
14352
14976
|
list.retry();
|
|
@@ -14354,9 +14978,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14354
14978
|
},
|
|
14355
14979
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14356
14980
|
) });
|
|
14357
|
-
else stage = /* @__PURE__ */ (0,
|
|
14981
|
+
else stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
14358
14982
|
}
|
|
14359
|
-
const Kind = doc.data ?
|
|
14983
|
+
const Kind = doc.data ? icons4[doc.data.kind] : import_lucide_react13.FileText;
|
|
14360
14984
|
const top = Math.min(...outline2.map((h) => h.level));
|
|
14361
14985
|
const chapters = outline2.reduce((all2, h) => {
|
|
14362
14986
|
if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
|
|
@@ -14369,12 +14993,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14369
14993
|
const hit = (h) => words3.every((w) => h.text.toLocaleLowerCase().includes(w));
|
|
14370
14994
|
const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
14371
14995
|
const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
|
|
14372
|
-
const panelTabs = [
|
|
14373
|
-
|
|
14374
|
-
|
|
14996
|
+
const panelTabs = [
|
|
14997
|
+
["outline", import_lucide_react13.ListTree, t.outline],
|
|
14998
|
+
...doc.data?.kind === "markdown" ? [["links", import_lucide_react13.Link2, t.links]] : [],
|
|
14999
|
+
["versions", import_lucide_react13.History, t.versions],
|
|
15000
|
+
["details", import_lucide_react13.Info, t.details]
|
|
15001
|
+
];
|
|
15002
|
+
if (pdf && host.signatures) panelTabs.push(["signatures", import_lucide_react13.Signature, t.signatures]);
|
|
15003
|
+
if (text && host.comments && !versionId) panelTabs.push(["comments", import_lucide_react13.MessagesSquare, t.comments]);
|
|
14375
15004
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
14376
|
-
if (sharing) panelTabs.push(["sharing",
|
|
14377
|
-
const listToggle = /* @__PURE__ */ (0,
|
|
15005
|
+
if (sharing) panelTabs.push(["sharing", import_lucide_react13.Share2, t.sharing]);
|
|
15006
|
+
const listToggle = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14378
15007
|
"button",
|
|
14379
15008
|
{
|
|
14380
15009
|
ref: listButton,
|
|
@@ -14384,10 +15013,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14384
15013
|
onClick: () => side2("list", !listOpen),
|
|
14385
15014
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
14386
15015
|
title: listOpen ? t.closeList : t.openList,
|
|
14387
|
-
children: listOpen ? /* @__PURE__ */ (0,
|
|
15016
|
+
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
15017
|
}
|
|
14389
15018
|
);
|
|
14390
|
-
const panelToggle = doc.data && /* @__PURE__ */ (0,
|
|
15019
|
+
const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14391
15020
|
"button",
|
|
14392
15021
|
{
|
|
14393
15022
|
ref: panelButton,
|
|
@@ -14397,16 +15026,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14397
15026
|
onClick: () => side2("panel", !panelOpen),
|
|
14398
15027
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
14399
15028
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
14400
|
-
children: panelOpen ? /* @__PURE__ */ (0,
|
|
15029
|
+
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
15030
|
}
|
|
14402
15031
|
);
|
|
14403
|
-
return /* @__PURE__ */ (0,
|
|
14404
|
-
/* @__PURE__ */ (0,
|
|
14405
|
-
start && /* @__PURE__ */ (0,
|
|
15032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs", "data-theme": theme, children: [
|
|
15033
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: "w100n-docs-bar", children: [
|
|
15034
|
+
start && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
|
|
14406
15035
|
narrow && listToggle,
|
|
14407
|
-
/* @__PURE__ */ (0,
|
|
14408
|
-
/* @__PURE__ */ (0,
|
|
14409
|
-
renaming !== null && doc.data ? /* @__PURE__ */ (0,
|
|
15036
|
+
/* @__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 }) }),
|
|
15037
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
15038
|
+
renaming !== null && doc.data ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14410
15039
|
"input",
|
|
14411
15040
|
{
|
|
14412
15041
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -14424,7 +15053,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14424
15053
|
}
|
|
14425
15054
|
}
|
|
14426
15055
|
}
|
|
14427
|
-
) : /* @__PURE__ */ (0,
|
|
15056
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14428
15057
|
"strong",
|
|
14429
15058
|
{
|
|
14430
15059
|
className: "w100n-docs-title",
|
|
@@ -14433,31 +15062,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14433
15062
|
children: doc.data?.name ?? t.documents
|
|
14434
15063
|
}
|
|
14435
15064
|
),
|
|
14436
|
-
docbar ? /* @__PURE__ */ (0,
|
|
14437
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
15065
|
+
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: [
|
|
15066
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronRight, { "aria-hidden": true }),
|
|
14438
15067
|
item
|
|
14439
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
15068
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
|
|
14440
15069
|
] }),
|
|
14441
|
-
versionId && /* @__PURE__ */ (0,
|
|
14442
|
-
versionId && text && /* @__PURE__ */ (0,
|
|
14443
|
-
/* @__PURE__ */ (0,
|
|
15070
|
+
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) }),
|
|
15071
|
+
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: [
|
|
15072
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDiff, { "aria-hidden": true }),
|
|
14444
15073
|
comparing ? t.hideChanges : t.showChanges
|
|
14445
15074
|
] }),
|
|
14446
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0,
|
|
14447
|
-
/* @__PURE__ */ (0,
|
|
15075
|
+
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: [
|
|
15076
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.RotateCcw, { "aria-hidden": true }),
|
|
14448
15077
|
t.restore
|
|
14449
15078
|
] }),
|
|
14450
|
-
restoring === "failed" && /* @__PURE__ */ (0,
|
|
14451
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0,
|
|
14452
|
-
/* @__PURE__ */ (0,
|
|
15079
|
+
restoring === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
|
|
15080
|
+
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: [
|
|
15081
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileSpreadsheet, { "aria-hidden": true }),
|
|
14453
15082
|
t.copyAs
|
|
14454
15083
|
] }),
|
|
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,
|
|
15084
|
+
copying === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.copyFailed }),
|
|
15085
|
+
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
|
|
15086
|
+
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
|
|
15087
|
+
renamed2 === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-muted", children: t.renameFailed }),
|
|
15088
|
+
docbar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { ref: setStatusAt, className: "w100n-docs-status" }),
|
|
15089
|
+
host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14461
15090
|
"button",
|
|
14462
15091
|
{
|
|
14463
15092
|
type: "button",
|
|
@@ -14467,146 +15096,167 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14467
15096
|
title: t.sendChat,
|
|
14468
15097
|
onClick: () => host.send(doc.data.id),
|
|
14469
15098
|
children: [
|
|
14470
|
-
/* @__PURE__ */ (0,
|
|
14471
|
-
/* @__PURE__ */ (0,
|
|
15099
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Send, { "aria-hidden": true }),
|
|
15100
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: t.sendChat })
|
|
14472
15101
|
]
|
|
14473
15102
|
}
|
|
14474
15103
|
),
|
|
14475
|
-
sharing && /* @__PURE__ */ (0,
|
|
15104
|
+
sharing && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
|
|
14476
15105
|
setTab("sharing");
|
|
14477
15106
|
side2("panel", true);
|
|
14478
15107
|
}, children: [
|
|
14479
|
-
/* @__PURE__ */ (0,
|
|
14480
|
-
/* @__PURE__ */ (0,
|
|
15108
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Share2, { "aria-hidden": true }),
|
|
15109
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: t.share })
|
|
14481
15110
|
] }),
|
|
14482
15111
|
doc.data && !versionId && actions?.(doc.data),
|
|
14483
15112
|
narrow && panelToggle,
|
|
14484
|
-
end && /* @__PURE__ */ (0,
|
|
15113
|
+
end && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
14485
15114
|
] }),
|
|
14486
|
-
/* @__PURE__ */ (0,
|
|
14487
|
-
listOpen && /* @__PURE__ */ (0,
|
|
14488
|
-
/* @__PURE__ */ (0,
|
|
14489
|
-
/* @__PURE__ */ (0,
|
|
14490
|
-
/* @__PURE__ */ (0,
|
|
14491
|
-
/* @__PURE__ */ (0,
|
|
15115
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: body, className: "w100n-docs-body", children: [
|
|
15116
|
+
listOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
|
|
15117
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-head", children: [
|
|
15118
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
15119
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
15120
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Files, { "aria-hidden": true }),
|
|
14492
15121
|
t.documents,
|
|
14493
|
-
/* @__PURE__ */ (0,
|
|
15122
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: all.length })
|
|
14494
15123
|
] }),
|
|
14495
|
-
host.create && /* @__PURE__ */ (0,
|
|
15124
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
14496
15125
|
if (e.key === "Escape" && adding) {
|
|
14497
15126
|
e.stopPropagation();
|
|
14498
15127
|
setAdding(false);
|
|
14499
15128
|
}
|
|
14500
15129
|
}, children: [
|
|
14501
|
-
/* @__PURE__ */ (0,
|
|
14502
|
-
/* @__PURE__ */ (0,
|
|
14503
|
-
/* @__PURE__ */ (0,
|
|
14504
|
-
/* @__PURE__ */ (0,
|
|
15130
|
+
/* @__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: [
|
|
15131
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Plus, { "aria-hidden": true }),
|
|
15132
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: sending === "busy" ? t.uploading : t.create }),
|
|
15133
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14505
15134
|
] }),
|
|
14506
|
-
adding && /* @__PURE__ */ (0,
|
|
14507
|
-
/* @__PURE__ */ (0,
|
|
15135
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "menu", className: "w100n-docs-menu", children: [
|
|
15136
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14508
15137
|
setAdding(false);
|
|
14509
15138
|
setMaking(true);
|
|
14510
15139
|
}, children: [
|
|
14511
|
-
/* @__PURE__ */ (0,
|
|
14512
|
-
/* @__PURE__ */ (0,
|
|
15140
|
+
/* @__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 }) }),
|
|
15141
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.newTitle })
|
|
14513
15142
|
] }),
|
|
14514
|
-
/* @__PURE__ */ (0,
|
|
15143
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14515
15144
|
setAdding(false);
|
|
14516
15145
|
upload.current.click();
|
|
14517
15146
|
}, children: [
|
|
14518
|
-
/* @__PURE__ */ (0,
|
|
14519
|
-
/* @__PURE__ */ (0,
|
|
15147
|
+
/* @__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 }) }),
|
|
15148
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.uploadFile })
|
|
14520
15149
|
] })
|
|
14521
15150
|
] }),
|
|
14522
|
-
/* @__PURE__ */ (0,
|
|
15151
|
+
/* @__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
15152
|
const file = e.target.files?.[0];
|
|
14524
15153
|
e.target.value = "";
|
|
14525
15154
|
if (file) void send(file);
|
|
14526
15155
|
} })
|
|
14527
15156
|
] }),
|
|
14528
|
-
/* @__PURE__ */ (0,
|
|
15157
|
+
/* @__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
15158
|
] }),
|
|
14530
|
-
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0,
|
|
15159
|
+
(spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
|
|
14531
15160
|
if (e.key !== "Escape" || !picking) return;
|
|
14532
15161
|
e.stopPropagation();
|
|
14533
15162
|
setPicking(false);
|
|
14534
15163
|
e.currentTarget.querySelector("button").focus();
|
|
14535
15164
|
}, children: [
|
|
14536
|
-
/* @__PURE__ */ (0,
|
|
14537
|
-
space ? /* @__PURE__ */ (0,
|
|
14538
|
-
/* @__PURE__ */ (0,
|
|
14539
|
-
!space && /* @__PURE__ */ (0,
|
|
14540
|
-
/* @__PURE__ */ (0,
|
|
15165
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
|
|
15166
|
+
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 }) }),
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: space?.name ?? t.allProjects }),
|
|
15168
|
+
!space && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: all.length }),
|
|
15169
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14541
15170
|
] }),
|
|
14542
|
-
picking && /* @__PURE__ */ (0,
|
|
14543
|
-
/* @__PURE__ */ (0,
|
|
14544
|
-
/* @__PURE__ */ (0,
|
|
14545
|
-
/* @__PURE__ */ (0,
|
|
14546
|
-
!spaceId && /* @__PURE__ */ (0,
|
|
15171
|
+
picking && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "listbox", className: "w100n-docs-menu", children: [
|
|
15172
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
|
|
15173
|
+
/* @__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 }) }),
|
|
15174
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.allProjects }),
|
|
15175
|
+
!spaceId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Check, { "aria-hidden": true })
|
|
14547
15176
|
] }),
|
|
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,
|
|
15177
|
+
groups2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "group", "aria-label": group || void 0, children: [
|
|
15178
|
+
group && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-menu-caption", children: group }),
|
|
15179
|
+
(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: [
|
|
15180
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
|
|
15181
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: item.name }),
|
|
15182
|
+
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
|
|
15183
|
+
item.id === spaceId && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Check, { "aria-hidden": true })
|
|
14555
15184
|
] }, item.id))
|
|
14556
15185
|
] }, group))
|
|
14557
15186
|
] })
|
|
14558
15187
|
] }),
|
|
14559
|
-
/* @__PURE__ */ (0,
|
|
14560
|
-
/* @__PURE__ */ (0,
|
|
14561
|
-
/* @__PURE__ */ (0,
|
|
14562
|
-
/* @__PURE__ */ (0,
|
|
15188
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-filters", children: [
|
|
15189
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
15190
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Search, { "aria-hidden": true }),
|
|
15191
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { ref: finder, value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search }),
|
|
15192
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("kbd", { children: "\u2318O" })
|
|
14563
15193
|
] }),
|
|
14564
|
-
present.length > 1 && /* @__PURE__ */ (0,
|
|
15194
|
+
present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
14565
15195
|
if (e.key !== "Escape" || !typing) return;
|
|
14566
15196
|
e.stopPropagation();
|
|
14567
15197
|
setTyping(false);
|
|
14568
15198
|
e.currentTarget.querySelector("button").focus();
|
|
14569
15199
|
}, children: [
|
|
14570
|
-
/* @__PURE__ */ (0,
|
|
14571
|
-
/* @__PURE__ */ (0,
|
|
14572
|
-
/* @__PURE__ */ (0,
|
|
14573
|
-
picked.length > 0 && /* @__PURE__ */ (0,
|
|
14574
|
-
/* @__PURE__ */ (0,
|
|
15200
|
+
/* @__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: [
|
|
15201
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ListFilter, { "aria-hidden": true }),
|
|
15202
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.typeFilter }),
|
|
15203
|
+
picked.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: picked.length }),
|
|
15204
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ChevronDown, { "aria-hidden": true })
|
|
14575
15205
|
] }),
|
|
14576
|
-
typing && /* @__PURE__ */ (0,
|
|
15206
|
+
typing && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
|
|
14577
15207
|
present.map((item) => {
|
|
14578
|
-
const Icon =
|
|
15208
|
+
const Icon = icons4[item];
|
|
14579
15209
|
const on2 = picked.includes(item);
|
|
14580
|
-
return /* @__PURE__ */ (0,
|
|
14581
|
-
/* @__PURE__ */ (0,
|
|
14582
|
-
/* @__PURE__ */ (0,
|
|
14583
|
-
/* @__PURE__ */ (0,
|
|
14584
|
-
/* @__PURE__ */ (0,
|
|
15210
|
+
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: [
|
|
15211
|
+
/* @__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 }) }),
|
|
15212
|
+
/* @__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 }) }),
|
|
15213
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: t.kinds[item] }),
|
|
15214
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
|
|
14585
15215
|
] }, item);
|
|
14586
15216
|
}),
|
|
14587
|
-
/* @__PURE__ */ (0,
|
|
14588
|
-
/* @__PURE__ */ (0,
|
|
14589
|
-
/* @__PURE__ */ (0,
|
|
15217
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-menu-foot", children: [
|
|
15218
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
|
|
15219
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
|
|
14590
15220
|
] })
|
|
14591
15221
|
] })
|
|
14592
15222
|
] })
|
|
14593
15223
|
] }),
|
|
14594
|
-
|
|
15224
|
+
/* @__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: () => {
|
|
15225
|
+
setShape(key2);
|
|
15226
|
+
localStorage.setItem("w100n-docs-view", key2);
|
|
15227
|
+
}, children: [
|
|
15228
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-hidden": true }),
|
|
15229
|
+
label
|
|
15230
|
+
] }, key2)) }),
|
|
15231
|
+
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
15232
|
t.kinds[item],
|
|
14596
|
-
/* @__PURE__ */ (0,
|
|
15233
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.X, { "aria-hidden": true })
|
|
14597
15234
|
] }, item)) })
|
|
14598
15235
|
] }),
|
|
14599
|
-
/* @__PURE__ */ (0,
|
|
14600
|
-
sending === "failed" && /* @__PURE__ */ (0,
|
|
15236
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-cards", children: [
|
|
15237
|
+
sending === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
|
|
14601
15238
|
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
|
-
|
|
15239
|
+
list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
|
|
15240
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", role: "status", children: notice }),
|
|
15241
|
+
list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
|
|
15242
|
+
shape3 === "tree" && list.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
15243
|
+
Tree,
|
|
15244
|
+
{
|
|
15245
|
+
items: shown,
|
|
15246
|
+
names: names2,
|
|
15247
|
+
bySpace: !spaceId,
|
|
15248
|
+
current: here.documentId,
|
|
15249
|
+
t,
|
|
15250
|
+
onOpen: open,
|
|
15251
|
+
onMenu: (item, e) => setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false }),
|
|
15252
|
+
onWarm: (item) => item ? warm(item) : clearTimeout(hover.current)
|
|
15253
|
+
}
|
|
15254
|
+
),
|
|
15255
|
+
shape3 === "cards" && folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
|
|
15256
|
+
folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
|
|
15257
|
+
/* @__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: [
|
|
15258
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
15259
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14610
15260
|
"input",
|
|
14611
15261
|
{
|
|
14612
15262
|
className: "w100n-docs-field",
|
|
@@ -14625,7 +15275,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14625
15275
|
}
|
|
14626
15276
|
}
|
|
14627
15277
|
) })
|
|
14628
|
-
] }, item.id) : /* @__PURE__ */ (0,
|
|
15278
|
+
] }, item.id) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14629
15279
|
"button",
|
|
14630
15280
|
{
|
|
14631
15281
|
type: "button",
|
|
@@ -14640,11 +15290,11 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14640
15290
|
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
14641
15291
|
},
|
|
14642
15292
|
children: [
|
|
14643
|
-
/* @__PURE__ */ (0,
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
14646
|
-
/* @__PURE__ */ (0,
|
|
14647
|
-
inside2.get(item.id) && /* @__PURE__ */ (0,
|
|
15293
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
|
|
15294
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-docs-card-text", children: [
|
|
15295
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: item.name }),
|
|
15296
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
|
|
15297
|
+
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
15298
|
] })
|
|
14649
15299
|
]
|
|
14650
15300
|
},
|
|
@@ -14654,31 +15304,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14654
15304
|
] })
|
|
14655
15305
|
] }),
|
|
14656
15306
|
!narrow && !listOpen && listToggle,
|
|
14657
|
-
/* @__PURE__ */ (0,
|
|
15307
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("main", { className: "w100n-docs-stage", children: [
|
|
14658
15308
|
!narrow && !panelOpen && panelToggle,
|
|
14659
|
-
/* @__PURE__ */ (0,
|
|
15309
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-bare", children: stage })
|
|
14660
15310
|
] }),
|
|
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,
|
|
15311
|
+
doc.data && panelOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
|
|
15312
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-head", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-row", children: [
|
|
15313
|
+
/* @__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: [
|
|
15314
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-hidden": true }),
|
|
15315
|
+
(panelTabs.length < 4 || tab === key2 && panelTabs.length < 5) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: label })
|
|
14666
15316
|
] }, key2)) }),
|
|
14667
|
-
/* @__PURE__ */ (0,
|
|
15317
|
+
/* @__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
15318
|
] }) }),
|
|
14669
|
-
/* @__PURE__ */ (0,
|
|
14670
|
-
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0,
|
|
14671
|
-
now && /* @__PURE__ */ (0,
|
|
14672
|
-
/* @__PURE__ */ (0,
|
|
14673
|
-
/* @__PURE__ */ (0,
|
|
15319
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key2]) => key2 === tab)?.[2], children: [
|
|
15320
|
+
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
|
|
15321
|
+
now && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-reading", children: [
|
|
15322
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
|
|
15323
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("small", { children: [
|
|
14674
15324
|
Math.round(now.progress * 100),
|
|
14675
15325
|
"% ",
|
|
14676
15326
|
t.read
|
|
14677
15327
|
] })
|
|
14678
15328
|
] }),
|
|
14679
|
-
outline2.length > 8 && /* @__PURE__ */ (0,
|
|
14680
|
-
/* @__PURE__ */ (0,
|
|
14681
|
-
/* @__PURE__ */ (0,
|
|
15329
|
+
outline2.length > 8 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
15330
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Search, { "aria-hidden": true }),
|
|
15331
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
|
|
14682
15332
|
] }),
|
|
14683
15333
|
chapters.map((c, i) => {
|
|
14684
15334
|
const subs = words3.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -14686,13 +15336,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14686
15336
|
const opened3 = words3.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
14687
15337
|
const named3 = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
14688
15338
|
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,
|
|
15339
|
+
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: [
|
|
15340
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-chapter-row", children: [
|
|
15341
|
+
/* @__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: [
|
|
15342
|
+
/* @__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 }) }),
|
|
15343
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: named3 ? named3[2] : c.head.text })
|
|
14694
15344
|
] }),
|
|
14695
|
-
c.subs.length > 0 && /* @__PURE__ */ (0,
|
|
15345
|
+
c.subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14696
15346
|
"button",
|
|
14697
15347
|
{
|
|
14698
15348
|
type: "button",
|
|
@@ -14702,13 +15352,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14702
15352
|
title: opened3 ? t.hideSections : t.showSections,
|
|
14703
15353
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened3 }),
|
|
14704
15354
|
children: [
|
|
14705
|
-
/* @__PURE__ */ (0,
|
|
14706
|
-
opened3 ? /* @__PURE__ */ (0,
|
|
15355
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: c.subs.length }),
|
|
15356
|
+
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
15357
|
]
|
|
14708
15358
|
}
|
|
14709
15359
|
)
|
|
14710
15360
|
] }),
|
|
14711
|
-
opened3 && subs.length > 0 && /* @__PURE__ */ (0,
|
|
15361
|
+
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
15362
|
"button",
|
|
14713
15363
|
{
|
|
14714
15364
|
type: "button",
|
|
@@ -14717,7 +15367,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14717
15367
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
14718
15368
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
14719
15369
|
children: [
|
|
14720
|
-
/* @__PURE__ */ (0,
|
|
15370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", { "aria-hidden": true }),
|
|
14721
15371
|
s.text
|
|
14722
15372
|
]
|
|
14723
15373
|
},
|
|
@@ -14725,46 +15375,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14725
15375
|
)) })
|
|
14726
15376
|
] }, c.head.id);
|
|
14727
15377
|
})
|
|
14728
|
-
] }) : /* @__PURE__ */ (0,
|
|
14729
|
-
tab === "
|
|
15378
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.noOutline })),
|
|
15379
|
+
tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Backlinks, { host, current: doc.data, notes: notes3, t, onOpen: open }),
|
|
15380
|
+
tab === "versions" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14730
15381
|
versions.error && failed(versions.retry),
|
|
14731
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */ (0,
|
|
15382
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14732
15383
|
"button",
|
|
14733
15384
|
{
|
|
14734
15385
|
type: "button",
|
|
14735
15386
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
14736
15387
|
onClick: () => view(item.current ? null : item.id),
|
|
14737
15388
|
children: [
|
|
14738
|
-
/* @__PURE__ */ (0,
|
|
15389
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14739
15390
|
date(item.createdAt),
|
|
14740
|
-
item.current && /* @__PURE__ */ (0,
|
|
15391
|
+
item.current && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: t.current })
|
|
14741
15392
|
] }),
|
|
14742
|
-
/* @__PURE__ */ (0,
|
|
15393
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
14743
15394
|
]
|
|
14744
15395
|
},
|
|
14745
15396
|
item.id
|
|
14746
15397
|
))
|
|
14747
15398
|
] }),
|
|
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,
|
|
15399
|
+
tab === "details" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("dl", { className: "w100n-docs-details", children: [
|
|
15400
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.kind }),
|
|
15401
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: t.kinds[doc.data.kind] }),
|
|
15402
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.size }),
|
|
15403
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: size2(doc.data.size) }),
|
|
15404
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.updated }),
|
|
15405
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: date(doc.data.updatedAt) }),
|
|
15406
|
+
doc.data.updatedBy && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15407
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.by }),
|
|
15408
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: doc.data.updatedBy.name })
|
|
14758
15409
|
] }),
|
|
14759
|
-
/* @__PURE__ */ (0,
|
|
14760
|
-
/* @__PURE__ */ (0,
|
|
15410
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: t.rights }),
|
|
15411
|
+
/* @__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
15412
|
] }),
|
|
14762
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0,
|
|
14763
|
-
/* @__PURE__ */ (0,
|
|
14764
|
-
/* @__PURE__ */ (0,
|
|
15413
|
+
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-about", children: [
|
|
15414
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "w100n-docs-caption", children: [
|
|
15415
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDown, { "aria-hidden": true }),
|
|
14765
15416
|
t.exportAs
|
|
14766
15417
|
] }),
|
|
14767
|
-
/* @__PURE__ */ (0,
|
|
15418
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14768
15419
|
"button",
|
|
14769
15420
|
{
|
|
14770
15421
|
type: "button",
|
|
@@ -14772,22 +15423,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14772
15423
|
disabled: exporting === "busy",
|
|
14773
15424
|
onClick: () => void exportAs(doc.data, format),
|
|
14774
15425
|
children: [
|
|
14775
|
-
/* @__PURE__ */ (0,
|
|
15426
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDown, { "aria-hidden": true }),
|
|
14776
15427
|
format.toUpperCase()
|
|
14777
15428
|
]
|
|
14778
15429
|
},
|
|
14779
15430
|
format
|
|
14780
15431
|
)) }),
|
|
14781
|
-
exporting === "failed" && /* @__PURE__ */ (0,
|
|
15432
|
+
exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
14782
15433
|
] }),
|
|
14783
|
-
tab === "comments" && /* @__PURE__ */ (0,
|
|
14784
|
-
tab === "sharing" && sharing && /* @__PURE__ */ (0,
|
|
14785
|
-
tab === "signatures" && /* @__PURE__ */ (0,
|
|
15434
|
+
tab === "comments" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: setBox }),
|
|
15435
|
+
tab === "sharing" && sharing && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
|
|
15436
|
+
tab === "signatures" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-versions", children: [
|
|
14786
15437
|
signatures.error && failed(signatures.retry),
|
|
14787
|
-
signatures.data?.length === 0 && /* @__PURE__ */ (0,
|
|
15438
|
+
signatures.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.noSignatures }),
|
|
14788
15439
|
(signatures.data ?? []).map((entry2) => {
|
|
14789
15440
|
const signed = versions.data?.find((v) => v.id === entry2.versionId);
|
|
14790
|
-
return /* @__PURE__ */ (0,
|
|
15441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14791
15442
|
"button",
|
|
14792
15443
|
{
|
|
14793
15444
|
type: "button",
|
|
@@ -14795,15 +15446,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14795
15446
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
14796
15447
|
onClick: () => view(signed.current ? null : signed.id),
|
|
14797
15448
|
children: [
|
|
14798
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14799
15450
|
entry2.signer.name,
|
|
14800
|
-
/* @__PURE__ */ (0,
|
|
15451
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-docs-badge", children: [
|
|
14801
15452
|
t.page,
|
|
14802
15453
|
" ",
|
|
14803
15454
|
entry2.page
|
|
14804
15455
|
] })
|
|
14805
15456
|
] }),
|
|
14806
|
-
/* @__PURE__ */ (0,
|
|
15457
|
+
/* @__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
15458
|
]
|
|
14808
15459
|
},
|
|
14809
15460
|
entry2.id
|
|
@@ -14814,85 +15465,98 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14814
15465
|
] })
|
|
14815
15466
|
] })
|
|
14816
15467
|
] }),
|
|
14817
|
-
|
|
15468
|
+
jump && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
15469
|
+
Jump,
|
|
15470
|
+
{
|
|
15471
|
+
mode: jump,
|
|
15472
|
+
items: all,
|
|
15473
|
+
actions: commands,
|
|
15474
|
+
t,
|
|
15475
|
+
onClose: () => setJump(null),
|
|
15476
|
+
onOpen: open,
|
|
15477
|
+
onCreate: host.create ? (name) => void note(name, true) : void 0,
|
|
15478
|
+
place: (item) => [!spaceId && names2.get(item.spaceId), item.folder].filter(Boolean).join(" / ")
|
|
15479
|
+
}
|
|
15480
|
+
),
|
|
15481
|
+
making && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made2) => {
|
|
14818
15482
|
setMaking(false);
|
|
14819
15483
|
opened2(made2);
|
|
14820
15484
|
} }),
|
|
14821
|
-
menu && /* @__PURE__ */ (0,
|
|
14822
|
-
/* @__PURE__ */ (0,
|
|
14823
|
-
/* @__PURE__ */ (0,
|
|
14824
|
-
/* @__PURE__ */ (0,
|
|
14825
|
-
menu.item.createdAt && /* @__PURE__ */ (0,
|
|
14826
|
-
/* @__PURE__ */ (0,
|
|
15485
|
+
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: [
|
|
15486
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-head", children: [
|
|
15487
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("b", { children: menu.item.name }),
|
|
15488
|
+
/* @__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 ") }),
|
|
15489
|
+
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 ") }),
|
|
15490
|
+
/* @__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
15491
|
] }),
|
|
14828
|
-
menu.sure ? /* @__PURE__ */ (0,
|
|
14829
|
-
/* @__PURE__ */ (0,
|
|
14830
|
-
/* @__PURE__ */ (0,
|
|
14831
|
-
/* @__PURE__ */ (0,
|
|
14832
|
-
/* @__PURE__ */ (0,
|
|
14833
|
-
/* @__PURE__ */ (0,
|
|
15492
|
+
menu.sure ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-context-ask", children: [
|
|
15493
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
|
|
15494
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
|
|
15495
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
|
|
15496
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
|
|
15497
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
14834
15498
|
t.trash
|
|
14835
15499
|
] })
|
|
14836
15500
|
] })
|
|
14837
|
-
] }) : /* @__PURE__ */ (0,
|
|
14838
|
-
/* @__PURE__ */ (0,
|
|
15501
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15502
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14839
15503
|
setMenu(null);
|
|
14840
15504
|
open(menu.item);
|
|
14841
15505
|
}, children: [
|
|
14842
|
-
/* @__PURE__ */ (0,
|
|
15506
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileText, { "aria-hidden": true }),
|
|
14843
15507
|
t.openFile
|
|
14844
15508
|
] }),
|
|
14845
|
-
host.href && /* @__PURE__ */ (0,
|
|
15509
|
+
host.href && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14846
15510
|
setMenu(null);
|
|
14847
15511
|
window.open(host.href(menu.item.id), "_blank", "noopener");
|
|
14848
15512
|
}, children: [
|
|
14849
|
-
/* @__PURE__ */ (0,
|
|
15513
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ExternalLink, { "aria-hidden": true }),
|
|
14850
15514
|
t.openTab
|
|
14851
15515
|
] }),
|
|
14852
|
-
host.href && /* @__PURE__ */ (0,
|
|
14853
|
-
/* @__PURE__ */ (0,
|
|
15516
|
+
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: [
|
|
15517
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Link, { "aria-hidden": true }),
|
|
14854
15518
|
t.copyLink
|
|
14855
15519
|
] }),
|
|
14856
|
-
host.send && /* @__PURE__ */ (0,
|
|
15520
|
+
host.send && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14857
15521
|
setMenu(null);
|
|
14858
15522
|
host.send(menu.item.id);
|
|
14859
15523
|
}, children: [
|
|
14860
|
-
/* @__PURE__ */ (0,
|
|
15524
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Send, { "aria-hidden": true }),
|
|
14861
15525
|
t.sendChat
|
|
14862
15526
|
] }),
|
|
14863
|
-
/* @__PURE__ */ (0,
|
|
14864
|
-
host.rename && /* @__PURE__ */ (0,
|
|
15527
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15528
|
+
host.rename && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14865
15529
|
setMenu(null);
|
|
14866
15530
|
setNaming({ id: menu.item.id, text: menu.item.name.replace(/\.[^.]+$/, "") });
|
|
14867
15531
|
}, children: [
|
|
14868
|
-
/* @__PURE__ */ (0,
|
|
15532
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Pencil, { "aria-hidden": true }),
|
|
14869
15533
|
t.rename
|
|
14870
15534
|
] }),
|
|
14871
|
-
host.create && /* @__PURE__ */ (0,
|
|
14872
|
-
/* @__PURE__ */ (0,
|
|
15535
|
+
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: [
|
|
15536
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Copy, { "aria-hidden": true }),
|
|
14873
15537
|
t.makeCopy
|
|
14874
15538
|
] }),
|
|
14875
|
-
/* @__PURE__ */ (0,
|
|
14876
|
-
/* @__PURE__ */ (0,
|
|
15539
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
|
|
15540
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Download, { "aria-hidden": true }),
|
|
14877
15541
|
t.download
|
|
14878
15542
|
] }),
|
|
14879
|
-
host.saveTemplate && /* @__PURE__ */ (0,
|
|
14880
|
-
/* @__PURE__ */ (0,
|
|
15543
|
+
host.saveTemplate && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
|
|
15544
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Bookmark, { "aria-hidden": true }),
|
|
14881
15545
|
t.saveTemplate
|
|
14882
15546
|
] }),
|
|
14883
|
-
/* @__PURE__ */ (0,
|
|
15547
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14884
15548
|
setMenu(null);
|
|
14885
15549
|
open(menu.item);
|
|
14886
15550
|
setTab("details");
|
|
14887
15551
|
side2("panel", true);
|
|
14888
15552
|
}, children: [
|
|
14889
|
-
/* @__PURE__ */ (0,
|
|
15553
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Info, { "aria-hidden": true }),
|
|
14890
15554
|
t.details
|
|
14891
15555
|
] }),
|
|
14892
|
-
host.remove && /* @__PURE__ */ (0,
|
|
14893
|
-
/* @__PURE__ */ (0,
|
|
14894
|
-
/* @__PURE__ */ (0,
|
|
14895
|
-
/* @__PURE__ */ (0,
|
|
15556
|
+
host.remove && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
15557
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", {}),
|
|
15558
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
|
|
15559
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Trash2, { "aria-hidden": true }),
|
|
14896
15560
|
t.trash
|
|
14897
15561
|
] })
|
|
14898
15562
|
] })
|
|
@@ -14903,24 +15567,24 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14903
15567
|
}
|
|
14904
15568
|
|
|
14905
15569
|
// src/FilePreview.tsx
|
|
14906
|
-
var
|
|
14907
|
-
var
|
|
15570
|
+
var import_react20 = require("react");
|
|
15571
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
14908
15572
|
function FilePreview({ url, name, mimeType, size: size2 = 0, bytes, pdfWorker }) {
|
|
14909
|
-
const [source] = (0,
|
|
15573
|
+
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
15574
|
const kind = kindOf(name, mimeType);
|
|
14911
15575
|
if (!kind) return null;
|
|
14912
|
-
return /* @__PURE__ */ (0,
|
|
15576
|
+
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
15577
|
}
|
|
14914
15578
|
|
|
14915
15579
|
// src/GuestDocument.tsx
|
|
14916
|
-
var
|
|
14917
|
-
var
|
|
15580
|
+
var import_react21 = require("react");
|
|
15581
|
+
var import_lucide_react14 = require("lucide-react");
|
|
14918
15582
|
init_text();
|
|
14919
15583
|
init_useLoad();
|
|
14920
|
-
var
|
|
14921
|
-
var TextEditor4 = (0,
|
|
14922
|
-
var SheetView4 = (0,
|
|
14923
|
-
var
|
|
15584
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
15585
|
+
var TextEditor4 = (0, import_react21.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
|
|
15586
|
+
var SheetView4 = (0, import_react21.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
|
|
15587
|
+
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
15588
|
var GuestRefused = class extends Error {
|
|
14925
15589
|
constructor(reason, file = "", sharedBy = "") {
|
|
14926
15590
|
super(reason);
|
|
@@ -14929,7 +15593,7 @@ var GuestRefused = class extends Error {
|
|
|
14929
15593
|
this.sharedBy = sharedBy;
|
|
14930
15594
|
}
|
|
14931
15595
|
};
|
|
14932
|
-
var
|
|
15596
|
+
var remembered2 = () => {
|
|
14933
15597
|
try {
|
|
14934
15598
|
return localStorage.getItem("w100n-guest-name") ?? "";
|
|
14935
15599
|
} catch {
|
|
@@ -14945,14 +15609,14 @@ var remember = (name) => {
|
|
|
14945
15609
|
};
|
|
14946
15610
|
function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
14947
15611
|
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,
|
|
15612
|
+
const [ask, setAsk] = (0, import_react21.useState)(() => ({ name: remembered2() || void 0 }));
|
|
15613
|
+
const [typed, setTyped] = (0, import_react21.useState)("");
|
|
15614
|
+
const [name, setName] = (0, import_react21.useState)(remembered2);
|
|
15615
|
+
const named3 = (0, import_react21.useRef)(name);
|
|
15616
|
+
const [slot, setSlot] = (0, import_react21.useState)(null);
|
|
15617
|
+
const [saving, setSaving] = (0, import_react21.useState)("idle");
|
|
14954
15618
|
const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
|
|
14955
|
-
const [notes3] = (0,
|
|
15619
|
+
const [notes3] = (0, import_react21.useState)(() => ({
|
|
14956
15620
|
me: { id: "", name: "" },
|
|
14957
15621
|
spaces: async () => [],
|
|
14958
15622
|
documents: async () => [],
|
|
@@ -14978,18 +15642,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14978
15642
|
};
|
|
14979
15643
|
const top = (file2, badge) => {
|
|
14980
15644
|
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,
|
|
15645
|
+
const Kind = kind2 ? icons5[kind2] : import_lucide_react14.FileText;
|
|
15646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
|
|
15647
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-guest-brand", children: brand }),
|
|
15648
|
+
file2 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
15649
|
+
/* @__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 }) }),
|
|
15650
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-heading", children: [
|
|
15651
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
|
|
15652
|
+
file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
|
|
14989
15653
|
] }),
|
|
14990
|
-
badge && /* @__PURE__ */ (0,
|
|
14991
|
-
file2.download && /* @__PURE__ */ (0,
|
|
14992
|
-
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0,
|
|
15654
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
|
|
15655
|
+
file2.download && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-end", children: [
|
|
15656
|
+
(kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
14993
15657
|
"button",
|
|
14994
15658
|
{
|
|
14995
15659
|
type: "button",
|
|
@@ -15000,41 +15664,41 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15000
15664
|
"aria-label": t.pdfCopy,
|
|
15001
15665
|
title: t.pdfCopy,
|
|
15002
15666
|
children: [
|
|
15003
|
-
/* @__PURE__ */ (0,
|
|
15004
|
-
/* @__PURE__ */ (0,
|
|
15667
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.FileDown, { "aria-hidden": true }),
|
|
15668
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.pdfCopy })
|
|
15005
15669
|
]
|
|
15006
15670
|
}
|
|
15007
15671
|
),
|
|
15008
|
-
/* @__PURE__ */ (0,
|
|
15009
|
-
/* @__PURE__ */ (0,
|
|
15010
|
-
/* @__PURE__ */ (0,
|
|
15672
|
+
/* @__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: [
|
|
15673
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.Download, { "aria-hidden": true }),
|
|
15674
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.download })
|
|
15011
15675
|
] })
|
|
15012
15676
|
] })
|
|
15013
15677
|
] })
|
|
15014
15678
|
] });
|
|
15015
15679
|
};
|
|
15016
|
-
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0,
|
|
15680
|
+
const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15017
15681
|
top(null, null),
|
|
15018
|
-
/* @__PURE__ */ (0,
|
|
15019
|
-
/* @__PURE__ */ (0,
|
|
15020
|
-
/* @__PURE__ */ (0,
|
|
15021
|
-
/* @__PURE__ */ (0,
|
|
15682
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-guest-card", children: [
|
|
15683
|
+
/* @__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 }) }),
|
|
15684
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { children: title }),
|
|
15685
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: body }),
|
|
15022
15686
|
form
|
|
15023
15687
|
] }) })
|
|
15024
15688
|
] });
|
|
15025
15689
|
if (opened2.error) {
|
|
15026
15690
|
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",
|
|
15691
|
+
if (refused?.reason === "ended") return gate("slate", import_lucide_react14.Ban, t.endedTitle, t.endedText);
|
|
15692
|
+
if (refused?.reason === "missing") return gate("slate", import_lucide_react14.Ban, t.missingTitle, t.missingText);
|
|
15029
15693
|
if (refused?.reason === "password" || refused?.reason === "wrong" || refused?.reason === "name") {
|
|
15030
15694
|
const password = refused.reason !== "name";
|
|
15031
15695
|
const shared = refused.sharedBy ? `${t.sharedBy.replace("{name}", refused.sharedBy)}. ` : "";
|
|
15032
15696
|
return gate(
|
|
15033
15697
|
"violet",
|
|
15034
|
-
password ?
|
|
15698
|
+
password ? import_lucide_react14.Lock : import_lucide_react14.UserRound,
|
|
15035
15699
|
refused.file || t.documents,
|
|
15036
15700
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
15037
|
-
/* @__PURE__ */ (0,
|
|
15701
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
15038
15702
|
e.preventDefault();
|
|
15039
15703
|
if (!typed.trim()) return;
|
|
15040
15704
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -15044,7 +15708,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15044
15708
|
}
|
|
15045
15709
|
setTyped("");
|
|
15046
15710
|
}, children: [
|
|
15047
|
-
/* @__PURE__ */ (0,
|
|
15711
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
15048
15712
|
"input",
|
|
15049
15713
|
{
|
|
15050
15714
|
className: "w100n-share-input",
|
|
@@ -15057,21 +15721,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15057
15721
|
onChange: (e) => setTyped(e.target.value)
|
|
15058
15722
|
}
|
|
15059
15723
|
),
|
|
15060
|
-
refused.reason === "wrong" && /* @__PURE__ */ (0,
|
|
15061
|
-
/* @__PURE__ */ (0,
|
|
15062
|
-
/* @__PURE__ */ (0,
|
|
15724
|
+
refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
|
|
15725
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
|
|
15726
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react14.Eye, { "aria-hidden": true }),
|
|
15063
15727
|
t.openDoc
|
|
15064
15728
|
] })
|
|
15065
15729
|
] })
|
|
15066
15730
|
);
|
|
15067
15731
|
}
|
|
15068
|
-
if (refused?.reason === "busy") return gate("slate",
|
|
15069
|
-
return gate("slate",
|
|
15732
|
+
if (refused?.reason === "busy") return gate("slate", import_lucide_react14.Ban, t.failed, t.tooMany);
|
|
15733
|
+
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
15734
|
}
|
|
15071
15735
|
const file = opened2.data;
|
|
15072
|
-
if (!file) return /* @__PURE__ */ (0,
|
|
15736
|
+
if (!file) return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15073
15737
|
top(null, null),
|
|
15074
|
-
/* @__PURE__ */ (0,
|
|
15738
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
|
|
15075
15739
|
] });
|
|
15076
15740
|
const kind = kindOf(file.name, file.mimeType);
|
|
15077
15741
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -15079,23 +15743,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15079
15743
|
const rights = { view: true, comment: talk, edit: false };
|
|
15080
15744
|
const quiet3 = () => {
|
|
15081
15745
|
};
|
|
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,
|
|
15746
|
+
let stage = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
15747
|
+
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 }) });
|
|
15748
|
+
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 });
|
|
15749
|
+
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 });
|
|
15750
|
+
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 }) });
|
|
15751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
|
|
15088
15752
|
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,
|
|
15753
|
+
saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
|
|
15754
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
|
|
15755
|
+
/* @__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 }) }),
|
|
15756
|
+
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: [
|
|
15757
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "w100n-share-field", children: [
|
|
15758
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: t.yourName }),
|
|
15759
|
+
/* @__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
15760
|
] }),
|
|
15097
|
-
/* @__PURE__ */ (0,
|
|
15098
|
-
/* @__PURE__ */ (0,
|
|
15761
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
|
|
15762
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: setSlot })
|
|
15099
15763
|
] }) })
|
|
15100
15764
|
] })
|
|
15101
15765
|
] });
|