@w100n/documents 0.16.3 → 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-KXFUAILH.js → SheetView-SBLAFGTL.js} +5 -5
- package/dist/{TextEditor-RNHXPYJX.js → TextEditor-X2GSL4QM.js} +119 -27
- package/dist/TextEditor-X2GSL4QM.js.map +1 -0
- package/dist/{chunk-E2FVJNDT.js → chunk-A6AHJCEK.js} +67 -832
- package/dist/chunk-A6AHJCEK.js.map +1 -0
- package/dist/{chunk-XFLYD3JS.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 +1212 -536
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +324 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +878 -490
- 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-RNHXPYJX.js.map +0 -1
- package/dist/chunk-E2FVJNDT.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-KXFUAILH.js.map → SheetView-SBLAFGTL.js.map} +0 -0
- /package/dist/{chunk-XFLYD3JS.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);
|
|
@@ -10773,6 +11061,7 @@ var index_exports = {};
|
|
|
10773
11061
|
__export(index_exports, {
|
|
10774
11062
|
DocumentOverlay: () => DocumentOverlay,
|
|
10775
11063
|
DocumentsWorkspace: () => DocumentsWorkspace,
|
|
11064
|
+
FilePreview: () => FilePreview,
|
|
10776
11065
|
GuestDocument: () => GuestDocument,
|
|
10777
11066
|
GuestRefused: () => GuestRefused,
|
|
10778
11067
|
SlidesView: () => SlidesView,
|
|
@@ -11674,7 +11963,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
11674
11963
|
};
|
|
11675
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;
|
|
11676
11965
|
const byKey = (a, b) => deck.slides[a].key < deck.slides[b].key ? -1 : 1;
|
|
11677
|
-
const
|
|
11966
|
+
const around3 = (i) => [i - 1, i, i + 1].filter((k) => k >= 0 && k < count).sort(byKey);
|
|
11678
11967
|
const caption = (i) => `${t.slide} ${i + 1}${deck.slides[i].title ? `: ${deck.slides[i].title}` : ""}`;
|
|
11679
11968
|
const post = (id, msg) => frames.current.get(id)?.contentWindow?.postMessage(msg, "*");
|
|
11680
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)(
|
|
@@ -12013,7 +12302,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12013
12302
|
s.key
|
|
12014
12303
|
)) }) }),
|
|
12015
12304
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w100n-slides-main", children: [
|
|
12016
|
-
/* @__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) => {
|
|
12017
12306
|
const id = `m:${deck.slides[i].key}:${epoch}`;
|
|
12018
12307
|
return frame(id, frozen2(deck.slides[i], id, "edit"), fit(stageBox, 32), caption(i), i !== index);
|
|
12019
12308
|
}) }),
|
|
@@ -12040,7 +12329,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
|
|
|
12040
12329
|
back();
|
|
12041
12330
|
},
|
|
12042
12331
|
children: [
|
|
12043
|
-
|
|
12332
|
+
around3(nav.at).map((i) => {
|
|
12044
12333
|
const id = `p:${deck.slides[i].key}:${epoch}`;
|
|
12045
12334
|
return frame(id, frozen2(deck.slides[i], id, "present"), fit(showBox), caption(i), i !== nav.at, true);
|
|
12046
12335
|
}),
|
|
@@ -12831,11 +13120,11 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
|
|
|
12831
13120
|
try {
|
|
12832
13121
|
const { write: write4 } = await Promise.resolve().then(() => (init_pdfWrite(), pdfWrite_exports));
|
|
12833
13122
|
const changed2 = fields();
|
|
12834
|
-
const
|
|
13123
|
+
const signs2 = marks2.flatMap((m) => m.kind === "sign" ? [m] : []);
|
|
12835
13124
|
const out = await write4(bytes, marks2, changed2);
|
|
12836
|
-
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(", ");
|
|
12837
13126
|
const { versionId } = await store(documentId, out, note);
|
|
12838
|
-
for (const s of
|
|
13127
|
+
for (const s of signs2) await host.sign?.(documentId, { versionId, page: s.page, method: s.method });
|
|
12839
13128
|
setClean(marks2);
|
|
12840
13129
|
setFilled(false);
|
|
12841
13130
|
pdf.annotationStorage.resetModified();
|
|
@@ -13302,14 +13591,195 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
|
|
|
13302
13591
|
}
|
|
13303
13592
|
|
|
13304
13593
|
// src/DocumentsWorkspace.tsx
|
|
13305
|
-
var
|
|
13594
|
+
var import_react19 = require("react");
|
|
13306
13595
|
var import_react_dom4 = require("react-dom");
|
|
13307
|
-
var
|
|
13308
|
-
init_focus();
|
|
13596
|
+
var import_lucide_react13 = require("lucide-react");
|
|
13309
13597
|
|
|
13310
|
-
// src/
|
|
13598
|
+
// src/Backlinks.tsx
|
|
13311
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
|
|
13312
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");
|
|
13313
13783
|
|
|
13314
13784
|
// src/blank.ts
|
|
13315
13785
|
var import_fflate2 = require("fflate");
|
|
@@ -13435,19 +13905,19 @@ function blank4(kind, name, template = "blank") {
|
|
|
13435
13905
|
// src/NewDocument.tsx
|
|
13436
13906
|
init_focus();
|
|
13437
13907
|
init_useLoad();
|
|
13438
|
-
var
|
|
13439
|
-
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 };
|
|
13440
13910
|
var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
|
|
13441
13911
|
function NewDocument({ host, t, onClose, onMade }) {
|
|
13442
|
-
const id = (0,
|
|
13443
|
-
const [kind, setKind] = (0,
|
|
13444
|
-
const [template, setTemplate] = (0,
|
|
13445
|
-
const [name, setName] = (0,
|
|
13446
|
-
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);
|
|
13447
13917
|
const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
|
|
13448
13918
|
const ours2 = (shared.data ?? []).filter((item) => item.kind === kind);
|
|
13449
13919
|
const stem = (file) => file.replace(/\.[^.]+$/, "");
|
|
13450
|
-
const [state, setState] = (0,
|
|
13920
|
+
const [state, setState] = (0, import_react15.useState)("idle");
|
|
13451
13921
|
useRestore(true);
|
|
13452
13922
|
const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
|
|
13453
13923
|
const make2 = async () => {
|
|
@@ -13461,77 +13931,77 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13461
13931
|
setState("failed");
|
|
13462
13932
|
}
|
|
13463
13933
|
};
|
|
13464
|
-
return /* @__PURE__ */ (0,
|
|
13934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
13465
13935
|
if (e.key === "Escape") {
|
|
13466
13936
|
e.stopPropagation();
|
|
13467
13937
|
onClose();
|
|
13468
13938
|
}
|
|
13469
|
-
}, 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) => {
|
|
13470
13940
|
e.preventDefault();
|
|
13471
13941
|
void make2();
|
|
13472
13942
|
}, children: [
|
|
13473
|
-
/* @__PURE__ */ (0,
|
|
13474
|
-
/* @__PURE__ */ (0,
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
13476
|
-
/* @__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 }) })
|
|
13477
13947
|
] }),
|
|
13478
|
-
/* @__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) => {
|
|
13479
13949
|
const Icon = icons2[item];
|
|
13480
|
-
return /* @__PURE__ */ (0,
|
|
13950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
|
|
13481
13951
|
setKind(item);
|
|
13482
13952
|
setTeam(null);
|
|
13483
13953
|
if (item === "sheet" || item === "slides") setTemplate("blank");
|
|
13484
13954
|
}, children: [
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13487
|
-
/* @__PURE__ */ (0,
|
|
13488
|
-
/* @__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] })
|
|
13489
13959
|
] })
|
|
13490
13960
|
] }, item);
|
|
13491
13961
|
}) }),
|
|
13492
|
-
/* @__PURE__ */ (0,
|
|
13493
|
-
/* @__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: () => {
|
|
13494
13964
|
setTeam(null);
|
|
13495
13965
|
setTemplate(item);
|
|
13496
13966
|
}, children: [
|
|
13497
|
-
/* @__PURE__ */ (0,
|
|
13498
|
-
/* @__PURE__ */ (0,
|
|
13499
|
-
/* @__PURE__ */ (0,
|
|
13500
|
-
/* @__PURE__ */ (0,
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13503
|
-
/* @__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", {})
|
|
13504
13974
|
] }) }),
|
|
13505
|
-
/* @__PURE__ */ (0,
|
|
13975
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.templates[item] })
|
|
13506
13976
|
] }, item)) }),
|
|
13507
|
-
ours2.length > 0 && /* @__PURE__ */ (0,
|
|
13508
|
-
/* @__PURE__ */ (0,
|
|
13509
|
-
/* @__PURE__ */ (0,
|
|
13510
|
-
/* @__PURE__ */ (0,
|
|
13511
|
-
/* @__PURE__ */ (0,
|
|
13512
|
-
/* @__PURE__ */ (0,
|
|
13513
|
-
/* @__PURE__ */ (0,
|
|
13514
|
-
/* @__PURE__ */ (0,
|
|
13515
|
-
/* @__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", {})
|
|
13516
13986
|
] }),
|
|
13517
|
-
/* @__PURE__ */ (0,
|
|
13987
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { title: item.name, children: stem(item.name) })
|
|
13518
13988
|
] }, item.id)) })
|
|
13519
13989
|
] }),
|
|
13520
|
-
/* @__PURE__ */ (0,
|
|
13521
|
-
/* @__PURE__ */ (0,
|
|
13522
|
-
/* @__PURE__ */ (0,
|
|
13523
|
-
/* @__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] })
|
|
13524
13994
|
] }),
|
|
13525
|
-
host.createIn && /* @__PURE__ */ (0,
|
|
13526
|
-
/* @__PURE__ */ (0,
|
|
13527
|
-
/* @__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 })
|
|
13528
13998
|
] })
|
|
13529
13999
|
] }),
|
|
13530
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13531
|
-
/* @__PURE__ */ (0,
|
|
13532
|
-
/* @__PURE__ */ (0,
|
|
13533
|
-
/* @__PURE__ */ (0,
|
|
13534
|
-
/* @__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 }),
|
|
13535
14005
|
state === "busy" ? t.making : t.make
|
|
13536
14006
|
] })
|
|
13537
14007
|
] })
|
|
@@ -13539,10 +14009,10 @@ function NewDocument({ host, t, onClose, onMade }) {
|
|
|
13539
14009
|
}
|
|
13540
14010
|
|
|
13541
14011
|
// src/Sharing.tsx
|
|
13542
|
-
var
|
|
13543
|
-
var
|
|
14012
|
+
var import_react16 = require("react");
|
|
14013
|
+
var import_lucide_react11 = require("lucide-react");
|
|
13544
14014
|
init_useLoad();
|
|
13545
|
-
var
|
|
14015
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
13546
14016
|
var blank5 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
|
|
13547
14017
|
var local = (iso) => {
|
|
13548
14018
|
const at2 = new Date(iso);
|
|
@@ -13550,9 +14020,9 @@ var local = (iso) => {
|
|
|
13550
14020
|
};
|
|
13551
14021
|
function Sharing({ host, doc, t, language, team }) {
|
|
13552
14022
|
const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
|
|
13553
|
-
const [form, setForm] = (0,
|
|
13554
|
-
const [state, setState] = (0,
|
|
13555
|
-
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);
|
|
13556
14026
|
const text = doc.kind === "docx" || doc.kind === "markdown";
|
|
13557
14027
|
const rules = new Intl.PluralRules(language);
|
|
13558
14028
|
const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
|
|
@@ -13614,31 +14084,31 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13614
14084
|
setCopied(null);
|
|
13615
14085
|
}
|
|
13616
14086
|
};
|
|
13617
|
-
if (form) return /* @__PURE__ */ (0,
|
|
13618
|
-
/* @__PURE__ */ (0,
|
|
13619
|
-
/* @__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 }),
|
|
13620
14090
|
form.id ? t.changeLink : t.newLink
|
|
13621
14091
|
] }),
|
|
13622
|
-
text && /* @__PURE__ */ (0,
|
|
13623
|
-
/* @__PURE__ */ (0,
|
|
13624
|
-
/* @__PURE__ */ (0,
|
|
13625
|
-
/* @__PURE__ */ (0,
|
|
13626
|
-
/* @__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 }),
|
|
13627
14097
|
t.canRead
|
|
13628
14098
|
] }),
|
|
13629
|
-
/* @__PURE__ */ (0,
|
|
13630
|
-
/* @__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 }),
|
|
13631
14101
|
t.canComment
|
|
13632
14102
|
] })
|
|
13633
14103
|
] })
|
|
13634
14104
|
] }),
|
|
13635
|
-
/* @__PURE__ */ (0,
|
|
13636
|
-
/* @__PURE__ */ (0,
|
|
13637
|
-
/* @__PURE__ */ (0,
|
|
13638
|
-
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 }),
|
|
13639
14109
|
label
|
|
13640
14110
|
] }, key2)) }),
|
|
13641
|
-
form.works === "day" && /* @__PURE__ */ (0,
|
|
14111
|
+
form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13642
14112
|
"input",
|
|
13643
14113
|
{
|
|
13644
14114
|
type: "date",
|
|
@@ -13650,14 +14120,14 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13650
14120
|
}
|
|
13651
14121
|
)
|
|
13652
14122
|
] }),
|
|
13653
|
-
/* @__PURE__ */ (0,
|
|
13654
|
-
/* @__PURE__ */ (0,
|
|
13655
|
-
/* @__PURE__ */ (0,
|
|
13656
|
-
/* @__PURE__ */ (0,
|
|
13657
|
-
/* @__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 })
|
|
13658
14128
|
] })
|
|
13659
14129
|
] }),
|
|
13660
|
-
form.password && /* @__PURE__ */ (0,
|
|
14130
|
+
form.password && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13661
14131
|
"input",
|
|
13662
14132
|
{
|
|
13663
14133
|
type: "password",
|
|
@@ -13669,120 +14139,120 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13669
14139
|
onChange: (e) => setForm({ ...form, secret: e.target.value })
|
|
13670
14140
|
}
|
|
13671
14141
|
),
|
|
13672
|
-
/* @__PURE__ */ (0,
|
|
13673
|
-
/* @__PURE__ */ (0,
|
|
13674
|
-
/* @__PURE__ */ (0,
|
|
13675
|
-
/* @__PURE__ */ (0,
|
|
13676
|
-
/* @__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 })
|
|
13677
14147
|
] })
|
|
13678
14148
|
] }),
|
|
13679
|
-
/* @__PURE__ */ (0,
|
|
13680
|
-
/* @__PURE__ */ (0,
|
|
13681
|
-
/* @__PURE__ */ (0,
|
|
13682
|
-
/* @__PURE__ */ (0,
|
|
13683
|
-
/* @__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 })
|
|
13684
14154
|
] })
|
|
13685
14155
|
] }),
|
|
13686
|
-
/* @__PURE__ */ (0,
|
|
13687
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13688
|
-
/* @__PURE__ */ (0,
|
|
13689
|
-
/* @__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: () => {
|
|
13690
14160
|
setForm(null);
|
|
13691
14161
|
setState("idle");
|
|
13692
14162
|
}, children: t.cancel }),
|
|
13693
|
-
/* @__PURE__ */ (0,
|
|
13694
|
-
/* @__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 }),
|
|
13695
14165
|
form.id ? t.saveLink : t.makeLink
|
|
13696
14166
|
] })
|
|
13697
14167
|
] })
|
|
13698
14168
|
] });
|
|
13699
14169
|
const on2 = links.data ?? [];
|
|
13700
|
-
return /* @__PURE__ */ (0,
|
|
13701
|
-
/* @__PURE__ */ (0,
|
|
13702
|
-
/* @__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 }),
|
|
13703
14173
|
t.guestLinks,
|
|
13704
|
-
on2.length > 0 && /* @__PURE__ */ (0,
|
|
14174
|
+
on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: on2.filter((l) => !l.ended).length })
|
|
13705
14175
|
] }),
|
|
13706
|
-
links.error && /* @__PURE__ */ (0,
|
|
14176
|
+
links.error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
13707
14177
|
t.failed,
|
|
13708
|
-
/* @__PURE__ */ (0,
|
|
14178
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
|
|
13709
14179
|
] }),
|
|
13710
|
-
links.data && !on2.length && /* @__PURE__ */ (0,
|
|
13711
|
-
state === "failed" && /* @__PURE__ */ (0,
|
|
13712
|
-
on2.map((l) => /* @__PURE__ */ (0,
|
|
13713
|
-
/* @__PURE__ */ (0,
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
13715
|
-
/* @__PURE__ */ (0,
|
|
13716
|
-
/* @__PURE__ */ (0,
|
|
13717
|
-
/* @__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: [
|
|
13718
14188
|
t.madeBy.replace("{name}", l.createdBy.name),
|
|
13719
14189
|
" \xB7 ",
|
|
13720
14190
|
day(l.createdAt)
|
|
13721
14191
|
] })
|
|
13722
14192
|
] })
|
|
13723
14193
|
] }),
|
|
13724
|
-
/* @__PURE__ */ (0,
|
|
13725
|
-
/* @__PURE__ */ (0,
|
|
13726
|
-
/* @__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 }),
|
|
13727
14197
|
l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
|
|
13728
14198
|
] }),
|
|
13729
|
-
l.download && /* @__PURE__ */ (0,
|
|
13730
|
-
/* @__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 }),
|
|
13731
14201
|
t.downloadOn
|
|
13732
14202
|
] }),
|
|
13733
|
-
l.password && /* @__PURE__ */ (0,
|
|
13734
|
-
/* @__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 }),
|
|
13735
14205
|
t.passwordOn
|
|
13736
14206
|
] }),
|
|
13737
|
-
/* @__PURE__ */ (0,
|
|
13738
|
-
/* @__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 }),
|
|
13739
14209
|
count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
|
|
13740
14210
|
] })
|
|
13741
14211
|
] }),
|
|
13742
|
-
/* @__PURE__ */ (0,
|
|
13743
|
-
/* @__PURE__ */ (0,
|
|
13744
|
-
/* @__PURE__ */ (0,
|
|
13745
|
-
/* @__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 }),
|
|
13746
14216
|
copied === l.id ? t.copied : t.copy
|
|
13747
14217
|
] })
|
|
13748
14218
|
] }),
|
|
13749
|
-
l.guests.length > 0 && /* @__PURE__ */ (0,
|
|
13750
|
-
/* @__PURE__ */ (0,
|
|
13751
|
-
/* @__PURE__ */ (0,
|
|
13752
|
-
/* @__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: [
|
|
13753
14223
|
g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
|
|
13754
14224
|
" \xB7 ",
|
|
13755
14225
|
ago(g.lastAt)
|
|
13756
14226
|
] })
|
|
13757
14227
|
] }, i)) }),
|
|
13758
|
-
/* @__PURE__ */ (0,
|
|
13759
|
-
/* @__PURE__ */ (0,
|
|
13760
|
-
/* @__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 }),
|
|
13761
14231
|
t.changeLink
|
|
13762
14232
|
] }),
|
|
13763
|
-
/* @__PURE__ */ (0,
|
|
13764
|
-
/* @__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 }),
|
|
13765
14235
|
t.turnOff
|
|
13766
14236
|
] })
|
|
13767
14237
|
] })
|
|
13768
14238
|
] }, l.id)),
|
|
13769
|
-
/* @__PURE__ */ (0,
|
|
14239
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
|
|
13770
14240
|
setState("idle");
|
|
13771
14241
|
setForm(blank5);
|
|
13772
14242
|
}, children: [
|
|
13773
|
-
/* @__PURE__ */ (0,
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Plus, { "aria-hidden": true }),
|
|
13774
14244
|
t.newLink
|
|
13775
14245
|
] }),
|
|
13776
|
-
team && /* @__PURE__ */ (0,
|
|
13777
|
-
/* @__PURE__ */ (0,
|
|
13778
|
-
/* @__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 }),
|
|
13779
14249
|
t.inTeam
|
|
13780
14250
|
] }),
|
|
13781
|
-
/* @__PURE__ */ (0,
|
|
13782
|
-
/* @__PURE__ */ (0,
|
|
13783
|
-
/* @__PURE__ */ (0,
|
|
13784
|
-
/* @__PURE__ */ (0,
|
|
13785
|
-
/* @__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 })
|
|
13786
14256
|
] })
|
|
13787
14257
|
] })
|
|
13788
14258
|
] })
|
|
@@ -13793,7 +14263,7 @@ function Sharing({ host, doc, t, language, team }) {
|
|
|
13793
14263
|
init_text();
|
|
13794
14264
|
|
|
13795
14265
|
// src/Thumb.tsx
|
|
13796
|
-
var
|
|
14266
|
+
var import_react17 = require("react");
|
|
13797
14267
|
|
|
13798
14268
|
// src/preview.ts
|
|
13799
14269
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -13846,12 +14316,12 @@ function preview(host, doc) {
|
|
|
13846
14316
|
}
|
|
13847
14317
|
|
|
13848
14318
|
// src/Thumb.tsx
|
|
13849
|
-
var
|
|
14319
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13850
14320
|
function Thumb({ host, item, label }) {
|
|
13851
|
-
const box2 = (0,
|
|
13852
|
-
const [seen2, setSeen] = (0,
|
|
13853
|
-
const [shot, setShot] = (0,
|
|
13854
|
-
(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)(() => {
|
|
13855
14325
|
if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
|
|
13856
14326
|
const watch = new IntersectionObserver((entries2) => {
|
|
13857
14327
|
if (entries2.some((entry2) => entry2.isIntersecting)) setSeen(true);
|
|
@@ -13859,7 +14329,7 @@ function Thumb({ host, item, label }) {
|
|
|
13859
14329
|
watch.observe(box2.current);
|
|
13860
14330
|
return () => watch.disconnect();
|
|
13861
14331
|
}, [item.thumbnailUrl, item.excerpt]);
|
|
13862
|
-
(0,
|
|
14332
|
+
(0, import_react17.useEffect)(() => {
|
|
13863
14333
|
if (!seen2) return;
|
|
13864
14334
|
let live = true;
|
|
13865
14335
|
void preview(host, item).then((found) => {
|
|
@@ -13872,53 +14342,142 @@ function Thumb({ host, item, label }) {
|
|
|
13872
14342
|
const text = item.excerpt ?? shot?.text ?? "";
|
|
13873
14343
|
const lines2 = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
|
|
13874
14344
|
const image = item.thumbnailUrl ?? shot?.image;
|
|
13875
|
-
return /* @__PURE__ */ (0,
|
|
13876
|
-
image ? /* @__PURE__ */ (0,
|
|
13877
|
-
/* @__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] }),
|
|
13878
14348
|
lines2.slice(1, 14).join(" ")
|
|
13879
|
-
] }) : /* @__PURE__ */ (0,
|
|
13880
|
-
/* @__PURE__ */ (0,
|
|
13881
|
-
/* @__PURE__ */ (0,
|
|
13882
|
-
/* @__PURE__ */ (0,
|
|
13883
|
-
/* @__PURE__ */ (0,
|
|
13884
|
-
/* @__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", {})
|
|
13885
14355
|
] }) }),
|
|
13886
|
-
/* @__PURE__ */ (0,
|
|
14356
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
|
|
13887
14357
|
] });
|
|
13888
14358
|
}
|
|
13889
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
|
+
})
|
|
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) });
|
|
14444
|
+
}
|
|
14445
|
+
|
|
13890
14446
|
// src/DocumentsWorkspace.tsx
|
|
13891
14447
|
init_useLoad();
|
|
13892
|
-
var
|
|
13893
|
-
var TextEditor3 = (0,
|
|
13894
|
-
var SheetView3 = (0,
|
|
13895
|
-
var Compare2 = (0,
|
|
13896
|
-
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 };
|
|
13897
14453
|
function DocumentsWorkspace({ host, language = "en", theme = "light", place: place2, onPlace, start, end, aside, actions }) {
|
|
13898
14454
|
const t = texts[language];
|
|
13899
|
-
const [own, setOwn] = (0,
|
|
14455
|
+
const [own, setOwn] = (0, import_react19.useState)({ spaceId: null, documentId: null });
|
|
13900
14456
|
const here = place2 ?? own;
|
|
13901
14457
|
const go = (next) => {
|
|
13902
14458
|
setOwn(next);
|
|
13903
14459
|
onPlace?.(next);
|
|
13904
14460
|
};
|
|
13905
|
-
const [query, setQuery] = (0,
|
|
13906
|
-
const [picked, setPicked] = (0,
|
|
13907
|
-
const [typing, setTyping] = (0,
|
|
13908
|
-
const [menusAt, setMenusAt] = (0,
|
|
13909
|
-
const [renaming, setRenaming] = (0,
|
|
13910
|
-
const [renamed2, setRenamed] = (0,
|
|
13911
|
-
const [statusAt, setStatusAt] = (0,
|
|
13912
|
-
const [listOpen, setListOpen] = (0,
|
|
13913
|
-
const [
|
|
13914
|
-
const [
|
|
13915
|
-
const
|
|
13916
|
-
const
|
|
13917
|
-
const
|
|
13918
|
-
const
|
|
13919
|
-
const
|
|
13920
|
-
const
|
|
13921
|
-
(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)(() => {
|
|
13922
14481
|
const el = body.current;
|
|
13923
14482
|
let was = false;
|
|
13924
14483
|
const check = () => {
|
|
@@ -13936,9 +14495,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13936
14495
|
watch.observe(el);
|
|
13937
14496
|
return () => watch.disconnect();
|
|
13938
14497
|
}, [here.documentId]);
|
|
13939
|
-
const [picking, setPicking] = (0,
|
|
13940
|
-
const [adding, setAdding] = (0,
|
|
13941
|
-
(0,
|
|
14498
|
+
const [picking, setPicking] = (0, import_react19.useState)(false);
|
|
14499
|
+
const [adding, setAdding] = (0, import_react19.useState)(false);
|
|
14500
|
+
(0, import_react19.useEffect)(() => {
|
|
13942
14501
|
if (!adding) return;
|
|
13943
14502
|
const close = (e) => {
|
|
13944
14503
|
if (!e.target.closest(".w100n-docs-new")) setAdding(false);
|
|
@@ -13946,7 +14505,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13946
14505
|
document.addEventListener("pointerdown", close);
|
|
13947
14506
|
return () => document.removeEventListener("pointerdown", close);
|
|
13948
14507
|
}, [adding]);
|
|
13949
|
-
(0,
|
|
14508
|
+
(0, import_react19.useEffect)(() => {
|
|
13950
14509
|
if (!typing) return;
|
|
13951
14510
|
const close = (e) => {
|
|
13952
14511
|
if (!e.target.closest(".w100n-docs-types")) setTyping(false);
|
|
@@ -13954,7 +14513,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13954
14513
|
document.addEventListener("pointerdown", close);
|
|
13955
14514
|
return () => document.removeEventListener("pointerdown", close);
|
|
13956
14515
|
}, [typing]);
|
|
13957
|
-
(0,
|
|
14516
|
+
(0, import_react19.useEffect)(() => {
|
|
13958
14517
|
if (!picking) return;
|
|
13959
14518
|
const close = (e) => {
|
|
13960
14519
|
if (!e.target.closest(".w100n-docs-picker")) setPicking(false);
|
|
@@ -13962,12 +14521,12 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13962
14521
|
document.addEventListener("pointerdown", close);
|
|
13963
14522
|
return () => document.removeEventListener("pointerdown", close);
|
|
13964
14523
|
}, [picking]);
|
|
13965
|
-
const [menu, setMenu] = (0,
|
|
13966
|
-
const [naming, setNaming] = (0,
|
|
13967
|
-
const [notice, setNotice] = (0,
|
|
13968
|
-
const early = (0,
|
|
13969
|
-
const hover = (0,
|
|
13970
|
-
(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)(() => {
|
|
13971
14530
|
if (!menu) return;
|
|
13972
14531
|
const close = (e) => {
|
|
13973
14532
|
if (e.type === "pointerdown" && e.target.closest(".w100n-docs-context")) return;
|
|
@@ -13983,22 +14542,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
13983
14542
|
window.removeEventListener("scroll", close, true);
|
|
13984
14543
|
};
|
|
13985
14544
|
}, [menu]);
|
|
13986
|
-
const [tab, setTab] = (0,
|
|
13987
|
-
const [outline2, setOutline] = (0,
|
|
13988
|
-
const [reading, setReading] = (0,
|
|
13989
|
-
const [hunt, setHunt] = (0,
|
|
13990
|
-
const [fold, setFold] = (0,
|
|
13991
|
-
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 });
|
|
13992
14551
|
const versionId = version2.documentId === here.documentId ? version2.id : null;
|
|
13993
|
-
const [comparing, setComparing] = (0,
|
|
13994
|
-
const [restoring, setRestoring] = (0,
|
|
13995
|
-
const [exporting, setExporting] = (0,
|
|
13996
|
-
const [copying, setCopying] = (0,
|
|
13997
|
-
const [kept, setKept] = (0,
|
|
13998
|
-
const [box2, setBox] = (0,
|
|
13999
|
-
const [making, setMaking] = (0,
|
|
14000
|
-
const [sending, setSending] = (0,
|
|
14001
|
-
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);
|
|
14002
14561
|
const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
|
|
14003
14562
|
const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
|
|
14004
14563
|
const spaceId = here.spaceId ?? single;
|
|
@@ -14009,7 +14568,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14009
14568
|
const all2 = await host.spaces({ signal });
|
|
14010
14569
|
return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
|
|
14011
14570
|
}, [host, spaceId]);
|
|
14012
|
-
(0,
|
|
14571
|
+
(0, import_react19.useEffect)(() => {
|
|
14013
14572
|
const sync = () => {
|
|
14014
14573
|
if (document.visibilityState !== "visible") return;
|
|
14015
14574
|
spaces.retry();
|
|
@@ -14062,9 +14621,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14062
14621
|
return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
|
|
14063
14622
|
};
|
|
14064
14623
|
const size2 = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
|
|
14065
|
-
const failed = (retry) => /* @__PURE__ */ (0,
|
|
14624
|
+
const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-note", children: [
|
|
14066
14625
|
t.failed,
|
|
14067
|
-
/* @__PURE__ */ (0,
|
|
14626
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: retry, children: t.retry })
|
|
14068
14627
|
] });
|
|
14069
14628
|
const { ask, dialog } = useUnsaved(guard, t);
|
|
14070
14629
|
const side2 = (which, open2) => {
|
|
@@ -14076,12 +14635,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14076
14635
|
if (which === "list") (open2 ? listClose : listButton).current?.focus();
|
|
14077
14636
|
else (open2 ? panel.current?.querySelector('[aria-selected="true"]') : panelButton.current)?.focus();
|
|
14078
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
|
+
};
|
|
14079
14647
|
const open = (item) => {
|
|
14080
14648
|
if (item.id === here.documentId) {
|
|
14081
14649
|
if (narrow) setListOpen(false);
|
|
14082
14650
|
return;
|
|
14083
14651
|
}
|
|
14084
|
-
|
|
14652
|
+
leave(() => {
|
|
14085
14653
|
setOutline([]);
|
|
14086
14654
|
setHunt("");
|
|
14087
14655
|
setFold({});
|
|
@@ -14238,8 +14806,64 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14238
14806
|
setSending("failed");
|
|
14239
14807
|
}
|
|
14240
14808
|
};
|
|
14241
|
-
|
|
14242
|
-
|
|
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 }),
|
|
14243
14867
|
t.pick
|
|
14244
14868
|
] });
|
|
14245
14869
|
if (here.documentId) {
|
|
@@ -14247,9 +14871,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14247
14871
|
doc.retry();
|
|
14248
14872
|
content.retry();
|
|
14249
14873
|
});
|
|
14250
|
-
else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0,
|
|
14251
|
-
else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ (0,
|
|
14252
|
-
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)(
|
|
14253
14877
|
TextEditor3,
|
|
14254
14878
|
{
|
|
14255
14879
|
kind: doc.data.kind,
|
|
@@ -14270,6 +14894,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14270
14894
|
slot: tab === "comments" && panelOpen ? box2 : null,
|
|
14271
14895
|
head: docbar ? { menus: menusAt, status: statusAt } : void 0,
|
|
14272
14896
|
guard,
|
|
14897
|
+
wiki: versionId ? void 0 : wiki,
|
|
14273
14898
|
file: versionId ? void 0 : {
|
|
14274
14899
|
formats: host.exportAs ? doc.data.exports ?? [] : [],
|
|
14275
14900
|
download: (f) => void exportAs(doc.data, f),
|
|
@@ -14285,7 +14910,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14285
14910
|
},
|
|
14286
14911
|
doc.data.id
|
|
14287
14912
|
) });
|
|
14288
|
-
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
14913
|
+
else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14289
14914
|
PdfView,
|
|
14290
14915
|
{
|
|
14291
14916
|
bytes: content.data,
|
|
@@ -14307,7 +14932,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14307
14932
|
},
|
|
14308
14933
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14309
14934
|
);
|
|
14310
|
-
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0,
|
|
14935
|
+
else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14311
14936
|
SlidesView,
|
|
14312
14937
|
{
|
|
14313
14938
|
html: new TextDecoder().decode(content.data),
|
|
@@ -14317,8 +14942,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14317
14942
|
theme,
|
|
14318
14943
|
onOutline: setOutline,
|
|
14319
14944
|
guard,
|
|
14320
|
-
onSaveRequest: host.save && !versionId ? async (bytes,
|
|
14321
|
-
await host.save(doc.data.id, bytes,
|
|
14945
|
+
onSaveRequest: host.save && !versionId ? async (bytes, note2) => {
|
|
14946
|
+
await host.save(doc.data.id, bytes, note2);
|
|
14322
14947
|
versions.retry();
|
|
14323
14948
|
doc.retry();
|
|
14324
14949
|
list.retry();
|
|
@@ -14326,7 +14951,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14326
14951
|
},
|
|
14327
14952
|
doc.data.id
|
|
14328
14953
|
);
|
|
14329
|
-
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)(
|
|
14330
14955
|
SheetView3,
|
|
14331
14956
|
{
|
|
14332
14957
|
bytes: content.data,
|
|
@@ -14344,8 +14969,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14344
14969
|
doc.retry();
|
|
14345
14970
|
list.retry();
|
|
14346
14971
|
},
|
|
14347
|
-
onSaveRequest: versionId || !host.save ? void 0 : async (bytes,
|
|
14348
|
-
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);
|
|
14349
14974
|
versions.retry();
|
|
14350
14975
|
doc.retry();
|
|
14351
14976
|
list.retry();
|
|
@@ -14353,9 +14978,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14353
14978
|
},
|
|
14354
14979
|
`${doc.data.id}:${versionId ?? ""}`
|
|
14355
14980
|
) });
|
|
14356
|
-
else stage = /* @__PURE__ */ (0,
|
|
14981
|
+
else stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
|
|
14357
14982
|
}
|
|
14358
|
-
const Kind = doc.data ?
|
|
14983
|
+
const Kind = doc.data ? icons4[doc.data.kind] : import_lucide_react13.FileText;
|
|
14359
14984
|
const top = Math.min(...outline2.map((h) => h.level));
|
|
14360
14985
|
const chapters = outline2.reduce((all2, h) => {
|
|
14361
14986
|
if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
|
|
@@ -14368,12 +14993,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14368
14993
|
const hit = (h) => words3.every((w) => h.text.toLocaleLowerCase().includes(w));
|
|
14369
14994
|
const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
14370
14995
|
const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
|
|
14371
|
-
const panelTabs = [
|
|
14372
|
-
|
|
14373
|
-
|
|
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]);
|
|
14374
15004
|
const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
|
|
14375
|
-
if (sharing) panelTabs.push(["sharing",
|
|
14376
|
-
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)(
|
|
14377
15007
|
"button",
|
|
14378
15008
|
{
|
|
14379
15009
|
ref: listButton,
|
|
@@ -14383,10 +15013,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14383
15013
|
onClick: () => side2("list", !listOpen),
|
|
14384
15014
|
"aria-label": listOpen ? t.closeList : t.openList,
|
|
14385
15015
|
title: listOpen ? t.closeList : t.openList,
|
|
14386
|
-
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 })
|
|
14387
15017
|
}
|
|
14388
15018
|
);
|
|
14389
|
-
const panelToggle = doc.data && /* @__PURE__ */ (0,
|
|
15019
|
+
const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14390
15020
|
"button",
|
|
14391
15021
|
{
|
|
14392
15022
|
ref: panelButton,
|
|
@@ -14396,16 +15026,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14396
15026
|
onClick: () => side2("panel", !panelOpen),
|
|
14397
15027
|
"aria-label": panelOpen ? t.closePanel : t.openPanel,
|
|
14398
15028
|
title: panelOpen ? t.closePanel : t.openPanel,
|
|
14399
|
-
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 })
|
|
14400
15030
|
}
|
|
14401
15031
|
);
|
|
14402
|
-
return /* @__PURE__ */ (0,
|
|
14403
|
-
/* @__PURE__ */ (0,
|
|
14404
|
-
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) }),
|
|
14405
15035
|
narrow && listToggle,
|
|
14406
|
-
/* @__PURE__ */ (0,
|
|
14407
|
-
/* @__PURE__ */ (0,
|
|
14408
|
-
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)(
|
|
14409
15039
|
"input",
|
|
14410
15040
|
{
|
|
14411
15041
|
className: "w100n-docs-title w100n-docs-rename",
|
|
@@ -14423,7 +15053,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14423
15053
|
}
|
|
14424
15054
|
}
|
|
14425
15055
|
}
|
|
14426
|
-
) : /* @__PURE__ */ (0,
|
|
15056
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
14427
15057
|
"strong",
|
|
14428
15058
|
{
|
|
14429
15059
|
className: "w100n-docs-title",
|
|
@@ -14432,31 +15062,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14432
15062
|
children: doc.data?.name ?? t.documents
|
|
14433
15063
|
}
|
|
14434
15064
|
),
|
|
14435
|
-
docbar ? /* @__PURE__ */ (0,
|
|
14436
|
-
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 }),
|
|
14437
15067
|
item
|
|
14438
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
15068
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
|
|
14439
15069
|
] }),
|
|
14440
|
-
versionId && /* @__PURE__ */ (0,
|
|
14441
|
-
versionId && text && /* @__PURE__ */ (0,
|
|
14442
|
-
/* @__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 }),
|
|
14443
15073
|
comparing ? t.hideChanges : t.showChanges
|
|
14444
15074
|
] }),
|
|
14445
|
-
versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0,
|
|
14446
|
-
/* @__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 }),
|
|
14447
15077
|
t.restore
|
|
14448
15078
|
] }),
|
|
14449
|
-
restoring === "failed" && /* @__PURE__ */ (0,
|
|
14450
|
-
doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0,
|
|
14451
|
-
/* @__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 }),
|
|
14452
15082
|
t.copyAs
|
|
14453
15083
|
] }),
|
|
14454
|
-
copying === "failed" && /* @__PURE__ */ (0,
|
|
14455
|
-
kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ (0,
|
|
14456
|
-
kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0,
|
|
14457
|
-
renamed2 === "failed" && /* @__PURE__ */ (0,
|
|
14458
|
-
docbar && /* @__PURE__ */ (0,
|
|
14459
|
-
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)(
|
|
14460
15090
|
"button",
|
|
14461
15091
|
{
|
|
14462
15092
|
type: "button",
|
|
@@ -14466,146 +15096,167 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14466
15096
|
title: t.sendChat,
|
|
14467
15097
|
onClick: () => host.send(doc.data.id),
|
|
14468
15098
|
children: [
|
|
14469
|
-
/* @__PURE__ */ (0,
|
|
14470
|
-
/* @__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 })
|
|
14471
15101
|
]
|
|
14472
15102
|
}
|
|
14473
15103
|
),
|
|
14474
|
-
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: () => {
|
|
14475
15105
|
setTab("sharing");
|
|
14476
15106
|
side2("panel", true);
|
|
14477
15107
|
}, children: [
|
|
14478
|
-
/* @__PURE__ */ (0,
|
|
14479
|
-
/* @__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 })
|
|
14480
15110
|
] }),
|
|
14481
15111
|
doc.data && !versionId && actions?.(doc.data),
|
|
14482
15112
|
narrow && panelToggle,
|
|
14483
|
-
end && /* @__PURE__ */ (0,
|
|
15113
|
+
end && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
|
|
14484
15114
|
] }),
|
|
14485
|
-
/* @__PURE__ */ (0,
|
|
14486
|
-
listOpen && /* @__PURE__ */ (0,
|
|
14487
|
-
/* @__PURE__ */ (0,
|
|
14488
|
-
/* @__PURE__ */ (0,
|
|
14489
|
-
/* @__PURE__ */ (0,
|
|
14490
|
-
/* @__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 }),
|
|
14491
15121
|
t.documents,
|
|
14492
|
-
/* @__PURE__ */ (0,
|
|
15122
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: all.length })
|
|
14493
15123
|
] }),
|
|
14494
|
-
host.create && /* @__PURE__ */ (0,
|
|
15124
|
+
host.create && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-new", onKeyDown: (e) => {
|
|
14495
15125
|
if (e.key === "Escape" && adding) {
|
|
14496
15126
|
e.stopPropagation();
|
|
14497
15127
|
setAdding(false);
|
|
14498
15128
|
}
|
|
14499
15129
|
}, children: [
|
|
14500
|
-
/* @__PURE__ */ (0,
|
|
14501
|
-
/* @__PURE__ */ (0,
|
|
14502
|
-
/* @__PURE__ */ (0,
|
|
14503
|
-
/* @__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 })
|
|
14504
15134
|
] }),
|
|
14505
|
-
adding && /* @__PURE__ */ (0,
|
|
14506
|
-
/* @__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: () => {
|
|
14507
15137
|
setAdding(false);
|
|
14508
15138
|
setMaking(true);
|
|
14509
15139
|
}, children: [
|
|
14510
|
-
/* @__PURE__ */ (0,
|
|
14511
|
-
/* @__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 })
|
|
14512
15142
|
] }),
|
|
14513
|
-
/* @__PURE__ */ (0,
|
|
15143
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14514
15144
|
setAdding(false);
|
|
14515
15145
|
upload.current.click();
|
|
14516
15146
|
}, children: [
|
|
14517
|
-
/* @__PURE__ */ (0,
|
|
14518
|
-
/* @__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 })
|
|
14519
15149
|
] })
|
|
14520
15150
|
] }),
|
|
14521
|
-
/* @__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) => {
|
|
14522
15152
|
const file = e.target.files?.[0];
|
|
14523
15153
|
e.target.value = "";
|
|
14524
15154
|
if (file) void send(file);
|
|
14525
15155
|
} })
|
|
14526
15156
|
] }),
|
|
14527
|
-
/* @__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 }) })
|
|
14528
15158
|
] }),
|
|
14529
|
-
(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) => {
|
|
14530
15160
|
if (e.key !== "Escape" || !picking) return;
|
|
14531
15161
|
e.stopPropagation();
|
|
14532
15162
|
setPicking(false);
|
|
14533
15163
|
e.currentTarget.querySelector("button").focus();
|
|
14534
15164
|
}, children: [
|
|
14535
|
-
/* @__PURE__ */ (0,
|
|
14536
|
-
space ? /* @__PURE__ */ (0,
|
|
14537
|
-
/* @__PURE__ */ (0,
|
|
14538
|
-
!space && /* @__PURE__ */ (0,
|
|
14539
|
-
/* @__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 })
|
|
14540
15170
|
] }),
|
|
14541
|
-
picking && /* @__PURE__ */ (0,
|
|
14542
|
-
/* @__PURE__ */ (0,
|
|
14543
|
-
/* @__PURE__ */ (0,
|
|
14544
|
-
/* @__PURE__ */ (0,
|
|
14545
|
-
!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 })
|
|
14546
15176
|
] }),
|
|
14547
|
-
groups2.map((group) => /* @__PURE__ */ (0,
|
|
14548
|
-
group && /* @__PURE__ */ (0,
|
|
14549
|
-
(spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0,
|
|
14550
|
-
/* @__PURE__ */ (0,
|
|
14551
|
-
/* @__PURE__ */ (0,
|
|
14552
|
-
!spaceId && counts.get(item.id) ? /* @__PURE__ */ (0,
|
|
14553
|
-
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 })
|
|
14554
15184
|
] }, item.id))
|
|
14555
15185
|
] }, group))
|
|
14556
15186
|
] })
|
|
14557
15187
|
] }),
|
|
14558
|
-
/* @__PURE__ */ (0,
|
|
14559
|
-
/* @__PURE__ */ (0,
|
|
14560
|
-
/* @__PURE__ */ (0,
|
|
14561
|
-
/* @__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" })
|
|
14562
15193
|
] }),
|
|
14563
|
-
present.length > 1 && /* @__PURE__ */ (0,
|
|
15194
|
+
present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w100n-docs-types", onKeyDown: (e) => {
|
|
14564
15195
|
if (e.key !== "Escape" || !typing) return;
|
|
14565
15196
|
e.stopPropagation();
|
|
14566
15197
|
setTyping(false);
|
|
14567
15198
|
e.currentTarget.querySelector("button").focus();
|
|
14568
15199
|
}, children: [
|
|
14569
|
-
/* @__PURE__ */ (0,
|
|
14570
|
-
/* @__PURE__ */ (0,
|
|
14571
|
-
/* @__PURE__ */ (0,
|
|
14572
|
-
picked.length > 0 && /* @__PURE__ */ (0,
|
|
14573
|
-
/* @__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 })
|
|
14574
15205
|
] }),
|
|
14575
|
-
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: [
|
|
14576
15207
|
present.map((item) => {
|
|
14577
|
-
const Icon =
|
|
15208
|
+
const Icon = icons4[item];
|
|
14578
15209
|
const on2 = picked.includes(item);
|
|
14579
|
-
return /* @__PURE__ */ (0,
|
|
14580
|
-
/* @__PURE__ */ (0,
|
|
14581
|
-
/* @__PURE__ */ (0,
|
|
14582
|
-
/* @__PURE__ */ (0,
|
|
14583
|
-
/* @__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 })
|
|
14584
15215
|
] }, item);
|
|
14585
15216
|
}),
|
|
14586
|
-
/* @__PURE__ */ (0,
|
|
14587
|
-
/* @__PURE__ */ (0,
|
|
14588
|
-
/* @__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 })
|
|
14589
15220
|
] })
|
|
14590
15221
|
] })
|
|
14591
15222
|
] })
|
|
14592
15223
|
] }),
|
|
14593
|
-
|
|
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: [
|
|
14594
15232
|
t.kinds[item],
|
|
14595
|
-
/* @__PURE__ */ (0,
|
|
15233
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.X, { "aria-hidden": true })
|
|
14596
15234
|
] }, item)) })
|
|
14597
15235
|
] }),
|
|
14598
|
-
/* @__PURE__ */ (0,
|
|
14599
|
-
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 }),
|
|
14600
15238
|
list.error && failed(list.retry),
|
|
14601
|
-
list.loading && !list.data && /* @__PURE__ */ (0,
|
|
14602
|
-
notice && /* @__PURE__ */ (0,
|
|
14603
|
-
list.data && !shown.length && /* @__PURE__ */ (0,
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
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)(
|
|
14609
15260
|
"input",
|
|
14610
15261
|
{
|
|
14611
15262
|
className: "w100n-docs-field",
|
|
@@ -14624,7 +15275,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14624
15275
|
}
|
|
14625
15276
|
}
|
|
14626
15277
|
) })
|
|
14627
|
-
] }, item.id) : /* @__PURE__ */ (0,
|
|
15278
|
+
] }, item.id) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14628
15279
|
"button",
|
|
14629
15280
|
{
|
|
14630
15281
|
type: "button",
|
|
@@ -14639,11 +15290,11 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14639
15290
|
setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
|
|
14640
15291
|
},
|
|
14641
15292
|
children: [
|
|
14642
|
-
/* @__PURE__ */ (0,
|
|
14643
|
-
/* @__PURE__ */ (0,
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
14646
|
-
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) })
|
|
14647
15298
|
] })
|
|
14648
15299
|
]
|
|
14649
15300
|
},
|
|
@@ -14653,31 +15304,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14653
15304
|
] })
|
|
14654
15305
|
] }),
|
|
14655
15306
|
!narrow && !listOpen && listToggle,
|
|
14656
|
-
/* @__PURE__ */ (0,
|
|
15307
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("main", { className: "w100n-docs-stage", children: [
|
|
14657
15308
|
!narrow && !panelOpen && panelToggle,
|
|
14658
|
-
/* @__PURE__ */ (0,
|
|
15309
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w100n-docs-bare", children: stage })
|
|
14659
15310
|
] }),
|
|
14660
|
-
doc.data && panelOpen && /* @__PURE__ */ (0,
|
|
14661
|
-
/* @__PURE__ */ (0,
|
|
14662
|
-
/* @__PURE__ */ (0,
|
|
14663
|
-
/* @__PURE__ */ (0,
|
|
14664
|
-
(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 })
|
|
14665
15316
|
] }, key2)) }),
|
|
14666
|
-
/* @__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 }) })
|
|
14667
15318
|
] }) }),
|
|
14668
|
-
/* @__PURE__ */ (0,
|
|
14669
|
-
tab === "outline" && (outline2.length ? /* @__PURE__ */ (0,
|
|
14670
|
-
now && /* @__PURE__ */ (0,
|
|
14671
|
-
/* @__PURE__ */ (0,
|
|
14672
|
-
/* @__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: [
|
|
14673
15324
|
Math.round(now.progress * 100),
|
|
14674
15325
|
"% ",
|
|
14675
15326
|
t.read
|
|
14676
15327
|
] })
|
|
14677
15328
|
] }),
|
|
14678
|
-
outline2.length > 8 && /* @__PURE__ */ (0,
|
|
14679
|
-
/* @__PURE__ */ (0,
|
|
14680
|
-
/* @__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 })
|
|
14681
15332
|
] }),
|
|
14682
15333
|
chapters.map((c, i) => {
|
|
14683
15334
|
const subs = words3.length ? c.subs.filter(hit) : c.subs;
|
|
@@ -14685,13 +15336,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14685
15336
|
const opened3 = words3.length > 0 || (fold[c.head.id] ?? i === reached);
|
|
14686
15337
|
const named3 = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
|
|
14687
15338
|
const mark = c.subs.findIndex((s) => s.id === now?.id);
|
|
14688
|
-
return /* @__PURE__ */ (0,
|
|
14689
|
-
/* @__PURE__ */ (0,
|
|
14690
|
-
/* @__PURE__ */ (0,
|
|
14691
|
-
/* @__PURE__ */ (0,
|
|
14692
|
-
/* @__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 })
|
|
14693
15344
|
] }),
|
|
14694
|
-
c.subs.length > 0 && /* @__PURE__ */ (0,
|
|
15345
|
+
c.subs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14695
15346
|
"button",
|
|
14696
15347
|
{
|
|
14697
15348
|
type: "button",
|
|
@@ -14701,13 +15352,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14701
15352
|
title: opened3 ? t.hideSections : t.showSections,
|
|
14702
15353
|
onClick: () => setFold({ ...fold, [c.head.id]: !opened3 }),
|
|
14703
15354
|
children: [
|
|
14704
|
-
/* @__PURE__ */ (0,
|
|
14705
|
-
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 })
|
|
14706
15357
|
]
|
|
14707
15358
|
}
|
|
14708
15359
|
)
|
|
14709
15360
|
] }),
|
|
14710
|
-
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)(
|
|
14711
15362
|
"button",
|
|
14712
15363
|
{
|
|
14713
15364
|
type: "button",
|
|
@@ -14716,7 +15367,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14716
15367
|
"data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
|
|
14717
15368
|
"aria-current": now?.id === s.id ? "location" : void 0,
|
|
14718
15369
|
children: [
|
|
14719
|
-
/* @__PURE__ */ (0,
|
|
15370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", { "aria-hidden": true }),
|
|
14720
15371
|
s.text
|
|
14721
15372
|
]
|
|
14722
15373
|
},
|
|
@@ -14724,46 +15375,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14724
15375
|
)) })
|
|
14725
15376
|
] }, c.head.id);
|
|
14726
15377
|
})
|
|
14727
|
-
] }) : /* @__PURE__ */ (0,
|
|
14728
|
-
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: [
|
|
14729
15381
|
versions.error && failed(versions.retry),
|
|
14730
|
-
(versions.data ?? []).map((item) => /* @__PURE__ */ (0,
|
|
15382
|
+
(versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14731
15383
|
"button",
|
|
14732
15384
|
{
|
|
14733
15385
|
type: "button",
|
|
14734
15386
|
"aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
|
|
14735
15387
|
onClick: () => view(item.current ? null : item.id),
|
|
14736
15388
|
children: [
|
|
14737
|
-
/* @__PURE__ */ (0,
|
|
15389
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14738
15390
|
date(item.createdAt),
|
|
14739
|
-
item.current && /* @__PURE__ */ (0,
|
|
15391
|
+
item.current && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w100n-docs-badge", children: t.current })
|
|
14740
15392
|
] }),
|
|
14741
|
-
/* @__PURE__ */ (0,
|
|
15393
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
|
|
14742
15394
|
]
|
|
14743
15395
|
},
|
|
14744
15396
|
item.id
|
|
14745
15397
|
))
|
|
14746
15398
|
] }),
|
|
14747
|
-
tab === "details" && /* @__PURE__ */ (0,
|
|
14748
|
-
/* @__PURE__ */ (0,
|
|
14749
|
-
/* @__PURE__ */ (0,
|
|
14750
|
-
/* @__PURE__ */ (0,
|
|
14751
|
-
/* @__PURE__ */ (0,
|
|
14752
|
-
/* @__PURE__ */ (0,
|
|
14753
|
-
/* @__PURE__ */ (0,
|
|
14754
|
-
doc.data.updatedBy && /* @__PURE__ */ (0,
|
|
14755
|
-
/* @__PURE__ */ (0,
|
|
14756
|
-
/* @__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 })
|
|
14757
15409
|
] }),
|
|
14758
|
-
/* @__PURE__ */ (0,
|
|
14759
|
-
/* @__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(", ") })
|
|
14760
15412
|
] }),
|
|
14761
|
-
tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0,
|
|
14762
|
-
/* @__PURE__ */ (0,
|
|
14763
|
-
/* @__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 }),
|
|
14764
15416
|
t.exportAs
|
|
14765
15417
|
] }),
|
|
14766
|
-
/* @__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)(
|
|
14767
15419
|
"button",
|
|
14768
15420
|
{
|
|
14769
15421
|
type: "button",
|
|
@@ -14771,22 +15423,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14771
15423
|
disabled: exporting === "busy",
|
|
14772
15424
|
onClick: () => void exportAs(doc.data, format),
|
|
14773
15425
|
children: [
|
|
14774
|
-
/* @__PURE__ */ (0,
|
|
15426
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileDown, { "aria-hidden": true }),
|
|
14775
15427
|
format.toUpperCase()
|
|
14776
15428
|
]
|
|
14777
15429
|
},
|
|
14778
15430
|
format
|
|
14779
15431
|
)) }),
|
|
14780
|
-
exporting === "failed" && /* @__PURE__ */ (0,
|
|
15432
|
+
exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
|
|
14781
15433
|
] }),
|
|
14782
|
-
tab === "comments" && /* @__PURE__ */ (0,
|
|
14783
|
-
tab === "sharing" && sharing && /* @__PURE__ */ (0,
|
|
14784
|
-
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: [
|
|
14785
15437
|
signatures.error && failed(signatures.retry),
|
|
14786
|
-
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 }),
|
|
14787
15439
|
(signatures.data ?? []).map((entry2) => {
|
|
14788
15440
|
const signed = versions.data?.find((v) => v.id === entry2.versionId);
|
|
14789
|
-
return /* @__PURE__ */ (0,
|
|
15441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
14790
15442
|
"button",
|
|
14791
15443
|
{
|
|
14792
15444
|
type: "button",
|
|
@@ -14794,15 +15446,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14794
15446
|
"aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
|
|
14795
15447
|
onClick: () => view(signed.current ? null : signed.id),
|
|
14796
15448
|
children: [
|
|
14797
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("b", { children: [
|
|
14798
15450
|
entry2.signer.name,
|
|
14799
|
-
/* @__PURE__ */ (0,
|
|
15451
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "w100n-docs-badge", children: [
|
|
14800
15452
|
t.page,
|
|
14801
15453
|
" ",
|
|
14802
15454
|
entry2.page
|
|
14803
15455
|
] })
|
|
14804
15456
|
] }),
|
|
14805
|
-
/* @__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 ") })
|
|
14806
15458
|
]
|
|
14807
15459
|
},
|
|
14808
15460
|
entry2.id
|
|
@@ -14813,85 +15465,98 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14813
15465
|
] })
|
|
14814
15466
|
] })
|
|
14815
15467
|
] }),
|
|
14816
|
-
|
|
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) => {
|
|
14817
15482
|
setMaking(false);
|
|
14818
15483
|
opened2(made2);
|
|
14819
15484
|
} }),
|
|
14820
|
-
menu && /* @__PURE__ */ (0,
|
|
14821
|
-
/* @__PURE__ */ (0,
|
|
14822
|
-
/* @__PURE__ */ (0,
|
|
14823
|
-
/* @__PURE__ */ (0,
|
|
14824
|
-
menu.item.createdAt && /* @__PURE__ */ (0,
|
|
14825
|
-
/* @__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 ") })
|
|
14826
15491
|
] }),
|
|
14827
|
-
menu.sure ? /* @__PURE__ */ (0,
|
|
14828
|
-
/* @__PURE__ */ (0,
|
|
14829
|
-
/* @__PURE__ */ (0,
|
|
14830
|
-
/* @__PURE__ */ (0,
|
|
14831
|
-
/* @__PURE__ */ (0,
|
|
14832
|
-
/* @__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 }),
|
|
14833
15498
|
t.trash
|
|
14834
15499
|
] })
|
|
14835
15500
|
] })
|
|
14836
|
-
] }) : /* @__PURE__ */ (0,
|
|
14837
|
-
/* @__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: () => {
|
|
14838
15503
|
setMenu(null);
|
|
14839
15504
|
open(menu.item);
|
|
14840
15505
|
}, children: [
|
|
14841
|
-
/* @__PURE__ */ (0,
|
|
15506
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.FileText, { "aria-hidden": true }),
|
|
14842
15507
|
t.openFile
|
|
14843
15508
|
] }),
|
|
14844
|
-
host.href && /* @__PURE__ */ (0,
|
|
15509
|
+
host.href && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14845
15510
|
setMenu(null);
|
|
14846
15511
|
window.open(host.href(menu.item.id), "_blank", "noopener");
|
|
14847
15512
|
}, children: [
|
|
14848
|
-
/* @__PURE__ */ (0,
|
|
15513
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.ExternalLink, { "aria-hidden": true }),
|
|
14849
15514
|
t.openTab
|
|
14850
15515
|
] }),
|
|
14851
|
-
host.href && /* @__PURE__ */ (0,
|
|
14852
|
-
/* @__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 }),
|
|
14853
15518
|
t.copyLink
|
|
14854
15519
|
] }),
|
|
14855
|
-
host.send && /* @__PURE__ */ (0,
|
|
15520
|
+
host.send && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14856
15521
|
setMenu(null);
|
|
14857
15522
|
host.send(menu.item.id);
|
|
14858
15523
|
}, children: [
|
|
14859
|
-
/* @__PURE__ */ (0,
|
|
15524
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Send, { "aria-hidden": true }),
|
|
14860
15525
|
t.sendChat
|
|
14861
15526
|
] }),
|
|
14862
|
-
/* @__PURE__ */ (0,
|
|
14863
|
-
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: () => {
|
|
14864
15529
|
setMenu(null);
|
|
14865
15530
|
setNaming({ id: menu.item.id, text: menu.item.name.replace(/\.[^.]+$/, "") });
|
|
14866
15531
|
}, children: [
|
|
14867
|
-
/* @__PURE__ */ (0,
|
|
15532
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Pencil, { "aria-hidden": true }),
|
|
14868
15533
|
t.rename
|
|
14869
15534
|
] }),
|
|
14870
|
-
host.create && /* @__PURE__ */ (0,
|
|
14871
|
-
/* @__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 }),
|
|
14872
15537
|
t.makeCopy
|
|
14873
15538
|
] }),
|
|
14874
|
-
/* @__PURE__ */ (0,
|
|
14875
|
-
/* @__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 }),
|
|
14876
15541
|
t.download
|
|
14877
15542
|
] }),
|
|
14878
|
-
host.saveTemplate && /* @__PURE__ */ (0,
|
|
14879
|
-
/* @__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 }),
|
|
14880
15545
|
t.saveTemplate
|
|
14881
15546
|
] }),
|
|
14882
|
-
/* @__PURE__ */ (0,
|
|
15547
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
|
|
14883
15548
|
setMenu(null);
|
|
14884
15549
|
open(menu.item);
|
|
14885
15550
|
setTab("details");
|
|
14886
15551
|
side2("panel", true);
|
|
14887
15552
|
}, children: [
|
|
14888
|
-
/* @__PURE__ */ (0,
|
|
15553
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react13.Info, { "aria-hidden": true }),
|
|
14889
15554
|
t.details
|
|
14890
15555
|
] }),
|
|
14891
|
-
host.remove && /* @__PURE__ */ (0,
|
|
14892
|
-
/* @__PURE__ */ (0,
|
|
14893
|
-
/* @__PURE__ */ (0,
|
|
14894
|
-
/* @__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 }),
|
|
14895
15560
|
t.trash
|
|
14896
15561
|
] })
|
|
14897
15562
|
] })
|
|
@@ -14901,15 +15566,25 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
|
|
|
14901
15566
|
] });
|
|
14902
15567
|
}
|
|
14903
15568
|
|
|
15569
|
+
// src/FilePreview.tsx
|
|
15570
|
+
var import_react20 = require("react");
|
|
15571
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
15572
|
+
function FilePreview({ url, name, mimeType, size: size2 = 0, bytes, pdfWorker }) {
|
|
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)))) }));
|
|
15574
|
+
const kind = kindOf(name, mimeType);
|
|
15575
|
+
if (!kind) return null;
|
|
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: "" } }) });
|
|
15577
|
+
}
|
|
15578
|
+
|
|
14904
15579
|
// src/GuestDocument.tsx
|
|
14905
|
-
var
|
|
14906
|
-
var
|
|
15580
|
+
var import_react21 = require("react");
|
|
15581
|
+
var import_lucide_react14 = require("lucide-react");
|
|
14907
15582
|
init_text();
|
|
14908
15583
|
init_useLoad();
|
|
14909
|
-
var
|
|
14910
|
-
var TextEditor4 = (0,
|
|
14911
|
-
var SheetView4 = (0,
|
|
14912
|
-
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 };
|
|
14913
15588
|
var GuestRefused = class extends Error {
|
|
14914
15589
|
constructor(reason, file = "", sharedBy = "") {
|
|
14915
15590
|
super(reason);
|
|
@@ -14918,7 +15593,7 @@ var GuestRefused = class extends Error {
|
|
|
14918
15593
|
this.sharedBy = sharedBy;
|
|
14919
15594
|
}
|
|
14920
15595
|
};
|
|
14921
|
-
var
|
|
15596
|
+
var remembered2 = () => {
|
|
14922
15597
|
try {
|
|
14923
15598
|
return localStorage.getItem("w100n-guest-name") ?? "";
|
|
14924
15599
|
} catch {
|
|
@@ -14934,14 +15609,14 @@ var remember = (name) => {
|
|
|
14934
15609
|
};
|
|
14935
15610
|
function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
14936
15611
|
const t = texts[language];
|
|
14937
|
-
const [ask, setAsk] = (0,
|
|
14938
|
-
const [typed, setTyped] = (0,
|
|
14939
|
-
const [name, setName] = (0,
|
|
14940
|
-
const named3 = (0,
|
|
14941
|
-
const [slot, setSlot] = (0,
|
|
14942
|
-
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");
|
|
14943
15618
|
const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
|
|
14944
|
-
const [notes3] = (0,
|
|
15619
|
+
const [notes3] = (0, import_react21.useState)(() => ({
|
|
14945
15620
|
me: { id: "", name: "" },
|
|
14946
15621
|
spaces: async () => [],
|
|
14947
15622
|
documents: async () => [],
|
|
@@ -14967,18 +15642,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14967
15642
|
};
|
|
14968
15643
|
const top = (file2, badge) => {
|
|
14969
15644
|
const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
|
|
14970
|
-
const Kind = kind2 ?
|
|
14971
|
-
return /* @__PURE__ */ (0,
|
|
14972
|
-
brand && /* @__PURE__ */ (0,
|
|
14973
|
-
file2 && /* @__PURE__ */ (0,
|
|
14974
|
-
/* @__PURE__ */ (0,
|
|
14975
|
-
/* @__PURE__ */ (0,
|
|
14976
|
-
/* @__PURE__ */ (0,
|
|
14977
|
-
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) })
|
|
14978
15653
|
] }),
|
|
14979
|
-
badge && /* @__PURE__ */ (0,
|
|
14980
|
-
file2.download && /* @__PURE__ */ (0,
|
|
14981
|
-
(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)(
|
|
14982
15657
|
"button",
|
|
14983
15658
|
{
|
|
14984
15659
|
type: "button",
|
|
@@ -14989,41 +15664,41 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
14989
15664
|
"aria-label": t.pdfCopy,
|
|
14990
15665
|
title: t.pdfCopy,
|
|
14991
15666
|
children: [
|
|
14992
|
-
/* @__PURE__ */ (0,
|
|
14993
|
-
/* @__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 })
|
|
14994
15669
|
]
|
|
14995
15670
|
}
|
|
14996
15671
|
),
|
|
14997
|
-
/* @__PURE__ */ (0,
|
|
14998
|
-
/* @__PURE__ */ (0,
|
|
14999
|
-
/* @__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 })
|
|
15000
15675
|
] })
|
|
15001
15676
|
] })
|
|
15002
15677
|
] })
|
|
15003
15678
|
] });
|
|
15004
15679
|
};
|
|
15005
|
-
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: [
|
|
15006
15681
|
top(null, null),
|
|
15007
|
-
/* @__PURE__ */ (0,
|
|
15008
|
-
/* @__PURE__ */ (0,
|
|
15009
|
-
/* @__PURE__ */ (0,
|
|
15010
|
-
/* @__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 }),
|
|
15011
15686
|
form
|
|
15012
15687
|
] }) })
|
|
15013
15688
|
] });
|
|
15014
15689
|
if (opened2.error) {
|
|
15015
15690
|
const refused = opened2.error instanceof GuestRefused ? opened2.error : null;
|
|
15016
|
-
if (refused?.reason === "ended") return gate("slate",
|
|
15017
|
-
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);
|
|
15018
15693
|
if (refused?.reason === "password" || refused?.reason === "wrong" || refused?.reason === "name") {
|
|
15019
15694
|
const password = refused.reason !== "name";
|
|
15020
15695
|
const shared = refused.sharedBy ? `${t.sharedBy.replace("{name}", refused.sharedBy)}. ` : "";
|
|
15021
15696
|
return gate(
|
|
15022
15697
|
"violet",
|
|
15023
|
-
password ?
|
|
15698
|
+
password ? import_lucide_react14.Lock : import_lucide_react14.UserRound,
|
|
15024
15699
|
refused.file || t.documents,
|
|
15025
15700
|
shared + (password ? t.passwordAsk : t.nameAsk),
|
|
15026
|
-
/* @__PURE__ */ (0,
|
|
15701
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
|
|
15027
15702
|
e.preventDefault();
|
|
15028
15703
|
if (!typed.trim()) return;
|
|
15029
15704
|
if (password) setAsk({ ...ask, password: typed });
|
|
@@ -15033,7 +15708,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15033
15708
|
}
|
|
15034
15709
|
setTyped("");
|
|
15035
15710
|
}, children: [
|
|
15036
|
-
/* @__PURE__ */ (0,
|
|
15711
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
15037
15712
|
"input",
|
|
15038
15713
|
{
|
|
15039
15714
|
className: "w100n-share-input",
|
|
@@ -15046,21 +15721,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15046
15721
|
onChange: (e) => setTyped(e.target.value)
|
|
15047
15722
|
}
|
|
15048
15723
|
),
|
|
15049
|
-
refused.reason === "wrong" && /* @__PURE__ */ (0,
|
|
15050
|
-
/* @__PURE__ */ (0,
|
|
15051
|
-
/* @__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 }),
|
|
15052
15727
|
t.openDoc
|
|
15053
15728
|
] })
|
|
15054
15729
|
] })
|
|
15055
15730
|
);
|
|
15056
15731
|
}
|
|
15057
|
-
if (refused?.reason === "busy") return gate("slate",
|
|
15058
|
-
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 }));
|
|
15059
15734
|
}
|
|
15060
15735
|
const file = opened2.data;
|
|
15061
|
-
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: [
|
|
15062
15737
|
top(null, null),
|
|
15063
|
-
/* @__PURE__ */ (0,
|
|
15738
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
|
|
15064
15739
|
] });
|
|
15065
15740
|
const kind = kindOf(file.name, file.mimeType);
|
|
15066
15741
|
const text = kind === "docx" || kind === "markdown";
|
|
@@ -15068,23 +15743,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
|
|
|
15068
15743
|
const rights = { view: true, comment: talk, edit: false };
|
|
15069
15744
|
const quiet3 = () => {
|
|
15070
15745
|
};
|
|
15071
|
-
let stage = /* @__PURE__ */ (0,
|
|
15072
|
-
if (text) stage = /* @__PURE__ */ (0,
|
|
15073
|
-
else if (kind === "pdf") stage = /* @__PURE__ */ (0,
|
|
15074
|
-
else if (kind === "slides") stage = /* @__PURE__ */ (0,
|
|
15075
|
-
else if (kind === "sheet") stage = /* @__PURE__ */ (0,
|
|
15076
|
-
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: [
|
|
15077
15752
|
top(file, talk ? t.badgeComment : t.badgeRead),
|
|
15078
|
-
saving === "failed" && /* @__PURE__ */ (0,
|
|
15079
|
-
/* @__PURE__ */ (0,
|
|
15080
|
-
/* @__PURE__ */ (0,
|
|
15081
|
-
talk && /* @__PURE__ */ (0,
|
|
15082
|
-
/* @__PURE__ */ (0,
|
|
15083
|
-
/* @__PURE__ */ (0,
|
|
15084
|
-
/* @__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) })
|
|
15085
15760
|
] }),
|
|
15086
|
-
/* @__PURE__ */ (0,
|
|
15087
|
-
/* @__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 })
|
|
15088
15763
|
] }) })
|
|
15089
15764
|
] })
|
|
15090
15765
|
] });
|
|
@@ -15096,6 +15771,7 @@ init_docx();
|
|
|
15096
15771
|
0 && (module.exports = {
|
|
15097
15772
|
DocumentOverlay,
|
|
15098
15773
|
DocumentsWorkspace,
|
|
15774
|
+
FilePreview,
|
|
15099
15775
|
GuestDocument,
|
|
15100
15776
|
GuestRefused,
|
|
15101
15777
|
SlidesView,
|